@@ -1462,15 +1462,6 @@ - (NSDictionary *)multiFactorResolverToDict:(FIRMultiFactorResolver *)resolver {
1462
1462
}
1463
1463
#endif
1464
1464
1465
- - (NSString *)getJSFactorId : (NSString *)factorId {
1466
- if ([factorId isEqualToString: @" 1" ]) {
1467
- // Only phone is supported by the front-end so far
1468
- return @" phone" ;
1469
- }
1470
-
1471
- return factorId;
1472
- }
1473
-
1474
1465
- (void )promiseRejectAuthException : (RCTPromiseRejectBlock)reject error : (NSError *)error {
1475
1466
NSDictionary *jsError = [self getJSError: error];
1476
1467
@@ -1737,19 +1728,25 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
1737
1728
- (NSArray <NSMutableDictionary *> *)convertMultiFactorData : (NSArray <FIRMultiFactorInfo *> *)hints {
1738
1729
NSMutableArray *enrolledFactors = [NSMutableArray array ];
1739
1730
1740
- for (FIRPhoneMultiFactorInfo *hint in hints) {
1731
+ for (FIRMultiFactorInfo *hint in hints) {
1741
1732
NSString *enrollmentTime =
1742
1733
[[[NSISO8601DateFormatter alloc ] init ] stringFromDate: hint.enrollmentDate];
1743
- [enrolledFactors addObject: @{
1734
+
1735
+ NSMutableDictionary *factorDict = [@{
1744
1736
@" uid" : hint.UID ,
1745
- @" factorId" : [ self getJSFactorId: ( hint.factorID)] ,
1737
+ @" factorId" : hint.factorID ,
1746
1738
@" displayName" : hint.displayName == nil ? [NSNull null ] : hint.displayName ,
1747
1739
@" enrollmentTime" : enrollmentTime,
1748
1740
// @deprecated enrollmentDate kept for backwards compatibility, please use enrollmentTime
1749
1741
@" enrollmentDate" : enrollmentTime,
1750
- // phoneNumber only present on FIRPhoneMultiFactorInfo
1751
- @" phoneNumber" : hint.phoneNumber == nil ? [NSNull null ] : hint.phoneNumber ,
1752
- }];
1742
+ } mutableCopy];
1743
+
1744
+ // only support phone mutli factor
1745
+ if ([hint isKindOfClass: [FIRPhoneMultiFactorInfo class ]]) {
1746
+ FIRPhoneMultiFactorInfo *phoneHint = (FIRPhoneMultiFactorInfo *)hint;
1747
+ factorDict[@" phoneNumber" ] = phoneHint.phoneNumber ;
1748
+ [enrolledFactors addObject: factorDict];
1749
+ }
1753
1750
}
1754
1751
return enrolledFactors;
1755
1752
}
0 commit comments