-
Notifications
You must be signed in to change notification settings - Fork 85
/
App.js
56 lines (46 loc) · 1.5 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
/**
* @version 0.43
* Init App
*/
import React, { useEffect } from 'react'
import SplashScreen from 'react-native-splash-screen'
import notifee, { EventType } from '@notifee/react-native'
import { Provider } from 'react-redux'
import { enableScreens } from 'react-native-screens'
import store from '@app/store'
import Application from '@app/appstores/Actions/App/App'
import Router from '@app/router'
import { ThemeProvider } from '@app/theme/ThemeProvider'
import Log from '@app/services/Log/Log'
import AppNotificationPopup from '@app/services/AppNotification/AppNotificationPopup'
enableScreens()
const App = () => {
useEffect(() => {
SplashScreen.hide()
Application.init({ source: 'App.mount', onMount: true })
const unsubscribePush = notifee.onForegroundEvent(async (message) => {
await Log.log('App.js notifee.useForegroundEvent message ' + JSON.stringify(message))
switch (message.type) {
case EventType.DISMISSED:
break
case EventType.PRESS:
AppNotificationPopup.onOpened(message?.detail?.notification)
break
}
})
return () => {
if (unsubscribePush) {
unsubscribePush()
}
Application.willUnmount()
}
}, [])
return (
<ThemeProvider>
<Provider store={store}>
<Router />
</Provider>
</ThemeProvider>
)
}
export default App