-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
41 lines (32 loc) · 1.65 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
import { useEffect } from "react";
import { Navigator } from "./src/navigation/Navigator";
import CodePush from "react-native-code-push";
import { EnvironmentHelper } from "./src/helpers/EnvironmentHelper";
import { LogBox } from "react-native";
import { ErrorHelper } from "@churchapps/mobilehelper";
import React from "react";
const CODE_PUSH_OPTIONS = {
checkFrequency: CodePush.CheckFrequency.ON_APP_START
}
EnvironmentHelper.init();
const app = () => {
LogBox.ignoreLogs(['new NativeEventEmitter']);
useEffect(() => { CodePush.sync({ installMode: CodePush.InstallMode.IMMEDIATE }, syncWithCodePush); }, [])
const syncWithCodePush = (status: CodePush.SyncStatus) => {
switch (status) {
case CodePush.SyncStatus.AWAITING_USER_ACTION: console.log("AWAITING_USER_ACTION"); break;
case CodePush.SyncStatus.CHECKING_FOR_UPDATE: console.log("CHECKING_FOR_UPDATE"); break;
case CodePush.SyncStatus.DOWNLOADING_PACKAGE: console.log("DOWNLOADING_PACKAGE"); break;
case CodePush.SyncStatus.INSTALLING_UPDATE: console.log("INSTALLING_UPDATE"); break;
case CodePush.SyncStatus.SYNC_IN_PROGRESS: console.log("SYNC_IN_PROGRESS"); break;
case CodePush.SyncStatus.UNKNOWN_ERROR: console.log("UNKNOWN_ERROR"); break;
case CodePush.SyncStatus.UPDATE_IGNORED: console.log("UPDATE_IGNORED"); break;
case CodePush.SyncStatus.UPDATE_INSTALLED: console.log("UPDATE_INSTALLED"); break;
case CodePush.SyncStatus.UP_TO_DATE: console.log("UP_TO_DATE"); break;
}
console.log('Codepush sync status', status);
}
useEffect(() => { ErrorHelper.init(); }, []);
return <Navigator />
}
export default CodePush(CODE_PUSH_OPTIONS)(app);