-
Slowly leveling up. Woo! Working on additions to Firebase with some success here and there, but stumped on one aspect of adding phone auth... https://firebase.google.com/docs/reference/kotlin/com/google/firebase/auth/PhoneAuthOptions The PhoneAuthOptions.Builder requires setCallbacks to be called and I for the life of me cannot figure out how to write an implementation of PhoneAuthProvider.OnVerificationStateChangedCallbacks that will transpile properly. Can you point me to some example that illustrates how to implement this? Swift obviously doesn't support abstract classes, but its a common pattern in java/kotlin and i'm sure Skip can do it, just need to see an example i can replicate. I tried about every variation i could think of and suspect i got close but close enough. lol. Any pointers that would get me past this would be greatly appreciated. And i'll open a PR to add several Firebase additions once its thoroughly tested Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Thanks for contributing! Even though Swift doesn't support abstract classes, the transpiled Kotlin doesn't know that 😁 I think something like this should do the trick: #if SKIP
class VerificationStateChangedCallbacks: com.google.firebase.auth.PhoneAuthProvider.OnVerificationStateChangedCallbacks {
init() {
}
override func onVerificationCompleted(credential: com.google.firebase.auth.PhoneAuthCredential) {
logger.log("onVerificationCompleted: \(credential)")
}
override func onVerificationFailed(exception: com.google.firebase.FirebaseException) {
logger.log("onVerificationFailed: \(exception)")
}
}
#endif |
Beta Was this translation helpful? Give feedback.
-
grrrrrrr... i swear i tried that exact thing, but i had marked the class as public (out of habit). FWIW i'm doing my changes within the SkipFirebaseAuth file in the skip-firebase package so it was already #SKIP'd. I'm sure the docs mention it somewhere but i cannot recall why that alone would cause it to not compile. Regardless, thank you very much and apologies for getting so close but missing that one detail. |
Beta Was this translation helpful? Give feedback.
Thanks for contributing!
Even though Swift doesn't support abstract classes, the transpiled Kotlin doesn't know that 😁
I think something like this should do the trick: