Skip to content

Commit e2b9ac6

Browse files
committed
Add phone auth
1 parent 64a5d6f commit e2b9ac6

File tree

6 files changed

+35
-17
lines changed

6 files changed

+35
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Firebase dynamic link.
5454

5555
#### SJFirebaseAuthEmai
5656
```python
57-
class sjfirebase.jclass.auth.SJFirebaseAuthEmai
57+
class sjfirebase.jclass.emailauth.SJFirebaseAuthEmail
5858
```
5959
The entry point of the Firebase Authentication SDK.
6060
First, obtain an instance of this class by calling `get_instance`

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[tool.poetry]
22
name = "sjfirebase"
3-
version = "1.2.1"
4-
description = "Implement Firebase Java SDK in pytho"
3+
version = "1.3.1"
4+
description = "Implement Firebase Java SDK in python"
55
authors = ["Kenechukwu Akubue <kengoon19@gmail.com>"]
66
readme = "README.md"
77
packages = [{include = "sjfirebase"}]
88

99
[tool.poetry.dependencies]
10-
python = "^3.11"
10+
python = "^3.8"
1111
pyjnius = "^1.6.1"
1212

1313

sjfirebase/jclass/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .auth import *
1+
from .emailauth import *
22
from .storage import *
33
from .firestore import *
44
from .database import *

sjfirebase/jclass/phoneauth.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from jnius import JavaClass, MetaJavaClass, JavaStaticMethod
2+
from sjfirebase import package_path
3+
4+
__all__ = ("SJFirebaseAuthPhone", )
5+
6+
7+
class SJFirebaseAuthPhone(JavaClass, metaclass=MetaJavaClass):
8+
__javaclass__ = f"{package_path}SJFirebaseAuthPhone"
9+
get_instance = JavaStaticMethod("()Lcom/google/firebase/auth/FirebaseAuth;")
10+
startPhoneNumberVerification = JavaStaticMethod(
11+
"(Ljava/lang/String;"
12+
"Ljava/lang/Long;"
13+
"Landroid/app/Activity;"
14+
"Lcom/google/firebase/auth/PhoneAuthProvider$OnVerificationStateChangedCallbacks;)V"
15+
)
16+
resendVerificationCode = JavaStaticMethod(
17+
"(Ljava/lang/String;"
18+
"Ljava/lang/Long;Landroid/app/Activity;"
19+
"Lcom/google/firebase/auth/PhoneAuthProvider$OnVerificationStateChangedCallbacks;"
20+
"Lcom/google/firebase/auth/PhoneAuthProvider$ForceResendingToken;)V"
21+
)
22+
verifyPhoneNumberWithCode = JavaStaticMethod(
23+
"(Ljava/lang/String;Ljava/lang/String;)Lcom/google/firebase/auth/PhoneAuthCredential;"
24+
)

sjfirebase/jclass/storage.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
from jnius import JavaClass, MetaJavaClass, JavaMultipleMethod
2-
from sjfirebase import package_path
1+
from jnius import autoclass
2+
from sjfirebase import package
33

44
__all__ = ("SJFirebaseStorage", )
55

66

7-
class SJFirebaseStorage(JavaClass, metaclass=MetaJavaClass):
8-
__javaclass__ = f"{package_path}SJFirebaseStorage"
9-
get_instance = JavaMultipleMethod(
10-
[
11-
"()Lcom/google/firebase/storage/FirebaseStorage;",
12-
"(Ljava/lang/String;)Lcom/google/firebase/storage/FirebaseStorage;",
13-
"(Lcom/google/firebase/FirebaseApp;)Lcom/google/firebase/storage/FirebaseStorage;",
14-
"(Lcom/google/firebase/FirebaseApp;Ljava/lang/String;)Lcom/google/firebase/storage/FirebaseStorage;"
15-
]
16-
)
7+
class SJFirebaseStorage:
8+
@classmethod
9+
def get_instance(cls, *args):
10+
return autoclass(f"{package}SJFirebaseStorage").get_instance(*args)

0 commit comments

Comments
 (0)