vbea 3 жил өмнө
parent
commit
9bc52819f9

+ 2 - 2
Strides-APP/android/app/version.properties

@@ -1,2 +1,2 @@
-#Tue Feb 14 17:36:03 CST 2023
-VERSION_CODE=138
+#Tue Feb 14 17:53:03 CST 2023
+VERSION_CODE=139

+ 19 - 6
Strides-APP/index.js

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

+ 3 - 0
Strides-APP/ios/Podfile

@@ -35,6 +35,9 @@ target 'JuicePlus' do
   pod 'GoogleUtilities', :modular_headers => true
   #微软热更新
   pod 'CodePush', :path => '../node_modules/react-native-code-push'
+  pod 'AppCenter', :path => '../node_modules/appcenter'
+  pod 'AppCenter/Analytics', :path => '../node_modules/appcenter-analytics'
+  pod 'AppCenter/Crashes', :path => '../node_modules/appcenter-crashes'
 
   use_react_native!(
     :path => config[:reactNativePath],