-
Notifications
You must be signed in to change notification settings - Fork 486
Automatic anonymous user upgrade #481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f4d5b24
4f1570c
e7cd44e
ea3ce2d
7bd2a7e
f0cede5
93238ad
6faa87f
3557efa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,20 +242,61 @@ + (void)showAlertWithTitle:(nullable NSString *)title | |
| [presentingViewController presentViewController:alertController animated:YES completion:nil]; | ||
| } | ||
|
|
||
| + (void)showAlertWithTitle:(nullable NSString *)title | ||
| message:(NSString *)message | ||
| actionTitle:(NSString *)actionTitle | ||
| presentingViewController:(UIViewController *)presentingViewController | ||
| actionHandler:(FUIAuthAlertActionHandler)actionHandler | ||
| cancelHandler:(FUIAuthAlertActionHandler)cancelHandler { | ||
| UIAlertController *alertController = | ||
| [UIAlertController alertControllerWithTitle:title | ||
| message:message | ||
| preferredStyle:UIAlertControllerStyleAlert]; | ||
| UIAlertAction *okAction = | ||
| [UIAlertAction actionWithTitle:actionTitle | ||
| style:UIAlertActionStyleDefault | ||
| handler:^(UIAlertAction *_Nonnull action) { | ||
| actionHandler(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand those handler are with nonnull type. but is it a good practice to check null before calling them? same to other handler calls.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooh, missed this. Will be addressed in a follow up PR. |
||
| }]; | ||
| [alertController addAction:okAction]; | ||
| UIAlertAction *cancelAction = | ||
| [UIAlertAction actionWithTitle:FUILocalizedString(kStr_Cancel) | ||
| style:UIAlertActionStyleCancel | ||
| handler:^(UIAlertAction * _Nonnull action) { | ||
| cancelHandler(); | ||
| }]; | ||
| [alertController addAction:cancelAction]; | ||
| [presentingViewController presentViewController:alertController animated:YES completion:nil]; | ||
| } | ||
|
|
||
| + (void)showSignInAlertWithEmail:(NSString *)email | ||
| provider:(id<FUIAuthProvider>)provider | ||
| presentingViewController:(UIViewController *)presentingViewController | ||
| signinHandler:(FUIAuthAlertActionHandler)signinHandler | ||
| cancelHandler:(FUIAuthAlertActionHandler)cancelHandler { | ||
| [self showSignInAlertWithEmail:email | ||
| providerShortName:provider.shortName | ||
| providerSignInLabel:provider.signInLabel | ||
| presentingViewController:presentingViewController | ||
| signinHandler:signinHandler | ||
| cancelHandler:cancelHandler]; | ||
| } | ||
|
|
||
| + (void)showSignInAlertWithEmail:(NSString *)email | ||
| providerShortName:(NSString *)providerShortName | ||
| providerSignInLabel:(NSString *)providerSignInLabel | ||
| presentingViewController:(UIViewController *)presentingViewController | ||
| signinHandler:(FUIAuthAlertActionHandler)signinHandler | ||
| cancelHandler:(FUIAuthAlertActionHandler)cancelHandler { | ||
| NSString *message = | ||
| [NSString stringWithFormat:FUILocalizedString(kStr_ProviderUsedPreviouslyMessage), | ||
| email, provider.shortName]; | ||
| email, providerShortName]; | ||
| UIAlertController *alertController = | ||
| [UIAlertController alertControllerWithTitle:FUILocalizedString(kStr_ExistingAccountTitle) | ||
| message:message | ||
| preferredStyle:UIAlertControllerStyleAlert]; | ||
| UIAlertAction *signInAction = | ||
| [UIAlertAction actionWithTitle:provider.signInLabel | ||
| [UIAlertAction actionWithTitle:providerSignInLabel | ||
| style:UIAlertActionStyleDefault | ||
| handler:^(UIAlertAction *_Nonnull action) { | ||
| signinHandler(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // | ||
| // Copyright (c) 2018 Google Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
|
|
||
| #import "FUIPasswordSignInViewController.h" | ||
| #import <FirebaseAuth/FirebaseAuth.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @interface FUIPasswordSignInViewController () | ||
|
|
||
| /** @property onDismissCallback: | ||
| @brief Sets an optional custom callback for FUIPasswordSigInViewController during dismissal. If | ||
| this property is set the default dismissal routine is not triggered and should be included | ||
| in this block if necessary. This block is NOT set to nil after use, set to nil after using | ||
| if you wish to avoid circular references. | ||
| */ | ||
| @property(nonatomic, strong, nullable) FIRAuthDataResultCallback onDismissCallback; | ||
|
|
||
| NS_ASSUME_NONNULL_END | ||
|
|
||
|
|
||
| @end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the getter is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public API, the developer may want to condition on whether shouldAutoUpgrade is turned on or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@protocol86 I mean the property name and the getter name are identical (shouldAutoUpgradeAnonymousUsers). why getter=?