-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
87 lines (79 loc) · 2.79 KB
/
App.tsx
File metadata and controls
87 lines (79 loc) · 2.79 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* CodeRoutine - Alpha Version
*
* A daily coding knowledge routine app with automatic progress tracking,
* immutable read status, and clean user experience.
*
* Features:
* - Daily coding articles
* - Automatic read marking at 100% progress
* - Immutable read status (once read, never modified)
* - Progress tracking and reading streaks
* - Offline caching and performance optimization
*/
import React, { useEffect } from 'react';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { ThemeProvider } from './src/context/ThemeContext';
import { AppProvider } from './src/context/AppContext';
import { ModalProvider } from './src/context/ModalContext';
import { NotificationProvider } from './src/context/NotificationContext';
import { NotificationModalProvider } from './src/context/NotificationModalContext';
import { PodcastProvider } from './src/context/PodcastContext';
import { ToastProvider } from './src/components/Toast';
import Navigation from './src/components/Navigation';
import SplashScreen from './src/screens/SplashScreen';
import NotificationOnboarding from './src/components/onboarding/NotificationOnboarding';
import { firebaseService } from './src/services/firebaseService';
import { firebaseApp } from './src/services/firebaseApp';
function AppContent() {
const [isInitialized, setIsInitialized] = React.useState(false);
const handleInitializationComplete = () => {
setIsInitialized(true);
};
if (!isInitialized) {
return <SplashScreen onInitializationComplete={handleInitializationComplete} />;
}
return (
<NotificationOnboarding>
<Navigation />
</NotificationOnboarding>
);
}
export default function App() {
useEffect(() => {
const initializeServices = async () => {
try {
// Initialize Firebase service (API backend)
await firebaseService.initialize();
} catch (error) {
console.error('App services initialization error:', error);
// Log initialization errors to Crashlytics (if available)
try {
firebaseApp.logError('App services initialization failed', error);
} catch (crashlyticsError) {
console.warn('Could not log error to Crashlytics:', crashlyticsError);
}
}
};
initializeServices();
}, []);
return (
<SafeAreaProvider>
<ThemeProvider>
<ModalProvider>
<NotificationModalProvider>
<NotificationProvider>
<AppProvider>
<PodcastProvider>
<ToastProvider>
<AppContent />
</ToastProvider>
</PodcastProvider>
</AppProvider>
</NotificationProvider>
</NotificationModalProvider>
</ModalProvider>
</ThemeProvider>
</SafeAreaProvider>
);
}