Skip to content

Commit

Permalink
Merge pull request #792 from firebase/interactive
Browse files Browse the repository at this point in the history
Separate interactive dismissal and cancel button customization
  • Loading branch information
morganchen12 authored Oct 21, 2019
2 parents 621de22 + 98bc1d1 commit dbd9c5b
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Auth/FirebaseAuthUI/FUIAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ __attribute__((deprecated("Instead use authUI:didSignInWithAuthDataResult:error:
@property(nonatomic, copy) NSArray<id<FUIAuthProvider>> *providers;

/** @property shouldHideCancelButton
@brief Whether to hide the cancel button, defaults to NO. On iOS 13, this also disables
the swipe-to-dismiss gesture.
@brief Whether to hide the cancel button, defaults to NO.
*/
@property(nonatomic, assign) BOOL shouldHideCancelButton;

/** @property interactiveDismissEnabled
@brief Whether or not interactive dismiss should be enabled on iOS 13 and above devices.
*/
@property(nonatomic, assign, getter=isInteractiveDismissEnabled) BOOL interactiveDismissEnabled API_AVAILABLE(ios(13));

/** @property customStringsBundle
@brief Custom strings bundle supplied by the developer. Nil when there is no custom strings
bundle set. In which case the default bundle will be used.
Expand Down
3 changes: 2 additions & 1 deletion Auth/FirebaseAuthUI/FUIAuth.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ - (instancetype)initWithAuth:(FIRAuth *)auth {
self = [super init];
if (self) {
_auth = auth;
_interactiveDismissEnabled = YES;
}
return self;
}
Expand Down Expand Up @@ -178,7 +179,7 @@ - (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI
if (self.auth.currentUser.isAnonymous && !credential) {
if (result) {
result(self.auth.currentUser, nil);
};
}
// Hide Auth Picker Controller which was presented modally.
if (isAuthPickerShown && presentingViewController.presentingViewController) {
[presentingViewController dismissViewControllerAnimated:YES completion:nil];
Expand Down
6 changes: 4 additions & 2 deletions Auth/FirebaseAuthUI/FUIAuthPickerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ - (void)viewDidLoad {
target:self
action:@selector(cancelAuthorization)];
self.navigationItem.leftBarButtonItem = cancelBarButton;
} else {
if (@available(iOS 13, *)) {
}
if (@available(iOS 13, *)) {
if (!self.authUI.interactiveDismissEnabled) {
self.modalInPresentation = YES;
}
}

self.navigationItem.backBarButtonItem =
[[UIBarButtonItem alloc] initWithTitle:FUILocalizedString(kStr_Back)
style:UIBarButtonItemStylePlain
Expand Down
6 changes: 6 additions & 0 deletions EmailAuth/FirebaseEmailAuthUI/FUIConfirmEmailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ - (void)viewWillAppear:(BOOL)animated {
style:UIBarButtonItemStylePlain
target:nil
action:nil];

if (@available(iOS 13, *)) {
if (!self.authUI.isInteractiveDismissEnabled) {
self.modalInPresentation = YES;
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface FUIEmailAuth : NSObject <FUIAuthProvider>

/** @property emailLink.
@brief The link for email link sign in.
@brief The link for email link sign in.
*/
@property(nonatomic, strong, readwrite, nullable) NSString *emailLink;

Expand Down
6 changes: 6 additions & 0 deletions EmailAuth/FirebaseEmailAuthUI/FUIEmailEntryViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ - (void)viewWillAppear:(BOOL)animated {
style:UIBarButtonItemStylePlain
target:nil
action:nil];

if (@available(iOS 13, *)) {
if (!self.authUI.isInteractiveDismissEnabled) {
self.modalInPresentation = YES;
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ - (void)viewWillAppear:(BOOL)animated {
style:UIBarButtonItemStylePlain
target:nil
action:nil];

if (@available(iOS 13, *)) {
if (!self.authUI.isInteractiveDismissEnabled) {
self.modalInPresentation = YES;
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions PhoneAuth/FirebasePhoneAuthUI/FUIPhoneEntryViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ - (void)viewWillAppear:(BOOL)animated {
style:UIBarButtonItemStylePlain
target:nil
action:nil];

if (@available(iOS 13, *)) {
if (!self.authUI.isInteractiveDismissEnabled) {
self.modalInPresentation = YES;
}
}
}
}

Expand Down

0 comments on commit dbd9c5b

Please sign in to comment.