Skip to content

Expose iOS MultiFactorResolver to FirebaseAuthMultiFactorException #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.FirebaseApp
import dev.gitlive.firebase.FirebaseException
import dev.gitlive.firebase.FirebaseNetworkException
import dev.gitlive.firebase.FirebaseTooManyRequestsException
import dev.gitlive.firebase.auth.ActionCodeResult.*
import dev.gitlive.firebase.ios
import kotlinx.cinterop.*
Expand Down Expand Up @@ -171,7 +172,7 @@ public actual open class FirebaseAuthEmailException(message: String) : FirebaseA
public actual open class FirebaseAuthInvalidCredentialsException(message: String) : FirebaseAuthException(message)
public actual open class FirebaseAuthWeakPasswordException(message: String) : FirebaseAuthInvalidCredentialsException(message)
public actual open class FirebaseAuthInvalidUserException(message: String) : FirebaseAuthException(message)
public actual open class FirebaseAuthMultiFactorException(message: String) : FirebaseAuthException(message)
public actual open class FirebaseAuthMultiFactorException(message: String, public val resolver: FIRMultiFactorResolver?) : FirebaseAuthException(message)
public actual open class FirebaseAuthRecentLoginRequiredException(message: String) : FirebaseAuthException(message)
public actual open class FirebaseAuthUserCollisionException(message: String) : FirebaseAuthException(message)
public actual open class FirebaseAuthWebException(message: String) : FirebaseAuthException(message)
Expand Down Expand Up @@ -248,7 +249,13 @@ private fun NSError.toException() = when (domain) {
17078L, // AuthErrorCode.secondFactorRequired
17088L, // AuthErrorCode.maximumSecondFactorCountExceeded
17084L, // AuthErrorCode.multiFactorInfoNotFound
-> FirebaseAuthMultiFactorException(toString())
-> {
val resolver = userInfo["FIRAuthErrorUserInfoMultiFactorResolverKey"] as? FIRMultiFactorResolver
FirebaseAuthMultiFactorException(toString(), resolver)
}

17052L, // AuthErrorCode.quotaExceeded
-> FirebaseTooManyRequestsException(toString())
Copy link
Author

Choose a reason for hiding this comment

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

Matches the behaviour of android


17007L, // AuthErrorCode.emailAlreadyInUse
17012L, // AuthErrorCode.accountExistsWithDifferentCredential
Expand Down