-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
206 lines (195 loc) · 7.66 KB
/
App.tsx
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
import React, {Component, useEffect, useReducer, useRef, useState} from 'react';
import {LogBox, StyleSheet, Text} from 'react-native';
import 'react-native-gesture-handler';
import {NavigationContainer} from '@react-navigation/native';
import {OurDarkTheme, OurDefaultTheme} from './src/shared/styles/theme';
import {OnboardingStack} from './src/navigation/onboarding';
// import {
// appsFlyerDeepLinkListener,
// DLListener,
// initializeAppsflyerSdk,
// linking,
// onAppOpenAttributionCanceller,
// onDeepLinkCanceller,
// onInstallConversionDataCanceller,
// } from './src/services/appsflyer/appsflyer';
// import AnimatedLoader from 'react-native-animated-loader';
// import {initializeSentry} from './src/services/monitoring/sentry';
// import {initializeOneSignal} from './src/services/push/push';
import {TabNavigator} from './src/navigation/tabnavigator';
import {useSelector} from 'react-redux';
// import messaging from '@react-native-firebase/messaging';
import {
getCompletedOnboardingAsyncStorage,
setCompletedOnboardingAsyncStorage,
} from './src/shared/utils/helpers';
import DataProvider, {useData} from './src/shared/utils/DataContext';
import AuthProvider, {useAuth, withAuth} from './src/shared/utils/AuthContext';
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
import {PersistGate} from 'redux-persist/integration/react';
// import {initializeApp} from 'firebase/app';
import Constants, {ExecutionEnvironment} from 'expo-constants';
import * as Notifications from 'expo-notifications';
import {Chat, OverlayProvider} from 'stream-chat-expo';
import {StreamChat} from 'stream-chat';
import {GestureHandlerRootView} from 'react-native-gesture-handler';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {Provider, observer} from 'mobx-react';
import {StoresProvider} from './src/common/hooks/use-stores';
import {getStores} from './AppStores';
import {QueryProvider} from './src/services';
import NavigationService, {
navigationRef,
} from './src/navigation/NavigationService';
import {StreamApp} from 'expo-activity-feed';
import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';
import ThemedStyles from './src/styles/ThemedStyles';
import {Provider as ReduxProvider} from 'react-redux';
import {store as redux_store} from './src/redux/store';
import {Audio, InterruptionModeAndroid, InterruptionModeIOS} from 'expo-av';
import mobileAds from 'react-native-google-mobile-ads';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import ErrorBoundary from './src/common/components/ErrorBoundary';
// import {check, request, PERMISSIONS, RESULTS} from 'expo-permissions';
const API_KEY = 'gqp7auuzq5b3';
// const client = StreamChat.getInstance(API_KEY);
LogBox.ignoreLogs([
'Require cycle:',
'Non-serializable values were found in the navigation state',
'source.uri should not be an empty string',
'Failed prop type: Invalid prop',
'Possible Unhandled Promise Rejection',
'LinearGradient colors and locations props should be arrays of the same length',
'Could not find',
'Sending',
'Each child',
'ImmutableState',
'[AppLovinSdk]',
'Some error occurred',
'Mismatch between',
'new Native',
'Encountered two',
]);
const isExpoGo =
Constants.executionEnvironment === ExecutionEnvironment.StoreClient;
console.log(
'Constants.executionEnvironment is ',
Constants.executionEnvironment,
);
let analytics, messaging;
if (!isExpoGo) {
console.log('! expo go.');
// eslint-disable-next-line @typescript-eslint/no-var-requires
analytics = require('@react-native-firebase/analytics').default;
messaging = require('@react-native-firebase/messaging').default;
}
type Props = {};
@observer
class App extends Component<Props> {
// const initializeAppLovin = () => {
// console.log('APPLOVIN.');
// if (Platform.OS === 'ios' && parseFloat(Platform.Version) >= 14.5) {
// // Enable the iOS consent flow programmatically - NSUserTrackingUsageDescription must be added to the Info.plist
// AppLovinMAX.setConsentFlowEnabled(true);
// AppLovinMAX.setPrivacyPolicyUrl('https://linedaddy.com/privacy/'); // mandatory
// AppLovinMAX.setTermsOfServiceUrl('https://linedaddy.com/terms/'); // optional
// }
//
// const KEY =
// 'h37RRZuxkfl7hnc3xMKAiTv1LmV6HztpxUtkeyk10a_pt4sm-HRGW0acNfpmEfz4VgF5yDO7R7ufN1D_VuEI1z';
// AppLovinMAX.setVerboseLogging(true);
//
// AppLovinMAX.initialize(KEY)
// .then(configuration => {
// // Attach ad listeners for interstitial ads, rewarded ads, and banner ads
// attachAdListeners();
// AppLovinMAX.showMediationDebugger();
// })
// .catch(error => {
// console.log('AppLovinMAX Error occurred: ', error);
// });
// };
// const attachAdListeners = () => {
// // Native Ad Listeners
// AppLovinMAX.addEventListener('OnNativeAdLoadedEvent', adInfo => {
// console.log('Native ad loaded from: ' + adInfo.networkName);
// });
// AppLovinMAX.addEventListener('OnNativeAdLoadFailedEvent', errorInfo => {
// console.log(
// 'Native ad failed to load with error code ' +
// errorInfo.code +
// ' and message: ' +
// errorInfo.message,
// );
// });
// AppLovinMAX.addEventListener('OnNativeAdClickedEvent', adInfo => {
// console.log('Native ad clicked');
// });
// AppLovinMAX.addEventListener('OnNativeAdRevenuePaid', adInfo => {
// console.log('Native ad revenue paid: ' + adInfo.revenue);
// });
// };
// useEffect(() => {
// // set global audio settings for the app
// Audio.setAudioModeAsync({
// playsInSilentModeIOS: true,
// interruptionModeIOS: InterruptionModeIOS.DoNotMix,
// shouldDuckAndroid: false,
// interruptionModeAndroid: InterruptionModeAndroid.DoNotMix,
// staysActiveInBackground: true,
// });
//
// mobileAds()
// .initialize()
// .then(adapterStatuses => {
// // Initialization complete!
// console.log('Initialized admob.');
// });
// }, []);
render() {
const stores = getStores();
return (
<StreamApp
apiKey={'gqp7auuzq5b3'}
token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiYmF0bWFuIn0.wQ_asT1i14aQa-v6WXhcNLpGYIoTNbJGekio4B8LAaQ"
appId="1266985
">
<GestureHandlerRootView style={appContainerStyle}>
<SafeAreaProvider>
<DataProvider>
<AuthProvider>
<QueryProvider>
<StoresProvider>
<ReduxProvider store={redux_store}>
<Provider key="app" {...stores}>
<NavigationContainer
// linking={linking}
ref={navigationRef}>
<BottomSheetModalProvider>
<ErrorBoundary
message="An error occurred"
containerStyle={ThemedStyles.style.centered}>
<TabNavigator
spinnerActive={false}
setSpinnerActive={() => {}}
/>
</ErrorBoundary>
</BottomSheetModalProvider>
</NavigationContainer>
</Provider>
</ReduxProvider>
</StoresProvider>
</QueryProvider>
</AuthProvider>
</DataProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
</StreamApp>
);
}
}
export default App;
const appContainerStyle = ThemedStyles.combine(
'flexContainer',
'bgPrimaryBackground',
);