-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
100 lines (88 loc) · 3.02 KB
/
App.js
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
88
89
90
91
92
93
94
95
96
97
98
99
100
import React, {useEffect} from 'react';
import {NavigationContainer} from '@react-navigation/native';
import 'react-native-gesture-handler';
import {ResetPasswordScreen} from './src/pages/auth';
import {createStackNavigator} from '@react-navigation/stack';
import PaymentScreen from './src/pages/payment/PaymentScreen';
import QrCodeScannerScreen from './src/pages/payment/QrCodeScannerScreen';
import CoreNavigation from './src/navigation/CoreNavigation';
import AddCategory from './src/pages/explore/AddCategory';
import EditCategory from './src/pages/explore/EditCategory';
import {
getFcmToken,
notificationListener,
requestUserPermission,
} from './src/utils/pushNotification';
import messaging from '@react-native-firebase/messaging';
import {Alert} from 'react-native';
import {onDisplayNotification} from './src/utils/notifeeNotify';
import {LocalStorage} from './src/helpers/LocalStorage';
import {catData} from './src/data/catData';
import SmsListener from './src/utils/SmsListener';
import {requestReadSmsPermission} from './src/utils/commonUtils';
const MainStack = createStackNavigator();
export default function App() {
useEffect(() => {
// requestUserPermission();
// notificationListener();
// getFcmToken();
let allCategory = LocalStorage.getString('categories')
? JSON.parse(LocalStorage.getString('categories'))
: [];
if (allCategory.length === 0) {
LocalStorage.set('categories', JSON.stringify(catData));
}
}, []);
// useEffect(() => {
// const unsubscribe = messaging().onMessage(async remoteMessage => {
// Alert.alert('A new FCM message arrived!', JSON.stringify(remoteMessage));
// onDisplayNotification();
// });
// return unsubscribe;
// }, []);
// useEffect(() => {
// requestReadSmsPermission();
// const onSmsReceived = event => {
// const sms = event.message;
// console.log('==smssmssmssms==================================');
// console.log(sms);
// console.log('=================smssms===================');
// // Process the SMS here, extract payment information and create expense categories
// };
// SmsListener.startListener(onSmsReceived);
// return () => {
// SmsListener.stopListener(onSmsReceived);
// };
// }, []);
return (
<NavigationContainer>
<MainStack.Navigator
screenOptions={{
headerShown: false,
}}>
<MainStack.Screen
options={{
headerShown: false,
}}
name="CoreNavigation"
component={CoreNavigation}
/>
<MainStack.Screen
options={{
headerShown: false,
}}
name="AddCategory"
component={AddCategory}
/>
<MainStack.Screen name="PaymentScreen" component={PaymentScreen} />
<MainStack.Screen
options={{
headerShown: false,
}}
name="EditCategory"
component={EditCategory}
/>
</MainStack.Navigator>
</NavigationContainer>
);
}