Skip to content

Commit 98bc1d1

Browse files
committed
Separate interactive dismissal and cancel button customization
1 parent f686b60 commit 98bc1d1

File tree

8 files changed

+37
-6
lines changed

8 files changed

+37
-6
lines changed

Auth/FirebaseAuthUI/FUIAuth.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,15 @@ __attribute__((deprecated("Instead use authUI:didSignInWithAuthDataResult:error:
188188
@property(nonatomic, copy) NSArray<id<FUIAuthProvider>> *providers;
189189

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

195+
/** @property interactiveDismissEnabled
196+
@brief Whether or not interactive dismiss should be enabled on iOS 13 and above devices.
197+
*/
198+
@property(nonatomic, assign, getter=isInteractiveDismissEnabled) BOOL interactiveDismissEnabled API_AVAILABLE(ios(13));
199+
196200
/** @property customStringsBundle
197201
@brief Custom strings bundle supplied by the developer. Nil when there is no custom strings
198202
bundle set. In which case the default bundle will be used.

Auth/FirebaseAuthUI/FUIAuth.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ - (instancetype)initWithAuth:(FIRAuth *)auth {
107107
self = [super init];
108108
if (self) {
109109
_auth = auth;
110+
_interactiveDismissEnabled = YES;
110111
}
111112
return self;
112113
}
@@ -178,7 +179,7 @@ - (void)signInWithProviderUI:(id<FUIAuthProvider>)providerUI
178179
if (self.auth.currentUser.isAnonymous && !credential) {
179180
if (result) {
180181
result(self.auth.currentUser, nil);
181-
};
182+
}
182183
// Hide Auth Picker Controller which was presented modally.
183184
if (isAuthPickerShown && presentingViewController.presentingViewController) {
184185
[presentingViewController dismissViewControllerAnimated:YES completion:nil];

Auth/FirebaseAuthUI/FUIAuthPickerViewController.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ - (void)viewDidLoad {
102102
target:self
103103
action:@selector(cancelAuthorization)];
104104
self.navigationItem.leftBarButtonItem = cancelBarButton;
105-
} else {
106-
if (@available(iOS 13, *)) {
105+
}
106+
if (@available(iOS 13, *)) {
107+
if (!self.authUI.interactiveDismissEnabled) {
107108
self.modalInPresentation = YES;
108109
}
109110
}
111+
110112
self.navigationItem.backBarButtonItem =
111113
[[UIBarButtonItem alloc] initWithTitle:FUILocalizedString(kStr_Back)
112114
style:UIBarButtonItemStylePlain

EmailAuth/FirebaseEmailAuthUI/FUIConfirmEmailViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ - (void)viewWillAppear:(BOOL)animated {
125125
style:UIBarButtonItemStylePlain
126126
target:nil
127127
action:nil];
128+
129+
if (@available(iOS 13, *)) {
130+
if (!self.authUI.isInteractiveDismissEnabled) {
131+
self.modalInPresentation = YES;
132+
}
133+
}
128134
}
129135
}
130136

EmailAuth/FirebaseEmailAuthUI/FUIEmailAuth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
3232
@interface FUIEmailAuth : NSObject <FUIAuthProvider>
3333

3434
/** @property emailLink.
35-
@brief The link for email link sign in.
35+
@brief The link for email link sign in.
3636
*/
3737
@property(nonatomic, strong, readwrite, nullable) NSString *emailLink;
3838

EmailAuth/FirebaseEmailAuthUI/FUIEmailEntryViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ - (void)viewWillAppear:(BOOL)animated {
126126
style:UIBarButtonItemStylePlain
127127
target:nil
128128
action:nil];
129+
130+
if (@available(iOS 13, *)) {
131+
if (!self.authUI.isInteractiveDismissEnabled) {
132+
self.modalInPresentation = YES;
133+
}
134+
}
129135
}
130136
}
131137

EmailAuth/FirebaseEmailAuthUI/FUIPasswordSignInViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ - (void)viewWillAppear:(BOOL)animated {
133133
style:UIBarButtonItemStylePlain
134134
target:nil
135135
action:nil];
136+
137+
if (@available(iOS 13, *)) {
138+
if (!self.authUI.isInteractiveDismissEnabled) {
139+
self.modalInPresentation = YES;
140+
}
141+
}
136142
}
137143
}
138144

PhoneAuth/FirebasePhoneAuthUI/FUIPhoneEntryViewController.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ - (void)viewWillAppear:(BOOL)animated {
168168
style:UIBarButtonItemStylePlain
169169
target:nil
170170
action:nil];
171+
172+
if (@available(iOS 13, *)) {
173+
if (!self.authUI.isInteractiveDismissEnabled) {
174+
self.modalInPresentation = YES;
175+
}
176+
}
171177
}
172178
}
173179

0 commit comments

Comments
 (0)