@umituz/react-native-auth 1.6.8 → 1.6.9
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.9",
|
|
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",
|
|
@@ -105,18 +105,34 @@ export const LoginForm: React.FC<LoginFormProps> = ({
|
|
|
105
105
|
const handleContinueAsGuest = async () => {
|
|
106
106
|
/* eslint-disable-next-line no-console */
|
|
107
107
|
if (__DEV__) {
|
|
108
|
-
console.log("
|
|
108
|
+
console.log("========================================");
|
|
109
|
+
console.log("[LoginForm] 🎯 Continue as Guest button PRESSED");
|
|
110
|
+
console.log("[LoginForm] Current loading state:", loading);
|
|
111
|
+
console.log("[LoginForm] Current error state:", error);
|
|
112
|
+
console.log("========================================");
|
|
109
113
|
}
|
|
114
|
+
|
|
110
115
|
try {
|
|
116
|
+
/* eslint-disable-next-line no-console */
|
|
117
|
+
if (__DEV__) {
|
|
118
|
+
console.log("[LoginForm] Calling continueAsGuest() function...");
|
|
119
|
+
}
|
|
120
|
+
|
|
111
121
|
await continueAsGuest();
|
|
122
|
+
|
|
112
123
|
/* eslint-disable-next-line no-console */
|
|
113
124
|
if (__DEV__) {
|
|
114
|
-
console.log("[LoginForm] continueAsGuest completed");
|
|
125
|
+
console.log("[LoginForm] ✅ continueAsGuest() completed successfully");
|
|
126
|
+
console.log("[LoginForm] Current loading state after:", loading);
|
|
115
127
|
}
|
|
116
128
|
} catch (err) {
|
|
117
129
|
/* eslint-disable-next-line no-console */
|
|
118
130
|
if (__DEV__) {
|
|
119
|
-
console.error("[LoginForm]
|
|
131
|
+
console.error("[LoginForm] ❌ ERROR in continueAsGuest:", err);
|
|
132
|
+
console.error("[LoginForm] Error details:", {
|
|
133
|
+
message: err instanceof Error ? err.message : String(err),
|
|
134
|
+
stack: err instanceof Error ? err.stack : undefined,
|
|
135
|
+
});
|
|
120
136
|
}
|
|
121
137
|
// Error handling is done in the hook
|
|
122
138
|
}
|
|
@@ -173,10 +189,18 @@ export const LoginForm: React.FC<LoginFormProps> = ({
|
|
|
173
189
|
<View style={styles.buttonContainer}>
|
|
174
190
|
<AtomicButton
|
|
175
191
|
variant="outline"
|
|
176
|
-
onPress={
|
|
192
|
+
onPress={() => {
|
|
193
|
+
/* eslint-disable-next-line no-console */
|
|
194
|
+
if (__DEV__) {
|
|
195
|
+
console.log("[LoginForm] 🔘 AtomicButton onPress triggered for Continue as Guest");
|
|
196
|
+
console.log("[LoginForm] Button disabled state:", loading);
|
|
197
|
+
}
|
|
198
|
+
handleContinueAsGuest();
|
|
199
|
+
}}
|
|
177
200
|
disabled={loading}
|
|
178
201
|
fullWidth
|
|
179
202
|
style={styles.guestButton}
|
|
203
|
+
testID="continue-as-guest-button"
|
|
180
204
|
>
|
|
181
205
|
{t("auth.continueAsGuest")}
|
|
182
206
|
</AtomicButton>
|
|
@@ -235,41 +235,84 @@ export function useAuth(): UseAuthResult {
|
|
|
235
235
|
const continueAsGuest = useCallback(async () => {
|
|
236
236
|
/* eslint-disable-next-line no-console */
|
|
237
237
|
if (__DEV__) {
|
|
238
|
-
console.log("
|
|
238
|
+
console.log("========================================");
|
|
239
|
+
console.log("[useAuth] 🎯 continueAsGuest() CALLED");
|
|
240
|
+
console.log("[useAuth] Current state:", {
|
|
241
|
+
isGuest,
|
|
242
|
+
loading,
|
|
243
|
+
firebaseUser: firebaseUser?.uid || null,
|
|
244
|
+
});
|
|
245
|
+
console.log("========================================");
|
|
239
246
|
}
|
|
247
|
+
|
|
240
248
|
const service = getAuthService();
|
|
241
249
|
if (!service) {
|
|
242
250
|
/* eslint-disable-next-line no-console */
|
|
243
251
|
if (__DEV__) {
|
|
244
|
-
console.log("[useAuth] No service, setting isGuest directly");
|
|
252
|
+
console.log("[useAuth] ⚠️ No service available, setting isGuest directly");
|
|
245
253
|
}
|
|
246
254
|
setIsGuest(true);
|
|
247
255
|
return;
|
|
248
256
|
}
|
|
257
|
+
|
|
249
258
|
try {
|
|
259
|
+
/* eslint-disable-next-line no-console */
|
|
260
|
+
if (__DEV__) {
|
|
261
|
+
console.log("[useAuth] Setting loading to true...");
|
|
262
|
+
}
|
|
250
263
|
setLoading(true);
|
|
264
|
+
|
|
251
265
|
/* eslint-disable-next-line no-console */
|
|
252
266
|
if (__DEV__) {
|
|
253
|
-
console.log("[useAuth] Calling service.setGuestMode()");
|
|
267
|
+
console.log("[useAuth] 📞 Calling service.setGuestMode()...");
|
|
254
268
|
}
|
|
255
269
|
await service.setGuestMode();
|
|
270
|
+
|
|
256
271
|
/* eslint-disable-next-line no-console */
|
|
257
272
|
if (__DEV__) {
|
|
258
|
-
console.log("[useAuth] Service.setGuestMode() completed
|
|
273
|
+
console.log("[useAuth] ✅ Service.setGuestMode() completed successfully");
|
|
274
|
+
console.log("[useAuth] Setting isGuest to true...");
|
|
259
275
|
}
|
|
276
|
+
|
|
260
277
|
// State will be updated by event listener, but set it here too for immediate update
|
|
261
278
|
setIsGuest(true);
|
|
279
|
+
|
|
280
|
+
/* eslint-disable-next-line no-console */
|
|
281
|
+
if (__DEV__) {
|
|
282
|
+
console.log("[useAuth] ✅ isGuest set to true");
|
|
283
|
+
console.log("[useAuth] Current state after:", {
|
|
284
|
+
isGuest: true,
|
|
285
|
+
loading: true, // Still loading, will be set to false in finally
|
|
286
|
+
});
|
|
287
|
+
}
|
|
262
288
|
} catch (error) {
|
|
263
289
|
/* eslint-disable-next-line no-console */
|
|
264
290
|
if (__DEV__) {
|
|
265
|
-
console.error("[useAuth]
|
|
291
|
+
console.error("[useAuth] ❌ ERROR in continueAsGuest:", error);
|
|
292
|
+
console.error("[useAuth] Error details:", {
|
|
293
|
+
message: error instanceof Error ? error.message : String(error),
|
|
294
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
295
|
+
});
|
|
266
296
|
}
|
|
267
297
|
// Even if service fails, set guest mode locally
|
|
268
298
|
setIsGuest(true);
|
|
269
299
|
} finally {
|
|
300
|
+
/* eslint-disable-next-line no-console */
|
|
301
|
+
if (__DEV__) {
|
|
302
|
+
console.log("[useAuth] Setting loading to false...");
|
|
303
|
+
}
|
|
270
304
|
setLoading(false);
|
|
305
|
+
/* eslint-disable-next-line no-console */
|
|
306
|
+
if (__DEV__) {
|
|
307
|
+
console.log("[useAuth] ✅ continueAsGuest() FINISHED");
|
|
308
|
+
console.log("[useAuth] Final state:", {
|
|
309
|
+
isGuest,
|
|
310
|
+
loading: false,
|
|
311
|
+
});
|
|
312
|
+
console.log("========================================");
|
|
313
|
+
}
|
|
271
314
|
}
|
|
272
|
-
}, []);
|
|
315
|
+
}, [isGuest, firebaseUser]);
|
|
273
316
|
|
|
274
317
|
return {
|
|
275
318
|
user,
|