Major improvements: Firebase data migration, enhanced loading screens, multi-day prayer tracking
- Migrated all localStorage data to Firebase for cross-device sync
- Prayer drafts now stored in users/{userId}/drafts
- Reminder settings in users/{userId}/settings
- Prayer statistics in users/{userId}/statistics
- Implemented persistent 'most prayed for' tracking in Firebase
- Enhanced loading screen with animated backgrounds and gradients
- Fixed auth session restoration on hard refresh
- Added prayedDates array for multi-day prayer tracking
- Calendar now accurately shows all days a prayer was prayed for
- Enabled Firestore offline persistence for offline-first experience
- Updated Firestore security rules for new data structure
- Improved clock display (removed leading zero from hours)
- Moved clock below date on homepage with appropriate sizing
- Fixed data loading race conditions between auth and Firestore
This commit is contained in:
1 parent
2c29fc28d6
commit
67c5ff1b35
13 files changed
+419
-138
No files matched your search
+14
-1
@@ -1,7 +1,7 @@
|
||||
// Import the functions you need from the SDKs you need
|
||||
import { initializeApp } from 'firebase/app';
|
||||
import { getAuth } from 'firebase/auth';
|
||||
import { getFirestore } from 'firebase/firestore';
|
||||
import { getFirestore, enableIndexedDbPersistence, enableMultiTabIndexedDbPersistence } from 'firebase/firestore';
|
||||
import { getStorage } from 'firebase/storage';
|
||||
import { getAnalytics } from 'firebase/analytics';
|
||||
import { getMessaging, onMessage, getToken } from 'firebase/messaging';
|
||||
@@ -29,6 +29,19 @@ export const auth = getAuth(app);
|
||||
// Initialize Cloud Firestore and get a reference to the service
|
||||
export const db = getFirestore(app);
|
||||
|
||||
// Enable offline persistence
|
||||
if (typeof window !== 'undefined') {
|
||||
enableMultiTabIndexedDbPersistence(db).catch((err) => {
|
||||
if (err.code === 'failed-precondition') {
|
||||
// Multiple tabs open, persistence can only be enabled in one tab at a time
|
||||
console.warn('Firestore: Multiple tabs open, persistence disabled');
|
||||
} else if (err.code === 'unimplemented') {
|
||||
// The current browser doesn't support persistence
|
||||
console.warn('Firestore: Persistence not supported in this browser');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize Firebase Storage and get a reference to the service
|
||||
export const storage = getStorage(app);
|
||||
|
||||
|
||||
Reference in new issue
Block a user