[ios] change convertProviderData to use a for in statement

This commit is contained in:
Salakar 2017-05-12 13:58:16 +01:00
parent d9035e9515
commit 06d20cac5c
1 changed files with 4 additions and 6 deletions

View File

@ -636,18 +636,16 @@ RCT_EXPORT_METHOD(reauthenticate:(NSString *)provider authToken:(NSString *)auth
} }
/** /**
Converts an array of FIRUserInfo instances into the correct format to match the web sdk Converts an array of FIRUserInfo instances into the correct format to match the web sdk
@param providerData FIRUser.providerData @param providerData FIRUser.providerData
@return NSArray @return NSArray
*/ */
- (NSArray <NSObject *> *) convertProviderData:(NSArray <id<FIRUserInfo>> *) providerData { - (NSArray <NSObject *> *) convertProviderData:(NSArray <id<FIRUserInfo>> *) providerData {
NSEnumerator *items = [providerData objectEnumerator];
NSMutableArray *output = [NSMutableArray array]; NSMutableArray *output = [NSMutableArray array];
id<FIRUserInfo> userInfo; for (id<FIRUserInfo> userInfo in providerData) {
while (userInfo = [items nextObject]) {
[output addObject:@{ [output addObject:@{
@"providerId": userInfo.providerID, @"providerId": userInfo.providerID,
@"uid": userInfo.uid, @"uid": userInfo.uid,
@ -677,8 +675,8 @@ RCT_EXPORT_METHOD(reauthenticate:(NSString *)provider authToken:(NSString *)auth
@"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: [NSString stringWithFormat:@"%@", user.photoURL] forKey:@"photoURL"]; [userDict setValue: [NSString stringWithFormat:@"%@", user.photoURL] forKey:@"photoURL"];