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

[iOS] Implementing swipe to dismiss for advanced sign-in settings

When swiping the advanced sign-in settings view, the cancel confirmation
dialog is displayed.
The dialog is the same than tapping on cancel.

Bug: 982300
Change-Id: I8451ece5281853e2dcdf4dc90e585affca7dd575
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725916Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682663}
parent 221b0de5
...@@ -46,7 +46,8 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) { ...@@ -46,7 +46,8 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
AdvancedSigninSettingsCoordinatorResultInterrupted, AdvancedSigninSettingsCoordinatorResultInterrupted,
}; };
@interface AdvancedSigninSettingsCoordinator () @interface AdvancedSigninSettingsCoordinator () <
UIAdaptivePresentationControllerDelegate>
// Google services settings coordinator. // Google services settings coordinator.
@property(nonatomic, strong) @property(nonatomic, strong)
...@@ -67,6 +68,8 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) { ...@@ -67,6 +68,8 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
[[AdvancedSigninSettingsNavigationController alloc] init]; [[AdvancedSigninSettingsNavigationController alloc] init];
self.advancedSigninSettingsNavigationController.modalPresentationStyle = self.advancedSigninSettingsNavigationController.modalPresentationStyle =
UIModalPresentationFormSheet; UIModalPresentationFormSheet;
self.advancedSigninSettingsNavigationController.presentationController
.delegate = self;
self.googleServicesSettingsCoordinator = [[GoogleServicesSettingsCoordinator self.googleServicesSettingsCoordinator = [[GoogleServicesSettingsCoordinator
alloc] alloc]
initWithBaseViewController:self.advancedSigninSettingsNavigationController initWithBaseViewController:self.advancedSigninSettingsNavigationController
...@@ -112,6 +115,18 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) { ...@@ -112,6 +115,18 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
} }
} }
#pragma mark - UIAdaptivePresentationControllerDelegate
- (BOOL)presentationControllerShouldDismiss:
(UIPresentationController*)presentationController {
return NO;
}
- (void)presentationControllerDidAttemptToDismiss:
(UIPresentationController*)presentationController {
[self showDismissAlertDialog];
}
#pragma mark - Private #pragma mark - Private
// Called once the view controller has been removed (if needed). // Called once the view controller has been removed (if needed).
...@@ -165,7 +180,7 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) { ...@@ -165,7 +180,7 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc] UIBarButtonItem* cancelButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self target:self
action:@selector(navigationCancelButtonAction)]; action:@selector(showDismissAlertDialog)];
cancelButton.accessibilityIdentifier = kSyncSettingsCancelButtonId; cancelButton.accessibilityIdentifier = kSyncSettingsCancelButtonId;
return cancelButton; return cancelButton;
} }
...@@ -182,9 +197,8 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) { ...@@ -182,9 +197,8 @@ typedef NS_ENUM(NSInteger, AdvancedSigninSettingsCoordinatorResult) {
return confirmButton; return confirmButton;
} }
// Called by the cancel button from the navigation controller. Presents a // Presents an UIAlert to ask the user if wants to cancel the sign-in.
// UIAlert to ask the user if wants to cancel the sign-in. - (void)showDismissAlertDialog {
- (void)navigationCancelButtonAction {
base::RecordAction( base::RecordAction(
base::UserMetricsAction("Signin_Signin_CancelAdvancedSyncSettings")); base::UserMetricsAction("Signin_Signin_CancelAdvancedSyncSettings"));
self.cancelConfirmationAlertCoordinator = [[AlertCoordinator alloc] self.cancelConfirmationAlertCoordinator = [[AlertCoordinator alloc]
......
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