From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 02 九月 2020 17:35:03 +0800
Subject: [PATCH] 2020-09-02-4

---
 ZigbeeApp/Home.Ios/AppDelegate.cs |  175 +++++++++++++++++++++++++++++----------------------------
 1 files changed, 89 insertions(+), 86 deletions(-)

diff --git a/ZigbeeApp/Home.Ios/AppDelegate.cs b/ZigbeeApp/Home.Ios/AppDelegate.cs
index f389cd1..36df79c 100644
--- a/ZigbeeApp/Home.Ios/AppDelegate.cs
+++ b/ZigbeeApp/Home.Ios/AppDelegate.cs
@@ -1,4 +1,4 @@
-锘縰sing System;
+锘縰sing System;
 using Foundation;
 using Microsoft.AppCenter;
 using Microsoft.AppCenter.Analytics;
@@ -23,7 +23,6 @@
 
         internal static UINavigationController rootViewController;
 
-
         public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
         {
             Shared.Application.IsGpsEnable = false;
@@ -37,7 +36,7 @@
             Window.MakeKeyAndVisible();
 
             Shared.IOS.TBL.WXApi.RegisterApp("wx2ec8f53f6fa36e82", "https://hdlcontrol.com/ZigbeeApp/");
-            Console.WriteLine("FinishedLaunching");
+
             DeviceTokenAction += (deviceToken) =>
             {
                 Shared.Common.Config.Instance.RegistrationID = deviceToken;
@@ -54,18 +53,18 @@
                         NSString key_hiddenJson = new NSString("HiddenJson");
                         if (userInfo.ContainsKey(key_hiddenJson))
                         {
-                            var hiddenJson = userInfo["HiddenJson"].ToString();
-                            if (!string.IsNullOrEmpty(hiddenJson))
-                            {
-                                if (hiddenJson.Contains("cmtID"))
-                                {
-                                    
-                                        ///鐩墠鏍规嵁杩欎釜鍒ゆ柇鏄惁鏄彲瑙嗗璁叉暟鎹�
-                                       // VideoMethod(hiddenJson);
-                                }
-                                else
+                            var hiddenJson = userInfo["HiddenJson"].ToString();
+                            if (!string.IsNullOrEmpty(hiddenJson))
+                            {
+                                if (hiddenJson.Contains("cmtID"))
                                 {
 
+                                    ///鐩墠鏍规嵁杩欎釜鍒ゆ柇鏄惁鏄彲瑙嗗璁叉暟鎹�
+                                    // VideoMethod(hiddenJson);
+                                }
+                                else
+                                {
+
                                     NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary;
                                     if (hiddenJsonDic != null)
                                     {
@@ -85,11 +84,11 @@
                                             }
                                         }
 
-                                    }
-                                }
+                                    }
+                                }
                             }
 
-                           
+
                         }
 
                     }
@@ -97,6 +96,7 @@
             }
             AppCenter.Start("0ca801a2-742b-42fb-ba10-7ba4391371aa", typeof(Analytics), typeof(Crashes));
             GDMapKit.setGDApiKey("3889cdfa4ef10c0d43348ffa2c1017c8");//楂樺痉鍦板浘key
+
             return true;
         }
 
@@ -106,33 +106,32 @@
         }
         public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
         {
-            Console.WriteLine("DidReceiveRemoteNotification");
             if (userInfo == null)
             {
                 return;
             }
             Console.WriteLine(userInfo);
 
-            if (application.ApplicationState == UIApplicationState.Active || application.ApplicationState == UIApplicationState.Background)//
+            if (application.ApplicationState == UIApplicationState.Active || application.ApplicationState == UIApplicationState.Background)
             {
                 NSString key_hiddenJson = new NSString("HiddenJson");
                 if (userInfo.ContainsKey(key_hiddenJson))
                 {
-                    var hiddenJson = userInfo["HiddenJson"].ToString();
-                    if (string.IsNullOrEmpty(hiddenJson))
-                    {
-                        return;
-                    }
-
-                    if (hiddenJson.Contains("cmtID"))
-                    {
-
-                        ///鐩墠鏍规嵁杩欎釜鍒ゆ柇鏄惁鏄彲瑙嗗璁叉暟鎹�
-                        VideoMethod(hiddenJson);
-                    }
-                    else
-                    {
-
+                    var hiddenJson = userInfo["HiddenJson"].ToString();
+                    if (string.IsNullOrEmpty(hiddenJson))
+                    {
+                        return;
+                    }
+
+                    if (hiddenJson.Contains("cmtID"))
+                    {
+
+                        ///鐩墠鏍规嵁杩欎釜鍒ゆ柇鏄惁鏄彲瑙嗗璁叉暟鎹�
+                        VideoMethod(hiddenJson);
+                    }
+                    else
+                    {
+
                         NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary;
                         if (hiddenJsonDic == null)
                         {
@@ -152,7 +151,7 @@
                                 //寮哄埗涓嬬嚎
                                 CommonPage.Instance.SingOut();
                                 CommonPage.Instance.ShowErrorInfoAlert(Shared.R.MyInternationalizationString.uHadBeenLoginAndOffLine);
-                            }
+                            }
                         }
                     }
                 }
@@ -162,20 +161,20 @@
                 NSString key_hiddenJson = new NSString("HiddenJson");
                 if (userInfo.ContainsKey(key_hiddenJson))
                 {
-
-                    var hiddenJson = userInfo["HiddenJson"].ToString();
-                    if (string.IsNullOrEmpty(hiddenJson)) {
-                        return;
-                    }
-
-                    if (hiddenJson.Contains("cmtID"))
-                    {
-                        ///鐩墠鏍规嵁杩欎釜鍒ゆ柇鏄惁鏄彲瑙嗗璁叉暟鎹�
-                        VideoMethod(hiddenJson);
-                    }
-                    else
-                    {
-
+
+                    var hiddenJson = userInfo["HiddenJson"].ToString();
+                    if (string.IsNullOrEmpty(hiddenJson)) {
+                        return;
+                    }
+
+                    if (hiddenJson.Contains("cmtID"))
+                    {
+                        ///鐩墠鏍规嵁杩欎釜鍒ゆ柇鏄惁鏄彲瑙嗗璁叉暟鎹�
+                        VideoMethod(hiddenJson);
+                    }
+                    else
+                    {
+
                         NSDictionary hiddenJsonDic = userInfo["HiddenJson"] as NSDictionary;
                         if (hiddenJsonDic == null)
                         {
@@ -194,50 +193,50 @@
                             {
                                 //鏍囪涓嬬嚎
                                 haveToSignOut = true;
-                            }
+                            }
                         }
                     }
                 }
 
             }
             completionHandler(UIBackgroundFetchResult.NewData);
-        }
-        /// <summary>
-        /// ios閫氱煡鏍忕偣鍑绘墦寮�鍙瀵硅鐨勬柟娉�
-        /// </summary>
-        /// <param name="hiddenJson">浜戠鎺ㄨ繃鏉ョ殑鏁版嵁</param>
-        private  void VideoMethod(string hiddenJson)
-        {
-
-            var json = Newtonsoft.Json.Linq.JObject.Parse(hiddenJson);
-            if (json == null)
-            {
-                return;
-            }
-            GateWay.Ios.ESVideoInfo eSVideoInfo = new GateWay.Ios.ESVideoInfo();
-            if (json["uuid"].ToString().Contains(","))
-            {
-                var uuid = json["uuid"].ToString().Split(',');
-                eSVideoInfo.ESVideoUUID = uuid[0];
-            }
-            else
-            {
-                eSVideoInfo.ESVideoUUID = json["uuid"].ToString();
-            }
-
-            eSVideoInfo.DeviceName = Language.StringByID(Shared.R.MyInternationalizationString.theOutdoorUnit);
-            eSVideoInfo.ESRoomID = int.Parse(json["roomno"].ToString());
-            if (!string.IsNullOrEmpty(json["unitno"].ToString()))
-            {
-                string str = json["unitno"].ToString();
-                string str1 = str.Substring(0, 2).TrimStart('0');
-                string str2 = str.Substring(2, 2).TrimStart('0');
-                eSVideoInfo.RoomName = str1 + Language.StringByID(Shared.R.MyInternationalizationString.dong) + str2 + Language.StringByID(Shared.R.MyInternationalizationString.unit);
-            }
-            GateWay.Ios.ESVideo.ShowESvideoVideoIntercom(eSVideoInfo);
-
-            //var url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/VideoIntercom/Answer";
-            //var dd=await Shared.Phone.Device.Logic.Send.HttpWebRequest(url, json.ToString(), "POST", 3, true);
+        }
+        /// <summary>
+        /// ios閫氱煡鏍忕偣鍑绘墦寮�鍙瀵硅鐨勬柟娉�
+        /// </summary>
+        /// <param name="hiddenJson">浜戠鎺ㄨ繃鏉ョ殑鏁版嵁</param>
+        private  void VideoMethod(string hiddenJson)
+        {
+
+            var json = Newtonsoft.Json.Linq.JObject.Parse(hiddenJson);
+            if (json == null)
+            {
+                return;
+            }
+            GateWay.Ios.ESVideoInfo eSVideoInfo = new GateWay.Ios.ESVideoInfo();
+            if (json["uuid"].ToString().Contains(","))
+            {
+                var uuid = json["uuid"].ToString().Split(',');
+                eSVideoInfo.ESVideoUUID = uuid[0];
+            }
+            else
+            {
+                eSVideoInfo.ESVideoUUID = json["uuid"].ToString();
+            }
+
+            eSVideoInfo.DeviceName = Language.StringByID(Shared.R.MyInternationalizationString.theOutdoorUnit);
+            eSVideoInfo.ESRoomID = int.Parse(json["roomno"].ToString());
+            if (!string.IsNullOrEmpty(json["unitno"].ToString()))
+            {
+                string str = json["unitno"].ToString();
+                string str1 = str.Substring(0, 2).TrimStart('0');
+                string str2 = str.Substring(2, 2).TrimStart('0');
+                eSVideoInfo.RoomName = str1 + Language.StringByID(Shared.R.MyInternationalizationString.dong) + str2 + Language.StringByID(Shared.R.MyInternationalizationString.unit);
+            }
+            GateWay.Ios.ESVideo.ShowESvideoVideoIntercom(eSVideoInfo);
+
+            //var url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/VideoIntercom/Answer";
+            //var dd=await Shared.Phone.Device.Logic.Send.HttpWebRequest(url, json.ToString(), "POST", 3, true);
         }
 
         public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
@@ -277,6 +276,10 @@
 
         public override void WillEnterForeground(UIApplication application)
         {
+            var internetStatus = GateWay.Ios.Reachability.InternetConnectionStatus();
+            Shared.Phone.UserCenter.HdlWifiLogic.Current.NetworkStateChanged((int)internetStatus);
+
+            //ZigBee.Common.Application.FindGateWaySocket.Start();
             // Called as part of the transiton from background to active state.
             // Here you can undo many of the changes made on entering the background.
             System.Console.WriteLine("WillEnterForeground");

--
Gitblit v1.8.0