Przeglądaj źródła

修改app 内打开chrome

zhejiushizhuce 2 lat temu
rodzic
commit
ef139bfd4a
1 zmienionych plików z 14 dodań i 26 usunięć
  1. 14 26
      src/App.js

+ 14 - 26
src/App.js

@@ -200,7 +200,7 @@ const App = () => {
     const appInitData=()=>{
         // scroll to top on route change
         checkInviteCode();
-        checkOpenInstallBox();
+        checkOpenInChrome();
         loadFont();
         //请求routes
         startReqRoutes();
@@ -239,20 +239,24 @@ const App = () => {
         checkOpenCheckin();
     }
     const checkOpenInstallBox=()=>{
-        if (global.installed===1)return;
-        global.installed=1;
+        if (promoteInstall>0){
+            if (global.installed===1)return;
+            global.installed=1;
+            let time=promoteInstall*1000;
+            // time=1000;
+            setTimeout(async ()=>{
+                if (!isShowInstallBox())return;
+                global.showInstallBox();
+            },time);
+        }
+    }
+    const checkOpenInChrome=()=>{
         let time=200;
-        // global.showBindPhone();
-        // time=1000;
         setTimeout(async ()=>{
-            // if (window.progressier==null)return ;
-            // if (window.progressier.detection.isStandalone())return;
-            // window.progressier.flow.init("install",true)
             if (!isShowInstallBox())return;
             if (isInAppBrowser()){
                 openUrlUseChrome();
             }
-            global.showInstallBox();
         },time);
     }
     //app Effect
@@ -311,23 +315,7 @@ const App = () => {
     },[serverKick])
     //监听安装提示
     useEffect(()=>{
-        // if (promoteInstall>0){
-        //     if (global.installed===1)return;
-        //     global.installed=1;
-        //     let time=promoteInstall*1000;
-        //     // global.showBindPhone();
-        //     // time=1000;
-        //     setTimeout(async ()=>{
-        //         // if (window.progressier==null)return ;
-        //         // if (window.progressier.detection.isStandalone())return;
-        //         // window.progressier.flow.init("install",true)
-        //         if (!isShowInstallBox())return;
-        //         if (isInAppBrowser()){
-        //             openUrlUseChrome();
-        //         }
-        //         global.showInstallBox();
-        //     },time);
-        // }
+        checkOpenInstallBox();
     },[promoteInstall])
     //监听打开pay
     useEffect(()=>{