Skip to content

Commit

Permalink
Merge branch 'feature/clean_code' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Feb 3, 2016
2 parents 96c111c + 25be49f commit 09fb3c1
Show file tree
Hide file tree
Showing 63 changed files with 98 additions and 2,781 deletions.
28 changes: 0 additions & 28 deletions Yep.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions Yep/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Ha4-ol-D2e">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Ha4-ol-D2e">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
Expand Down Expand Up @@ -354,7 +354,6 @@
<outlet property="feedsTableView" destination="D86-dp-qKQ" id="rh9-wh-IqK"/>
<segue destination="h8b-7V-qPb" kind="show" identifier="showFeedsWithSkill" id="D1j-0N-VMH"/>
<segue destination="dYX-Ms-gWP" kind="show" identifier="showSkillHome" id="TTj-EA-7SS"/>
<segue destination="IEG-17-cLh" kind="show" identifier="showFeedMedia" id="DsA-Jb-0sJ"/>
<segue destination="iL2-os-eZV" kind="show" identifier="showConversation" id="tg0-ny-kGT"/>
<segue destination="oUx-zd-faH" kind="show" identifier="showProfile" id="Gdt-20-g91"/>
<segue destination="4oS-hQ-vpS" kind="presentation" identifier="presentNewFeed" id="4uC-Sk-gjF"/>
Expand Down Expand Up @@ -390,14 +389,6 @@
</objects>
<point key="canvasLocation" x="-296" y="638"/>
</scene>
<!--MessageMediaViewController-->
<scene sceneID="DvE-gL-l6T">
<objects>
<viewControllerPlaceholder storyboardName="MessageMedia" referencedIdentifier="MessageMediaViewController" id="IEG-17-cLh" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="ja9-fT-ObV" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="87" y="299"/>
</scene>
<!--ConversationViewController-->
<scene sceneID="pz7-gU-UIN">
<objects>
Expand Down
6 changes: 0 additions & 6 deletions Yep/Configs/YepConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ class YepConfig {
static let textAttributes:[String: NSObject] = [
NSFontAttributeName: UIFont.chatTextFont(),
]
// static let textAttributes: [String: NSObject] = [
// NSFontAttributeName: UIFont.chatTextFont(),
// NSKernAttributeName: 0.5,
// NSParagraphStyleAttributeName: NSParagraphStyle.chatTextParagraphStyle(),
// ]
}

struct FeedMedia {
Expand Down Expand Up @@ -296,6 +291,5 @@ class YepConfig {
static let timelineImage = UIImage(named: "wechat_timeline")!
}
}

}

14 changes: 1 addition & 13 deletions Yep/Configs/YepHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import Foundation
import RealmSwift
import Navi



typealias CancelableTask = (cancel: Bool) -> Void

extension String {
Expand Down Expand Up @@ -134,6 +132,7 @@ extension UIImage {
}

extension UINavigationBar {

func hideBottomHairline() {
let navigationBarImageView = hairlineImageViewInNavigationBar(self)
navigationBarImageView?.hidden = true
Expand Down Expand Up @@ -162,14 +161,3 @@ extension UINavigationBar {
}
}

func GoogleAnalyticsTrackView(name: String) {

}

func GoogleAnalyticsTrackEvent(action: String, label: String, value: NSNumber) {

}

func GoogleAnalyticsTrackSocial(network: String, action: String, target: String) {

}
5 changes: 4 additions & 1 deletion Yep/Extensions/CGRect+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import UIKit

extension CGRect {

func largestCenteredSquare() -> CGRect {

let width = self.size.width
let height = self.size.height
let widthBigger = width / height > 1.0
Expand All @@ -19,4 +21,5 @@ extension CGRect {

return square
}
}
}

4 changes: 0 additions & 4 deletions Yep/Extensions/UIColor+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ extension UIColor {

class func yepBorderColor() -> UIColor {
return UIColor(red: 0.898, green: 0.898, blue: 0.898, alpha: 1)
// return UIColor(red: 0.7, green: 0.7, blue: 0.7, alpha: 1)
}

class func avatarBackgroundColor() -> UIColor {
Expand All @@ -56,7 +55,6 @@ extension UIColor {
}

class func rightWaveColor() -> UIColor {
//return UIColor(white: 0.0, alpha: 0.15)
return UIColor(red:0.176, green:0.537, blue:0.878, alpha:1)
}

Expand All @@ -69,13 +67,11 @@ extension UIColor {
}

class func messageToolBarColor() -> UIColor {
// return UIColor.yepTintColor()
return UIColor(red:0.557, green:0.557, blue:0.576, alpha:1)
}

class func messageToolBarHighlightColor() -> UIColor {
return UIColor.yepTintColor()
// return UIColor(red:0.557, green:0.557, blue:0.576, alpha:1)
}

class func messageToolBarNormalColor() -> UIColor {
Expand Down
103 changes: 1 addition & 102 deletions Yep/Extensions/UIImage+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,106 +219,15 @@ extension UIImage {
let cgImage = CGImageCreateWithImageInRect(self.CGImage, rect)!
return UIImage(CGImage: cgImage)
}
/*
private func bubblePathWithTailDirection(tailDirection: MessageImageTailDirection, size: CGSize) -> UIBezierPath {
let scale = UIScreen.mainScreen().scale
let cornerRadius: CGFloat = 20 * scale
let tailOffset: CGFloat = 8 * scale
let tailHeight: CGFloat = 8 * scale
let width = size.width
let height = size.height
if tailDirection == .Right {
let bubble = UIBezierPath()
bubble.moveToPoint(CGPoint(x: cornerRadius, y: 0))
bubble.addArcWithCenter(CGPoint(x: cornerRadius, y: cornerRadius), radius: cornerRadius, startAngle: CGFloat(M_PI * 1.5), endAngle: CGFloat(M_PI), clockwise: false)
bubble.addLineToPoint(CGPoint(x: 0, y: height - cornerRadius))
bubble.addArcWithCenter(CGPoint(x: cornerRadius, y: height - cornerRadius), radius: cornerRadius, startAngle: CGFloat(M_PI), endAngle: CGFloat(M_PI * 0.5), clockwise: false)
bubble.addLineToPoint(CGPoint(x: width - (cornerRadius + tailOffset), y: height))
bubble.addArcWithCenter(CGPoint(x: width - (cornerRadius + tailOffset), y: height - cornerRadius), radius: cornerRadius, startAngle: CGFloat(M_PI * 0.5), endAngle: CGFloat(M_PI * 2), clockwise: false)
bubble.addLineToPoint(CGPoint(x: width, y: height - cornerRadius - tailHeight * 0.5))
bubble.addLineToPoint(CGPoint(x: width - tailOffset, y: height - cornerRadius - tailHeight))
bubble.addLineToPoint(CGPoint(x: width - tailOffset, y: cornerRadius))
bubble.addArcWithCenter(CGPoint(x: width - (cornerRadius + tailOffset), y: cornerRadius), radius: cornerRadius, startAngle: CGFloat(0), endAngle: CGFloat(M_PI * 1.5), clockwise: false)
bubble.closePath()
return bubble
} else {
let bubble = UIBezierPath()
bubble.moveToPoint(CGPoint(x: width - cornerRadius, y: 0))
bubble.addArcWithCenter(CGPoint(x: width - cornerRadius, y: cornerRadius), radius: cornerRadius, startAngle: -CGFloat(M_PI * 0.5), endAngle: 0, clockwise: true)
bubble.addLineToPoint(CGPoint(x: width, y: height - cornerRadius))
bubble.addArcWithCenter(CGPoint(x: width - cornerRadius, y: height - cornerRadius), radius: cornerRadius, startAngle: 0, endAngle: CGFloat(M_PI * 0.5), clockwise: true)
bubble.addLineToPoint(CGPoint(x: cornerRadius + tailOffset, y: height))
bubble.addArcWithCenter(CGPoint(x: cornerRadius + tailOffset, y: height - cornerRadius), radius: cornerRadius, startAngle: CGFloat(M_PI * 0.5), endAngle: CGFloat(M_PI), clockwise: true)
bubble.addLineToPoint(CGPoint(x: 0, y: height - cornerRadius - tailHeight * 0.5))
bubble.addLineToPoint(CGPoint(x: tailOffset, y: height - cornerRadius - tailHeight))
bubble.addLineToPoint(CGPoint(x: tailOffset, y: cornerRadius))
bubble.addArcWithCenter(CGPoint(x: cornerRadius + tailOffset, y: cornerRadius), radius: cornerRadius, startAngle: CGFloat(M_PI), endAngle: CGFloat(M_PI * 1.5), clockwise: true)
bubble.closePath()
return bubble
}
}
func bubbleImageWithTailDirection(tailDirection: MessageImageTailDirection) -> UIImage {
let scale: CGFloat = self.scale
UIGraphicsBeginImageContextWithOptions(self.size, false, scale)
let context = UIGraphicsGetCurrentContext()
var transform = CGAffineTransformConcat(CGAffineTransformIdentity, CGAffineTransformMakeScale(1.0, -1.0))
transform = CGAffineTransformConcat(transform, CGAffineTransformMakeTranslation(0.0, self.size.height))
CGContextConcatCTM(context, transform)
let drawRect = CGRect(origin: CGPointZero, size: self.size)
let bubble = bubblePathWithTailDirection(tailDirection, size: self.size)
CGContextAddPath(context, bubble.CGPath)
CGContextClip(context)
CGContextDrawImage(context, drawRect, self.CGImage)
let roundImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return roundImage
}
func bubbleImageWithTailDirection(tailDirection: MessageImageTailDirection, size: CGSize) -> UIImage {
let bubbleImage = self.fixRotation().cropToAspectRatio(size.width / size.height).resizeToTargetSize(size).bubbleImageWithTailDirection(tailDirection)
return bubbleImage
}
*/
}

extension UIImage {

func imageWithGradientTintColor(tintColor: UIColor) -> UIImage {

return imageWithTintColor(tintColor, blendMode: CGBlendMode.Overlay)
}


func imageWithTintColor(tintColor: UIColor, blendMode: CGBlendMode) -> UIImage {
UIGraphicsBeginImageContextWithOptions(size, false, 0)

Expand Down Expand Up @@ -426,15 +335,6 @@ extension UIImage {

image.drawAtPoint(CGPointZero)

//let bottomShadowImage = UIImage(named: "location_bottom_shadow")!
//bottomShadowImage.drawAtPoint(CGPoint(x: 0, y: image.size.height - 20))
/*
let scale = UIScreen.mainScreen().scale
let orientation: UIImageOrientation = .Up
var bottomShadowImage = UIImage(CGImage: UIImage(named: "location_bottom_shadow")!.CGImage, scale: scale, orientation: orientation)!
bottomShadowImage = bottomShadowImage.resizableImageWithCapInsets(UIEdgeInsets(top: 1, left: 1, bottom: 1, right: 1), resizingMode: UIImageResizingMode.Stretch)
bottomShadowImage.drawInRect(CGRect(x: 0, y: image.size.height - 20, width: image.size.width, height: 20))
*/
let bottomShadowImage = UIImage(named: "location_bottom_shadow")!
let bottomShadowHeightRatio: CGFloat = 0.185 // 20 / 108
bottomShadowImage.drawInRect(CGRect(x: 0, y: floor(image.size.height * (1 - bottomShadowHeightRatio)), width: image.size.width, height: ceil(image.size.height * bottomShadowHeightRatio)))
Expand All @@ -453,7 +353,6 @@ extension UIImage {

return bubbleImage
}

}

// MARK: - Decode
Expand Down
1 change: 1 addition & 0 deletions Yep/Extensions/UIScrollView+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ extension UIScrollView {
setContentOffset(topPoint, animated: true)
}
}

Loading

0 comments on commit 09fb3c1

Please sign in to comment.