Skip to content

Commit c9153ab

Browse files
committed
fix(auth, tvOS): guard all phone & MFA with iOS-only compile ifdef
this matches upstream style
1 parent 047c751 commit c9153ab

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/auth/ios/RNFBAuth/RNFBAuthModule.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
static __strong NSMutableDictionary *emulatorConfigs;
5656
// Used for caching credentials between method calls.
5757
static __strong NSMutableDictionary<NSString *, FIRAuthCredential *> *credentials;
58-
#if !TARGET_OS_TV
58+
#if TARGET_OS_IOS
5959
static __strong NSMutableDictionary<NSString *, FIRMultiFactorResolver *> *cachedResolver;
6060
static __strong NSMutableDictionary<NSString *, FIRMultiFactorSession *> *cachedSessions;
6161
#endif
@@ -78,7 +78,7 @@ - (id)init {
7878
idTokenHandlers = [[NSMutableDictionary alloc] init];
7979
emulatorConfigs = [[NSMutableDictionary alloc] init];
8080
credentials = [[NSMutableDictionary alloc] init];
81-
#if !TARGET_OS_TV
81+
#if TARGET_OS_IOS
8282
cachedResolver = [[NSMutableDictionary alloc] init];
8383
cachedSessions = [[NSMutableDictionary alloc] init];
8484
#endif
@@ -107,7 +107,7 @@ - (void)invalidate {
107107
[idTokenHandlers removeAllObjects];
108108

109109
[credentials removeAllObjects];
110-
#if !TARGET_OS_TV
110+
#if TARGET_OS_IOS
111111
[cachedResolver removeAllObjects];
112112
[cachedSessions removeAllObjects];
113113
#endif
@@ -421,7 +421,7 @@ - (void)invalidate {
421421
}
422422
}
423423

424-
#if !TARGET_OS_TV
424+
#if TARGET_OS_IOS
425425
RCT_EXPORT_METHOD(updatePhoneNumber
426426
: (FIRApp *)firebaseApp
427427
: (NSString *)provider
@@ -625,7 +625,7 @@ - (void)invalidate {
625625
[builder setCustomParameters:provider[@"customParameters"]];
626626
}
627627

628-
#if !TARGET_OS_TV
628+
#if TARGET_OS_IOS
629629
[builder getCredentialWithUIDelegate:nil
630630
completion:^(FIRAuthCredential *_Nullable credential,
631631
NSError *_Nullable error) {
@@ -827,7 +827,7 @@ - (void)invalidate {
827827
}];
828828
}
829829

830-
#if !TARGET_OS_TV
830+
#if TARGET_OS_IOS
831831
RCT_EXPORT_METHOD(signInWithPhoneNumber
832832
: (FIRApp *)firebaseApp
833833
: (NSString *)phoneNumber
@@ -1134,7 +1134,7 @@ - (void)invalidate {
11341134
[builder setCustomParameters:provider[@"parameters"]];
11351135
}
11361136

1137-
#if !TARGET_OS_TV
1137+
#if TARGET_OS_IOS
11381138
[builder getCredentialWithUIDelegate:nil
11391139
completion:^(FIRAuthCredential *_Nullable credential,
11401140
NSError *_Nullable error) {
@@ -1262,7 +1262,7 @@ - (void)invalidate {
12621262
if (provider[@"parameters"]) {
12631263
[builder setCustomParameters:provider[@"parameters"]];
12641264
}
1265-
#if !TARGET_OS_TV
1265+
#if TARGET_OS_IOS
12661266
[builder getCredentialWithUIDelegate:nil
12671267
completion:^(FIRAuthCredential *_Nullable credential,
12681268
NSError *_Nullable error) {
@@ -1390,7 +1390,7 @@ - (FIRAuthCredential *)getCredentialForProvider:(NSString *)provider
13901390
} else if ([provider compare:@"github.com" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
13911391
credential = [FIRGitHubAuthProvider credentialWithToken:authToken];
13921392
} else if ([provider compare:@"phone" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
1393-
#if !TARGET_OS_TV
1393+
#if TARGET_OS_IOS
13941394
DLog(@"using app credGen: %@", firebaseApp.name) credential =
13951395
[[FIRPhoneAuthProvider providerWithAuth:[FIRAuth authWithApp:firebaseApp]]
13961396
credentialWithVerificationID:authToken
@@ -1440,7 +1440,7 @@ - (void)promiseNoUser:(RCTPromiseResolveBlock)resolve
14401440
}
14411441
}
14421442

1443-
#if !TARGET_OS_TV
1443+
#if TARGET_OS_IOS
14441444
- (NSDictionary *)multiFactorResolverToDict:(FIRMultiFactorResolver *)resolver {
14451445
// Temporarily store the non-serializable session for later
14461446
NSString *sessionHash = [NSString stringWithFormat:@"%@", @([resolver.session hash])];
@@ -1563,7 +1563,7 @@ - (NSDictionary *)getJSError:(NSError *)error {
15631563

15641564

15651565
NSDictionary *resolverDict = nil;
1566-
#if !TARGET_OS_TV
1566+
#if TARGET_OS_IOS
15671567
if ([error userInfo][FIRAuthErrorUserInfoMultiFactorResolverKey] != nil) {
15681568
FIRMultiFactorResolver *resolver = error.userInfo[FIRAuthErrorUserInfoMultiFactorResolverKey];
15691569
resolverDict = [self multiFactorResolverToDict:resolver];
@@ -1718,14 +1718,14 @@ - (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
17181718
@"refreshToken" : user.refreshToken,
17191719
@"tenantId" : user.tenantID ? (id)user.tenantID : [NSNull null],
17201720
keyUid : user.uid,
1721-
#if !TARGET_OS_TV
1721+
#if TARGET_OS_IOS
17221722
@"multiFactor" :
17231723
@{@"enrolledFactors" : [self convertMultiFactorData:user.multiFactor.enrolledFactors]}
17241724
#endif
17251725
};
17261726
}
17271727

1728-
#if !TARGET_OS_TV
1728+
#if TARGET_OS_IOS
17291729
- (NSArray<NSMutableDictionary *> *)convertMultiFactorData:(NSArray<FIRMultiFactorInfo *> *)hints {
17301730
NSMutableArray *enrolledFactors = [NSMutableArray array];
17311731

0 commit comments

Comments
 (0)