From ec3ea1b883c4d61c36cfbd53fdb1e81db61badc8 Mon Sep 17 00:00:00 2001 From: Michael Nahkies Date: Mon, 26 Feb 2024 21:35:46 +0000 Subject: [PATCH] fix: ios enrollmentDate -> enrollmentTime rename `enrollmentDate` -> `enrollmentTime` on iOS to match Android/Web (ref: https://firebase.google.com/docs/reference/js/auth.multifactorinfo) keep `enrollmentDate` around on ios for backwards compatibility, mark as deprecated. ref: - https://github.com/invertase/react-native-firebase/blob/main/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java#L2500 - https://github.com/invertase/react-native-firebase/blob/main/packages/auth/lib/index.d.ts#L483 split from #7565 --- packages/auth/ios/RNFBAuth/RNFBAuthModule.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/auth/ios/RNFBAuth/RNFBAuthModule.m b/packages/auth/ios/RNFBAuth/RNFBAuthModule.m index 76862bc069..30290ace30 100644 --- a/packages/auth/ios/RNFBAuth/RNFBAuthModule.m +++ b/packages/auth/ios/RNFBAuth/RNFBAuthModule.m @@ -1686,13 +1686,15 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user { NSMutableArray *enrolledFactors = [NSMutableArray array]; for (FIRPhoneMultiFactorInfo *hint in hints) { - NSString *enrollmentDate = + NSString *enrollmentTime = [[[NSISO8601DateFormatter alloc] init] stringFromDate:hint.enrollmentDate]; [enrolledFactors addObject:@{ @"uid" : hint.UID, @"factorId" : [self getJSFactorId:(hint.factorID)], @"displayName" : hint.displayName == nil ? [NSNull null] : hint.displayName, - @"enrollmentDate" : enrollmentDate, + @"enrollmentTime" : enrollmentTime, + // @deprecated enrollmentDate kept for backwards compatibility, please use enrollmentTime + @"enrollmentDate" : enrollmentTime, }]; } return enrolledFactors; @@ -1745,4 +1747,4 @@ - (FIRActionCodeSettings *)buildActionCodeSettings:(NSDictionary *)actionCodeSet return settings; } -@end \ No newline at end of file +@end