@umituz/react-native-auth 1.6.0 → 1.6.1
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-auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Authentication service for React Native apps - Secure, type-safe, and production-ready. Provider-agnostic design supports Firebase Auth and can be adapted for Supabase or other providers.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -239,7 +239,10 @@ export class AuthService implements IAuthService {
|
|
|
239
239
|
params.password
|
|
240
240
|
);
|
|
241
241
|
|
|
242
|
-
|
|
242
|
+
// Clear guest mode when user signs in
|
|
243
|
+
if (this.isGuestMode) {
|
|
244
|
+
this.isGuestMode = false;
|
|
245
|
+
}
|
|
243
246
|
|
|
244
247
|
// Emit event for AppNavigator to handle navigation
|
|
245
248
|
DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
|
|
@@ -287,6 +290,8 @@ export class AuthService implements IAuthService {
|
|
|
287
290
|
|
|
288
291
|
this.isGuestMode = true;
|
|
289
292
|
|
|
293
|
+
// Emit event for AppNavigator to handle navigation
|
|
294
|
+
DeviceEventEmitter.emit("guest-mode-enabled");
|
|
290
295
|
}
|
|
291
296
|
|
|
292
297
|
/**
|
|
@@ -52,7 +52,11 @@ export function useAuth(): UseAuthResult {
|
|
|
52
52
|
const { user: firebaseUser, loading: firebaseLoading } = useFirebaseAuth();
|
|
53
53
|
|
|
54
54
|
// App-specific state
|
|
55
|
-
|
|
55
|
+
// Initialize isGuest from service if available
|
|
56
|
+
const [isGuest, setIsGuest] = useState(() => {
|
|
57
|
+
const service = getAuthService();
|
|
58
|
+
return service ? service.getIsGuestMode() : false;
|
|
59
|
+
});
|
|
56
60
|
const [error, setError] = useState<string | null>(null);
|
|
57
61
|
const [loading, setLoading] = useState(false);
|
|
58
62
|
const prevAuthState = useRef({ isAuthenticated: false, isGuest: false });
|
|
@@ -94,6 +98,17 @@ export function useAuth(): UseAuthResult {
|
|
|
94
98
|
}
|
|
95
99
|
}, [firebaseUser, isGuest]);
|
|
96
100
|
|
|
101
|
+
// Sync isGuest state with service on mount
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
const service = getAuthService();
|
|
104
|
+
if (service) {
|
|
105
|
+
const serviceIsGuest = service.getIsGuestMode();
|
|
106
|
+
if (serviceIsGuest !== isGuest) {
|
|
107
|
+
setIsGuest(serviceIsGuest);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, []);
|
|
111
|
+
|
|
97
112
|
const signUp = useCallback(async (
|
|
98
113
|
email: string,
|
|
99
114
|
password: string,
|