|
@@ -19,7 +19,10 @@ import Analytics from 'appcenter-analytics';
|
|
|
|
|
|
|
|
const Index = () => {
|
|
const Index = () => {
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- checkUpdate();
|
|
|
|
|
|
|
+ Analytics.trackEvent("IntoApp", {versionName: app.versionName, versionCode: app.versionCode});
|
|
|
|
|
+ if (isIos) {
|
|
|
|
|
+ checkUpdate();
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
return (
|
|
return (
|
|
|
<RootSiblingParent>
|
|
<RootSiblingParent>
|
|
@@ -70,7 +73,7 @@ const checkUpdate = () => {
|
|
|
toastShort("Update installed")
|
|
toastShort("Update installed")
|
|
|
}
|
|
}
|
|
|
console.log("[CodePush]", "Update installed");
|
|
console.log("[CodePush]", "Update installed");
|
|
|
- //codePush.notifyAppReady();
|
|
|
|
|
|
|
+ codePush.notifyAppReady();
|
|
|
//codePush.restartApp(true);
|
|
//codePush.restartApp(true);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -80,15 +83,25 @@ const checkUpdate = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//热更新配置
|
|
//热更新配置
|
|
|
-let codePushOptions = {
|
|
|
|
|
- updateDialog: isIOS,
|
|
|
|
|
|
|
+let codePushIos = {
|
|
|
|
|
+ updateDialog: true,
|
|
|
//实时检测更新并下载
|
|
//实时检测更新并下载
|
|
|
checkFrequency: codePush.CheckFrequency.MANUAL,
|
|
checkFrequency: codePush.CheckFrequency.MANUAL,
|
|
|
//下载完成后立即安装
|
|
//下载完成后立即安装
|
|
|
- installMode: codePush.InstallMode.IMMEDIATE
|
|
|
|
|
|
|
+ //installMode: codePush.InstallMode.IMMEDIATE
|
|
|
//下次进入安装
|
|
//下次进入安装
|
|
|
//installMode: codePush.InstallMode.ON_NEXT_RESTART
|
|
//installMode: codePush.InstallMode.ON_NEXT_RESTART
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-AppRegistry.registerComponent(app.name, () => codePush(codePushOptions)(Index));
|
|
|
|
|
|
|
+let codePushAndroid = {
|
|
|
|
|
+ updateDialog: true,
|
|
|
|
|
+ //实时检测更新并下载
|
|
|
|
|
+ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
|
|
|
|
|
+ //下载完成后立即安装
|
|
|
|
|
+ installMode: codePush.InstallMode.IMMEDIATE
|
|
|
|
|
+ //下次进入安装
|
|
|
|
|
+ //installMode: codePush.InstallMode.ON_NEXT_RESTART
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+AppRegistry.registerComponent(app.name, () => codePush(isIOS ? codePushIos : codePushAndroid)(Index));
|
|
|
//AppRegistry.registerComponent(appName, () => Index);
|
|
//AppRegistry.registerComponent(appName, () => Index);
|