@umituz/react-native-auth 1.6.4 → 1.6.5

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.4",
3
+ "version": "1.6.5",
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",
@@ -308,6 +308,10 @@ export class AuthService implements IAuthService {
308
308
  * Set guest mode (no authentication)
309
309
  */
310
310
  async setGuestMode(): Promise<void> {
311
+ /* eslint-disable-next-line no-console */
312
+ if (__DEV__) {
313
+ console.log("[AuthService] setGuestMode called");
314
+ }
311
315
  const auth = this.getAuth();
312
316
 
313
317
  // Sign out from Firebase if logged in
@@ -320,15 +324,31 @@ export class AuthService implements IAuthService {
320
324
  }
321
325
 
322
326
  this.isGuestMode = true;
327
+ /* eslint-disable-next-line no-console */
328
+ if (__DEV__) {
329
+ console.log("[AuthService] isGuestMode set to true");
330
+ }
323
331
 
324
332
  // Persist guest mode to storage
325
333
  try {
326
334
  await storageRepository.setString(GUEST_MODE_KEY, "true");
335
+ /* eslint-disable-next-line no-console */
336
+ if (__DEV__) {
337
+ console.log("[AuthService] Guest mode persisted to storage");
338
+ }
327
339
  } catch (error) {
328
340
  // Ignore storage errors - guest mode will still work in memory
341
+ /* eslint-disable-next-line no-console */
342
+ if (__DEV__) {
343
+ console.warn("[AuthService] Failed to persist guest mode to storage:", error);
344
+ }
329
345
  }
330
346
 
331
347
  // Emit event for AppNavigator to handle navigation
348
+ /* eslint-disable-next-line no-console */
349
+ if (__DEV__) {
350
+ console.log("[AuthService] Emitting guest-mode-enabled event");
351
+ }
332
352
  DeviceEventEmitter.emit("guest-mode-enabled");
333
353
  }
334
354
 
@@ -81,9 +81,21 @@ export const LoginForm: React.FC<LoginFormProps> = ({
81
81
  };
82
82
 
83
83
  const handleContinueAsGuest = async () => {
84
+ /* eslint-disable-next-line no-console */
85
+ if (__DEV__) {
86
+ console.log("[LoginForm] Continue as Guest button pressed");
87
+ }
84
88
  try {
85
89
  await continueAsGuest();
90
+ /* eslint-disable-next-line no-console */
91
+ if (__DEV__) {
92
+ console.log("[LoginForm] continueAsGuest completed");
93
+ }
86
94
  } catch (err) {
95
+ /* eslint-disable-next-line no-console */
96
+ if (__DEV__) {
97
+ console.error("[LoginForm] Error in continueAsGuest:", err);
98
+ }
87
99
  // Error handling is done in the hook
88
100
  }
89
101
  };
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { useEffect, useRef, useCallback, useState } from "react";
10
10
  import type { User } from "firebase/auth";
11
+ import { DeviceEventEmitter } from "react-native";
11
12
  import { getAuthService } from "../../infrastructure/services/AuthService";
12
13
  import { useFirebaseAuth } from "@umituz/react-native-firebase-auth";
13
14
 
@@ -109,6 +110,24 @@ export function useAuth(): UseAuthResult {
109
110
  }
110
111
  }, []);
111
112
 
113
+ // Listen for guest-mode-enabled event to update state
114
+ useEffect(() => {
115
+ const subscription = DeviceEventEmitter.addListener(
116
+ "guest-mode-enabled",
117
+ () => {
118
+ /* eslint-disable-next-line no-console */
119
+ if (__DEV__) {
120
+ console.log("[useAuth] Guest mode enabled event received");
121
+ }
122
+ setIsGuest(true);
123
+ }
124
+ );
125
+
126
+ return () => {
127
+ subscription.remove();
128
+ };
129
+ }, []);
130
+
112
131
  const signUp = useCallback(async (
113
132
  email: string,
114
133
  password: string,