Merge branch 'develop' of https://github.com/CatchChat/Yep into develop

This commit is contained in:
kevinzhow
2015-08-21 16:18:13 +08:00
11 changed files with 63 additions and 22 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ use_frameworks!
def pods
pod 'DeviceGuru'
pod '1PasswordExtension'
pod '1PasswordExtension', '~> 1.5'
pod 'KeyboardMan'
pod 'Ruler'
pod 'Proposer'
+4 -4
View File
@@ -1,5 +1,5 @@
PODS:
- 1PasswordExtension (1.2)
- 1PasswordExtension (1.5)
- AFNetworking (2.5.4):
- AFNetworking/NSURLConnection (= 2.5.4)
- AFNetworking/NSURLSession (= 2.5.4)
@@ -44,7 +44,7 @@ PODS:
- TPKeyboardAvoiding (1.2.9)
DEPENDENCIES:
- 1PasswordExtension
- 1PasswordExtension (~> 1.5)
- AFNetworking (~> 2.5.4)
- APAddressBook/Swift
- DeviceGuru
@@ -60,10 +60,10 @@ DEPENDENCIES:
EXTERNAL SOURCES:
MZFayeClient:
:path: "../CatchLib-iOS/MZFayeClient/"
:path: ../CatchLib-iOS/MZFayeClient/
SPEC CHECKSUMS:
1PasswordExtension: fcf300204bda5b5c78936dbb937a7d661f1ca796
1PasswordExtension: d2392e44526be30ae7d23f305e96e411ede9b9d1
AFNetworking: 05edc0ac4c4c8cf57bcf4b84be5b0744b6d8e71e
APAddressBook: 2c949367b190a993d2cce769a3b20bce8bcf000c
Base64: 4924bf3ca6fa559a5161ef717291bd450eb7bd1a
+4
View File
@@ -207,6 +207,7 @@
50E114FC1ABC549300F13000 /* ContactsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E114FA1ABC549300F13000 /* ContactsCell.swift */; };
50E114FD1ABC549300F13000 /* ContactsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50E114FB1ABC549300F13000 /* ContactsCell.xib */; };
50E18BB71B180F7D0076C3C6 /* BottomButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E18BB61B180F7D0076C3C6 /* BottomButtonView.swift */; };
50E1D7291B870D7500D90A82 /* NSParagraphStyle+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E1D7281B870D7500D90A82 /* NSParagraphStyle+Yep.swift */; };
50E61CEB1AF1F69D00908A9D /* ConversationTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E61CEA1AF1F69D00908A9D /* ConversationTitleView.swift */; };
50EB8C5E1AE78AB9001AC1EE /* YepAsset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50EB8C5D1AE78AB9001AC1EE /* YepAsset.swift */; };
50EB8CBF1AE89ED8001AC1EE /* ChatLeftVideoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50EB8CBD1AE89ED8001AC1EE /* ChatLeftVideoCell.swift */; };
@@ -454,6 +455,7 @@
50E114FA1ABC549300F13000 /* ContactsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ContactsCell.swift; path = Views/Cells/Contacts/ContactsCell.swift; sourceTree = "<group>"; };
50E114FB1ABC549300F13000 /* ContactsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ContactsCell.xib; path = Views/Cells/Contacts/ContactsCell.xib; sourceTree = "<group>"; };
50E18BB61B180F7D0076C3C6 /* BottomButtonView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BottomButtonView.swift; path = Views/SayHi/BottomButtonView.swift; sourceTree = "<group>"; };
50E1D7281B870D7500D90A82 /* NSParagraphStyle+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSParagraphStyle+Yep.swift"; path = "Extensions/NSParagraphStyle+Yep.swift"; sourceTree = "<group>"; };
50E61CEA1AF1F69D00908A9D /* ConversationTitleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConversationTitleView.swift; path = Views/ConversationTitle/ConversationTitleView.swift; sourceTree = "<group>"; };
50EB8C5D1AE78AB9001AC1EE /* YepAsset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepAsset.swift; path = Helpers/YepAsset.swift; sourceTree = "<group>"; };
50EB8CBD1AE89ED8001AC1EE /* ChatLeftVideoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatLeftVideoCell.swift; path = Views/Cells/ChatLeftVideo/ChatLeftVideoCell.swift; sourceTree = "<group>"; };
@@ -809,6 +811,7 @@
501560D61B427FD6000933F0 /* Results+Yep.swift */,
50B38FB61B69CD960064C132 /* Array+Yep.swift */,
50FA9A431B661698009BF2A0 /* UIViewController+Yep.swift */,
50E1D7281B870D7500D90A82 /* NSParagraphStyle+Yep.swift */,
);
name = Extensions;
sourceTree = "<group>";
@@ -1968,6 +1971,7 @@
5023DE2A1AB685BA00B3EE96 /* ContactsViewController.swift in Sources */,
50CDBE491ACBAD3200459CE0 /* ChatLeftImageCell.swift in Sources */,
5033159C1AC101C80008A209 /* ChatRightTextCell.swift in Sources */,
50E1D7291B870D7500D90A82 /* NSParagraphStyle+Yep.swift in Sources */,
5044BF061B5FA74800930ADC /* BubbleMenuView.swift in Sources */,
5023DE561AB6CA1000B3EE96 /* AvatarCache.swift in Sources */,
5023DE371AB6979600B3EE96 /* ConversationCell.swift in Sources */,
+9
View File
@@ -136,6 +136,15 @@ class YepConfig {
static let centerXOffset: CGFloat = 4
static let imageAppearDuration: NSTimeInterval = 0.1
static let textAttributes:[String: NSObject] = [
NSFontAttributeName: UIFont.chatTextFont(),
]
// static let textAttributes: [String: NSObject] = [
// NSFontAttributeName: UIFont.chatTextFont(),
// NSKernAttributeName: 0.5,
// NSParagraphStyleAttributeName: NSParagraphStyle.chatTextParagraphStyle(),
// ]
}
struct MetaData {
+25
View File
@@ -0,0 +1,25 @@
//
// NSParagraphStyle+Yep.swift
// Yep
//
// Created by nixzhu on 15/8/21.
// Copyright (c) 2015 Catch Inc. All rights reserved.
//
import UIKit
extension NSParagraphStyle {
class func chatTextParagraphStyle() -> NSParagraphStyle {
let style = NSMutableParagraphStyle()
style.minimumLineHeight = 17.3
style.lineSpacing = 0
style.paragraphSpacing = 0
style.paragraphSpacingBefore = 0
style.lineBreakMode = .ByWordWrapping
return style
}
}
@@ -103,7 +103,6 @@ class ConversationViewController: BaseViewController {
let sectionInsetTop: CGFloat = 10
let sectionInsetBottom: CGFloat = 10
let messageTextAttributes = [NSFontAttributeName: UIFont.chatTextFont()]
lazy var messageTextLabelMaxWidth: CGFloat = {
let maxWidth = self.collectionViewWidth - (YepConfig.chatCellGapBetweenWallAndAvatar() + YepConfig.chatCellAvatarSize() + YepConfig.chatCellGapBetweenTextContentLabelAndAvatar() + YepConfig.chatTextGapBetweenWallAndContentLabel())
return maxWidth
@@ -1011,7 +1010,7 @@ class ConversationViewController: BaseViewController {
switch message.mediaType {
case MessageMediaType.Text.rawValue:
let rect = message.textContent.boundingRectWithSize(CGSize(width: messageTextLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: messageTextAttributes, context: nil)
let rect = message.textContent.boundingRectWithSize(CGSize(width: messageTextLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: YepConfig.ChatCell.textAttributes, context: nil)
height = max(ceil(rect.height) + (11 * 2), YepConfig.chatCellAvatarSize())
@@ -1081,7 +1080,7 @@ class ConversationViewController: BaseViewController {
}
}
let rect = message.textContent.boundingRectWithSize(CGSize(width: messageTextLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: messageTextAttributes, context: nil)
let rect = message.textContent.boundingRectWithSize(CGSize(width: messageTextLabelMaxWidth, height: CGFloat(FLT_MAX)), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: YepConfig.ChatCell.textAttributes, context: nil)
let width = ceil(rect.width)
@@ -49,7 +49,7 @@ class OAuthViewController: BaseViewController, UIWebViewDelegate, NSURLConnectio
}
@IBAction func fillPassword(sender: AnyObject) {
OnePasswordExtension.sharedExtension().fillLoginIntoWebView(webView, forViewController: self, sender: sender) { (finish, error) -> Void in
OnePasswordExtension.sharedExtension().fillItemIntoWebView(webView, forViewController: self, sender: sender, showOnlyLogins: false) { (finish, error) -> Void in
}
}
@@ -58,6 +58,7 @@ class ChatLeftTextCell: ChatBaseCell {
self.user = message.fromFriend
textContentTextView.text = message.textContent
//textContentTextView.attributedText = NSAttributedString(string: message.textContent, attributes: textAttributes)
textContentTextViewWidthConstraint.constant = max(YepConfig.minMessageTextLabelWidth, textContentLabelWidth)
textContentTextView.textAlignment = textContentLabelWidth < YepConfig.minMessageTextLabelWidth ? .Center : .Left
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15A204h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
@@ -14,7 +14,7 @@
<rect key="frame" x="0.0" y="0.0" width="500" height="129"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble_left_tail" translatesAutoresizingMaskIntoConstraints="NO" id="ppr-iG-zxj" userLabel="Bubble Tail Image View">
<rect key="frame" x="57" y="58" width="13" height="14"/>
<rect key="frame" x="57" y="13" width="13" height="14"/>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="13" id="TUy-IJ-8Vo"/>
@@ -22,12 +22,12 @@
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble_body" translatesAutoresizingMaskIntoConstraints="NO" id="Yfx-Em-Job" userLabel="Bubble Body Image View">
<rect key="frame" x="63" y="45" width="116" height="40"/>
<rect key="frame" x="63" y="0.0" width="116" height="129"/>
<animations/>
<color key="tintColor" white="0.84999999999999998" alpha="1" colorSpace="calibratedWhite"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="hYu-LI-zcX" userLabel="Avatar Image View">
<rect key="frame" x="15" y="45" width="40" height="40"/>
<rect key="frame" x="15" y="0.0" width="40" height="40"/>
<animations/>
<constraints>
<constraint firstAttribute="width" constant="40" id="JV9-zT-1At"/>
@@ -35,7 +35,7 @@
</constraints>
</imageView>
<textView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Text Content" translatesAutoresizingMaskIntoConstraints="NO" id="o2v-vm-ItZ" customClass="ChatTextView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="75" y="48" width="92" height="34"/>
<rect key="frame" x="75" y="3" width="92" height="123"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
@@ -51,11 +51,12 @@
</view>
<animations/>
<constraints>
<constraint firstAttribute="centerY" secondItem="o2v-vm-ItZ" secondAttribute="centerY" id="BYZ-KA-Py1"/>
<constraint firstAttribute="bottom" secondItem="o2v-vm-ItZ" secondAttribute="bottom" constant="3" id="4HG-w9-FvJ"/>
<constraint firstItem="hYu-LI-zcX" firstAttribute="centerY" secondItem="ppr-iG-zxj" secondAttribute="centerY" id="CqX-BA-AO1"/>
<constraint firstItem="o2v-vm-ItZ" firstAttribute="top" secondItem="Yfx-Em-Job" secondAttribute="top" constant="3" id="MHY-GR-4fS"/>
<constraint firstItem="o2v-vm-ItZ" firstAttribute="bottom" secondItem="Yfx-Em-Job" secondAttribute="bottom" constant="-3" id="MIb-vK-cmz"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="o2v-vm-ItZ" secondAttribute="trailing" constant="50" id="Tpu-kA-CsQ"/>
<constraint firstItem="o2v-vm-ItZ" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="3" id="aOB-ao-yJA"/>
<constraint firstItem="Yfx-Em-Job" firstAttribute="top" secondItem="hYu-LI-zcX" secondAttribute="top" id="cCW-R1-CFn"/>
<constraint firstItem="hYu-LI-zcX" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="15" id="hM8-00-nUm"/>
<constraint firstItem="o2v-vm-ItZ" firstAttribute="leading" secondItem="Yfx-Em-Job" secondAttribute="leading" constant="12" id="nPH-jo-SPd"/>
@@ -73,6 +73,7 @@ class ChatRightTextCell: ChatRightBaseCell {
self.mediaTapAction = mediaTapAction
textContentTextView.text = message.textContent
//textContentTextView.attributedText = NSAttributedString(string: message.textContent, attributes: textAttributes)
textContentTextViewWidthConstraint.constant = max(YepConfig.minMessageTextLabelWidth, textContentLabelWidth)
textContentTextView.textAlignment = textContentLabelWidth < YepConfig.minMessageTextLabelWidth ? .Center : .Left
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15A204h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
@@ -14,7 +14,7 @@
<rect key="frame" x="0.0" y="0.0" width="500" height="131"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble_right_tail" translatesAutoresizingMaskIntoConstraints="NO" id="1JC-jy-KNh" userLabel="Bubble Tail Image View">
<rect key="frame" x="430" y="59" width="13" height="14"/>
<rect key="frame" x="430" y="13" width="13" height="14"/>
<animations/>
<constraints>
<constraint firstAttribute="height" constant="14" id="GPy-Nl-hAU"/>
@@ -22,11 +22,11 @@
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bubble_body" translatesAutoresizingMaskIntoConstraints="NO" id="73l-kE-1KG" userLabel="Bubble Body Image View">
<rect key="frame" x="321" y="46" width="116" height="40"/>
<rect key="frame" x="321" y="0.0" width="116" height="131"/>
<animations/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="RKK-8d-9vO" userLabel="Avatar Image View">
<rect key="frame" x="445" y="46" width="40" height="40"/>
<rect key="frame" x="445" y="0.0" width="40" height="40"/>
<animations/>
<color key="tintColor" red="0.80000001192092896" green="0.40000000596046448" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
@@ -35,7 +35,7 @@
</constraints>
</imageView>
<textView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" editable="NO" text="Text Content" translatesAutoresizingMaskIntoConstraints="NO" id="em7-jr-W4a" customClass="ChatTextView" customModule="Yep" customModuleProvider="target">
<rect key="frame" x="333" y="49" width="92" height="34"/>
<rect key="frame" x="333" y="3" width="92" height="125"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
@@ -46,7 +46,7 @@
<dataDetectorType key="dataDetectorTypes" phoneNumber="YES" link="YES" address="YES" calendarEvent="YES"/>
</textView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_dot_sending" translatesAutoresizingMaskIntoConstraints="NO" id="tB7-GG-3Zd" userLabel="Dot Image View">
<rect key="frame" x="310" y="63" width="6" height="6"/>
<rect key="frame" x="310" y="62.5" width="6" height="6"/>
<animations/>
<constraints>
<constraint firstAttribute="width" secondItem="tB7-GG-3Zd" secondAttribute="height" multiplier="1:1" id="XM0-Py-y5P"/>
@@ -67,10 +67,11 @@
<constraint firstItem="73l-kE-1KG" firstAttribute="leading" secondItem="tB7-GG-3Zd" secondAttribute="trailing" constant="5" id="UIT-W7-WO6"/>
<constraint firstItem="1JC-jy-KNh" firstAttribute="centerY" secondItem="RKK-8d-9vO" secondAttribute="centerY" id="Upo-MS-aQJ"/>
<constraint firstItem="em7-jr-W4a" firstAttribute="leading" secondItem="73l-kE-1KG" secondAttribute="leading" constant="12" id="WkS-Oi-AjM"/>
<constraint firstAttribute="centerY" secondItem="em7-jr-W4a" secondAttribute="centerY" id="cTN-DN-cH9"/>
<constraint firstAttribute="bottom" secondItem="em7-jr-W4a" secondAttribute="bottom" constant="3" id="dXH-j4-Dn8"/>
<constraint firstItem="tB7-GG-3Zd" firstAttribute="centerY" secondItem="73l-kE-1KG" secondAttribute="centerY" id="h7l-0p-SWm"/>
<constraint firstItem="1JC-jy-KNh" firstAttribute="leading" secondItem="em7-jr-W4a" secondAttribute="trailing" constant="5" id="iAD-hS-cmr"/>
<constraint firstItem="73l-kE-1KG" firstAttribute="trailing" secondItem="em7-jr-W4a" secondAttribute="trailing" constant="12" id="sFr-bX-lfC"/>
<constraint firstItem="em7-jr-W4a" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" constant="3" id="vdd-9g-iCq"/>
<constraint firstAttribute="trailing" secondItem="RKK-8d-9vO" secondAttribute="trailing" constant="15" id="vs0-4M-TaV"/>
</constraints>
<size key="customSize" width="417" height="131"/>