From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001 From: hxb <hxb@hdlchina.com.cn> Date: 星期二, 30 八月 2022 09:37:38 +0800 Subject: [PATCH] 合并了IOS的代码 --- ZigbeeApp/Shared/Common/CommonPage.cs | 58 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 19 deletions(-) diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs old mode 100755 new mode 100644 index d72d0b2..6211aa3 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -34,7 +34,10 @@ AddChidren(Phone.UserView.HomePage.Instance); Application.MainPage.AddChidren(Loading); - Phone.UserView.HomePage.Instance.InitPage(); + Phone.UserView.HomePage.Instance.InitPage(); + + //璁剧疆椤堕儴鐘舵�佹爮鏂囧瓧涓洪粦鑹� + Application.SetStatusBarTextBlack(true); } //public static string RequestHttpsHost = "https://global.hdlcontrol.com/HangZhouHdlCloudApi"; @@ -42,12 +45,12 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.1.0120082701"; + //public static string CodeIDString = "1.1.0121070801"; + public static string CodeIDString = "1.2.1"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> public static int RegisterSoruceFromZIGBEE = 0; - public static string Source = "ZIGBEE"; /// <summary> /// Company 鐢ㄦ埛鍏徃鐢ㄤ簬鍏徃App瀹氬埗鐗� 榛樿0 /// </summary> @@ -106,9 +109,9 @@ /// </summary> /// <param name="requestUrl">璇锋眰Url</param> /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> - /// <param name="timeout">瓒呮椂,榛樿10绉�</param> + /// <param name="timeout">瓒呮椂,榛樿5绉�</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - public ResponseEntity.ResponsePack RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData, int timeout = 10) + public ResponseEntity.ResponsePack RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData, int timeout = 5) { string result = this.RequestHttpsZigbeeResultAsync(requestUrl, byteData, timeout); if (result != null) @@ -132,9 +135,9 @@ /// </summary> /// <param name="requestUrl">璇锋眰Url</param> /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> - /// <param name="timeout">瓒呮椂,榛樿10绉�</param> + /// <param name="timeout">瓒呮椂,榛樿5绉�</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - public string RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData, int timeout = 10) + public string RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData, int timeout = 5) { var result = RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData, "POST", timeout); if (result != null) @@ -151,9 +154,9 @@ /// <param name="requestUrl">璇锋眰Url</param> /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param> - /// <param name="timeout">瓒呮椂,榛樿10绉�</param> + /// <param name="timeout">瓒呮椂,榛樿5绉�</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - public byte[] RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST", int timeout = 10) + public byte[] RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST", int timeout = 5) { //璇锋眰Url鐨勫畬鎴愯矾寰� var fullUrl = $"{RequestHttpsHost}/{requestUrl}"; @@ -167,9 +170,9 @@ /// <param name="requestUrl">璇锋眰Url</param> /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param> - /// <param name="timeout">瓒呮椂,榛樿10绉�</param> + /// <param name="timeout">瓒呮椂,榛樿5绉�</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - public byte[] RequestZigbeeHttpsByAdmin(string requestUrl, byte[] byteData, string requestMethod = "POST", int timeout = 10) + public byte[] RequestZigbeeHttpsByAdmin(string requestUrl, byte[] byteData, string requestMethod = "POST", int timeout = 5) { //璇锋眰Url鐨勫畬鎴愯矾寰� var fullUrl = $"{Config.Instance.AdminRequestBaseUrl}/{requestUrl}"; @@ -184,9 +187,9 @@ /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param> /// <param name="token">token</param> /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param> - /// <param name="timeout">瓒呮椂,榛樿10绉�</param> + /// <param name="timeout">瓒呮椂,榛樿5绉�</param> /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns> - public byte[] DoRequestZigbeeHttpsInterface(string requestFullUrl, byte[] byteData, string token, string requestMethod = "POST", int timeout = 10) + public byte[] DoRequestZigbeeHttpsInterface(string requestFullUrl, byte[] byteData, string token, string requestMethod = "POST", int timeout = 5) { try { @@ -199,6 +202,7 @@ webRequest.Timeout = timeout * 1000; //鍙栨秷浣跨敤浠g悊璁块棶 webRequest.Proxy = null; + webRequest.UseDefaultCredentials = false; if (token != null) { //瀵瑰簲寰俊缃戝潃 @@ -305,6 +309,17 @@ } } } + } + + //娓呴櫎瑙掓爣鏁板�� + public void clearBadgeNum() + { + try + { + //this.RequestHttpsZigbeeResultAsync("ZigbeeUsers/CornerClear", null, 10); + this.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/CornerClear", null, "GET", 10); + } + catch { } } /// <summary> @@ -315,8 +330,12 @@ try { Application.RunOnMainThread(() => - { - //璁惧畾涓�涓椂闂� + { +#if iOS + //鍏ㄨ閫氶��鍑虹櫥褰� + Shared.IOS.HDLFVSDK.Video.Logout(); +#endif + //璁惧畾涓�涓椂闂� Config.Instance.LoginDateTime = new DateTime(1970, 1, 1); Config.Instance.Save(); CommonPage.Instance.RemoveAll(); @@ -355,10 +374,10 @@ /// <returns>杩斿洖鐘舵�佺爜</returns> public string PushRegID() { -#if DEBUG - //璋冭瘯涓嶉渶瑕佸彂閫佽繖涓笢瑗� - return null; -#endif +//#if DEBUG +// //璋冭瘯涓嶉渶瑕佸彂閫佽繖涓笢瑗� +// return null; +//#endif try { string deviceAlias; @@ -378,6 +397,7 @@ DeviceType = deviceType }; var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(RegIDObj); + Console.WriteLine(requestJson); var reverObj = CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/SignZigbeeNeedPushRegID", System.Text.Encoding.UTF8.GetBytes(requestJson), 4); if (reverObj == null) { -- Gitblit v1.8.0