diff --git a/Podfile b/Podfile index 070f1f1e2..9f44466e1 100644 --- a/Podfile +++ b/Podfile @@ -5,8 +5,8 @@ target 'Signal' do pod 'ATAppUpdater' pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git' #pod 'AxolotlKit', path: '../SignalProtocolKit' - pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'signal-master' - #pod 'JSQMessagesViewController', path: '../JSQMessagesViewController' + #pod 'JSQMessagesViewController', git: 'https://github.com/WhisperSystems/JSQMessagesViewController.git', branch: 'signal-master' + pod 'JSQMessagesViewController', path: '../JSQMessagesViewController' pod 'PureLayout' pod 'OpenSSL', git: 'https://github.com/WhisperSystems/OpenSSL-Pod' pod 'Reachability' diff --git a/Podfile.lock b/Podfile.lock index cb1997f9a..78db27f8a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -43,7 +43,7 @@ PODS: - Reachability (3.2) - SAMKeychain (1.5.2) - SignalServiceKit (0.9.0): - - '25519' + - 25519 - AFNetworking - AxolotlKit - CocoaLumberjack @@ -114,7 +114,7 @@ PODS: DEPENDENCIES: - ATAppUpdater - AxolotlKit (from `https://github.com/WhisperSystems/SignalProtocolKit.git`) - - JSQMessagesViewController (from `https://github.com/WhisperSystems/JSQMessagesViewController.git`, branch `signal-master`) + - JSQMessagesViewController (from `../JSQMessagesViewController`) - OpenSSL (from `https://github.com/WhisperSystems/OpenSSL-Pod`) - PureLayout - Reachability @@ -125,8 +125,7 @@ EXTERNAL SOURCES: AxolotlKit: :git: https://github.com/WhisperSystems/SignalProtocolKit.git JSQMessagesViewController: - :branch: signal-master - :git: https://github.com/WhisperSystems/JSQMessagesViewController.git + :path: ../JSQMessagesViewController OpenSSL: :git: https://github.com/WhisperSystems/OpenSSL-Pod SignalServiceKit: @@ -138,9 +137,6 @@ CHECKOUT OPTIONS: AxolotlKit: :commit: 6e9d5e8c3dc87e397b4b7485172507b0990a22dd :git: https://github.com/WhisperSystems/SignalProtocolKit.git - JSQMessagesViewController: - :commit: 9e452ee59cbcebf2c67f0dc499988b6725de776e - :git: https://github.com/WhisperSystems/JSQMessagesViewController.git OpenSSL: :commit: b2d3c149102032a09aefbfb470885db4aa83efad :git: https://github.com/WhisperSystems/OpenSSL-Pod @@ -149,7 +145,7 @@ CHECKOUT OPTIONS: :git: https://github.com/facebook/SocketRocket.git SPEC CHECKSUMS: - '25519': dc4bad7e2dbcbf1efa121068a705a44cd98c80fc + 25519: dc4bad7e2dbcbf1efa121068a705a44cd98c80fc AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67 ATAppUpdater: a9f7027060959d47e58733d3b48f6b9a28cb8de1 AxolotlKit: ba0ab24b879d34559a68e1270b079cc9bd7b3417 @@ -171,6 +167,6 @@ SPEC CHECKSUMS: UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d YapDatabase: cd911121580ff16675f65ad742a9eb0ab4d9e266 -PODFILE CHECKSUM: 2f847bb25e70d1d376f38cf21ae08624fa6ed67d +PODFILE CHECKSUM: 4a6db311736b5ab36b660af813dcdf0af62da48c -COCOAPODS: 1.2.1 +COCOAPODS: 1.3.1 diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 986b6a2f4..35f9e9b95 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2052,7 +2052,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 3465F381B1856CC06933B3A8 /* [CP] Copy Pods Resources */ = { @@ -2062,13 +2062,13 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-Signal/Pods-Signal-resources.sh", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Assets/JSQMessagesAssets.bundle", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.xib", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesCollectionViewCellIncoming.xib", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesCollectionViewCellOutgoing.xib", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesLoadEarlierHeaderView.xib", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesToolbarContentView.xib", - "${PODS_ROOT}/JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesTypingIndicatorFooterView.xib", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Assets/JSQMessagesAssets.bundle", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.xib", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesCollectionViewCellIncoming.xib", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesCollectionViewCellOutgoing.xib", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesLoadEarlierHeaderView.xib", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesToolbarContentView.xib", + "${PODS_ROOT}/../../JSQMessagesViewController/JSQMessagesViewController/Views/JSQMessagesTypingIndicatorFooterView.xib", "${PODS_ROOT}/SAMKeychain/Support/SAMKeychain.bundle", "${PODS_ROOT}/../SignalServiceKit/src/Security/PinningCertificate/textsecure.cer", "${PODS_ROOT}/../SignalServiceKit/src/Security/PinningCertificate/GIAG2.crt", @@ -2160,7 +2160,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; B4E9B04E862FB64FC9A8F79B /* [CP] Embed Pods Frameworks */ = { @@ -2580,11 +2580,7 @@ "DEBUG=1", "$(inherited)", ); - "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = ( - "DEBUG=1", - "$(inherited)", - "SSK_BUILDING_FOR_TESTS=1", - ); + "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1 $(inherited) SSK_BUILDING_FOR_TESTS=1"; GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index defb1508f..f358535be 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -243,6 +243,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { @property (nonatomic) BOOL isViewVisible; @property (nonatomic) BOOL isAppInBackground; @property (nonatomic) BOOL shouldObserveDBModifications; +@property (nonatomic) BOOL viewHasEverAppeared; @end @@ -639,7 +640,10 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { [((OWSMessagesToolbarContentView *)self.inputToolbar.contentView)ensureSubviews]; [self.view layoutSubviews]; - [self scrollToDefaultPosition]; + + if (!self.viewHasEverAppeared) { + [self scrollToDefaultPosition]; + } } - (NSIndexPath *_Nullable)indexPathOfUnreadMessagesIndicator @@ -1059,6 +1063,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { [ProfileFetcherJob runWithThread:self.thread networkManager:self.networkManager]; [self markVisibleMessagesAsRead]; + + self.viewHasEverAppeared = YES; } - (void)viewWillDisappear:(BOOL)animated @@ -3506,6 +3512,12 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { - (BOOL)isScrolledToBottom { + if (self.collectionView.contentSize.height < 1) { + // If the collection view hasn't determined its content size yet, + // scroll state is not yet coherent. + return NO; + } + const CGFloat kIsAtBottomTolerancePts = 5; return (self.collectionView.contentOffset.y + self.collectionView.bounds.size.height + kIsAtBottomTolerancePts >= self.collectionView.contentSize.height); @@ -4149,6 +4161,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { - (void)scrollToBottomAnimated:(BOOL)animated { + OWSAssert([NSThread isMainThread]); if (self.isUserScrolling) { return;