From 505effa88b17ce8c3c7ac5403b76d9e5d0cfc2a5 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期一, 28 十月 2024 11:58:31 +0800 Subject: [PATCH] 谷歌版本问题修复 --- HDL_ON/Common/ApiUtlis.cs | 174 ++++++++++++++++++++++------------------------------------ 1 files changed, 66 insertions(+), 108 deletions(-) diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index d4666d5..bb5653a 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using HDL_ON.DAL.Server; using HDL_ON.Entity; +using HDL_ON.UI; using HDL_ON.UI.UI2.FuntionControlView.Video; using HDL_ON.UI.UI2.Intelligence.Automation; using Newtonsoft.Json; @@ -104,7 +105,7 @@ string code = StateCode.SUCCESS; Inverter.Ins.H5Page = null;//閲嶇疆鍏変紡椤甸潰 - var downloadDataThread = new System.Threading.Thread(async() => + var downloadDataThread = new System.Threading.Thread(() => { try { @@ -280,26 +281,6 @@ } MainPage.Log($"鍒锋柊涓汉淇℃伅鎴愬姛"); - //int count = 0; - //while (count < 10) - //{ - // if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) - // { - // System.Threading.Thread.Sleep(200); - // } - // else - // { - // break; - // } - // count++; - //} - //if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) - //{ - // return; - //} - - //return; - try { //===================鎴块棿======================= @@ -345,7 +326,7 @@ { FunctionList.List.ClearDatas(); MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); - MainPage.Log($"sid鍒楄〃鑾峰彇====\r\n", deviceResult.Data.ToString()); + //MainPage.Log($"sid鍒楄〃鑾峰彇====\r\n", deviceResult.Data.ToString()); var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); if (deviceList == null) { @@ -416,7 +397,6 @@ //} //======================鑾峰彇鍙瀵硅璁惧鍒楄〃==================== - bool isInterphoneType_HDL = false;//鏄惁涓篐DLLinphone鍙瀵硅 bool isInterphoneType_FREEVIEW = false;//鏄惁涓哄叏瑙嗛�氬彲瑙嗗璁� var videoInfo = VideoSend.GetVideoInfoList(); if (videoInfo.Code == StateCode.SUCCESS) @@ -432,69 +412,8 @@ { UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken; } - else if (video.interphoneType == InterphoneType.HDL.ToString()) - { - isInterphoneType_HDL = true; - DB_ResidenceData.Instance.SupportFacePass = true; - DB_ResidenceData.Instance.SaveResidenceData(); - DB_ResidenceData.Instance.SupportFVDevice = true; - } - else if (video.interphoneType == InterphoneType.FREEVIEW.ToString()) - { -#if __IOS__ - try - { - FunctionList.List.videoIntercom.Remove(video); - --i; - }catch(Exception ex) - { - MainPage.Log("Error", $"ios 鍏ㄨ閫氬紓甯� : {ex.StackTrace}"); - } - -#else - //涓哄叏瑙嗛�氬彲瑙嗗璁� - DB_ResidenceData.Instance.SupportFacePass = true; - Entity.DB_ResidenceData.Instance.SupportVisitorManage = true; - Entity.DB_ResidenceData.Instance.SupportFVDevice = true; - isInterphoneType_FREEVIEW = true; -#endif - } } } - - - //======================鑾峰彇Sip璐﹀彿骞朵笖鍒濆鍖朣DK鍙瀵硅璁惧鍒楄〃==================== - //濡傛灉妫�娴嬬嚎绋嬫病鍚姩锛屾墠缁х画涓嬮潰鎿嶄綔 鍥犱负App鏈夊彲鑳藉垰鍚姩椹笂鏀跺埌鎺ㄩ�佷簡锛岀劧鍚庢墠鎵ц鍒拌繖閲� - if (HDLLinphone.Current.CheckIncomingCallThreadIsNull()) - { - - //褰撳墠浣忓畢鏄疕DL鍙瀵硅绫诲瀷鐨勮澶� - if (isInterphoneType_HDL) - { - //HDLLinphone鍙瀵硅,鑾峰彇Sip璐﹀彿骞跺垵濮嬪寲SDK - HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo(); - callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; - callVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); - HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo); - } - else if (isInterphoneType_FREEVIEW) - { - //HDLLinphone鍙瀵硅,鑾峰彇Sip璐﹀彿骞跺垵濮嬪寲SDK - HDLCallVideoInfo callVideoInfo = new HDLCallVideoInfo(); - callVideoInfo.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; - callVideoInfo.InterphoneType = InterphoneType.FREEVIEW.ToString(); - HDLLinphone.Current.GetHDLSipInfoAndInitSDK(callVideoInfo); - } - else - { - Utlis.WriteLine("褰撳墠浣忓畢涓嶆敮鎸丠DL鍙瀵硅,閫�鍑虹櫥褰曟墍鏈夎处鍙�"); - //褰撳墠浣忓畢涓嶆敮鎸丠DL鍙瀵硅 - HDLLinphone.Current.LogoutAllAccount(); - } - } - - - //======================鐧诲綍鍏ㄨ閫�==================== if (isInterphoneType_FREEVIEW) { @@ -746,6 +665,34 @@ catch (Exception ex){ MainPage.Log("Error", $"璇诲彇鏈湴鏁版嵁寮傚父锛歿ex.StackTrace}"); } + + try + { + HomePage.LoadEvent_CheckTokenValid(); + if (IsValidToken && !UserInfo.Current.IsTipedInvalidToken) + { + UserInfo.Current.IsTipedInvalidToken = true; + UserInfo.Current.SaveUserInfo(); + Application.RunOnMainThread(() => + { + try + { + new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.TokenInvalidTipMsg, StringId.OfflineControl, StringId.GoLogin, () => + { + HDLCommon.Current.Logout(); + }); + } + catch (Exception ex) + { + MainPage.Log("Error", $"鎻愮ず鐧诲綍鍑瘉绐楀彛鍔犺浇寮傚父:{ex.StackTrace}"); + } + }); + } + } + catch (Exception ex) + { + MainPage.Log("Error", $"鏇存柊鐧诲綍鍑瘉鏂规硶璋冪敤寮傚父:{ex.StackTrace}"); + } } } }) @@ -778,39 +725,50 @@ { lock (FunctionList.List.securities) { - var pack = Ins.HttpRequest.GetSecurityList(); - if (pack.Code == StateCode.SUCCESS) + try { - var packList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString()); - Console.WriteLine("瀹夐槻鎬绘暟锛�" + packList.Count); - var sidList = new List<string>(); - foreach (var function in packList) + var pack = Ins.HttpRequest.GetSecurityList(); + if (pack.Code == StateCode.SUCCESS) { - sidList.Add(function.sid); - } - var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>()); - var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString()); - if (infoList != null) - { - var filePathList = FileUtlis.Files.ReadFiles().FindAll((obj) => obj.StartsWith("SecurityData_")); - if (filePathList != null) + var packList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(pack.Data.ToString()); + Console.WriteLine("瀹夐槻鎬绘暟锛�" + packList.Count); + var sidList = new List<string>(); + foreach (var function in packList) { - foreach (var file in filePathList) + sidList.Add(function.sid); + } + if (sidList.Count == 0) + { + return; + } + var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>()); + var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString()); + if (infoList != null) + { + var filePathList = FileUtlis.Files.ReadFiles().FindAll((obj) => obj.StartsWith("SecurityData_")); + if (filePathList != null) { - FileUtlis.Files.DeleteFile(file); + foreach (var file in filePathList) + { + FileUtlis.Files.DeleteFile(file); + } + } + FunctionList.List.securities.Clear(); + foreach (var function in infoList) + { + function.SaveFile(); + FunctionList.List.IniFunctionList(function.savePath, true); } } - FunctionList.List.securities.Clear(); - foreach (var function in infoList) - { - function.SaveFile(); - FunctionList.List.IniFunctionList(function.savePath, true); - } + } + else + { + MainPage.Log($"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{pack.Code}; Msg:{pack.message}"); } } - else + catch (Exception ex) { - MainPage.Log($"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{pack.Code}; Msg:{pack.message}"); + MainPage.Log("Error", $"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{ex.StackTrace}"); } } } -- Gitblit v1.8.0