فهرست منبع

#IQRV #comment [JS][Chromium] 支持未安装浏览器的提示

gifur 2 سال پیش
والد
کامیت
e6d1bf79ab

+ 1 - 0
Module/include/EventCode.h

@@ -938,6 +938,7 @@ ERROR_ACCESSAUTH_CONNECT_ACS}
 #define	LOG_EVT_CHROMIUM_OPEN_MAIN_WITH_UOSV2 0x40200018
 #define	LOG_EVT_CHROMIUM_OPEN_AD_WITH_UOSV2 0x40200019
 #define	LOG_EVT_CHROMIUM_BROWSER_USING_TYPE_CHANGE 0x4020001A
+#define	LOG_EVT_CHROMIUM_BROWSER_LACK_OF_NEWONE 0x4020001B
 
 #define LOG_EVT_CHROMIUM_USE_CUSTOM_FULTURE_URL 0x40200018
 #define LOG_SLV_CHROMIUM_URLOPEN      0x40200001  //chromium启动url

+ 42 - 8
Module/mod_ResourceWatcher/mod_ResourceWatcher.cpp

@@ -1765,17 +1765,51 @@ void ResourceWatcherEntity::FetchSystemSnapshot(
     SpReqAnsContext<ResourceWatcherService_FetchSystemSnapshot_Req, ResourceWatcherService_FetchSystemSnapshot_Ans>::Pointer ctx)
 {
     CSimpleStringA info(true);
-    const bool ret = m_fsm.GetMonitorInfo(info);
-    if (ret) {
-        ctx->Ans.result = 0;
-        ctx->Ans.msg = info;
-        LogWarn(Severity_Low, Error_Debug, LOG_INFO_MONITOR_SETTINGS_GET, info);
+    if (ctx->Req.type == 1) {
+        const bool ret = m_fsm.GetMonitorInfo(info);
+        if (ret) {
+            ctx->Ans.result = 0;
+            ctx->Ans.msg = info;
+            LogWarn(Severity_Low, Error_Debug, LOG_INFO_MONITOR_SETTINGS_GET, info);
 
+        } else {
+            ctx->Ans.result = -1;
+            ctx->Ans.msg = "调用 GetMonitorInfo 接口失败";
+        }
+        ctx->Answer(Error_Succeed);
+    } else if (ctx->Req.type == 2) { /** 有无安装新版浏览器 [Gifur@20221219]*/
+        const std::string execute_newbrowser_path = "/usr/share/browser/browser";
+        const std::string execute_oldbrowser_path = "/usr/share/uosbrowser/uosbrowser";
+		int result(0);
+		std::string additional("");
+        std::string succStr, errStr;
+        std::string runStr("dpkg -l | grep org.deepin.browser | awk '{print $3}'");
+        if (SP::Module::Util::ShellExecute(runStr, succStr, errStr)) {
+			if (succStr.empty()) {
+				if (ExistsFileA(execute_oldbrowser_path.c_str())) {
+					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s exists!", execute_oldbrowser_path.c_str());
+					result = 1;
+				} else {
+					DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s not exists!", execute_oldbrowser_path.c_str());
+				}
+			} else {
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("new browser version: %s", succStr.c_str());
+				additional = succStr;
+				if (!ExistsFileA(execute_newbrowser_path.c_str())) {
+					DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s not exists!", execute_newbrowser_path.c_str()); 
+				}
+				result = 2;
+			}
+            ctx->Ans.result = result;
+            ctx->Ans.msg = additional.c_str();
+            ctx->Answer(Error_Succeed);
+		} else {
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("execute '%s' failed!", runStr.c_str());
+            ctx->Answer(Error_Process);
+		}
     } else {
-        ctx->Ans.result = -1;
-        ctx->Ans.msg = "调用 GetMonitorInfo 接口失败";
+        ctx->Answer(Error_NotSupport);
     }
-    ctx->Answer(Error_Succeed);
 }
 
 SP_BEGIN_ENTITY_MAP()

+ 1 - 0
Module/mod_chromium/CModTools.cpp

@@ -1210,6 +1210,7 @@ namespace Chromium {
 				} else {
 					DbgEx("%s not exists!", execute_oldbrowser_path.c_str());
 				}
+				LogWarn(Severity_Low, Error_Debug, LOG_EVT_CHROMIUM_BROWSER_LACK_OF_NEWONE, "未安装新浏览器");
 			} else {
 				DbgEx("new browser version: %s", succStr.c_str());
 				additional = succStr;

+ 22 - 1
addin/res/ManagerDesktop/js/guide.js

@@ -2141,7 +2141,28 @@ $(function () {
     });
     
     $(document).on('click', '#guide_finish_restart_btn', function() {
-        FinshedDeploy();
+
+        let req = new Request();
+        req.type = 2;//检测是否有安装新版浏览器,没有则提示下载包安装
+        req.reserved1 = 0;
+        req.reserved2 = 0;
+        req.timeout = 10000;
+        utilStartSubmitDialog();
+        RVC.ResourceWatcherEntity.FetchSystemSnapshot(req, function(ret) {
+            utilStopSubmitDialog();
+            if(ret.errorCode === 0) {
+                let result = JSON.parse(ret[RVC.EntityController.sigResponseUUID])
+                if(result.result != 2) {
+                    utilStartAlertDialog("检测到未安装新版UOS浏览器,请记得下载并安装!否则将有可能影响业务输入法的使用(下载和安装请查看安装文档) ", function() {
+                        FinshedDeploy();
+                    });
+                } else {
+                    FinshedDeploy();
+                }
+            } else {
+                FinshedDeploy();
+            }
+        });
     });
 
     $(document).on('click', '#reset_btn', function() {