-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
92 lines (69 loc) · 2.4 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, { useEffect } from 'react';
import AppNavigator from './src/navigation/AppNavigator';
import { DarkModeProvider } from 'react-native-dark-mode';
import { YellowBox } from 'react-native';
import 'react-native-gesture-handler';
import SplashScreen from 'react-native-splash-screen'
import { Provider } from 'react-redux'
import Store from './src/redux/store'
import OneSignal from 'react-native-onesignal';
const ONESIGNAL_APP_ID = "5a1bfa16-9a43-44ad-a29c-6afc84b3610a"
import Cache from './src/utils/cache'
// import ZendeskSupport from '@synapsestudios/react-native-zendesk-support';
import * as Zendesk from 'react-native-zendesk'
const App = () => {
const onReceived = (notification) => {
console.log("Notification received: ", notification);
}
const onOpened = (openResult) => {
console.log('Message: ', openResult.notification.payload.body);
console.log('Data: ', openResult.notification.payload.additionalData);
console.log('isActive: ', openResult.notification.isAppInFocus);
console.log('openResult: ', openResult);
}
const onIds = (device) => {
console.log('Device info: ', device);
Cache.pushToken = device.pushToken
SplashScreen.hide();
}
const initZendesk = () => {
const config = {
appId: '738437f6af0e47481ea490317c9c4276cc4425dd8d89c54f',
zendeskUrl: 'https://westindiatech.zendesk.com',
clientId: 'mobile_sdk_client_693cffd200bbb0a08273'
}
// ZendeskSupport.initialize(config)
// ZendeskSupport.setupIdentity(null)
Zendesk.initialize(config)
Zendesk.identifyAnonymous()
}
useEffect(() => {
console.disableYellowBox = true;
OneSignal.init(ONESIGNAL_APP_ID);
OneSignal.addEventListener('received', onReceived);
OneSignal.addEventListener('opened', onOpened);
OneSignal.addEventListener('ids', onIds);
initZendesk()
return () => {
OneSignal.removeEventListener('received', onReceived);
OneSignal.removeEventListener('opened', onOpened);
OneSignal.removeEventListener('ids', onIds);
}
}, [])
return (
<Provider store={Store}>
<DarkModeProvider>
<AppNavigator />
</DarkModeProvider>
</Provider>
);
};
export default App;
YellowBox.ignoreWarnings(['`-[RCTRootView cancelTouches]` is deprecated and will be deleted soon.',]);