Preserve scroll state across conversation view layout changes, if possible.
// FREEBIE
This commit is contained in:
parent
eaa1f4f318
commit
7d32491968
4
Podfile
4
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'
|
||||
|
|
10
Podfile.lock
10
Podfile.lock
|
@ -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: 868cf70fae0f3b54c3cfa7773ef03578d209b668
|
||||
:git: https://github.com/WhisperSystems/JSQMessagesViewController.git
|
||||
OpenSSL:
|
||||
:commit: b2d3c149102032a09aefbfb470885db4aa83efad
|
||||
:git: https://github.com/WhisperSystems/OpenSSL-Pod
|
||||
|
@ -171,6 +167,6 @@ SPEC CHECKSUMS:
|
|||
UnionFind: c33be5adb12983981d6e827ea94fc7f9e370f52d
|
||||
YapDatabase: cd911121580ff16675f65ad742a9eb0ab4d9e266
|
||||
|
||||
PODFILE CHECKSUM: 2f847bb25e70d1d376f38cf21ae08624fa6ed67d
|
||||
PODFILE CHECKSUM: 4a6db311736b5ab36b660af813dcdf0af62da48c
|
||||
|
||||
COCOAPODS: 1.2.1
|
||||
|
|
|
@ -169,7 +169,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
UIDocumentPickerDelegate,
|
||||
UIImagePickerControllerDelegate,
|
||||
UINavigationControllerDelegate,
|
||||
UITextViewDelegate>
|
||||
UITextViewDelegate,
|
||||
JSQLayoutDelegate>
|
||||
|
||||
@property (nonatomic) TSThread *thread;
|
||||
@property (nonatomic) TSMessageAdapter *lastDeliveredMessage;
|
||||
|
@ -245,6 +246,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
@property (nonatomic) BOOL shouldObserveDBModifications;
|
||||
@property (nonatomic) BOOL viewHasEverAppeared;
|
||||
@property (nonatomic) BOOL wasScrolledToBottomBeforeKeyboardShow;
|
||||
@property (nonatomic) BOOL wasScrolledToBottomBeforeLayoutChange;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -404,7 +406,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
// We only want to update scroll state for non-empty show events.
|
||||
BOOL isPresenting = endValue.size.height > 0.f;
|
||||
|
||||
if (isPresenting) {
|
||||
if (isPresenting && self.wasScrolledToBottomBeforeKeyboardShow) {
|
||||
[self scrollToBottomImmediately];
|
||||
}
|
||||
}
|
||||
|
@ -543,6 +545,8 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
self.collectionView.layoutDelegate = self;
|
||||
|
||||
[super viewDidLoad];
|
||||
|
||||
[self.navigationController.navigationBar setTranslucent:NO];
|
||||
|
@ -4461,6 +4465,24 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
[self updateNavigationBarSubtitleLabel];
|
||||
}
|
||||
|
||||
#pragma mark - JSQLayoutDelegate
|
||||
|
||||
- (void)jsqWillChangeLayout
|
||||
{
|
||||
OWSAssert([NSThread isMainThread]);
|
||||
|
||||
self.wasScrolledToBottomBeforeLayoutChange = [self isScrolledToBottom];
|
||||
}
|
||||
|
||||
- (void)jsqDidChangeLayout
|
||||
{
|
||||
OWSAssert([NSThread isMainThread]);
|
||||
|
||||
if (self.wasScrolledToBottomBeforeLayoutChange) {
|
||||
[self scrollToBottomImmediately];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Class methods
|
||||
|
||||
+ (UINib *)nib
|
||||
|
|
Loading…
Reference in New Issue