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 @@
#pragma mark - ManageSyncSettingsCoordinatorDelegate
- (void)manageSyncSettingsCoordinatorWasPopped:
- (void)manageSyncSettingsCoordinatorWasRemoved:
(ManageSyncSettingsCoordinator*)coordinator {
DCHECK_EQ(self.manageSyncSettingsCoordinator, coordinator);
[self.manageSyncSettingsCoordinator stop];
......
......@@ -12,8 +12,8 @@
// Delegate for ManageSyncSettingsCoordinator.
@protocol ManageSyncSettingsCoordinatorDelegate <NSObject>
// Called when the view controller is popped out from navigation controller.
- (void)manageSyncSettingsCoordinatorWasPopped:
// Called when the view controller is removed from its parent.
- (void)manageSyncSettingsCoordinatorWasRemoved:
(ManageSyncSettingsCoordinator*)coordinator;
@end
......
......@@ -103,10 +103,10 @@
#pragma mark - ManageSyncSettingsTableViewControllerPresentationDelegate
- (void)manageSyncSettingsTableViewControllerWasPopped:
- (void)manageSyncSettingsTableViewControllerWasRemoved:
(ManageSyncSettingsTableViewController*)controller {
DCHECK_EQ(self.viewController, controller);
[self.delegate manageSyncSettingsCoordinatorWasPopped:self];
[self.delegate manageSyncSettingsCoordinatorWasRemoved:self];
}
#pragma mark - ChromeIdentityBrowserOpener
......
......@@ -19,7 +19,7 @@
@protocol ManageSyncSettingsTableViewControllerPresentationDelegate <NSObject>
// Called when the view controller is removed from its parent.
- (void)manageSyncSettingsTableViewControllerWasPopped:
- (void)manageSyncSettingsTableViewControllerWasRemoved:
(ManageSyncSettingsTableViewController*)controller;
@end
......
......@@ -33,6 +33,14 @@
[self reloadData];
}
- (void)didMoveToParentViewController:(UIViewController*)parent {
[super didMoveToParentViewController:parent];
if (!parent) {
[self.presentationDelegate
manageSyncSettingsTableViewControllerWasRemoved:self];
}
}
#pragma mark - Private
- (void)switchAction:(UISwitch*)sender {
......@@ -63,13 +71,6 @@
return cell;
}
#pragma mark - SettingsControllerProtocol
- (void)viewControllerWasPopped {
[self.presentationDelegate
manageSyncSettingsTableViewControllerWasPopped:self];
}
#pragma mark - ChromeTableViewController
- (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