-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebaseConfig.ts
More file actions
49 lines (42 loc) · 1.61 KB
/
firebaseConfig.ts
File metadata and controls
49 lines (42 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { initializeApp, getApps, FirebaseApp } from "firebase/app";
import { initializeAuth } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
import { getFunctions } from "firebase/functions";
import ReactNativeAsyncStorage from "@react-native-async-storage/async-storage";
import * as firebaseAuth from "firebase/auth";
const reactNativePersistence = (firebaseAuth as any).getReactNativePersistence;
// Import React Native Firebase to ensure it's initialized first
import "@react-native-firebase/app";
const firebaseConfig = {
apiKey: "AIzaSyCoMkTjfYne2GQ-OpWODSYo9GiMlXqzRg4",
authDomain: "harbor-ch.firebaseapp.com",
projectId: "harbor-ch",
storageBucket: "harbor-ch.firebasestorage.app",
messagingSenderId: "838717009645",
appId: "1:838717009645:web:0dba1cce14cf3f794426e4",
measurementId: "G-PVV6GZQQ8R",
};
// Initialize Firebase only if no apps exist (prevents conflicts)
let app: FirebaseApp;
if (getApps().length === 0) {
app = initializeApp(firebaseConfig);
} else {
app = getApps()[0];
}
// Initialize Firebase Auth with AsyncStorage persistence
export const auth = initializeAuth(app, {
persistence: reactNativePersistence(ReactNativeAsyncStorage),
});
// Initialize Firebase services
export const db = getFirestore(app);
export const storage = getStorage(app);
export const functions = getFunctions(app);
// Superwall configuration
export const SUPERWALL_CONFIG = {
apiKeys: {
ios: process.env.EXPO_PUBLIC_SUPERWALL_IOS_API_KEY || "",
android: process.env.EXPO_PUBLIC_SUPERWALL_ANDROID_API_KEY || "",
},
};
export default app;