From 299f4b1218c0d3721aa92bf091950d6708942583 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期六, 28 八月 2021 15:45:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/newBranch1' into WJC

---
 HDL_ON/Common/ApiUtlis.cs |   66 ++++++++++++++++++++++++++++----
 1 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 2c4449a..9786858 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -204,7 +204,7 @@
                     {
                         endTime = DateTime.Now.AddSeconds(100);
                         MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛");
-                        var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
+                        var sceneList = JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString());
                         if (sceneList == null)
                         {
                             sceneList = new List<Scene>();
@@ -263,6 +263,7 @@
                     //}
 
                     //======================鑾峰彇鍙瀵硅璁惧鍒楄〃====================
+                    bool isInterphoneType_HDL = false;//鏄惁涓篐DLLinphone鍙瀵硅
                     var videoInfo= VideoSend.GetVideoInfoList();
                     if (videoInfo.Code == StateCode.SUCCESS)
                     {
@@ -274,10 +275,30 @@
                             if (video.interphoneType == InterphoneType.IMOUVISIAL.ToString())
                             {
                                 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();
                             }
                         }
                     }
 
+                    //======================鑾峰彇Sip璐﹀彿骞朵笖鍒濆鍖朣DK鍙瀵硅璁惧鍒楄〃====================
+                    //濡傛灉妫�娴嬬嚎绋嬫病鍚姩锛屾墠缁х画涓嬮潰鎿嶄綔 鍥犱负App鏈夊彲鑳藉垰鍚姩椹笂鏀跺埌鎺ㄩ�佷簡锛岀劧鍚庢墠鎵ц鍒拌繖閲�
+                    if (HDLLinphone.Current.CheckIncomingCallThreadIsNull()) {
+                        //褰撳墠浣忓畢鏄疕DL鍙瀵硅绫诲瀷鐨勮澶�
+                        if (isInterphoneType_HDL)
+                        {
+                            //HDLLinphone鍙瀵硅,鑾峰彇Sip璐﹀彿骞跺垵濮嬪寲SDK
+                            HDLLinphone.Current.GetHDLSipInfoAndInitSDK(DB_ResidenceData.Instance.CurrentRegion.id);
+                        }
+                        else
+                        {
+                            Utlis.WriteLine("褰撳墠浣忓畢涓嶆敮鎸丠DL鍙瀵硅,閫�鍑虹櫥褰曟墍鏈夎处鍙�");
+                            //褰撳墠浣忓畢涓嶆敮鎸丠DL鍙瀵硅
+                            HDLLinphone.Current.LogoutAllAccount();
+                        }
+                    }
 
                     //======================瀹夐槻====================
                     GetSecurityList();
@@ -294,8 +315,11 @@
                         MainPage.Log($"缁撴潫璇诲彇浜戠鏁版嵁绾跨▼");
                         endTime = DateTime.MinValue;
                         DownloadDataComplete = true;
-                        waitPage.Hide();
-                        waitPage.RemoveFromParent();
+                        if (waitPage != null)
+                        {
+                            waitPage.RemoveFromParent();
+                            waitPage = null;
+                        }
                     });
                     //涓嶈�冭檻缃戝叧鎯呭喌锛岀洿鎺ヨ闃�
                     DAL.Mqtt.MqttClient.InitState();
@@ -327,8 +351,11 @@
                     DownloadDataComplete = true;
                     Application.RunOnMainThread(() =>
                     {
-                        waitPage.Hide();
-                        waitPage.RemoveFromParent();
+                        if (waitPage != null)
+                        {
+                            waitPage.RemoveFromParent();
+                            waitPage = null;
+                        }
                     });
                     //鍒濆鍖栨暟鎹�
                     //SpatialInfo.CurrentSpatial.Clear();
@@ -388,17 +415,38 @@
                 }
                 var infoListPack = Ins.httpRequest.GetSecurityInfo(sidList, new List<string>());
                 var infoList = JsonConvert.DeserializeObject<List<SecurityAlarm>>(infoListPack.Data.ToString());
-                foreach (var function in infoList)
+                if (infoList != null)
                 {
-                    function.SaveFile();
-                    FunctionList.List.IniFunctionList(function.savePath, true);
+                    var filePathList = FileUtlis.Files.ReadFiles().FindAll((obj) => obj.StartsWith("SecurityData_"));
+                    if (filePathList != null)
+                    {
+                        foreach (var file in filePathList)
+                        {
+                            FileUtlis.Files.DeleteFile(file);
+                        }
+                    }
+                    foreach (var function in infoList)
+                    {
+                        function.SaveFile();
+                        FunctionList.List.IniFunctionList(function.savePath, true);
+                    }
                 }
-            }
+            } 
             else
             {
                 MainPage.Log($"璇诲彇瀹夐槻鍒楄〃澶辫触:Code:{pack.Code}; Msg:{pack.message}");
             }
 
         }
+
+        /// <summary>
+        /// 鑾峰彇SIP璐﹀彿淇℃伅
+        /// </summary>
+        public void GetSipInfo()
+        {
+            var pack = Ins.HttpRequest.GetSecurityList();
+        }
+
+
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0