Commit c9ff9a09 authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Commit Bot

[iOS] Only show "Cancel Sync" confirmation in Sync & Google Services.

Currently the cancel confirmation alert is shown on all screens
derived from "Sync & Google Services" even if there is no "Cancel"
button on the navigation bar.

Bug: 1115504
Change-Id: I4b8793af8fcb7f7f1bf081d352c18f0f192c6e69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2358679Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799196}
parent bd157bae
...@@ -251,7 +251,11 @@ using l10n_util::GetNSString; ...@@ -251,7 +251,11 @@ using l10n_util::GetNSString;
- (void)presentationControllerDidAttemptToDismiss: - (void)presentationControllerDidAttemptToDismiss:
(UIPresentationController*)presentationController { (UIPresentationController*)presentationController {
[self showCancelConfirmationAlert]; // Only show cancel confirmation when "Sync and Google Services" is displayed.
if (self.googleServicesSettingsCoordinator
.googleServicesSettingsViewIsShown) {
[self showCancelConfirmationAlert];
}
} }
@end @end
...@@ -33,6 +33,11 @@ ...@@ -33,6 +33,11 @@
delegate; delegate;
// Presenter which can show signin UI. // Presenter which can show signin UI.
@property(nonatomic, strong) id<ApplicationCommands> handler; @property(nonatomic, strong) id<ApplicationCommands> handler;
// Whether the Google services settings view is at the top of the navigation
// stack. This does not necessarily mean the view is displayed to the user since
// it can be obstructed by views that are not owned by the navigation stack
// (e.g. MyGoogle UI).
@property(nonatomic, assign, readonly) BOOL googleServicesSettingsViewIsShown;
- (instancetype)initWithBaseViewController:(UIViewController*)viewController - (instancetype)initWithBaseViewController:(UIViewController*)viewController
browser:(Browser*)browser NS_UNAVAILABLE; browser:(Browser*)browser NS_UNAVAILABLE;
......
...@@ -162,6 +162,11 @@ using signin_metrics::PromoAction; ...@@ -162,6 +162,11 @@ using signin_metrics::PromoAction;
self.viewController); self.viewController);
} }
- (BOOL)googleServicesSettingsViewIsShown {
return [self.viewController
isEqual:self.baseNavigationController.topViewController];
}
#pragma mark - GoogleServicesSettingsCommandHandler #pragma mark - GoogleServicesSettingsCommandHandler
- (void)restartAuthenticationFlow { - (void)restartAuthenticationFlow {
......
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