diff --git a/Ring/Cartfile b/Ring/Cartfile index a49a381e1c971d11e171dc333b88f6896580e1f3..23bdf1b9c58a535d1d3e9989aca3fcc27e51236c 100644 --- a/Ring/Cartfile +++ b/Ring/Cartfile @@ -7,3 +7,4 @@ github "ViccAlexander/Chameleon" github "andreamazz/AMPopTip" github "ashleymills/Reachability.swift" github "stephencelis/SQLite.swift" ~> 0.11.4 +github "optonaut/ActiveLabel.swift" diff --git a/Ring/Cartfile.resolved b/Ring/Cartfile.resolved index c02fcfa120af6af18637c026330ae283e34e1372..6e0345bb0be127de41036392b2c7eaab7e6fb64a 100644 --- a/Ring/Cartfile.resolved +++ b/Ring/Cartfile.resolved @@ -9,3 +9,4 @@ github "ashleymills/Reachability.swift" "v4.1.0" github "pkluz/PKHUD" "5.0.0" github "realm/realm-cocoa" "v3.0.1" github "stephencelis/SQLite.swift" "0.11.4" +github "optonaut/ActiveLabel.swift" "0.8.0" diff --git a/Ring/Ring.xcodeproj/project.pbxproj b/Ring/Ring.xcodeproj/project.pbxproj index 4fa08ea450ea5ec94162932073e453f5a75de04f..c270b320d3da76b96bcc5d30a48be952af49a2f8 100644 --- a/Ring/Ring.xcodeproj/project.pbxproj +++ b/Ring/Ring.xcodeproj/project.pbxproj @@ -91,6 +91,7 @@ 0E403F811F7D797300C80BC2 /* MessageCellGenerated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E403F801F7D797300C80BC2 /* MessageCellGenerated.swift */; }; 0E403F831F7D79B000C80BC2 /* MessageCellGenerated.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E403F821F7D79B000C80BC2 /* MessageCellGenerated.xib */; }; 0E48F9D31FDF150700D6CC08 /* ContactRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E48F9D21FDF150700D6CC08 /* ContactRequestManager.swift */; }; + 0E4909611FE97A94005CAA50 /* ActiveLabel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E4909601FE97A94005CAA50 /* ActiveLabel.framework */; }; 0E6949791FA7E71C0029B60A /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E6949781FA7E71C0029B60A /* BaseViewController.swift */; }; 0E983E6E1FC77C3E0082103E /* ConversationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E983E6D1FC77C3E0082103E /* ConversationModel.swift */; }; 0E9D84491FA7DA6A00C561EB /* ChatTabBarItemViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E9D84481FA7DA6A00C561EB /* ChatTabBarItemViewModel.swift */; }; @@ -337,6 +338,7 @@ 0E403F801F7D797300C80BC2 /* MessageCellGenerated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageCellGenerated.swift; sourceTree = "<group>"; }; 0E403F821F7D79B000C80BC2 /* MessageCellGenerated.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessageCellGenerated.xib; sourceTree = "<group>"; }; 0E48F9D21FDF150700D6CC08 /* ContactRequestManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactRequestManager.swift; sourceTree = "<group>"; }; + 0E4909601FE97A94005CAA50 /* ActiveLabel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ActiveLabel.framework; path = Carthage/Build/iOS/ActiveLabel.framework; sourceTree = "<group>"; }; 0E6949781FA7E71C0029B60A /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; }; 0E983E6D1FC77C3E0082103E /* ConversationModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationModel.swift; sourceTree = "<group>"; }; 0E9D84481FA7DA6A00C561EB /* ChatTabBarItemViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatTabBarItemViewModel.swift; sourceTree = "<group>"; }; @@ -528,6 +530,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 0E4909611FE97A94005CAA50 /* ActiveLabel.framework in Frameworks */, 0E0FF1A71FC38070003898C2 /* SQLite.framework in Frameworks */, 5C093F011FB495830011D90E /* Differentiator.framework in Frameworks */, 0ED666101F9FED1C00743D42 /* AMPopTip.framework in Frameworks */, @@ -639,6 +642,7 @@ 02AED8171DD4C4B000F740BA /* Frameworks */ = { isa = PBXGroup; children = ( + 0E4909601FE97A94005CAA50 /* ActiveLabel.framework */, 0E0FF1A61FC38070003898C2 /* SQLite.framework */, 5C093F001FB495830011D90E /* Differentiator.framework */, 0ED6660F1F9FED1C00743D42 /* AMPopTip.framework */, @@ -1451,6 +1455,7 @@ "$(SRCROOT)/Carthage/Build/iOS/Reachability.framework", "$(SRCROOT)/Carthage/Build/iOS/Differentiator.framework", "$(SRCROOT)/Carthage/Build/iOS/SQLite.framework", + "$(SRCROOT)/Carthage/Build/iOS/ActiveLabel.framework", ); name = "⚙️ Copy Frameworks"; outputPaths = ( @@ -1467,6 +1472,7 @@ "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/AMPopTip.framework", "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/Differentiator.framework", "$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/SQLite.framework", + "(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ActiveLabel.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCell.swift b/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCell.swift index 35ed2c780797fabf04b6fdad2bd6c360ddb38f08..4d3511dcc3421e2c989a111f0e358a3be98baa8c 100644 --- a/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCell.swift +++ b/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCell.swift @@ -22,13 +22,14 @@ import UIKit import Reusable import RxSwift +import ActiveLabel class MessageCell: UITableViewCell, NibReusable { @IBOutlet weak var bubble: MessageBubble! @IBOutlet weak var bubbleBottomConstraint: NSLayoutConstraint! @IBOutlet weak var bubbleTopConstraint: NSLayoutConstraint! - @IBOutlet weak var messageLabel: UILabel! + @IBOutlet weak var messageLabel: ActiveLabel! @IBOutlet weak var bottomCorner: UIView! @IBOutlet weak var topCorner: UIView! @IBOutlet weak var timeLabel: UILabel! diff --git a/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellReceived.xib b/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellReceived.xib index 6a7be568a7fc954d3fe5376acd24e3d6e9981bb1..543f286315d61f4ebf4b9cb8836e9dc5bd4e9b13 100644 --- a/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellReceived.xib +++ b/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellReceived.xib @@ -74,7 +74,7 @@ <view clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kZJ-Ay-LTR" customClass="MessageBubble" customModule="Ring" customModuleProvider="target"> <rect key="frame" x="64" y="8" width="190.5" height="30.5"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label Label Label Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lyR-7c-S2k"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label Label Label Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lyR-7c-S2k" customClass="ActiveLabel" customModule="ActiveLabel"> <rect key="frame" x="10" y="8" width="170.5" height="14.5"/> <fontDescription key="fontDescription" type="system" pointSize="16"/> <nil key="highlightedColor"/> diff --git a/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellSent.xib b/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellSent.xib index 82afc04e2cfaea8c7b32ece384cd5be92f6699e5..a7a4bf03afea2a9c333ecfbe63936192a8d5d7df 100644 --- a/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellSent.xib +++ b/Ring/Ring/Features/Conversations/Conversation/Cells/MessageCellSent.xib @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait"> <adaptation id="fullscreen"/> </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13174"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> @@ -38,7 +38,7 @@ <view clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kZJ-Ay-LTR" customClass="MessageBubble" customModule="Ring" customModuleProvider="target"> <rect key="frame" x="303.5" y="8" width="190.5" height="31"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label Label Label Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lyR-7c-S2k"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label Label Label Label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lyR-7c-S2k" customClass="ActiveLabel" customModule="ActiveLabel"> <rect key="frame" x="10" y="8" width="170.5" height="15"/> <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="16"/> <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> @@ -61,21 +61,21 @@ </userDefinedRuntimeAttributes> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="h8N-aw-5lV" userLabel="Right Divider"> - <rect key="frame" x="347.5" y="16" width="138.5" height="1"/> + <rect key="frame" x="347.5" y="19" width="126.5" height="1"/> <color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="1" id="3h1-r8-Nis"/> </constraints> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2U4-l3-KET" userLabel="Left Divider"> - <rect key="frame" x="24" y="16" width="137.5" height="1"/> + <rect key="frame" x="36" y="19" width="125.5" height="1"/> <color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="height" constant="1" id="gla-pJ-IsN"/> </constraints> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="11/14/2016 12:34PM" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ogn-wv-fZy" userLabel="Message Time"> - <rect key="frame" x="177.5" y="6" width="154" height="21"/> + <rect key="frame" x="177.5" y="9" width="154" height="21"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> diff --git a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift index 159b442b34c7e3943f3f15bc628a5966e6f2a6bd..540dcb59e6e3a6c1ea808129f240fc6b66d5ba29 100644 --- a/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift +++ b/Ring/Ring/Features/Conversations/Conversation/ConversationViewController.swift @@ -346,7 +346,11 @@ class ConversationViewController: UIViewController, UITextFieldDelegate, Storybo let type = messageVM.bubblePosition() let bubbleColor = type == .received ? UIColor.ringMsgCellReceived : UIColor.ringMsgCellSent + cell.messageLabel.enabledTypes = [.url] cell.messageLabel.setTextWithLineSpacing(withText: messageVM.content, withLineSpacing: 2) + cell.messageLabel.handleURLTap { url in + UIApplication.shared.openURL(url) + } cell.topCorner.isHidden = true cell.topCorner.backgroundColor = bubbleColor