-
Notifications
You must be signed in to change notification settings - Fork 160
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
Fix android phone authentication #308
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,9 +91,6 @@ actual class PhoneAuthProvider(val android: com.google.firebase.auth.PhoneAuthPr | |
|
||
override fun onCodeSent(verificationId: String, forceResending: PhoneAuthProvider.ForceResendingToken) { | ||
verificationProvider.codeSent { android.verifyPhoneNumber(phoneNumber, verificationProvider.timeout, verificationProvider.unit, verificationProvider.activity, this, forceResending) } | ||
} | ||
|
||
override fun onCodeAutoRetrievalTimeOut(verificationId: String) { | ||
launch { | ||
val code = verificationProvider.getVerificationCode() | ||
try { | ||
|
@@ -104,6 +101,9 @@ actual class PhoneAuthProvider(val android: com.google.firebase.auth.PhoneAuthPr | |
} | ||
} | ||
|
||
override fun onCodeAutoRetrievalTimeOut(verificationId: String) { | ||
} | ||
|
||
override fun onVerificationCompleted(credential: com.google.firebase.auth.PhoneAuthCredential) { | ||
response.complete(Result.success(AuthCredential(credential))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i know this isnt your code but we shoudlnt be wrapping the result in a Result - can just fail the CompletableDeferred with completeExceptionally There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So instead of response.complete(Result.failure(exception)) we should do response.completeExceptionally(exception)? |
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll need to fail the CompletableDeferred here too otherwise it will hang?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think we should make a response.complete() in onCodeAutoRetrievalTimeOut(), because the response can be completed only once and we would not be able to make response.complete() after user input when onCodeAutoRetrievalTimeOut() is called before.
Maybe we could add a function inside PhoneVerificationProvider: onCodeAutoRetrievalTimeOut()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't want to complete, you fail it with the appropriate exception