diff options
author | Ivan <gonzalezivan@google.com> | 2017-10-10 10:32:15 -0700 |
---|---|---|
committer | Ivan <gonzalezivan@google.com> | 2017-10-10 10:32:15 -0700 |
commit | 236a8e04243867ee634564c5bb465475fbf346b6 (patch) | |
tree | c526135c903a4baea4ece7570cfafa7d34dc4c06 /Example/Auth | |
parent | a2632ed24f51de12ed15944e7168d22360c6e9d4 (diff) |
new user popup toggle
Diffstat (limited to 'Example/Auth')
-rw-r--r-- | Example/Auth/Sample/MainViewController.m | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/Example/Auth/Sample/MainViewController.m b/Example/Auth/Sample/MainViewController.m index 282d9b8..016d39b 100644 --- a/Example/Auth/Sample/MainViewController.m +++ b/Example/Auth/Sample/MainViewController.m @@ -517,6 +517,11 @@ static NSString *const kPhoneNumberSignInTitle = @"Sign in With Phone Number"; */ static NSString *const kPhoneNumberSignInReCaptchaTitle = @"Sign in With Phone Number (reCAPTCHA)"; +/** @var kIsNewUserToggleTitle + @brief The title for button to enable new or existing user toggle. + */ +static NSString *const kNewOrExistingUserToggleTitle = @"New or Existing User Toggle"; + /** @typedef showEmailPasswordDialogCompletion @brief The type of block which gets called to complete the Email/Password dialog flow. */ @@ -590,6 +595,11 @@ typedef enum { */ BOOL _useUserInMemory; + /** @var _newUserToggle + @brief When enabled allows login popup alert determining new or existing user. + */ + BOOL _isNewUserToggleOn; + /** @var _actionCodeRequestType @brief The type for the next action code request. */ @@ -652,7 +662,12 @@ typedef enum { [StaticContentTableViewSection sectionWithTitle:kSectionTitleSettings cells:@[ [StaticContentTableViewCell cellWithTitle:NSLocalizedString(@"SETTINGSKEY", kSettingsButtonTextDesription) - action:^{ [weakSelf presentSettings]; }] + action:^{ [weakSelf presentSettings]; }], + [StaticContentTableViewCell cellWithTitle:kNewOrExistingUserToggleTitle + value:_isNewUserToggleOn ? @"Enabled" : @"Disabled" + action:^{ + _isNewUserToggleOn = !_isNewUserToggleOn; + [self updateTable]; }], ]], [StaticContentTableViewSection sectionWithTitle:kPhoneAuthSectionTitle cells:@[ [StaticContentTableViewCell cellWithTitle:kPhoneNumberSignInReCaptchaTitle @@ -1779,12 +1794,14 @@ static NSDictionary<NSString *, NSString *> *parseURL(NSString *urlString) { } if (authResult.additionalUserInfo) { [self logSuccess:[self stringWithAdditionalUserInfo:authResult.additionalUserInfo]]; - NSString *newUserString = authResult.additionalUserInfo.isNewUser ? - @"New user" : @"Existing user"; - [self showMessagePromptWithTitle:@"New Or Exisiting" - message:newUserString - showCancelButton:NO - completion:nil]; + if (_isNewUserToggleOn) { + NSString *newUserString = authResult.additionalUserInfo.isNewUser ? + @"New user" : @"Existing user"; + [self showMessagePromptWithTitle:@"New or Existing" + message:newUserString + showCancelButton:NO + completion:nil]; + } } [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error]; }; |