[ios] added user `providerData` props
This commit is contained in:
parent
e6bd721617
commit
6c68d85261
|
@ -636,6 +636,31 @@ RCT_EXPORT_METHOD(reauthenticate:(NSString *)provider authToken:(NSString *)auth
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
Converts an array of FIRUserInfo instances into the correct format to match the web sdk
|
||||
|
||||
@param providerData FIRUser.providerData
|
||||
@return NSArray
|
||||
*/
|
||||
- (NSArray <NSObject *> *) convertProviderData:(NSArray <id<FIRUserInfo>> *) providerData {
|
||||
NSEnumerator *items = [providerData objectEnumerator];
|
||||
NSMutableArray *output = [NSMutableArray array];
|
||||
|
||||
id<FIRUserInfo> userInfo;
|
||||
while (userInfo = [items nextObject]) {
|
||||
[output addObject:@{
|
||||
@"providerId": userInfo.providerID,
|
||||
@"uid": userInfo.uid,
|
||||
@"displayName": userInfo.displayName,
|
||||
@"photoURL": userInfo.photoURL,
|
||||
@"email": userInfo.email
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
Converts a FIRUser instance into a dictionary to send via RNBridge
|
||||
|
||||
|
@ -650,7 +675,8 @@ RCT_EXPORT_METHOD(reauthenticate:(NSString *)provider authToken:(NSString *)auth
|
|||
@"isAnonymous": @(user.anonymous),
|
||||
@"displayName": user.displayName ? user.displayName : [NSNull null],
|
||||
@"refreshToken": user.refreshToken,
|
||||
@"providerId": [user.providerID lowercaseString]
|
||||
@"providerId": [user.providerID lowercaseString],
|
||||
@"providerDate": [self convertProviderData: user.providerData]
|
||||
}
|
||||
mutableCopy
|
||||
];
|
||||
|
|
|
@ -142,10 +142,13 @@ export default class User {
|
|||
return FirebaseAuth.getToken(forceRefresh);
|
||||
}
|
||||
|
||||
// TODO return from native
|
||||
// get providerData() {
|
||||
// return this._valueOrNull('providerData');
|
||||
// }
|
||||
/**
|
||||
*
|
||||
* @returns {Array}
|
||||
*/
|
||||
get providerData(): Array {
|
||||
return this._valueOrNull('providerData') || [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current user's email
|
||||
|
|
Loading…
Reference in New Issue