@umituz/react-native-firebase 3.0.6 → 3.0.8
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": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
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",
|
|
@@ -47,7 +47,7 @@ class FirebaseAuthClientSingleton extends ServiceClientSingleton<Auth, FirebaseA
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
* Get Auth instance
|
|
50
|
+
* Get Auth instance with enhanced auto-initialization
|
|
51
51
|
*/
|
|
52
52
|
getAuth(): Auth | null {
|
|
53
53
|
// Attempt initialization if not already initialized
|
|
@@ -55,16 +55,26 @@ class FirebaseAuthClientSingleton extends ServiceClientSingleton<Auth, FirebaseA
|
|
|
55
55
|
try {
|
|
56
56
|
const app = getFirebaseApp();
|
|
57
57
|
if (app) {
|
|
58
|
-
this.initialize();
|
|
58
|
+
const auth = this.initialize();
|
|
59
|
+
if (__DEV__ && !auth) {
|
|
60
|
+
console.warn('[Firebase] Auto-initialization of Auth returned null');
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
if (__DEV__) {
|
|
64
|
+
console.warn('[Firebase] Firebase App not available for Auth auto-initialization');
|
|
65
|
+
}
|
|
59
66
|
}
|
|
60
67
|
} catch (error) {
|
|
61
68
|
// Silently handle auto-initialization errors
|
|
62
69
|
// The error will be stored in state for later retrieval
|
|
63
70
|
const errorMessage = error instanceof Error ? error.message : 'Auto-initialization failed';
|
|
64
71
|
this.setError(errorMessage);
|
|
72
|
+
if (__DEV__) {
|
|
73
|
+
console.error('[Firebase] Auth auto-initialization failed:', errorMessage);
|
|
74
|
+
}
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
|
-
//
|
|
77
|
+
// Return instance (will attempt auto-init if needed)
|
|
68
78
|
return this.getInstance(true);
|
|
69
79
|
}
|
|
70
80
|
}
|
|
@@ -51,23 +51,37 @@ export function createFirebaseInitModule(
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
if (!result.app) {
|
|
54
|
+
const errorMsg = 'Firebase configuration not found. Please set EXPO_PUBLIC_FIREBASE_* environment variables.';
|
|
54
55
|
if (__DEV__) {
|
|
55
|
-
console.
|
|
56
|
+
console.error(`[Firebase] ${errorMsg}`);
|
|
57
|
+
}
|
|
58
|
+
// In production, this is a critical error
|
|
59
|
+
if (critical) {
|
|
60
|
+
throw new Error(errorMsg);
|
|
56
61
|
}
|
|
57
62
|
return false;
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
if (result.auth === false && result.authError) {
|
|
66
|
+
const errorMsg = `Auth initialization failed: ${result.authError}`;
|
|
61
67
|
if (__DEV__) {
|
|
62
|
-
console.
|
|
68
|
+
console.error(`[Firebase] ${errorMsg}`);
|
|
69
|
+
}
|
|
70
|
+
// Auth failure is critical for apps that require authentication
|
|
71
|
+
if (critical && authInitializer) {
|
|
72
|
+
throw new Error(errorMsg);
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
return true;
|
|
67
77
|
} catch (error) {
|
|
68
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
78
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown Firebase initialization error';
|
|
69
79
|
if (__DEV__) {
|
|
70
|
-
console.
|
|
80
|
+
console.error(`[Firebase] Initialization failed: ${errorMessage}`);
|
|
81
|
+
}
|
|
82
|
+
// Re-throw in production if this is a critical module
|
|
83
|
+
if (critical) {
|
|
84
|
+
throw error;
|
|
71
85
|
}
|
|
72
86
|
return false;
|
|
73
87
|
}
|