diff options
author | Michael Lehenbauer <mikelehen@gmail.com> | 2018-01-09 17:00:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-09 17:00:18 -0800 |
commit | d6bf54e2872801bc915ffd695bf2aa3051ae22ab (patch) | |
tree | 166325a14805321cbf5045fdd4a52dd634747218 /Firebase/Auth | |
parent | 2c6682c66ea7b86b3b7cb52e623086b4184d500a (diff) | |
parent | aa00c7444982de08b21604965a708d1cad5188f7 (diff) |
Merge pull request #635 from firebase/mikelehen/merge-master-to-firestore-api-changes
Merge master to firestore api changes
Diffstat (limited to 'Firebase/Auth')
11 files changed, 26 insertions, 48 deletions
diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m index ad363e0..ebca6c8 100644 --- a/Firebase/Auth/Source/FIRAuth.m +++ b/Firebase/Auth/Source/FIRAuth.m @@ -657,12 +657,29 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; isReauthentication ? FIRAuthOperationTypeReauth : FIRAuthOperationTypeSignUpOrSignIn; [self signInWithPhoneCredential:phoneCredential operation:operation - callback:^(FIRUser *_Nullable user, + callback:^(FIRVerifyPhoneNumberResponse *_Nullable response, NSError *_Nullable error) { if (callback) { - FIRAuthDataResult *result = user ? - [[FIRAuthDataResult alloc] initWithUser:user additionalUserInfo:nil] : nil; - callback(result, error); + if (error) { + callback(nil, error); + return; + } + + [self completeSignInWithAccessToken:response.IDToken + accessTokenExpirationDate:response.approximateExpirationDate + refreshToken:response.refreshToken + anonymous:NO + callback:^(FIRUser *_Nullable user, NSError *_Nullable error) { + FIRAdditionalUserInfo *additionalUserInfo = + [[FIRAdditionalUserInfo alloc] initWithProviderID:FIRPhoneAuthProviderID + profile:nil + username:nil + isNewUser:response.isNewUser]; + FIRAuthDataResult *result = user ? + [[FIRAuthDataResult alloc] initWithUser:user + additionalUserInfo:additionalUserInfo] : nil; + callback(result, error); + }]; } }]; return; @@ -1143,14 +1160,14 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; */ - (void)signInWithPhoneCredential:(FIRPhoneAuthCredential *)credential operation:(FIRAuthOperationType)operation - callback:(FIRAuthResultCallback)callback { + callback:(FIRVerifyPhoneNumberResponseCallback)callback { if (credential.temporaryProof.length && credential.phoneNumber.length) { FIRVerifyPhoneNumberRequest *request = [[FIRVerifyPhoneNumberRequest alloc] initWithTemporaryProof:credential.temporaryProof phoneNumber:credential.phoneNumber operation:operation requestConfiguration:_requestConfiguration]; - [self phoneNumberSignInWithRequest:request callback:callback]; + [FIRAuthBackend verifyPhoneNumber:request callback:callback]; return; } @@ -1167,32 +1184,9 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; verificationCode:credential.verificationCode operation:operation requestConfiguration:_requestConfiguration]; - [self phoneNumberSignInWithRequest:request callback:callback]; + [FIRAuthBackend verifyPhoneNumber:request callback:callback]; } - -/** @fn phoneNumberSignInWithVerificationID:pasverificationCodesword:callback: - @brief Signs in using a FIRVerifyPhoneNumberRequest object. - @param request THe FIRVerifyPhoneNumberRequest request object. - @param callback A block which is invoked when the sign in finishes (or is cancelled.) Invoked - asynchronously on the global auth work queue in the future. - */ -- (void)phoneNumberSignInWithRequest:(FIRVerifyPhoneNumberRequest *)request - callback:(FIRAuthResultCallback)callback { - [FIRAuthBackend verifyPhoneNumber:request - callback:^(FIRVerifyPhoneNumberResponse *_Nullable response, - NSError *_Nullable error) { - if (error) { - callback(nil, error); - return; - } - [self completeSignInWithAccessToken:response.IDToken - accessTokenExpirationDate:response.approximateExpirationDate - refreshToken:response.refreshToken - anonymous:NO - callback:callback]; - }]; -} #endif /** @fn internalSignInAndRetrieveDataWithCustomToken:completion: diff --git a/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m b/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m index 7775305..215a391 100644 --- a/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m +++ b/Firebase/Auth/Source/FIRAuthAPNSTokenManager.m @@ -73,7 +73,9 @@ static const NSTimeInterval kLegacyRegistrationTimeout = 30; } else { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#if TARGET_OS_IOS [_application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert]; +#endif // TARGET_OS_IOS #pragma clang diagnostic pop } }); diff --git a/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m b/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m index c6b9d03..12ef97c 100644 --- a/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRCreateAuthURIResponse.m @@ -16,8 +16,6 @@ #import "FIRCreateAuthURIResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRCreateAuthURIResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m b/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m index 671a41f..ae98175 100644 --- a/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRDeleteAccountResponse.m @@ -16,8 +16,6 @@ #import "FIRDeleteAccountResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRDeleteAccountResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m index bd028f1..0b6c416 100644 --- a/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRGetOOBConfirmationCodeResponse.m @@ -16,8 +16,6 @@ #import "FIRGetOOBConfirmationCodeResponse.h" -#import "FIRAuthErrorUtils.h" - NS_ASSUME_NONNULL_BEGIN /** @var kOOBCodeKey diff --git a/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m b/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m index 9a1556b..6092cfe 100644 --- a/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRResetPasswordResponse.m @@ -16,8 +16,6 @@ #import "FIRResetPasswordResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRResetPasswordResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m b/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m index 6e228eb..ff9c7a6 100644 --- a/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRSetAccountInfoResponse.m @@ -16,8 +16,6 @@ #import "FIRSetAccountInfoResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRSetAccountInfoResponseProviderUserInfo - (instancetype)initWithDictionary:(NSDictionary *)dictionary { diff --git a/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m b/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m index 7e58c5d..2071e07 100644 --- a/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRSignUpNewUserResponse.m @@ -16,8 +16,6 @@ #import "FIRSignUpNewUserResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRSignUpNewUserResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m index 8c970c8..5ee39fa 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyAssertionResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyAssertionResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyAssertionResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m index 8a87141..b6c3818 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyCustomTokenResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyCustomTokenResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyCustomTokenResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary diff --git a/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m b/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m index d2c4a7c..71b4edd 100644 --- a/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m +++ b/Firebase/Auth/Source/RPCs/FIRVerifyPasswordResponse.m @@ -16,8 +16,6 @@ #import "FIRVerifyPasswordResponse.h" -#import "FIRAuthErrorUtils.h" - @implementation FIRVerifyPasswordResponse - (BOOL)setWithDictionary:(NSDictionary *)dictionary |