@@ -1462,14 +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
1465
1474
1466
- (void )promiseRejectAuthException : (RCTPromiseRejectBlock)reject error : (NSError *)error {
1475
1467
NSDictionary *jsError = [self getJSError: error];
@@ -1737,19 +1729,23 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
1737
1729
- (NSArray <NSMutableDictionary *> *)convertMultiFactorData : (NSArray <FIRMultiFactorInfo *> *)hints {
1738
1730
NSMutableArray *enrolledFactors = [NSMutableArray array ];
1739
1731
1740
- for (FIRPhoneMultiFactorInfo *hint in hints) {
1741
- NSString *enrollmentTime =
1742
- [[[NSISO8601DateFormatter alloc ] init ] stringFromDate: hint.enrollmentDate];
1743
- [enrolledFactors addObject: @{
1744
- @" uid" : hint.UID ,
1745
- @" factorId" : [self getJSFactorId: (hint.factorID)],
1746
- @" displayName" : hint.displayName == nil ? [NSNull null ] : hint.displayName ,
1747
- @" enrollmentTime" : enrollmentTime,
1748
- // @deprecated enrollmentDate kept for backwards compatibility, please use enrollmentTime
1749
- @" enrollmentDate" : enrollmentTime,
1750
- // phoneNumber only present on FIRPhoneMultiFactorInfo
1751
- @" phoneNumber" : hint.phoneNumber == nil ? [NSNull null ] : hint.phoneNumber ,
1752
- }];
1732
+ for (FIRMultiFactorInfo *hint in hints) {
1733
+ // only support phone mutli factor
1734
+ if ([hint isKindOfClass: [FIRPhoneMultiFactorInfo class ]]) {
1735
+ FIRPhoneMultiFactorInfo *phoneHint = (FIRPhoneMultiFactorInfo *)hint;
1736
+
1737
+ NSString *enrollmentTime =
1738
+ [[[NSISO8601DateFormatter alloc ] init ] stringFromDate: phoneHint.enrollmentDate];
1739
+ [enrolledFactors addObject: @{
1740
+ @" uid" : phoneHint.UID ,
1741
+ @" factorId" : FIRPhoneMultiFactorInfo.FIRPhoneMultiFactorID ,
1742
+ @" displayName" : phoneHint.displayName == nil ? [NSNull null ] : phoneHint.displayName ,
1743
+ @" enrollmentTime" : enrollmentTime,
1744
+ // @deprecated enrollmentDate kept for backwards compatibility, please use enrollmentTime
1745
+ @" enrollmentDate" : enrollmentTime,
1746
+ @" phoneNumber" : phoneHint.phoneNumber ,
1747
+ }];
1748
+ }
1753
1749
}
1754
1750
return enrolledFactors;
1755
1751
}
0 commit comments