[ios][auth] replace deprecated methods

- FIREmailAuthProvider() -> FIREmailPasswordAuthProvider()
- getIDTokenForcingRefresh() -> getTokenForcingRefresh()
This commit is contained in:
Michael Diarmid 2017-06-13 06:21:45 +01:00 committed by GitHub
parent 0edb79243a
commit 87eb76520e
1 changed files with 12 additions and 12 deletions

View File

@ -282,7 +282,7 @@ RCT_EXPORT_METHOD(getToken:(BOOL)forceRefresh resolver:(RCTPromiseResolveBlock)
FIRUser *user = [FIRAuth auth].currentUser; FIRUser *user = [FIRAuth auth].currentUser;
if (user) { if (user) {
[user getIDTokenForcingRefresh:(BOOL) forceRefresh completion:^(NSString *token, NSError *_Nullable error) { [user getTokenForcingRefresh:(BOOL) forceRefresh completion:^(NSString *token, NSError *_Nullable error) {
if (error) { if (error) {
[self promiseRejectAuthException:reject error:error]; [self promiseRejectAuthException:reject error:error];
} else { } else {
@ -472,7 +472,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
} else if ([provider compare:@"google" options:NSCaseInsensitiveSearch] == NSOrderedSame) { } else if ([provider compare:@"google" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
credential = [FIRGoogleAuthProvider credentialWithIDToken:authToken accessToken:authTokenSecret]; credential = [FIRGoogleAuthProvider credentialWithIDToken:authToken accessToken:authTokenSecret];
} else if ([provider compare:@"password" options:NSCaseInsensitiveSearch] == NSOrderedSame) { } else if ([provider compare:@"password" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
credential = [FIREmailAuthProvider credentialWithEmail:authToken password:authTokenSecret]; credential = [FIREmailPasswordAuthProvider credentialWithEmail:authToken password:authTokenSecret];
} else if ([provider compare:@"github" options:NSCaseInsensitiveSearch] == NSOrderedSame) { } else if ([provider compare:@"github" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
credential = [FIRGitHubAuthProvider credentialWithToken:authToken]; credential = [FIRGitHubAuthProvider credentialWithToken:authToken];
} else { } else {
@ -703,16 +703,16 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
*/ */
- (NSDictionary *) firebaseUserToDict:(FIRUser *) user { - (NSDictionary *) firebaseUserToDict:(FIRUser *) user {
NSMutableDictionary *userDict = [ NSMutableDictionary *userDict = [
@{ @"uid": user.uid, @{ @"uid": user.uid,
@"email": user.email ? user.email : [NSNull null], @"email": user.email ? user.email : [NSNull null],
@"emailVerified": @(user.emailVerified), @"emailVerified": @(user.emailVerified),
@"isAnonymous": @(user.anonymous), @"isAnonymous": @(user.anonymous),
@"displayName": user.displayName ? user.displayName : [NSNull null], @"displayName": user.displayName ? user.displayName : [NSNull null],
@"refreshToken": user.refreshToken, @"refreshToken": user.refreshToken,
@"providerId": [user.providerID lowercaseString], @"providerId": [user.providerID lowercaseString],
@"providerData": [self convertProviderData: user.providerData] @"providerData": [self convertProviderData: user.providerData]
} mutableCopy } mutableCopy
]; ];
if ([user valueForKey:@"photoURL"] != nil) { if ([user valueForKey:@"photoURL"] != nil) {
[userDict setValue: [user.photoURL absoluteString] forKey:@"photoURL"]; [userDict setValue: [user.photoURL absoluteString] forKey:@"photoURL"];