5555static __strong NSMutableDictionary *emulatorConfigs;
5656// Used for caching credentials between method calls.
5757static __strong NSMutableDictionary <NSString *, FIRAuthCredential *> *credentials;
58+ #if !TARGET_OS_TV
5859static __strong NSMutableDictionary <NSString *, FIRMultiFactorResolver *> *cachedResolver;
5960static __strong NSMutableDictionary <NSString *, FIRMultiFactorSession *> *cachedSessions;
61+ #endif
6062
6163@implementation RNFBAuthModule
6264#pragma mark -
@@ -76,8 +78,10 @@ - (id)init {
7678 idTokenHandlers = [[NSMutableDictionary alloc ] init ];
7779 emulatorConfigs = [[NSMutableDictionary alloc ] init ];
7880 credentials = [[NSMutableDictionary alloc ] init ];
81+ #if !TARGET_OS_TV
7982 cachedResolver = [[NSMutableDictionary alloc ] init ];
8083 cachedSessions = [[NSMutableDictionary alloc ] init ];
84+ #endif
8185 });
8286 return self;
8387}
@@ -103,8 +107,10 @@ - (void)invalidate {
103107 [idTokenHandlers removeAllObjects ];
104108
105109 [credentials removeAllObjects ];
110+ #if !TARGET_OS_TV
106111 [cachedResolver removeAllObjects ];
107112 [cachedSessions removeAllObjects ];
113+ #endif
108114}
109115
110116#pragma mark -
@@ -415,6 +421,7 @@ - (void)invalidate {
415421 }
416422}
417423
424+ #if !TARGET_OS_TV
418425RCT_EXPORT_METHOD (updatePhoneNumber
419426 : (FIRApp *)firebaseApp
420427 : (NSString *)provider
@@ -455,6 +462,7 @@ - (void)invalidate {
455462 [self promiseNoUser: resolve rejecter: reject isError: YES ];
456463 }
457464}
465+ #endif
458466
459467RCT_EXPORT_METHOD (updateProfile
460468 : (FIRApp *)firebaseApp
@@ -617,6 +625,7 @@ - (void)invalidate {
617625 [builder setCustomParameters: provider[@" customParameters" ]];
618626 }
619627
628+ #if !TARGET_OS_TV
620629 [builder getCredentialWithUIDelegate: nil
621630 completion: ^(FIRAuthCredential *_Nullable credential,
622631 NSError *_Nullable error) {
@@ -647,6 +656,7 @@ - (void)invalidate {
647656 }];
648657 }
649658 }];
659+ #endif
650660}
651661
652662RCT_EXPORT_METHOD (confirmPasswordReset
@@ -817,6 +827,7 @@ - (void)invalidate {
817827 }];
818828}
819829
830+ #if !TARGET_OS_TV
820831RCT_EXPORT_METHOD (signInWithPhoneNumber
821832 : (FIRApp *)firebaseApp
822833 : (NSString *)phoneNumber
@@ -1053,6 +1064,7 @@ - (void)invalidate {
10531064 }
10541065 }];
10551066}
1067+ #endif
10561068
10571069RCT_EXPORT_METHOD (linkWithCredential
10581070 : (FIRApp *)firebaseApp
@@ -1122,6 +1134,7 @@ - (void)invalidate {
11221134 [builder setCustomParameters: provider[@" parameters" ]];
11231135 }
11241136
1137+ #if !TARGET_OS_TV
11251138 [builder getCredentialWithUIDelegate: nil
11261139 completion: ^(FIRAuthCredential *_Nullable credential,
11271140 NSError *_Nullable error) {
@@ -1151,6 +1164,7 @@ - (void)invalidate {
11511164 }];
11521165 }
11531166 }];
1167+ #endif
11541168}
11551169
11561170RCT_EXPORT_METHOD (unlink
@@ -1248,7 +1262,7 @@ - (void)invalidate {
12481262 if (provider[@" parameters" ]) {
12491263 [builder setCustomParameters: provider[@" parameters" ]];
12501264 }
1251-
1265+ # if !TARGET_OS_TV
12521266 [builder getCredentialWithUIDelegate: nil
12531267 completion: ^(FIRAuthCredential *_Nullable credential,
12541268 NSError *_Nullable error) {
@@ -1279,6 +1293,7 @@ - (void)invalidate {
12791293 }];
12801294 }
12811295 }];
1296+ #endif
12821297}
12831298
12841299RCT_EXPORT_METHOD (fetchSignInMethodsForEmail
@@ -1375,10 +1390,12 @@ - (FIRAuthCredential *)getCredentialForProvider:(NSString *)provider
13751390 } else if ([provider compare: @" github.com" options: NSCaseInsensitiveSearch] == NSOrderedSame) {
13761391 credential = [FIRGitHubAuthProvider credentialWithToken: authToken];
13771392 } else if ([provider compare: @" phone" options: NSCaseInsensitiveSearch] == NSOrderedSame) {
1393+ #if !TARGET_OS_TV
13781394 DLog (@" using app credGen: %@ " , firebaseApp.name ) credential =
13791395 [[FIRPhoneAuthProvider providerWithAuth: [FIRAuth authWithApp: firebaseApp]]
13801396 credentialWithVerificationID: authToken
13811397 verificationCode: authTokenSecret];
1398+ #endif
13821399 } else if ([provider compare: @" oauth" options: NSCaseInsensitiveSearch] == NSOrderedSame) {
13831400 credential = [FIROAuthProvider credentialWithProviderID: @" oauth"
13841401 IDToken: authToken
@@ -1423,6 +1440,7 @@ - (void)promiseNoUser:(RCTPromiseResolveBlock)resolve
14231440 }
14241441}
14251442
1443+ #if !TARGET_OS_TV
14261444- (NSDictionary *)multiFactorResolverToDict : (FIRMultiFactorResolver *)resolver {
14271445 // Temporarily store the non-serializable session for later
14281446 NSString *sessionHash = [NSString stringWithFormat: @" %@ " , @([resolver.session hash ])];
@@ -1433,6 +1451,7 @@ - (NSDictionary *)multiFactorResolverToDict:(FIRMultiFactorResolver *)resolver {
14331451 @" auth" : resolver.auth
14341452 };
14351453}
1454+ #endif
14361455
14371456- (NSString *)getJSFactorId : (NSString *)factorId {
14381457 if ([factorId isEqualToString: @" 1" ]) {
@@ -1542,14 +1561,17 @@ - (NSDictionary *)getJSError:(NSError *)error {
15421561 authCredentialDict = [self authCredentialToDict: authCredential];
15431562 }
15441563
1564+
15451565 NSDictionary *resolverDict = nil ;
1566+ #if !TARGET_OS_TV
15461567 if ([error userInfo ][FIRAuthErrorUserInfoMultiFactorResolverKey] != nil ) {
15471568 FIRMultiFactorResolver *resolver = error.userInfo [FIRAuthErrorUserInfoMultiFactorResolverKey];
15481569 resolverDict = [self multiFactorResolverToDict: resolver];
15491570
15501571 NSString *sessionKey = [NSString stringWithFormat: @" %@ " , @([resolver.session hash ])];
15511572 cachedResolver[sessionKey] = resolver;
15521573 }
1574+ #endif
15531575
15541576 return @{
15551577 @" code" : code,
@@ -1696,11 +1718,14 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
16961718 @" refreshToken" : user.refreshToken ,
16971719 @" tenantId" : user.tenantID ? (id )user.tenantID : [NSNull null ],
16981720 keyUid : user.uid ,
1721+ #if !TARGET_OS_TV
16991722 @" multiFactor" :
17001723 @{@" enrolledFactors" : [self convertMultiFactorData: user.multiFactor.enrolledFactors]}
1724+ #endif
17011725 };
17021726}
17031727
1728+ #if !TARGET_OS_TV
17041729- (NSArray <NSMutableDictionary *> *)convertMultiFactorData : (NSArray <FIRMultiFactorInfo *> *)hints {
17051730 NSMutableArray *enrolledFactors = [NSMutableArray array ];
17061731
@@ -1720,6 +1745,7 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
17201745 }
17211746 return enrolledFactors;
17221747}
1748+ #endif
17231749
17241750- (NSDictionary *)authCredentialToDict : (FIRAuthCredential *)authCredential {
17251751 NSString *authCredentialHash = [NSString stringWithFormat: @" %@ " , @([authCredential hash ])];
0 commit comments