Skip to content

Instantly share code, notes, and snippets.

@Younes-Charfaoui
Created September 12, 2019 00:22
Show Gist options
  • Save Younes-Charfaoui/806fc77c02d1c65853f534f6556c6cdf to your computer and use it in GitHub Desktop.
Save Younes-Charfaoui/806fc77c02d1c65853f534f6556c6cdf to your computer and use it in GitHub Desktop.
import com.google.firebase.FirebaseException
import com.google.firebase.auth.PhoneAuthCredential
import com.google.firebase.auth.PhoneAuthProvider
class PhoneCallbacks(private val listener : PhoneCallbacksListener) : PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
interface PhoneCallbacksListener {
fun onVerificationCompleted(credential: PhoneAuthCredential?)
fun onVerificationFailed(exception: FirebaseException?)
fun onCodeSent(
verificationId: String?,
token: PhoneAuthProvider.ForceResendingToken?
)
}
override fun onVerificationCompleted(phoneAuthCredential: PhoneAuthCredential?) {
listener.onVerificationCompleted(phoneAuthCredential)
}
override fun onVerificationFailed(exception: FirebaseException?) {
listener.onVerificationFailed(exception)
}
override fun onCodeSent(verificationId: String?, token: PhoneAuthProvider.ForceResendingToken?) {
listener.onCodeSent(verificationId,token)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment