Skip to content

Add TvOS support to the auth module.#799

Open
dfoelster wants to merge 3 commits intoGitLiveApp:masterfrom
dfoelster:feature/auth-on-tvOs
Open

Add TvOS support to the auth module.#799
dfoelster wants to merge 3 commits intoGitLiveApp:masterfrom
dfoelster:feature/auth-on-tvOs

Conversation

@dfoelster
Copy link
Copy Markdown

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.

dfoelster and others added 2 commits February 20, 2026 14:23
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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.supportedTargets and created tvOS stub implementations for multifactor, phone auth, and error mapping
  • Extracted iOS-specific implementations (PhoneAuthProvider, MultiFactor, toAuthException, FirebaseAuthMultiFactorException) from appleMain into iosMain
  • Introduced expect/actual declarations in appleMain for getMultiFactor(), updatePhoneNumberInternal(), and toAuthException()

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants