Skip to content

Commit 80ac5aa

Browse files
committed
FIRAuthUIDelegateProtocol is not available outside of the firebase library, so there is no point to use it in PhoneVerificationProvider
1 parent 10e6c04 commit 80ac5aa

File tree

1 file changed

+8
-2
lines changed
  • firebase-auth/src/iosMain/kotlin/dev/gitlive/firebase/auth

1 file changed

+8
-2
lines changed

firebase-auth/src/iosMain/kotlin/dev/gitlive/firebase/auth/credentials.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,20 @@ actual class PhoneAuthProvider(val ios: FIRPhoneAuthProvider) {
7777
actual fun credential(verificationId: String, smsCode: String): PhoneAuthCredential = PhoneAuthCredential(ios.credentialWithVerificationID(verificationId, smsCode))
7878

7979
actual suspend fun verifyPhoneNumber(phoneNumber: String, verificationProvider: PhoneVerificationProvider): AuthCredential {
80-
val verificationId: String = ios.awaitResult { ios.verifyPhoneNumber(phoneNumber, verificationProvider.delegate, it) }
80+
val verificationId: String = ios.awaitResult {
81+
if (verificationProvider.delegate != null) {
82+
ios.verifyPhoneNumber(phoneNumber, verificationProvider.delegate as? FIRAuthUIDelegateProtocol, it)
83+
} else {
84+
ios.verifyPhoneNumber(phoneNumber, null, it)
85+
}
86+
}
8187
val verificationCode = verificationProvider.getVerificationCode()
8288
return credential(verificationId, verificationCode)
8389
}
8490
}
8591

8692
actual interface PhoneVerificationProvider {
87-
val delegate: FIRAuthUIDelegateProtocol
93+
val delegate: Any?
8894
suspend fun getVerificationCode(): String
8995
}
9096

0 commit comments

Comments
 (0)