Commit c271fb88 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Fixing the dismiss of the Manage Sync Settings view

-[UIViewController popViewControllerAnimated:] should not be used to
know if a view controller is removed or not. This method is called when
the view starts to be swapped away. Unfortunately, the gesture can
cancel the swipe.
This is an issue since the coordinator is stopped and deallocated at
as soon as the method is called.

This method needs to be replaced by -[UIViewController
didMoveToParentViewController:]. This method is called when the view
controller is really popped out of the screen.

Cleanup for popViewControllerAnimated with: crrev.com/c/2089811

Bug: 1055782
Change-Id: Ibddec42996506eec3d6898ef4a2cc68ab8973784
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2088516Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Auto-Submit: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747408}
parent 356303bc
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
#pragma mark - ManageSyncSettingsCoordinatorDelegate #pragma mark - ManageSyncSettingsCoordinatorDelegate
- (void)manageSyncSettingsCoordinatorWasPopped: - (void)manageSyncSettingsCoordinatorWasRemoved:
(ManageSyncSettingsCoordinator*)coordinator { (ManageSyncSettingsCoordinator*)coordinator {
DCHECK_EQ(self.manageSyncSettingsCoordinator, coordinator); DCHECK_EQ(self.manageSyncSettingsCoordinator, coordinator);
[self.manageSyncSettingsCoordinator stop]; [self.manageSyncSettingsCoordinator stop];
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
// Delegate for ManageSyncSettingsCoordinator. // Delegate for ManageSyncSettingsCoordinator.
@protocol ManageSyncSettingsCoordinatorDelegate <NSObject> @protocol ManageSyncSettingsCoordinatorDelegate <NSObject>
// Called when the view controller is popped out from navigation controller. // Called when the view controller is removed from its parent.
- (void)manageSyncSettingsCoordinatorWasPopped: - (void)manageSyncSettingsCoordinatorWasRemoved:
(ManageSyncSettingsCoordinator*)coordinator; (ManageSyncSettingsCoordinator*)coordinator;
@end @end
......
...@@ -103,10 +103,10 @@ ...@@ -103,10 +103,10 @@
#pragma mark - ManageSyncSettingsTableViewControllerPresentationDelegate #pragma mark - ManageSyncSettingsTableViewControllerPresentationDelegate
- (void)manageSyncSettingsTableViewControllerWasPopped: - (void)manageSyncSettingsTableViewControllerWasRemoved:
(ManageSyncSettingsTableViewController*)controller { (ManageSyncSettingsTableViewController*)controller {
DCHECK_EQ(self.viewController, controller); DCHECK_EQ(self.viewController, controller);
[self.delegate manageSyncSettingsCoordinatorWasPopped:self]; [self.delegate manageSyncSettingsCoordinatorWasRemoved:self];
} }
#pragma mark - ChromeIdentityBrowserOpener #pragma mark - ChromeIdentityBrowserOpener
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
@protocol ManageSyncSettingsTableViewControllerPresentationDelegate <NSObject> @protocol ManageSyncSettingsTableViewControllerPresentationDelegate <NSObject>
// Called when the view controller is removed from its parent. // Called when the view controller is removed from its parent.
- (void)manageSyncSettingsTableViewControllerWasPopped: - (void)manageSyncSettingsTableViewControllerWasRemoved:
(ManageSyncSettingsTableViewController*)controller; (ManageSyncSettingsTableViewController*)controller;
@end @end
......
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
[self reloadData]; [self reloadData];
} }
- (void)didMoveToParentViewController:(UIViewController*)parent {
[super didMoveToParentViewController:parent];
if (!parent) {
[self.presentationDelegate
manageSyncSettingsTableViewControllerWasRemoved:self];
}
}
#pragma mark - Private #pragma mark - Private
- (void)switchAction:(UISwitch*)sender { - (void)switchAction:(UISwitch*)sender {
...@@ -63,13 +71,6 @@ ...@@ -63,13 +71,6 @@
return cell; return cell;
} }
#pragma mark - SettingsControllerProtocol
- (void)viewControllerWasPopped {
[self.presentationDelegate
manageSyncSettingsTableViewControllerWasPopped:self];
}
#pragma mark - ChromeTableViewController #pragma mark - ChromeTableViewController
- (void)loadModel { - (void)loadModel {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment