Skip to content

Commit bd5e102

Browse files
committed
add phone auth interface
1 parent ba29f65 commit bd5e102

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

sjfirebase/jinterface/phone.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
__all__ = ("VerificationStateChangeCallback",)
2+
3+
from jnius import PythonJavaClass, java_method
4+
5+
6+
class VerificationStateChangeCallback(PythonJavaClass):
7+
__javainterfaces__ = ["com/simplejnius/sjfirebase/callback/VerificationStateChangeCallback"]
8+
__javacontext__ = "app"
9+
10+
def __init__(self, on_code_sent, on_verification_completed, on_verification_failed):
11+
self.on_code_sent = on_code_sent
12+
self.on_verification_completed = on_verification_completed
13+
self.on_verification_failed = on_verification_failed
14+
15+
@java_method("(Ljava/lang/String;Lcom/google/firebase/auth/PhoneAuthProvider$ForceResendingToken;)V")
16+
def onCodeSent(self, verification_id, token):
17+
self.on_code_sent(verification_id, token)
18+
19+
@java_method("(Lcom/google/firebase/auth/PhoneAuthCredential;)V")
20+
def onVerificationCompleted(self, credentials):
21+
self.on_verification_completed(credentials)
22+
23+
@java_method("(Lcom/google/firebase/FirebaseException;)V")
24+
def onVerificationFailed(self, exception):
25+
self.on_verification_failed(exception)

0 commit comments

Comments
 (0)