Add TvOS support to the auth module.#799
Open
dfoelster wants to merge 3 commits intoGitLiveApp:masterfrom
Open
Add TvOS support to the auth module.#799dfoelster wants to merge 3 commits intoGitLiveApp:masterfrom
dfoelster wants to merge 3 commits intoGitLiveApp:masterfrom
Conversation
There are some parts of the public api, that are not existing in the TvOS sdk. Mostly relating to auth via phone number or multifactor. Those methods will throw an UnsupportedOperationException with this change.
Reedyuk
approved these changes
Mar 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds tvOS support to the firebase-auth module by splitting Apple-platform-specific code (multifactor, phone auth, error handling) from appleMain into iosMain and tvosMain source sets. On tvOS, unsupported features (phone auth, multifactor) throw UnsupportedOperationException.
Changes:
- Added tvOS to
firebase-auth.supportedTargetsand created tvOS stub implementations for multifactor, phone auth, and error mapping - Extracted iOS-specific implementations (
PhoneAuthProvider,MultiFactor,toAuthException,FirebaseAuthMultiFactorException) fromappleMainintoiosMain - Introduced
expect/actualdeclarations inappleMainforgetMultiFactor(),updatePhoneNumberInternal(), andtoAuthException()
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle.properties | Add tvos to firebase-auth supported targets |
| gradle/libs.versions.toml | Bump Kotlin version 2.2.20 → 2.2.21 |
| firebase-auth/src/appleMain/.../auth.kt | Extract error mapping and multifactor exception to expect declarations |
| firebase-auth/src/appleMain/.../credentials.kt | Move PhoneAuthProvider out to iosMain/tvosMain |
| firebase-auth/src/appleMain/.../user.kt | Add expect functions for multiFactor and updatePhoneNumber |
| firebase-auth/src/iosMain/.../auth.kt | iOS actual for error mapping with full multifactor support |
| firebase-auth/src/iosMain/.../credentials.kt | iOS actual for PhoneAuthProvider |
| firebase-auth/src/iosMain/.../multifactor.kt | iOS actual for multifactor classes |
| firebase-auth/src/iosMain/.../user.kt | iOS actual for getMultiFactor and updatePhoneNumber |
| firebase-auth/src/tvosMain/.../auth.kt | tvOS error mapping (no multifactor error codes) |
| firebase-auth/src/tvosMain/.../credentials.kt | tvOS PhoneAuthProvider stub (throws) |
| firebase-auth/src/tvosMain/.../multifactor.kt | tvOS multifactor stubs (mostly throws) |
| firebase-auth/src/tvosMain/.../user.kt | tvOS stubs for user multifactor/phone |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+11
to
+12
| public actual suspend fun unenroll(multiFactorInfo: MultiFactorInfo): Unit = Unit | ||
| public actual suspend fun unenroll(factorUid: String): Unit = Unit |
Collaborator
There was a problem hiding this comment.
@nbransby thoughts on this approach? i assume we want to really be as thin as possible and just let sdk throw the exception if its not implemented.
|
|
||
| internal actual fun FirebaseUser.getMultiFactor(): MultiFactor = MultiFactor() | ||
|
|
||
| internal actual suspend fun FirebaseUser.updatePhoneNumberInternal(credential: PhoneAuthCredential): Unit = Unit |
Comment on lines
+8
to
+9
| public actual open class FirebaseAuthMultiFactorException(message: String) : FirebaseAuthException(message) | ||
|
|
| @@ -0,0 +1,35 @@ | |||
| package dev.gitlive.firebase.auth | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are some parts of the public api that are not existing in the TvOS sdk. Mostly relating to auth via phone number or multifactor. Those methods will throw an UnsupportedOperationException with this change.
But it allows for authenticated usage of already supported modules.