@umituz/react-native-firebase 1.13.33 → 1.13.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.35",
|
|
4
4
|
"description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/auth/index.ts
CHANGED
|
@@ -43,13 +43,13 @@ export type {
|
|
|
43
43
|
export {
|
|
44
44
|
checkAuthState,
|
|
45
45
|
isAuthenticated,
|
|
46
|
-
|
|
46
|
+
isAnonymous,
|
|
47
47
|
getCurrentUserId,
|
|
48
48
|
getCurrentUser,
|
|
49
49
|
getCurrentUserIdFromGlobal,
|
|
50
50
|
getCurrentUserFromGlobal,
|
|
51
51
|
isCurrentUserAuthenticated,
|
|
52
|
-
|
|
52
|
+
isCurrentUserAnonymous,
|
|
53
53
|
verifyUserId,
|
|
54
54
|
getSafeUserId,
|
|
55
55
|
isValidUser,
|
|
@@ -21,7 +21,6 @@ function isAnonymousUser(user: User): boolean {
|
|
|
21
21
|
export interface AuthCheckResult {
|
|
22
22
|
isAuthenticated: boolean;
|
|
23
23
|
isAnonymous: boolean;
|
|
24
|
-
isGuest: boolean;
|
|
25
24
|
currentUser: User | null;
|
|
26
25
|
userId: string | null;
|
|
27
26
|
}
|
|
@@ -35,7 +34,6 @@ export function checkAuthState(auth: Auth | null): AuthCheckResult {
|
|
|
35
34
|
return {
|
|
36
35
|
isAuthenticated: false,
|
|
37
36
|
isAnonymous: false,
|
|
38
|
-
isGuest: false,
|
|
39
37
|
currentUser: null,
|
|
40
38
|
userId: null,
|
|
41
39
|
};
|
|
@@ -47,18 +45,14 @@ export function checkAuthState(auth: Auth | null): AuthCheckResult {
|
|
|
47
45
|
return {
|
|
48
46
|
isAuthenticated: false,
|
|
49
47
|
isAnonymous: false,
|
|
50
|
-
isGuest: false,
|
|
51
48
|
currentUser: null,
|
|
52
49
|
userId: null,
|
|
53
50
|
};
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
const anonymous = isAnonymousUser(currentUser);
|
|
57
|
-
|
|
58
53
|
return {
|
|
59
54
|
isAuthenticated: true,
|
|
60
|
-
isAnonymous:
|
|
61
|
-
isGuest: anonymous,
|
|
55
|
+
isAnonymous: isAnonymousUser(currentUser),
|
|
62
56
|
currentUser,
|
|
63
57
|
userId: currentUser.uid,
|
|
64
58
|
};
|
|
@@ -72,10 +66,10 @@ export function isAuthenticated(auth: Auth | null): boolean {
|
|
|
72
66
|
}
|
|
73
67
|
|
|
74
68
|
/**
|
|
75
|
-
* Check if user is
|
|
69
|
+
* Check if user is anonymous
|
|
76
70
|
*/
|
|
77
|
-
export function
|
|
78
|
-
return checkAuthState(auth).
|
|
71
|
+
export function isAnonymous(auth: Auth | null): boolean {
|
|
72
|
+
return checkAuthState(auth).isAnonymous;
|
|
79
73
|
}
|
|
80
74
|
|
|
81
75
|
/**
|
|
@@ -120,12 +114,12 @@ export function isCurrentUserAuthenticated(): boolean {
|
|
|
120
114
|
}
|
|
121
115
|
|
|
122
116
|
/**
|
|
123
|
-
* Check if current user is
|
|
117
|
+
* Check if current user is anonymous
|
|
124
118
|
* Convenience function that uses getFirebaseAuth()
|
|
125
119
|
*/
|
|
126
|
-
export function
|
|
120
|
+
export function isCurrentUserAnonymous(): boolean {
|
|
127
121
|
const auth = getFirebaseAuth();
|
|
128
|
-
return
|
|
122
|
+
return isAnonymous(auth);
|
|
129
123
|
}
|
|
130
124
|
|
|
131
125
|
/**
|