- Use single MessagesViewController. Goal: Being able to reuse that UI
for SplitViewController on iPad. Prevents unnecessary deallocations and
re-allocations.
- Remove custom archiving UI for default swipe right to left archive
action, like in iOS Mail.app.
- DynamicType for main view.
- Simplify API of MessagesViewController to prevent undefined behavior.
//FREEBIE
pull/1/head
Frederic Jacobs 9 years ago
parent 1b02e186f8
commit 2c83046ff6

@ -89,7 +89,7 @@ CHECKOUT OPTIONS:
:commit: e5582fef8a6b3e35f8070361ef37237222da712b
:git: https://github.com/WhisperSystems/JSQMessagesViewController
TextSecureKit:
:commit: 8d6ce0b57c2d7de63d4e22f205ea87622432088e
:commit: f6f6133498661a7c406097970d152b4acea9099e
:git: https://github.com/WhisperSystems/TextSecureKit
SPEC CHECKSUMS:

@ -109,7 +109,6 @@
76EB064618170B33006006FC /* TimeUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04FA18170B33006006FC /* TimeUtil.m */; };
76EB064818170B33006006FC /* Zid.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04FD18170B33006006FC /* Zid.m */; };
76EB065618170B34006006FC /* InCallViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB050C18170B33006006FC /* InCallViewController.m */; };
76EB065A18170B34006006FC /* NextResponderScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB051018170B33006006FC /* NextResponderScrollView.m */; };
76EB068618170B34006006FC /* ContactTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB052F18170B33006006FC /* ContactTableViewCell.m */; };
A10FDF79184FB4BB007FF963 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76C87F18181EFCE600C4ACAB /* MediaPlayer.framework */; };
A11CD70D17FA230600A2D1B1 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A11CD70C17FA230600A2D1B1 /* QuartzCore.framework */; };
@ -349,7 +348,6 @@
B660F78A1C29988E00687D6E /* UIUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B97940261832BD2400BD66CB /* UIUtil.m */; };
B660F78B1C29988E00687D6E /* Zid.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EB04FD18170B33006006FC /* Zid.m */; };
B660F78C1C29988E00687D6E /* UIDevice+TSHardwareVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */; };
B660F78D1C29988E00687D6E /* TSAdapterCacheManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FC7C7A951A581AF40091823B /* TSAdapterCacheManager.m */; };
B66B9F721AEA6D1100E2E609 /* NotificationSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B66B9F711AEA6D1100E2E609 /* NotificationSettingsViewController.m */; };
B66B9F7D1AEAF40500E2E609 /* NotificationSettingsOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B66B9F7C1AEAF40500E2E609 /* NotificationSettingsOptionsViewController.m */; };
B66DBF4A19D5BBC8006EA940 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B66DBF4919D5BBC8006EA940 /* Images.xcassets */; };
@ -431,7 +429,6 @@
FC4FA0261A1B9DC600DA100A /* SignalsNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = FC4FA0251A1B9DC600DA100A /* SignalsNavigationController.m */; };
FC5CDF391A3393DD00B47253 /* error_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC5CDF371A3393DD00B47253 /* error_white@2x.png */; };
FC5CDF3A1A3393DD00B47253 /* warning_white@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC5CDF381A3393DD00B47253 /* warning_white@2x.png */; };
FC7C7A961A581AF40091823B /* TSAdapterCacheManager.m in Sources */ = {isa = PBXBuildFile; fileRef = FC7C7A951A581AF40091823B /* TSAdapterCacheManager.m */; };
FC9120411A39EFB70074545C /* qr@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = FC91203F1A39EFB70074545C /* qr@2x.png */; };
FCAC963C19FEF9280046DFC5 /* SignalsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCAC963B19FEF9280046DFC5 /* SignalsViewController.m */; };
FCAC964019FEF99A0046DFC5 /* InboxTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FCAC963E19FEF99A0046DFC5 /* InboxTableViewCell.m */; };
@ -696,8 +693,6 @@
76EB04FD18170B33006006FC /* Zid.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Zid.m; sourceTree = "<group>"; };
76EB050B18170B33006006FC /* InCallViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InCallViewController.h; sourceTree = "<group>"; };
76EB050C18170B33006006FC /* InCallViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InCallViewController.m; sourceTree = "<group>"; };
76EB050F18170B33006006FC /* NextResponderScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NextResponderScrollView.h; sourceTree = "<group>"; };
76EB051018170B33006006FC /* NextResponderScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NextResponderScrollView.m; sourceTree = "<group>"; };
76EB052E18170B33006006FC /* ContactTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactTableViewCell.h; sourceTree = "<group>"; };
76EB052F18170B33006006FC /* ContactTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactTableViewCell.m; sourceTree = "<group>"; };
91E46203423941C0C94D90E9 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
@ -987,8 +982,6 @@
FC4FA0251A1B9DC600DA100A /* SignalsNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalsNavigationController.m; sourceTree = "<group>"; };
FC5CDF371A3393DD00B47253 /* error_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "error_white@2x.png"; sourceTree = "<group>"; };
FC5CDF381A3393DD00B47253 /* warning_white@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "warning_white@2x.png"; sourceTree = "<group>"; };
FC7C7A941A581AF40091823B /* TSAdapterCacheManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAdapterCacheManager.h; sourceTree = "<group>"; };
FC7C7A951A581AF40091823B /* TSAdapterCacheManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAdapterCacheManager.m; sourceTree = "<group>"; };
FC91203F1A39EFB70074545C /* qr@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "qr@2x.png"; sourceTree = "<group>"; };
FCAC963A19FEF9280046DFC5 /* SignalsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SignalsViewController.h; path = UITests/SignalsViewController.h; sourceTree = "<group>"; };
FCAC963B19FEF9280046DFC5 /* SignalsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SignalsViewController.m; path = UITests/SignalsViewController.m; sourceTree = "<group>"; };
@ -1567,8 +1560,6 @@
76EB04FD18170B33006006FC /* Zid.m */,
FCC81A961A44558300DFEC7D /* UIDevice+TSHardwareVersion.h */,
FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */,
FC7C7A941A581AF40091823B /* TSAdapterCacheManager.h */,
FC7C7A951A581AF40091823B /* TSAdapterCacheManager.m */,
B62F5E0E1C2980B4000D370C /* NSData+ows_StripToken.h */,
B62F5E0F1C2980B4000D370C /* NSData+ows_StripToken.m */,
);
@ -1618,8 +1609,6 @@
FC3196311A08141D0094C78E /* Settings */,
76EB050B18170B33006006FC /* InCallViewController.h */,
76EB050C18170B33006006FC /* InCallViewController.m */,
76EB050F18170B33006006FC /* NextResponderScrollView.h */,
76EB051018170B33006006FC /* NextResponderScrollView.m */,
);
path = "view controllers";
sourceTree = "<group>";
@ -2569,7 +2558,6 @@
76EB05A618170B33006006FC /* RtpPacket.m in Sources */,
76EB064218170B33006006FC /* StringUtil.m in Sources */,
A547DD741A70A87800103EC7 /* DJWActionSheet+OWS.m in Sources */,
76EB065A18170B34006006FC /* NextResponderScrollView.m in Sources */,
76EB062618170B33006006FC /* Queue.m in Sources */,
D221A09A169C9E5E00537ABF /* main.m in Sources */,
76EB061618170B33006006FC /* AnonymousOccurrenceLogger.m in Sources */,
@ -2630,7 +2618,6 @@
7038632718F70C0700D4A43F /* CryptoTools.m in Sources */,
76EB058C18170B33006006FC /* DnsManager.m in Sources */,
B671B2461A93B238002BBD9D /* GroupContactsResult.m in Sources */,
FC7C7A961A581AF40091823B /* TSAdapterCacheManager.m in Sources */,
B66B9F721AEA6D1100E2E609 /* NotificationSettingsViewController.m in Sources */,
76EB059018170B33006006FC /* IgnoredPacketFailure.m in Sources */,
76EB05D418170B33006006FC /* ZrtpManager.m in Sources */,
@ -2840,7 +2827,6 @@
B660F78A1C29988E00687D6E /* UIUtil.m in Sources */,
B660F78B1C29988E00687D6E /* Zid.m in Sources */,
B660F78C1C29988E00687D6E /* UIDevice+TSHardwareVersion.m in Sources */,
B660F78D1C29988E00687D6E /* TSAdapterCacheManager.m in Sources */,
B660F6C31C29868000687D6E /* EC25AgreerTest.m in Sources */,
B660F6B91C29868000687D6E /* SpeexCodecTest.m in Sources */,
B660F6D81C29868000687D6E /* CryptoToolsTest.m in Sources */,

@ -82,7 +82,6 @@
<outlet property="tableView" destination="PaA-ol-uQT" id="nQU-tR-wbL"/>
<segue destination="Duq-aU-MmN" kind="modal" identifier="2.0_6.0_Call_Segue" modalPresentationStyle="fullScreen" modalTransitionStyle="crossDissolve" id="gHJ-y4-zWg"/>
<segue destination="lIF-0m-2N3" kind="modal" identifier="showSignupFlow" id="DR8-fx-0PD"/>
<segue destination="DtA-8O-wrT" kind="push" identifier="showSegue" id="njS-JT-0Pa"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dE8-zB-mtF" userLabel="First Responder" sceneMemberID="firstResponder"/>
@ -377,10 +376,10 @@ A0 09 9A FF A8 8A 09 99</string>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="groupMemberCell" id="hyn-Ss-OAa">
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
<rect key="frame" x="0.0" y="22" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hyn-Ss-OAa" id="4XE-JO-Upr">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
@ -748,7 +747,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="130" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="hpG-pz-GPZ" id="gVo-Nw-ff7" userLabel="Country Code Table Row">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" tag="1" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="United states" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SDz-Ag-lp3">
@ -1371,7 +1370,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="64" width="320" height="118"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5zF-Ko-9qU" id="gr7-Sm-bcs">
<rect key="frame" x="0.0" y="0.0" width="320" height="117"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="117.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1 (708) 000-1234" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ipE-BI-sLL">
@ -1429,7 +1428,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="182" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8rk-06-1ZS" id="hqv-P5-du9">
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Network Status" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uNq-FV-lwt">
@ -1468,7 +1467,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="226" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ITG-sW-Zn0" id="vOb-SA-SH2">
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Privacy" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TAs-sK-kbi">
@ -1491,7 +1490,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="270" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jp5-vZ-AhJ" id="sji-CJ-bhq">
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Notifications" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BaC-fn-VoA">
@ -1514,7 +1513,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="314" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Xx7-pz-aLN" id="pMA-vR-8Ae">
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Advanced" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qix-5C-dh1">
@ -1537,7 +1536,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="358" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EI4-kQ-MMA" id="czg-5p-aVz">
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
<rect key="frame" x="0.0" y="0.0" width="287" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="About" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6FV-LR-9Hv">
@ -1564,7 +1563,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="402" width="320" height="100"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="R82-FT-SEA" id="Ok9-fE-WhB">
<rect key="frame" x="0.0" y="0.0" width="320" height="99"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="99.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Mk-ly-6fq">
@ -1657,7 +1656,7 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="22" width="320" height="48"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Ld5-sX-pB8" id="EqP-87-4hZ">
<rect key="frame" x="0.0" y="0.0" width="320" height="47"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="47.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="urb-Me-knG">
@ -1719,8 +1718,8 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ukg-om-VX3">
<rect key="frame" x="0.0" y="0.0" width="320" height="100"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ukg-om-VX3">
<rect key="frame" x="0.0" y="20" width="320" height="100"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ul8-NY-i4c">
<rect key="frame" x="8" y="20" width="60" height="60"/>
@ -1754,15 +1753,15 @@ A0 09 9A FF A8 8A 09 99</string>
<constraint firstItem="gbm-B5-gCc" firstAttribute="leading" secondItem="Ul8-NY-i4c" secondAttribute="trailing" constant="18" id="yn3-rt-mGC"/>
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsMultipleSelection="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="cFo-AT-Srf">
<rect key="frame" x="0.0" y="108" width="320" height="396"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsMultipleSelection="YES" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="cFo-AT-Srf">
<rect key="frame" x="0.0" y="128" width="320" height="440"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="ekO-kw-iHV">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add people:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="daD-wf-IGn">
<rect key="frame" x="10" y="274" width="130" height="21"/>
<rect key="frame" x="10" y="274" width="130" height="20.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
@ -1780,11 +1779,11 @@ A0 09 9A FF A8 8A 09 99</string>
<rect key="frame" x="0.0" y="590" width="320" height="60"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="yfF-Jl-bZ1" id="f0v-od-N9K">
<rect key="frame" x="0.0" y="0.0" width="320" height="59"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="59.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="a4j-OQ-ala">
<rect key="frame" x="15" y="0.0" width="290" height="59"/>
<rect key="frame" x="15" y="0.0" width="290" height="59.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="20"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>

@ -28,6 +28,7 @@ static NSString *const kCallSegue = @"2.0_6.0_Call_Segue";
@class ContactsManager;
@class PhoneManager;
@class SignalsViewController;
@class TSGroupThread;
@interface Environment : NSObject
@property (nonatomic, readonly) in_port_t serverPort;
@ -86,5 +87,6 @@ static NSString *const kCallSegue = @"2.0_6.0_Call_Segue";
+ (void)messageThreadId:(NSString *)threadId;
+ (void)messageIdentifier:(NSString *)identifier withCompose:(BOOL)compose;
+ (void)messageGroupModel:(TSGroupModel *)model withCompose:(BOOL)compose;
+ (void)messageGroup:(TSGroupThread *)groupThread;
@end

@ -189,40 +189,19 @@ static Environment *environment = nil;
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
if (vc.presentedViewController) {
[vc.presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
[[TSStorageManager sharedManager]
.dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
TSThread *thread = [TSContactThread getOrCreateThreadWithContactId:identifier transaction:transaction];
[vc presentThread:thread keyboardOnViewAppearing:YES];
[vc.navigationController popToRootViewControllerAnimated:NO];
vc.contactIdentifierFromCompose = identifier;
vc.composeMessage = compose;
[vc performSegueWithIdentifier:@"showSegue" sender:nil];
}];
}
+ (void)messageGroup:(TSGroupThread *)groupThread {
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
if (vc.presentedViewController) {
[vc.presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
[vc.navigationController popToRootViewControllerAnimated:NO];
[vc performSegueWithIdentifier:@"showSegue" sender:groupThread];
}
+ (void)messageGroupModel:(TSGroupModel *)model withCompose:(BOOL)compose {
Environment *env = [self getCurrent];
SignalsViewController *vc = env.signalsViewController;
if (vc.presentedViewController) {
[vc.presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
[vc.navigationController popToRootViewControllerAnimated:NO];
vc.groupFromCompose = model;
vc.composeMessage = compose;
[vc performSegueWithIdentifier:@"showSegue" sender:nil];
[vc presentThread:groupThread keyboardOnViewAppearing:YES];
}
+ (void)resetAppData {

@ -1,27 +0,0 @@
//
// TSAdapterCacheManager.h
// Signal
//
// Created by Dylan Bourgeois on 03/01/15.
// Copyright (c) 2015 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
@class TSMessageAdapter;
@interface TSAdapterCacheManager : NSObject {
NSCache *messageAdaptersCache;
}
@property (nonatomic, retain) NSCache *messageAdaptersCache;
+ (id)sharedManager;
- (void)cacheAdapter:(TSMessageAdapter *)adapter forInteractionId:(NSString *)identifier;
- (void)clearCacheEntryForInteractionId:(NSString *)identifier;
- (TSMessageAdapter *)adapterForInteractionId:(NSString *)identifier;
- (BOOL)containsCacheEntryForInteractionId:(NSString *)identifier;
@end

@ -1,54 +0,0 @@
//
// TSAdapterCacheManager.m
// Signal
//
// Created by Dylan Bourgeois on 03/01/15.
// Copyright (c) 2015 Open Whisper Systems. All rights reserved.
//
#import "TSAdapterCacheManager.h"
#import "TSMessageAdapter.h"
@implementation TSAdapterCacheManager
@synthesize messageAdaptersCache;
+ (id)sharedManager {
static TSAdapterCacheManager *sharedManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedManager = [[self alloc] init];
});
return sharedManager;
}
- (id)init {
if (self = [super init]) {
messageAdaptersCache = [[NSCache alloc] init];
}
return self;
}
- (void)cacheAdapter:(TSMessageAdapter *)adapter forInteractionId:(NSString *)identifier {
NSParameterAssert(adapter);
NSParameterAssert(identifier);
[messageAdaptersCache setObject:adapter forKey:identifier];
}
- (void)clearCacheEntryForInteractionId:(NSString *)identifier {
NSParameterAssert(identifier);
[messageAdaptersCache removeObjectForKey:identifier];
}
- (TSMessageAdapter *)adapterForInteractionId:(NSString *)identifier {
NSParameterAssert(identifier);
return [messageAdaptersCache objectForKey:identifier];
}
- (BOOL)containsCacheEntryForInteractionId:(NSString *)identifier {
return [messageAdaptersCache objectForKey:identifier] != nil;
}
@end

@ -20,4 +20,9 @@
+ (UIFont *)ows_boldFontWithSize:(CGFloat)size;
#pragma mark Dynamic Type
+ (UIFont *)ows_dynamicTypeBodyFont;
@end

@ -22,7 +22,6 @@
return [UIFont systemFontOfSize:size weight:UIFontWeightRegular];
}
+ (UIFont *)ows_mediumFontWithSize:(CGFloat)size {
return [UIFont systemFontOfSize:size weight:UIFontWeightMedium];
}
@ -31,4 +30,10 @@
return [UIFont boldSystemFontOfSize:size];
}
#pragma mark Dynamic Type
+ (UIFont *)ows_dynamicTypeBodyFont {
return [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
}
@end

@ -7,37 +7,22 @@
//
#import <UIKit/UIKit.h>
#import "NextResponderScrollView.h"
#import "TSThread.h"
typedef enum : NSUInteger { kArchiveState = 0, kInboxState = 1 } CellState;
@class InboxTableViewCell;
@protocol TableViewCellDelegate <NSObject>
- (void)tableViewCellTappedArchive:(InboxTableViewCell *)cell;
@end
@interface InboxTableViewCell : UITableViewCell <UIScrollViewDelegate>
@property (nonatomic, strong) IBOutlet UILabel *nameLabel;
@property (nonatomic, strong) IBOutlet UILabel *snippetLabel;
@property (nonatomic, strong) IBOutlet UIImageView *contactPictureView;
@property (nonatomic, strong) IBOutlet UILabel *timeLabel;
@property (nonatomic, strong) IBOutlet NextResponderScrollView *scrollView;
@property (nonatomic, strong) IBOutlet UIView *contentContainerView;
@property (nonatomic, strong) IBOutlet UIView *archiveView;
@property (nonatomic, strong) IBOutlet UIImageView *archiveImageView;
@property (nonatomic, retain) IBOutlet UIView *messageCounter;
@property (nonatomic, assign) id<TableViewCellDelegate> delegate;
@property (nonatomic, retain) NSString *threadId;
+ (instancetype)inboxTableViewCell;
- (void)configureWithThread:(TSThread *)thread;
- (void)configureForState:(CellState)state;
- (void)animateDisappear;
@end

@ -41,12 +41,6 @@
}
- (void)initializeLayout {
_scrollView.contentSize =
CGSizeMake(CGRectGetWidth(_contentContainerView.bounds), CGRectGetHeight(_scrollView.frame));
_scrollView.contentOffset = CGPointMake(CGRectGetWidth(_archiveView.frame), 0);
_archiveImageView.image = [_archiveImageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.selectionStyle = UITableViewCellSelectionStyleDefault;
}
@ -130,20 +124,6 @@
});
}
- (void)configureForState:(CellState)state {
switch (state) {
case kArchiveState:
_archiveImageView.image = [[UIImage imageNamed:@"cellBtnMoveToInbox--blue"]
imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
break;
case kInboxState:
break;
default:
break;
}
}
- (void)updateCellForUnreadMessage {
_nameLabel.font = [UIFont ows_boldFontWithSize:14.0f];
_nameLabel.textColor = [UIColor ows_blackColor];
@ -186,27 +166,6 @@
return attributedString;
}
#pragma mark - UIScrollViewDelegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (_scrollView.contentOffset.x < 0) {
_archiveImageView.image = [_archiveImageView.image jsq_imageMaskedWithColor:[UIColor ows_materialBlueColor]];
_archiveImageView.bounds = CGRectMake(_archiveImageView.bounds.origin.x,
_archiveImageView.bounds.origin.y,
ARCHIVE_IMAGE_VIEW_WIDTH,
_archiveImageView.bounds.size.height);
} else {
_archiveImageView.image = [_archiveImageView.image jsq_imageMaskedWithColor:[UIColor ows_darkGrayColor]];
double ratio = (_archiveView.frame.size.width / 2.0f - _scrollView.contentOffset.x) /
(_archiveView.frame.size.width / 2.0f);
double newWidth = ARCHIVE_IMAGE_VIEW_WIDTH / 2.0f + (ARCHIVE_IMAGE_VIEW_WIDTH * ratio) / 2.0f;
_archiveImageView.bounds = CGRectMake(_archiveImageView.bounds.origin.x,
_archiveImageView.bounds.origin.y,
(CGFloat)newWidth,
_archiveImageView.bounds.size.height);
}
}
- (void)setUnreadMsgCount:(NSUInteger)unreadMessages {
if (_unreadMessages != unreadMessages) {
_unreadMessages = unreadMessages;
@ -257,19 +216,6 @@
}
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
withVelocity:(CGPoint)velocity
targetContentOffset:(inout CGPoint *)targetContentOffset {
if (_scrollView.contentOffset.x < SWIPE_ARCHIVE_OFFSET) {
// archive the thread
[_delegate tableViewCellTappedArchive:self];
[Environment.preferences setHasArchivedAMessage:YES];
} else {
// don't do anything
*targetContentOffset = CGPointMake(CGRectGetWidth(_archiveView.frame), 0);
}
}
#pragma mark - Animation
- (void)animateDisappear {

@ -1,10 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@ -13,130 +12,87 @@
<rect key="frame" x="0.0" y="0.0" width="400" height="72"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" multipleTouchEnabled="YES" contentMode="center" tableViewCell="axX-Rb-kiK" id="BRG-hJ-lRa">
<rect key="frame" x="0.0" y="0.0" width="400" height="71"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="72"/>
<autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yBY-TS-2tI" userLabel="Archive View">
<rect key="frame" x="-32" y="0.0" width="200" height="72"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kq8-RD-txC" userLabel="Container View">
<rect key="frame" x="0.0" y="0.0" width="400" height="72"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="cellBtnMoveToArchive--blue" translatesAutoresizingMaskIntoConstraints="NO" id="WyX-Hb-Mpn">
<rect key="frame" x="60" y="25" width="22" height="22"/>
<animations/>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="p9o-x6-nT5">
<rect key="frame" x="10" y="10" width="52" height="53"/>
<constraints>
<constraint firstAttribute="width" constant="22" id="POu-Gs-JsW"/>
<constraint firstAttribute="height" constant="22" id="oci-BQ-wXb"/>
<constraint firstAttribute="width" constant="52" id="mb7-1o-58k"/>
</constraints>
</imageView>
</subviews>
<animations/>
<color key="backgroundColor" red="0.79607843137254897" green="0.8901960784313725" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="WyX-Hb-Mpn" firstAttribute="top" secondItem="yBY-TS-2tI" secondAttribute="top" constant="25" id="D9f-ck-Her"/>
<constraint firstItem="WyX-Hb-Mpn" firstAttribute="leading" secondItem="yBY-TS-2tI" secondAttribute="leading" constant="60" id="KzQ-6W-TfR"/>
<constraint firstAttribute="width" constant="200" id="cyx-QR-zwE"/>
<constraint firstAttribute="height" constant="72" id="nSm-46-Dix"/>
</constraints>
</view>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceHorizontal="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" canCancelContentTouches="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bG5-iK-ql3" customClass="NextResponderScrollView">
<rect key="frame" x="0.0" y="0.0" width="400" height="72"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kq8-RD-txC" userLabel="Container View">
<rect key="frame" x="0.0" y="0.0" width="400" height="72"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p9o-x6-nT5">
<rect key="frame" x="10" y="10" width="52" height="53"/>
<animations/>
</imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" misplaced="YES" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" enabled="NO" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bp6-EC-9eP">
<rect key="frame" x="383" y="10" width="0.0" height="0.0"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="kgo-Kw-ZP3"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" red="0.13725490200000001" green="0.1215686275" blue="0.12549019610000001" alpha="1" colorSpace="calibratedRGB"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" enabled="NO" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qgj-EY-BWC">
<rect key="frame" x="75" y="29" width="235" height="33"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KNJ-HQ-UVM" userLabel="New Messages Tag">
<rect key="frame" x="353" y="35" width="27" height="27"/>
<animations/>
<color key="backgroundColor" red="0.25882352939999997" green="0.74901960779999999" blue="0.25098039220000001" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="27" id="S3w-sZ-O53"/>
<constraint firstAttribute="width" secondItem="KNJ-HQ-UVM" secondAttribute="height" multiplier="1:1" id="pRB-Zk-iwR"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mfN-2A-QxN">
<rect key="frame" x="75" y="6" width="236" height="25"/>
<animations/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" enabled="NO" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bp6-EC-9eP">
<rect key="frame" x="383" y="10" width="0.0" height="17"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="KNJ-HQ-UVM" firstAttribute="top" secondItem="bp6-EC-9eP" secondAttribute="bottom" constant="8" id="Xxt-Pd-bUm"/>
<constraint firstItem="Qgj-EY-BWC" firstAttribute="top" secondItem="kq8-RD-txC" secondAttribute="top" constant="29" id="YQx-hl-fQf"/>
<constraint firstAttribute="height" constant="17" id="kgo-Kw-ZP3"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" red="0.13725490200000001" green="0.1215686275" blue="0.12549019610000001" alpha="1" colorSpace="calibratedRGB"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" enabled="NO" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Qgj-EY-BWC">
<rect key="frame" x="75" y="29" width="236" height="33"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<view userInteractionEnabled="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KNJ-HQ-UVM" userLabel="New Messages Tag">
<rect key="frame" x="353" y="35" width="27" height="27"/>
<color key="backgroundColor" red="0.25882352939999997" green="0.74901960779999999" blue="0.25098039220000001" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="27" id="S3w-sZ-O53"/>
<constraint firstAttribute="width" secondItem="KNJ-HQ-UVM" secondAttribute="height" multiplier="1:1" id="pRB-Zk-iwR"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mfN-2A-QxN">
<rect key="frame" x="75" y="6" width="236" height="25"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="kq8-RD-txC" secondAttribute="bottom" id="4a6-E0-eBE"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="top" secondItem="bG5-iK-ql3" secondAttribute="top" id="AG5-dI-2pd"/>
<constraint firstAttribute="trailing" secondItem="kq8-RD-txC" secondAttribute="trailing" id="CWM-Sv-BB9"/>
<constraint firstAttribute="trailing" secondItem="KNJ-HQ-UVM" secondAttribute="trailing" constant="20" id="J8b-wh-IUa"/>
<constraint firstAttribute="trailing" secondItem="Qgj-EY-BWC" secondAttribute="trailing" constant="90" id="LNQ-nI-2z4"/>
<constraint firstAttribute="trailing" secondItem="bp6-EC-9eP" secondAttribute="trailing" constant="17" id="ZIh-x7-oZT"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="centerX" secondItem="bG5-iK-ql3" secondAttribute="centerX" id="dF0-aa-sOI"/>
<constraint firstItem="bp6-EC-9eP" firstAttribute="top" secondItem="bG5-iK-ql3" secondAttribute="top" constant="10" id="ghx-vM-qjc"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="leading" secondItem="bG5-iK-ql3" secondAttribute="leading" id="lDQ-73-Y5y"/>
<constraint firstItem="Qgj-EY-BWC" firstAttribute="leading" secondItem="bG5-iK-ql3" secondAttribute="leading" constant="75" id="vVN-fS-XXB"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="centerY" secondItem="bG5-iK-ql3" secondAttribute="centerY" id="zll-OP-FWQ"/>
<constraint firstItem="KNJ-HQ-UVM" firstAttribute="top" secondItem="kq8-RD-txC" secondAttribute="top" constant="35" id="1fE-Dr-blB"/>
<constraint firstItem="Qgj-EY-BWC" firstAttribute="bottom" secondItem="KNJ-HQ-UVM" secondAttribute="bottom" id="AKd-U0-qM0"/>
<constraint firstItem="p9o-x6-nT5" firstAttribute="leading" secondItem="kq8-RD-txC" secondAttribute="leading" constant="10" id="EXY-ll-Ulo"/>
<constraint firstAttribute="trailing" secondItem="KNJ-HQ-UVM" secondAttribute="trailing" constant="20" id="MME-Mn-YIq"/>
<constraint firstAttribute="trailing" secondItem="mfN-2A-QxN" secondAttribute="trailing" constant="89" id="S4b-7i-rpp"/>
<constraint firstAttribute="bottom" secondItem="mfN-2A-QxN" secondAttribute="bottom" constant="41" id="TTx-u5-eDX"/>
<constraint firstItem="KNJ-HQ-UVM" firstAttribute="top" secondItem="bp6-EC-9eP" secondAttribute="bottom" constant="8" id="Xxt-Pd-bUm"/>
<constraint firstItem="p9o-x6-nT5" firstAttribute="centerY" secondItem="kq8-RD-txC" secondAttribute="centerY" id="Yk2-fP-LXc"/>
<constraint firstItem="Qgj-EY-BWC" firstAttribute="trailing" secondItem="mfN-2A-QxN" secondAttribute="trailing" id="fPa-M6-Cjl"/>
<constraint firstItem="mfN-2A-QxN" firstAttribute="top" secondItem="kq8-RD-txC" secondAttribute="top" constant="6" id="ic3-WA-xFo"/>
<constraint firstItem="Qgj-EY-BWC" firstAttribute="top" secondItem="kq8-RD-txC" secondAttribute="top" constant="29" id="jHb-Ij-oxU"/>
<constraint firstItem="Qgj-EY-BWC" firstAttribute="leading" secondItem="mfN-2A-QxN" secondAttribute="leading" id="kuk-P5-Tgp"/>
<constraint firstItem="bp6-EC-9eP" firstAttribute="top" secondItem="p9o-x6-nT5" secondAttribute="top" id="oNW-MD-rmQ"/>
<constraint firstItem="mfN-2A-QxN" firstAttribute="leading" secondItem="p9o-x6-nT5" secondAttribute="trailing" constant="13" id="prC-xO-Y0J"/>
<constraint firstAttribute="trailing" secondItem="bp6-EC-9eP" secondAttribute="trailing" constant="17" id="vMu-Lr-eTJ"/>
</constraints>
<connections>
<outlet property="delegate" destination="axX-Rb-kiK" id="TMe-oF-FQE"/>
</connections>
</scrollView>
</view>
</subviews>
<animations/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="yBY-TS-2tI" secondAttribute="centerY" constant="-0.5" id="4d0-90-jLX"/>
<constraint firstItem="bG5-iK-ql3" firstAttribute="centerY" secondItem="yBY-TS-2tI" secondAttribute="centerY" id="5Va-qA-vJx"/>
<constraint firstAttribute="trailing" secondItem="bG5-iK-ql3" secondAttribute="trailing" id="Wbl-He-blg"/>
<constraint firstItem="yBY-TS-2tI" firstAttribute="leading" secondItem="BRG-hJ-lRa" secondAttribute="leadingMargin" constant="-40" id="ZTu-mT-wNL"/>
<constraint firstItem="bG5-iK-ql3" firstAttribute="leading" secondItem="BRG-hJ-lRa" secondAttribute="leading" id="byS-fb-Uet"/>
<constraint firstItem="bG5-iK-ql3" firstAttribute="bottom" secondItem="yBY-TS-2tI" secondAttribute="bottom" id="opm-uv-Fhc"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="centerX" secondItem="BRG-hJ-lRa" secondAttribute="centerX" id="7r4-bD-FQ6"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="height" secondItem="BRG-hJ-lRa" secondAttribute="height" id="ZfP-IE-NYS"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="centerY" secondItem="BRG-hJ-lRa" secondAttribute="centerY" id="em2-Xt-SpY"/>
<constraint firstItem="kq8-RD-txC" firstAttribute="width" secondItem="BRG-hJ-lRa" secondAttribute="width" id="pNl-2B-oKE"/>
</constraints>
</tableViewCellContentView>
<animations/>
<connections>
<outlet property="archiveImageView" destination="WyX-Hb-Mpn" id="99i-j3-F49"/>
<outlet property="archiveView" destination="yBY-TS-2tI" id="Olb-KX-yw5"/>
<outlet property="contactPictureView" destination="p9o-x6-nT5" id="oUA-O3-JIc"/>
<outlet property="contentContainerView" destination="kq8-RD-txC" id="yaJ-z3-8sC"/>
<outlet property="messageCounter" destination="KNJ-HQ-UVM" id="Ysu-EC-k1P"/>
<outlet property="nameLabel" destination="mfN-2A-QxN" id="Jr0-05-R1t"/>
<outlet property="scrollView" destination="bG5-iK-ql3" id="wEp-AH-Pdu"/>
<outlet property="snippetLabel" destination="Qgj-EY-BWC" id="EIb-je-Cw5"/>
<outlet property="timeLabel" destination="bp6-EC-9eP" id="O4O-ST-o3v"/>
</connections>
<point key="canvasLocation" x="254" y="340"/>
<point key="canvasLocation" x="253" y="340"/>
</tableViewCell>
</objects>
<resources>
<image name="cellBtnMoveToArchive--blue" width="30" height="30"/>
</resources>
</document>

@ -22,22 +22,18 @@
UIGestureRecognizerDelegate>
@property (nonatomic, readonly) TSThread *thread;
@property (nonatomic, retain) APNavigationController *navController;
@property (nonatomic, strong) MPMoviePlayerController *videoPlayer;
@property (nonatomic, strong) AVAudioPlayer *audioPlayer;
@property (nonatomic, strong) AVAudioRecorder *audioRecorder;
- (void)setupWithThread:(TSThread *)thread;
- (void)setupWithTSIdentifier:(NSString *)identifier;
- (void)setupWithTSGroup:(TSGroupModel *)model;
- (void)configureForThread:(TSThread *)thread keyboardOnViewAppearing:(BOOL)keyboardAppearing;
- (void)popKeyBoard;
#pragma mark 3D Touch Methods
- (void)peekSetup;
- (void)popped;
- (void)setComposeOnOpen:(BOOL)compose;
- (TSThread *)thread;
- (void)popKeyBoard;
@end

@ -27,7 +27,6 @@
#import "PreferencesUtil.h"
#import "ShowGroupMembersViewController.h"
#import "SignalKeyingStorage.h"
#import "TSAdapterCacheManager.h"
#import "TSAttachmentPointer.h"
#import "TSContentAdapters.h"
#import "TSDatabaseView.h"
@ -37,6 +36,7 @@
#import "TSMessagesManager+attachments.h"
#import "TSMessagesManager+sendMessages.h"
#import "UIButton+OWS.h"
#import "UIFont+OWS.h"
#import "UIUtil.h"
#define kYapDatabaseRangeLength 50
@ -66,8 +66,8 @@ typedef enum : NSUInteger {
NSUInteger _unreadCount;
}
@property (nonatomic, readwrite) TSThread *thread;
@property (nonatomic, weak) UIView *navView;
@property (nonatomic, retain) TSThread *thread;
@property (nonatomic, strong) YapDatabaseConnection *editingDatabaseConnection;
@property (nonatomic, strong) YapDatabaseConnection *uiDatabaseConnection;
@property (nonatomic, strong) YapDatabaseViewMappings *messageMappings;
@ -88,8 +88,6 @@ typedef enum : NSUInteger {
@property (nonatomic) BOOL displayPhoneAsTitle;
@property NSUInteger page;
@property BOOL isVisible;
@property (nonatomic) BOOL composeOnOpen;
@property (nonatomic) BOOL peek;
@ -102,33 +100,6 @@ typedef enum : NSUInteger {
@implementation MessagesViewController
- (void)setupWithTSIdentifier:(NSString *)identifier {
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
self.thread = [TSContactThread getOrCreateThreadWithContactId:identifier transaction:transaction];
}];
}
- (void)setupWithTSGroup:(TSGroupModel *)model {
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
self.thread = [TSGroupThread getOrCreateThreadWithGroupModel:model transaction:transaction];
}];
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:self.thread
messageBody:@""
attachments:[[NSMutableArray alloc] init]];
message.groupMetaMessage = TSGroupMessageNew;
if (model.groupImage != nil) {
[[TSMessagesManager sharedManager] sendAttachment:UIImagePNGRepresentation(model.groupImage)
contentType:@"image/png"
inMessage:message
thread:self.thread];
} else {
[[TSMessagesManager sharedManager] sendMessage:message inThread:self.thread success:nil failure:nil];
}
isGroupConversation = YES;
}
- (void)peekSetup {
_peek = YES;
[self setComposeOnOpen:NO];
@ -139,17 +110,22 @@ typedef enum : NSUInteger {
[self hideInputIfNeeded];
}
- (void)setComposeOnOpen:(BOOL)compose {
_composeOnOpen = compose;
}
- (void)setupWithThread:(TSThread *)thread {
self.thread = thread;
isGroupConversation = [self.thread isKindOfClass:[TSGroupThread class]];
}
- (void)configureForThread:(TSThread *)thread keyboardOnViewAppearing:(BOOL)keyboardAppearing {
_thread = thread;
isGroupConversation = [self.thread isKindOfClass:[TSGroupThread class]];
_composeOnOpen = keyboardAppearing;
_lastDeliveredMessageIndexPath = nil;
- (TSThread *)thread {
return _thread;
[self.uiDatabaseConnection beginLongLivedReadTransaction];
self.messageMappings =
[[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ] view:TSMessageDatabaseViewExtensionName];
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.messageMappings updateWithTransaction:transaction];
self.page = 0;
[self updateRangeOptionsForPage:self.page];
[self markAllMessagesAsRead];
[self.collectionView reloadData];
}];
}
- (void)hideInputIfNeeded {
@ -172,7 +148,6 @@ typedef enum : NSUInteger {
- (void)viewDidLoad {
[super viewDidLoad];
_isVisible = NO;
[self.navigationController.navigationBar setTranslucent:NO];
_showFingerprintDisplay =
@ -183,7 +158,7 @@ typedef enum : NSUInteger {
_toggleContactPhoneDisplay.numberOfTapsRequired = 1;
_messageButton = [UIButton ows_blueButtonWithTitle:NSLocalizedString(@"SEND_BUTTON_TITLE", @"")];
_messageButton.enabled = FALSE;
_messageButton.enabled = NO;
_messageButton.titleLabel.adjustsFontSizeToFitWidth = YES;
_attachButton = [[UIButton alloc] init];
@ -195,31 +170,18 @@ typedef enum : NSUInteger {
UIEdgeInsetsMake(JSQ_IMAGE_INSET, JSQ_IMAGE_INSET, JSQ_IMAGE_INSET, JSQ_IMAGE_INSET);
[_attachButton setImage:[UIImage imageNamed:@"btnAttachments--blue"] forState:UIControlStateNormal];
[self markAllMessagesAsRead];
[self initializeBubbles];
[self initializeTextView];
self.messageMappings = [[YapDatabaseViewMappings alloc] initWithGroups:@[ self.thread.uniqueId ]
view:TSMessageDatabaseViewExtensionName];
self.page = 0;
[self updateRangeOptionsForPage:self.page];
[self.uiDatabaseConnection beginLongLivedReadTransaction];
[self.uiDatabaseConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.messageMappings updateWithTransaction:transaction];
[self.collectionView reloadData];
}];
[self initializeCollectionViewLayout];
self.senderId = ME_MESSAGE_IDENTIFIER self.senderDisplayName = ME_MESSAGE_IDENTIFIER
self.senderId = ME_MESSAGE_IDENTIFIER;
self.senderDisplayName = ME_MESSAGE_IDENTIFIER;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startReadTimer)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(startReadTimer)
name:UIApplicationWillEnterForegroundNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(cancelReadTimer)
name:UIApplicationDidEnterBackgroundNotification
@ -230,7 +192,7 @@ typedef enum : NSUInteger {
}
- (void)initializeTextView {
[self.inputToolbar.contentView.textView setFont:[UIFont ows_regularFontWithSize:17.f]];
[self.inputToolbar.contentView.textView setFont:[UIFont ows_dynamicTypeBodyFont]];
self.inputToolbar.contentView.leftBarButtonItem = _attachButton;
self.inputToolbar.contentView.rightBarButtonItem = _messageButton;
self.inputToolbar.contentView.textView.layer.cornerRadius = 4.f;
@ -247,7 +209,6 @@ typedef enum : NSUInteger {
[super viewWillAppear:animated];
[self initializeToolbars];
[self.collectionView reloadData];
NSInteger numberOfMessages = (NSInteger)[self.messageMappings numberOfItemsInGroup:self.thread.uniqueId];
if (numberOfMessages > 0) {
@ -272,13 +233,16 @@ typedef enum : NSUInteger {
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self markAllMessagesAsRead];
[self dismissKeyBoard];
[self startReadTimer];
_isVisible = YES;
[self initializeTitleLabelGestureRecognizer];
[self updateBackButtonAsync];
[self.inputToolbar.contentView.textView endEditing:YES];
self.inputToolbar.contentView.textView.editable = YES;
if (_composeOnOpen) {
[self popKeyBoard];
}
@ -296,11 +260,13 @@ typedef enum : NSUInteger {
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
if ([self.navigationController.viewControllers indexOfObject:self] == NSNotFound) {
// back button was pressed.
[self.navController hideDropDown:self];
}
[super viewWillDisappear:animated];
[_unreadContainer removeFromSuperview];
_unreadContainer = nil;
@ -332,7 +298,8 @@ typedef enum : NSUInteger {
}
- (void)viewDidDisappear:(BOOL)animated {
_isVisible = NO;
[super viewDidDisappear:animated];
self.inputToolbar.contentView.textView.editable = NO;
}
- (void)didReceiveMemoryWarning {
@ -453,6 +420,13 @@ typedef enum : NSUInteger {
self.navigationItem.rightBarButtonItem.imageInsets = UIEdgeInsetsMake(0, -10, 0, 10);
} else if (!_thread.isGroupThread) {
self.navigationItem.rightBarButtonItem = nil;
} else {
self.navigationItem.rightBarButtonItem =
[[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"contact-options-action"]
imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
style:UIBarButtonItemStylePlain
target:self
action:@selector(didSelectShow:)];
}
[self hideInputIfNeeded];
@ -515,7 +489,7 @@ typedef enum : NSUInteger {
- (void)initializeCollectionViewLayout {
if (self.collectionView) {
[self.collectionView.collectionViewLayout setMessageBubbleFont:[UIFont ows_regularFontWithSize:15.0f]];
[self.collectionView.collectionViewLayout setMessageBubbleFont:[UIFont ows_dynamicTypeBodyFont]];
self.collectionView.showsVerticalScrollIndicator = NO;
self.collectionView.showsHorizontalScrollIndicator = NO;
@ -622,7 +596,6 @@ typedef enum : NSUInteger {
[self performSegueWithIdentifier:kShowGroupMembersSegue sender:self];
}
#pragma mark - Calls
- (SignalRecipient *)signalRecipient {
@ -1262,7 +1235,6 @@ typedef enum : NSUInteger {
- (void)deleteMessageAtIndexPath:(NSIndexPath *)indexPath {
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
[[TSAdapterCacheManager sharedManager] clearCacheEntryForInteractionId:interaction.uniqueId];
[interaction removeWithTransaction:transaction];
}];
}
@ -1452,7 +1424,9 @@ typedef enum : NSUInteger {
[[TSMessagesManager sharedManager] sendAttachment:attachmentData
contentType:attachmentType
inMessage:message
thread:self.thread];
thread:self.thread
success:nil
failure:nil];
}];
}
@ -1582,7 +1556,10 @@ typedef enum : NSUInteger {
if (isGroupConversation) {
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
TSGroupThread *gThread = (TSGroupThread *)self.thread;
self.thread = [TSGroupThread threadWithGroupModel:gThread.groupModel transaction:transaction];
if (gThread.groupModel) {
self.thread = [TSGroupThread threadWithGroupModel:gThread.groupModel transaction:transaction];
}
}];
}
@ -1596,15 +1573,6 @@ typedef enum : NSUInteger {
return;
}
if (!_isVisible) {
// Since we moved our databaseConnection to a new commit,
// we need to update the mappings too.
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.messageMappings updateWithTransaction:transaction];
}];
return;
}
NSArray *messageRowChanges = nil;
NSArray *sectionChanges = nil;
@ -1628,11 +1596,6 @@ typedef enum : NSUInteger {
break;
}
case YapDatabaseViewChangeInsert: {
TSInteraction *interaction = [self interactionAtIndexPath:rowChange.newIndexPath];
[[TSAdapterCacheManager sharedManager]
cacheAdapter:[TSMessageAdapter messageViewDataWithInteraction:interaction
inThread:self.thread]
forInteractionId:interaction.uniqueId];
[self.collectionView insertItemsAtIndexPaths:@[ rowChange.newIndexPath ]];
scrollToBottom = YES;
break;
@ -1649,14 +1612,6 @@ typedef enum : NSUInteger {
[rowsToUpdate addObject:_lastDeliveredMessageIndexPath];
}
for (NSIndexPath *indexPath in rowsToUpdate) {
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
[[TSAdapterCacheManager sharedManager]
cacheAdapter:[TSMessageAdapter messageViewDataWithInteraction:interaction
inThread:self.thread]
forInteractionId:interaction.uniqueId];
}
[self.collectionView reloadItemsAtIndexPaths:rowsToUpdate];
scrollToBottom = YES;
break;
@ -1707,18 +1662,10 @@ typedef enum : NSUInteger {
}
- (TSMessageAdapter *)messageAtIndexPath:(NSIndexPath *)indexPath {
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
TSAdapterCacheManager *manager = [TSAdapterCacheManager sharedManager];
if (![manager containsCacheEntryForInteractionId:interaction.uniqueId]) {
[manager cacheAdapter:[TSMessageAdapter messageViewDataWithInteraction:interaction inThread:self.thread]
forInteractionId:interaction.uniqueId];
}
return [manager adapterForInteractionId:interaction.uniqueId];
TSInteraction *interaction = [self interactionAtIndexPath:indexPath];
return [TSMessageAdapter messageViewDataWithInteraction:interaction inThread:self.thread];
}
#pragma mark group action view
@ -1807,7 +1754,7 @@ typedef enum : NSUInteger {
}
- (void)markAllMessagesAsRead {
[self.editingDatabaseConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[self.thread markAllAsReadWithTransaction:transaction];
}];
}
@ -1879,7 +1826,9 @@ typedef enum : NSUInteger {
[[TSMessagesManager sharedManager] sendAttachment:UIImagePNGRepresentation(newGroupModel.groupImage)
contentType:@"image/png"
inMessage:message
thread:groupThread];
thread:groupThread
success:nil
failure:nil];
} else {
[[TSMessagesManager sharedManager] sendMessage:message inThread:groupThread success:nil failure:nil];
}
@ -1992,4 +1941,11 @@ typedef enum : NSUInteger {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark 3D Touch Preview Actions
- (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
return @[];
}
@end

@ -7,7 +7,10 @@
//
#import <MobileCoreServices/UTCoreTypes.h>
#import <TextSecureKit/NSDate+millisecondTimeStamp.h>
#import <TextSecureKit/TSAccountManager.h>
#import <TextSecureKit/TSMessagesManager+attachments.h>
#import <TextSecureKit/TSMessagesManager+sendMessages.h>
#import "ContactsManager.h"
#import "DJWActionSheet+OWS.h"
#import "Environment.h"
@ -16,6 +19,7 @@
#import "SecurityUtils.h"
#import "SignalKeyingStorage.h"
#import "SignalsViewController.h"
#import "TSOutgoingMessage.h"
#import "UIImage+normalizeImage.h"
#import "UIUtil.h"
@ -116,7 +120,87 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
#pragma mark - Actions
- (void)createGroup {
TSGroupModel *model = [self makeGroup];
[Environment messageGroupModel:model withCompose:YES];
[[TSStorageManager sharedManager]
.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
self.thread = [TSGroupThread getOrCreateThreadWithGroupModel:model transaction:transaction];
}];
UIAlertController *alertController =
[UIAlertController alertControllerWithTitle:NSLocalizedString(@"GROUP_CREATING", nil)
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[self
presentViewController:alertController
animated:YES
completion:^{
TSOutgoingMessage *message =
[[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:self.thread
messageBody:@""
attachments:[[NSMutableArray alloc] init]];
message.groupMetaMessage = TSGroupMessageNew;
if (model.groupImage != nil) {
[[TSMessagesManager sharedManager] sendAttachment:UIImagePNGRepresentation(model.groupImage)
contentType:@"image/png"
inMessage:message
thread:self.thread
success:^{
[self dismissViewControllerAnimated:YES
completion:^{
[Environment messageGroup:self.thread];
}];
}
failure:^{
[self
dismissViewControllerAnimated:YES
completion:^{
[[TSStorageManager sharedManager]
.dbConnection
readWriteWithBlock:^(
YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.thread removeWithTransaction:transaction];
}];
SignalAlertView(
NSLocalizedString(@"GROUP_CREATING_FAILED", nil),
NSLocalizedString(@"NETWORK_ERROR_RECOVERY", nil));
}];
}];
} else {
[[TSMessagesManager sharedManager] sendMessage:message
inThread:self.thread
success:^{
[self dismissViewControllerAnimated:YES
completion:^{
[Environment messageGroup:self.thread];
}];
}
failure:^{
[self
dismissViewControllerAnimated:YES
completion:^{
[[TSStorageManager sharedManager]
.dbConnection
readWriteWithBlock:^(
YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[self.thread removeWithTransaction:transaction];
}];
SignalAlertView(
NSLocalizedString(@"GROUP_CREATING_FAILED", nil),
NSLocalizedString(@"NETWORK_ERROR_RECOVERY", nil));
}];
}];
}
}];
}

@ -1,12 +0,0 @@
#import <UIKit/UIKit.h>
/**
*
* This scroll view is used in inbox feed table cell to pass touches through to the next responder-
* because the scroll view touches override the table cell touches otherwise.
*
*/
@interface NextResponderScrollView : UIScrollView
@end

@ -1,31 +0,0 @@
#import "NextResponderScrollView.h"
@implementation NextResponderScrollView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (!self.dragging) {
[self.nextResponder touchesBegan:touches withEvent:event];
} else {
[self.nextResponder touchesBegan:touches withEvent:event];
[super touchesBegan:touches withEvent:event];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (!self.dragging) {
[self.nextResponder touchesEnded:touches withEvent:event];
} else {
[self.nextResponder touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
if (!self.dragging) {
[self.nextResponder touchesCancelled:touches withEvent:event];
} else {
[self.nextResponder touchesCancelled:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
}
@end

@ -13,20 +13,15 @@
#import "Contact.h"
#import "TSGroupModel.h"
@interface SignalsViewController : UIViewController <UITableViewDelegate,
UITableViewDataSource,
TableViewCellDelegate,
UIViewControllerPreviewingDelegate>
@property (nonatomic) NSString *contactIdentifierFromCompose;
@property (nonatomic) TSGroupModel *groupFromCompose;
@property (nonatomic) BOOL composeMessage;
@interface SignalsViewController
: UIViewController <UITableViewDelegate, UITableViewDataSource, UIViewControllerPreviewingDelegate>
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, strong) IBOutlet UILabel *emptyBoxLabel;
@property (nonatomic, retain) CallState *latestCall;
- (void)presentThread:(TSThread *)thread keyboardOnViewAppearing:(BOOL)keyboardOnViewAppearing;
- (NSNumber *)updateInboxCountLabel;
- (void)composeNew;

@ -27,18 +27,18 @@
#define CELL_HEIGHT 72.0f
#define HEADER_HEIGHT 44.0f
static NSString *const kSegueIndentifier = @"showSegue";
static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
@interface SignalsViewController ()
@property (nonatomic, strong) MessagesViewController *mvc;
@property (nonatomic, strong) YapDatabaseConnection *editingDbConnection;
@property (nonatomic, strong) YapDatabaseConnection *uiDatabaseConnection;
@property (nonatomic, strong) YapDatabaseViewMappings *threadMappings;
@property (nonatomic) CellState viewingThreadsIn;
@property (nonatomic) long inboxCount;
@property (nonatomic, retain) UISegmentedControl *segmentedControl;
@property (nonatomic) NSArray<id<UIPreviewActionItem>> *previewActions;
@property (nonatomic, strong) id previewingContext;
@end
@ -82,9 +82,10 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
self.navigationItem.titleView = self.segmentedControl;
[self.segmentedControl setSelectedSegmentIndex:0];
if ([self.traitCollection respondsToSelector:@selector(forceTouchCapability)] &&
(self.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable)) {
[self registerForPreviewingWithDelegate:self sourceView:self.view];
[self registerForPreviewingWithDelegate:self sourceView:self.tableView];
}
}
@ -92,12 +93,18 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
viewControllerForLocation:(CGPoint)location {
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
MessagesViewController *vc = [[MessagesViewController alloc] initWithNibName:nil bundle:nil];
TSThread *thread = [self threadForIndexPath:indexPath];
[vc setupWithThread:thread];
[vc peekSetup];
if (indexPath) {
[previewingContext setSourceRect:[self.tableView rectForRowAtIndexPath:indexPath]];
MessagesViewController *vc = [[MessagesViewController alloc] initWithNibName:nil bundle:nil];
TSThread *thread = [self threadForIndexPath:indexPath];
[vc configureForThread:thread keyboardOnViewAppearing:NO];
[vc peekSetup];
return vc;
return vc;
} else {
return nil;
}
}
- (void)previewingContext:(id<UIViewControllerPreviewing>)previewingContext
@ -108,23 +115,6 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
[self.navigationController pushViewController:vc animated:NO];
}
- (NSArray<id<UIPreviewActionItem>> *)previewActionItems {
return self.previewActions;
}
- (NSArray<id<UIPreviewActionItem>> *)previewActions {
if (_previewActions == nil) {
UIPreviewAction *printAction = [UIPreviewAction
actionWithTitle:@"Print"
style:UIPreviewActionStyleDefault
handler:^(UIPreviewAction *_Nonnull action, UIViewController *_Nonnull previewViewController){
// ... code to handle action here
}];
_previewActions = @[ printAction ];
}
return _previewActions;
}
- (void)composeNew {
if (self.presentedViewController) {
[self dismissViewControllerAnimated:YES completion:nil];
@ -176,13 +166,11 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
TSThread *thread = [self threadForIndexPath:indexPath];
if (!cell) {
cell = [InboxTableViewCell inboxTableViewCell];
cell.delegate = self;
cell = [InboxTableViewCell inboxTableViewCell];
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[cell configureWithThread:thread];
[cell configureForState:self.viewingThreadsIn == kInboxState ? kInboxState : kArchiveState];
});
if ((unsigned long)indexPath.row == [self.threadMappings numberOfItemsInSection:0] - 1) {
@ -216,21 +204,34 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
// add the ability to delete the cell
UITableViewRowAction *deleteAction =
[UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:@" "
title:NSLocalizedString(@"TXT_DELETE_TITLE", nil)
handler:^(UITableViewRowAction *action, NSIndexPath *swipedIndexPath) {
[self tableViewCellTappedDelete:swipedIndexPath];
}];
UITableViewRowAction *archiveAction;
if (self.viewingThreadsIn == kInboxState) {
archiveAction = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleNormal
title:NSLocalizedString(@"ARCHIVE_ACTION", nil)
handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull tappedIndexPath) {
[self archiveIndexPath:tappedIndexPath];
[Environment.preferences setHasArchivedAMessage:YES];
}];
UIImage *buttonImage = [[UIImage imageNamed:@"cellBtnDelete"] resizedImageToSize:CGSizeMake(82.0f, 72.0f)];
} else {
archiveAction = [UITableViewRowAction
rowActionWithStyle:UITableViewRowActionStyleNormal
title:@"Unarchive"
handler:^(UITableViewRowAction *_Nonnull action, NSIndexPath *_Nonnull tappedIndexPath) {
[self archiveIndexPath:tappedIndexPath];
}];
}
deleteAction.backgroundColor = [[UIColor alloc] initWithPatternImage:buttonImage];
return @[ deleteAction ];
return @[ deleteAction, archiveAction ];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
@ -242,23 +243,49 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
- (void)tableViewCellTappedDelete:(NSIndexPath *)indexPath {
TSThread *thread = [self threadForIndexPath:indexPath];
if ([thread isKindOfClass:[TSGroupThread class]]) {
UIAlertController *removingFromGroup = [UIAlertController
alertControllerWithTitle:[NSString
stringWithFormat:NSLocalizedString(@"GROUP_REMOVING", nil), [thread name]]
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:removingFromGroup animated:YES completion:nil];
TSOutgoingMessage *message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:@""
attachments:[[NSMutableArray alloc] init]];
message.groupMetaMessage = TSGroupMessageQuit;
[[TSMessagesManager sharedManager] sendMessage:message inThread:thread success:nil failure:nil];
[[TSMessagesManager sharedManager] sendMessage:message
inThread:thread
success:^{
[self dismissViewControllerAnimated:YES
completion:^{
[self deleteThread:thread];
}];
}
failure:^{
[self dismissViewControllerAnimated:YES
completion:^{
SignalAlertView(NSLocalizedString(@"GROUP_REMOVING_FAILED", nil),
NSLocalizedString(@"NETWORK_ERROR_RECOVERY", nil));
}];
}];
} else {
[self deleteThread:thread];
}
}
- (void)deleteThread:(TSThread *)thread {
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[thread removeWithTransaction:transaction];
}];
_inboxCount -= (self.viewingThreadsIn == kArchiveState) ? 1 : 0;
[self checkIfEmptyView];
}
- (void)tableViewCellTappedArchive:(InboxTableViewCell *)cell {
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
TSThread *thread = [self threadForIndexPath:indexPath];
- (void)archiveIndexPath:(NSIndexPath *)indexPath {
TSThread *thread = [self threadForIndexPath:indexPath];
BOOL viewingThreadsIn = self.viewingThreadsIn;
[self.editingDbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
@ -287,35 +314,33 @@ static NSString *const kShowSignupFlowSegue = @"showSignupFlow";
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self performSegueWithIdentifier:kSegueIndentifier sender:self];
[tableView deselectRowAtIndexPath:indexPath animated:NO];
TSThread *thread = [self threadForIndexPath:indexPath];
[self presentThread:thread keyboardOnViewAppearing:NO];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)presentThread:(TSThread *)thread keyboardOnViewAppearing:(BOOL)keyboardOnViewAppearing {
dispatch_async(dispatch_get_main_queue(), ^{
if (!_mvc) {
_mvc = [[UIStoryboard storyboardWithName:@"Storyboard" bundle:NULL]
instantiateViewControllerWithIdentifier:@"MessagesViewController"];
}
if (self.presentedViewController) {
[self.presentedViewController dismissViewControllerAnimated:YES completion:nil];
}
[self.navigationController popToRootViewControllerAnimated:YES];
[_mvc configureForThread:thread keyboardOnViewAppearing:keyboardOnViewAppearing];
[self.navigationController pushViewController:_mvc animated:YES];
});
}
#pragma mark - Navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:kSegueIndentifier]) {
MessagesViewController *vc = [segue destinationViewController];
NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
TSThread *thread = [self threadForIndexPath:selectedIndexPath];
if (self.contactIdentifierFromCompose) {
[vc setupWithTSIdentifier:self.contactIdentifierFromCompose];
[vc setComposeOnOpen:self.composeMessage];
self.contactIdentifierFromCompose = nil;
self.composeMessage = NO;
} else if (self.groupFromCompose) {
[vc setupWithTSGroup:self.groupFromCompose];
[vc setComposeOnOpen:self.composeMessage];
self.groupFromCompose = nil;
self.composeMessage = NO;
} else if (thread) {
[vc setupWithThread:thread];
[vc setComposeOnOpen:NO];
} else if ([sender isKindOfClass:[TSGroupThread class]]) {
[vc setupWithThread:sender];
[vc setComposeOnOpen:YES];
}
} else if ([segue.identifier isEqualToString:kCallSegue]) {
if ([segue.identifier isEqualToString:kCallSegue]) {
InCallViewController *vc = [segue destinationViewController];
[vc configureWithLatestCall:_latestCall];
_latestCall = nil;

Loading…
Cancel
Save