Skip to content

Commit 2ec7a6b

Browse files
committed
removing some functionality that is missing natively on tvos
Some features like phone auth are only available on iOS and are missing on tvOS.
1 parent 93ab80c commit 2ec7a6b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

auth/src/ios/credential_ios.mm

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
#import "FIRGitHubAuthProvider.h"
2828
#import "FIRGoogleAuthProvider.h"
2929
#import "FIROAuthProvider.h"
30+
31+
#if FIREBASE_PLATFORM_IOS
3032
#import "FIRPhoneAuthProvider.h"
33+
#endif
34+
3135
#import "FIRTwitterAuthProvider.h"
3236

3337
// This object is shared between the PhoneAuthProvider::Listener and the blocks in
@@ -219,6 +223,7 @@ @implementation PhoneListenerDataObjC
219223
return localPlayer.isAuthenticated;
220224
}
221225

226+
#if FIREBASE_PLATFORM_IOS
222227
// We skip the implementation of ForceResendingTokenData since it is not needed.
223228
// The ForceResendingToken class for iOS is empty.
224229
PhoneAuthProvider::ForceResendingToken::ForceResendingToken()
@@ -325,6 +330,7 @@ explicit PhoneAuthProviderData(FIRPhoneAuthProvider* objc_provider)
325330
}
326331
return provider;
327332
}
333+
#endif // FIREBASE_PLATFORM_IOS
328334

329335
// FederatedAuthHandlers
330336
FederatedOAuthProvider::FederatedOAuthProvider() { }
@@ -420,6 +426,7 @@ void ReauthenticateWithProviderGetCredentialCallback(FIRAuthCredential* _Nullabl
420426
ReferenceCountedFutureImpl &futures = auth_data->future_impl;
421427
auto handle =
422428
futures.SafeAlloc<SignInResult>(kUserFn_LinkWithProvider, SignInResult());
429+
#if FIREBASE_PLATFORM_IOS
423430
FIROAuthProvider* ios_provider = (FIROAuthProvider*)[FIROAuthProvider
424431
providerWithProviderID:@(provider_data_.provider_id.c_str())
425432
auth:AuthImpl(auth_data)];
@@ -442,13 +449,21 @@ void ReauthenticateWithProviderGetCredentialCallback(FIRAuthCredential* _Nullabl
442449
SignInResult());
443450
return future;
444451
}
452+
453+
#else // non iOS Apple platform
454+
Future<SignInResult> future = MakeFuture(&futures, handle);
455+
futures.Complete(handle, kAuthErrorApiNotAvailable,
456+
"Link with getCredentialWithUIDelegate is not supported on non-iOS Apple platforms.");
457+
#endif // FIREBASE_PLATFORM_IOS
458+
445459
}
446460

447461
Future<SignInResult> FederatedOAuthProvider::Reauthenticate(AuthData* auth_data) {
448462
assert(auth_data);
449463
ReferenceCountedFutureImpl &futures = auth_data->future_impl;
450464
auto handle =
451465
futures.SafeAlloc<SignInResult>(kUserFn_LinkWithProvider, SignInResult());
466+
#if FIREBASE_PLATFORM_IOS
452467
FIROAuthProvider* ios_provider = (FIROAuthProvider*)[FIROAuthProvider
453468
providerWithProviderID:@(provider_data_.provider_id.c_str())
454469
auth:AuthImpl(auth_data)];
@@ -471,6 +486,12 @@ void ReauthenticateWithProviderGetCredentialCallback(FIRAuthCredential* _Nullabl
471486
SignInResult());
472487
return future;
473488
}
489+
490+
#else // non iOS Apple Platform
491+
Future<SignInResult> future = MakeFuture(&futures, handle);
492+
futures.Complete(handle, kAuthErrorApiNotAvailable,
493+
"Reauthenticate with getCredentialWithUIDelegate is not supported on non-iOS Apple platforms.");
494+
#endif // FIREBASE_PLATFORM_IOS
474495
}
475496

476497
} // namespace auth

auth/src/ios/user_ios.mm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
* limitations under the License.
1515
*/
1616

17+
#if FIREBASE_PLATFORM_IOS
1718
#import "FIRPhoneAuthCredential.h"
19+
#endif
1820

1921
#include "app/src/time.h"
2022
#include "auth/src/ios/common_ios.h"
@@ -229,6 +231,8 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
229231
}
230232
ReferenceCountedFutureImpl& futures = auth_data_->future_impl;
231233
const auto handle = futures.SafeAlloc<User*>(kUserFn_UpdatePhoneNumberCredential);
234+
235+
#if FIREBASE_PLATFORM_IOS
232236
FIRAuthCredential *objc_credential = CredentialFromImpl(credential.impl_);
233237
if ([objc_credential isKindOfClass:[FIRPhoneAuthCredential class]]) {
234238
[UserImpl(auth_data_)
@@ -240,6 +244,12 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
240244
} else {
241245
futures.Complete(handle, kAuthErrorInvalidCredential, kInvalidCredentialMessage);
242246
}
247+
248+
#else // non iOS Apple platform
249+
futures.Complete(handle, kAuthErrorApiNotAvailable,
250+
"Phone Auth is not supported on non-iOS apple platforms.");
251+
#endif // FIREBASE_PLATFORM_IOS
252+
243253
return MakeFuture(&futures, handle);
244254
}
245255

0 commit comments

Comments
 (0)