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

[iOS] Implementing swipe to dismiss the sign-in view controller

In ChromeSigninViewController, when a swipe to dismiss is done by the
user, the secondary button (Cancel) action is triggered.
The swipe to dismiss does the exact same behavior than the Cancel button.
Swipe to dismiss is only enabled for UnityConsent flag enabled.

Bug: 987232
Change-Id: I3dc6f41a49652e3a2c4482628f26e1de5621ab47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715292
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682203}
parent 307c07bf
...@@ -69,7 +69,10 @@ using TimerGeneratorBlock = std::unique_ptr<base::OneShotTimer> (^)(); ...@@ -69,7 +69,10 @@ using TimerGeneratorBlock = std::unique_ptr<base::OneShotTimer> (^)();
@end @end
// ChromeSigninViewController is a view controller that handles all the // ChromeSigninViewController is a view controller that handles all the
// sign-in UI flow. // sign-in UI flow. To support the swipe to dismiss feature, the init method of
// this class uses the presentation controller. Therefore the presentation style
// cannot be changed after the init. The style is set to
// UIModalPresentationFormSheet by the init method.
@interface ChromeSigninViewController @interface ChromeSigninViewController
: UIViewController<SigninConfirmationViewControllerDelegate> : UIViewController<SigninConfirmationViewControllerDelegate>
......
...@@ -137,11 +137,12 @@ enum AuthenticationState { ...@@ -137,11 +137,12 @@ enum AuthenticationState {
} // namespace } // namespace
@interface ChromeSigninViewController ()< @interface ChromeSigninViewController () <
ChromeIdentityInteractionManagerDelegate, ChromeIdentityInteractionManagerDelegate,
ChromeIdentityServiceObserver, ChromeIdentityServiceObserver,
MDCActivityIndicatorDelegate, MDCActivityIndicatorDelegate,
SigninAccountSelectorViewControllerDelegate, SigninAccountSelectorViewControllerDelegate,
UIAdaptivePresentationControllerDelegate,
UnifiedConsentCoordinatorDelegate> UnifiedConsentCoordinatorDelegate>
@property(nonatomic, strong) ChromeIdentity* selectedIdentity; @property(nonatomic, strong) ChromeIdentity* selectedIdentity;
@end @end
...@@ -215,6 +216,9 @@ enum AuthenticationState { ...@@ -215,6 +216,9 @@ enum AuthenticationState {
_identityServiceObserver.reset( _identityServiceObserver.reset(
new ChromeIdentityServiceObserverBridge(self)); new ChromeIdentityServiceObserverBridge(self));
_currentState = NULL_STATE; _currentState = NULL_STATE;
self.modalPresentationStyle = UIModalPresentationFormSheet;
self.presentationController.delegate = self;
} }
return self; return self;
} }
...@@ -507,6 +511,18 @@ enum AuthenticationState { ...@@ -507,6 +511,18 @@ enum AuthenticationState {
]; ];
} }
#pragma mark - UIAdaptivePresentationController
- (BOOL)presentationControllerShouldDismiss:
(UIPresentationController*)presentationController {
return _unifiedConsentEnabled;
}
- (void)presentationControllerDidDismiss:
(UIPresentationController*)presentationController {
[self onSecondaryButtonPressed:self];
}
#pragma mark - Accessibility #pragma mark - Accessibility
- (BOOL)accessibilityPerformEscape { - (BOOL)accessibilityPerformEscape {
......
...@@ -265,11 +265,7 @@ ...@@ -265,11 +265,7 @@
promoAction:promoAction_ promoAction:promoAction_
signInIdentity:signInIdentity signInIdentity:signInIdentity
dispatcher:self.dispatcher]; dispatcher:self.dispatcher];
[signinViewController_ setDelegate:self]; signinViewController_.delegate = self;
[signinViewController_
setModalPresentationStyle:UIModalPresentationFormSheet];
[signinViewController_
setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
signInIdentity_ = signInIdentity; signInIdentity_ = signInIdentity;
identityAdded_ = identityAdded; identityAdded_ = identityAdded;
......
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