@umituz/react-native-auth 1.6.0 → 1.6.2
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.2",
|
|
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",
|
|
@@ -204,6 +204,11 @@ export class AuthService implements IAuthService {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
// Clear guest mode when user signs up
|
|
208
|
+
if (this.isGuestMode) {
|
|
209
|
+
this.isGuestMode = false;
|
|
210
|
+
}
|
|
211
|
+
|
|
207
212
|
// Emit event for AppNavigator to handle navigation
|
|
208
213
|
DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
|
|
209
214
|
|
|
@@ -239,7 +244,10 @@ export class AuthService implements IAuthService {
|
|
|
239
244
|
params.password
|
|
240
245
|
);
|
|
241
246
|
|
|
242
|
-
|
|
247
|
+
// Clear guest mode when user signs in
|
|
248
|
+
if (this.isGuestMode) {
|
|
249
|
+
this.isGuestMode = false;
|
|
250
|
+
}
|
|
243
251
|
|
|
244
252
|
// Emit event for AppNavigator to handle navigation
|
|
245
253
|
DeviceEventEmitter.emit("user-authenticated", { userId: userCredential.user.uid });
|
|
@@ -287,6 +295,8 @@ export class AuthService implements IAuthService {
|
|
|
287
295
|
|
|
288
296
|
this.isGuestMode = true;
|
|
289
297
|
|
|
298
|
+
// Emit event for AppNavigator to handle navigation
|
|
299
|
+
DeviceEventEmitter.emit("guest-mode-enabled");
|
|
290
300
|
}
|
|
291
301
|
|
|
292
302
|
/**
|
|
@@ -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,
|