Fix swipe-back-to-pop gesture.

The interactivePopGestureRecognizer machinery doesn't work when you have
a custom back button.

// FREEBIE
This commit is contained in:
Michael Kirk 2017-03-19 15:11:57 -04:00
parent 0a09330d35
commit c182a05961
2 changed files with 13 additions and 0 deletions

View File

@ -462,6 +462,9 @@ typedef enum : NSUInteger {
{
[super viewWillAppear:animated];
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
self.navigationController.interactivePopGestureRecognizer.delegate = self;
// We need to recheck on every appearance, since the user may have left the group in the settings VC,
// or on another device.
[self hideInputIfNeeded];
@ -543,6 +546,9 @@ typedef enum : NSUInteger {
[super viewWillDisappear:animated];
[self toggleObservers:NO];
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
[_unreadContainer removeFromSuperview];
_unreadContainer = nil;

View File

@ -211,6 +211,10 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
self.navigationController.interactivePopGestureRecognizer.delegate = self;
// HACK to unselect rows when swiping back
// http://stackoverflow.com/questions/19379510/uitableviewcell-doesnt-get-deselected-when-swiping-back-quickly
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
@ -220,6 +224,9 @@ static NSString *const OWSConversationSettingsTableViewControllerSegueShowGroupM
{
[super viewWillDisappear:animated];
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
if (self.disappearingMessagesConfiguration.isNewRecord && !self.disappearingMessagesConfiguration.isEnabled) {
// don't save defaults, else we'll unintentionally save the configuration and notify the contact.
return;