From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 09:01:53 +0800
Subject: [PATCH] 更新

---
 HDL-ON_iOS/Other/SkipControl.cs |  119 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 103 insertions(+), 16 deletions(-)

diff --git a/HDL-ON_iOS/Other/SkipControl.cs b/HDL-ON_iOS/Other/SkipControl.cs
index 1613887..9a8439d 100644
--- a/HDL-ON_iOS/Other/SkipControl.cs
+++ b/HDL-ON_iOS/Other/SkipControl.cs
@@ -1,9 +1,11 @@
 锘縰sing System;
 using CoreGraphics;
 using Foundation;
+using HDL_ON.Entity;
+using HDLSceneSiri;
 using Intents;
 using IntentsUI;
-using Other.Siri;
+using Shared;
 using UIKit;
 
 namespace Other
@@ -20,34 +22,119 @@
             //user.View.BackgroundColor = new UIColor(242, 243, 247, 1);
 
             //HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(user, true);
-            var sDM = new SceneDateManager();
-            var isLogin = sDM.IsLgoin;//sDM.GetData(NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin);
 
 
+            var sDM = new SiriKit.SceneDateManager();
+            Console.WriteLine($"IsLogin:{sDM.IsLgoin};accessToken:{sDM.AccessToken};refreshToken:{sDM.RefreshToken};RegionUrl:{sDM.RegionUrl};HomeId:{sDM.HomeId}");
+
+            //NSMutableArray list = new NSMutableArray();
+            //foreach (var localScene in HDL_ON.Entity.FunctionList.List.scenes)
+            //{
+            //    list.Add(new HDLSceneSiri.HDLSiriControlModel()
+            //    {
+            //        UserSceneId = localScene.userSceneId,
+            //        Name = localScene.name,
+            //    });
+            //}
+            //var vc = new HDLSceneSiri.HDLSiriSceneListViewController();
+            //vc.DataSource = list;
+            ////vc.TitleName
+            ////PresentViewController(vc, true, null);
+            //HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(vc, true);
+
+
+            //1.鍒濆鍖杁ataList
+            NSMutableArray dataSourceList = new NSMutableArray();
+            //2.鍒濆鍖栧満鏅垪琛ㄦ暟鎹�
+            HDLSiriShortcutModel sceneModel = new HDLSiriShortcutModel();
+            if (Language.CurrentLanguage == "Chinese")
+            {
+                sceneModel.Title = "鍦烘櫙";
+                sceneModel.Content = "灏嗗満鏅坊鍔犲埌蹇嵎鎸囦护锛屽嵆鍙�氳繃Siri鎵ц";
+            }
+            else
+            {
+                sceneModel.Title = "Scenes";
+                sceneModel.Content = "Add the scene to the shortcut, which can be executed through Siri";
+            }
 
             NSMutableArray list = new NSMutableArray();
             foreach (var localScene in HDL_ON.Entity.FunctionList.List.scenes)
             {
-                list.Add(new HDLSceneSiri.HDLSiriSceneModel()
+                list.Add(new HDLSiriControlModel()
                 {
-                    UserSceneId = localScene.userSceneId,
-                    Name = localScene.name,
+                    ControlId = localScene.userSceneId,//涓嶈兘涓虹┖
+                    ControlName = localScene.name,//涓嶈兘涓虹┖
+                    ControlType = "1",//涓嶈兘涓虹┖
+                    ControlJSONStr = "1",//涓嶈兘涓虹┖
+                    ActionName = Language.CurrentLanguage == "Chinese"? "鍦烘櫙": "Scene"//涓嶈兘涓虹┖
                 });
             }
-            var vc = new HDLSceneSiri.HDLSiriSceneListViewController();
-            vc.DataSource = list;
-            //vc.TitleName
-            //PresentViewController(vc, true, null);
+            sceneModel.List = NSArray.FromArray<HDLSiriControlModel>(list);
+            dataSourceList.Add(sceneModel);
+
+            //3.鍒濆鍖栧畨闃插垪琛ㄦ暟鎹�
+            HDLSiriShortcutModel securityModel = new HDLSiriShortcutModel();
+            if (Language.CurrentLanguage == "Chinese")
+            {
+                securityModel.Title = "瀹夐槻";
+                securityModel.Content = "灏嗗畨闃叉坊鍔犲埌蹇嵎鎸囦护锛屽嵆鍙�氳繃Siri鎵ц";
+            }else
+            {
+                securityModel.Title = "Security";
+                securityModel.Content = "Add security to the shortcut, which can be executed through Siri";
+            }
+            NSMutableArray list2 = new NSMutableArray();
+            foreach (var temp in HDL_ON.Entity.FunctionList.List.securities)
+            {
+                SecurityState securityState = new SecurityState()
+                {
+                    gatewayId = DB_ResidenceData.Instance.HomeGateway.gatewayId,
+                    sid = temp.sid,
+                    status = "enable",
+                    userSecurityId = temp.userSecurityId
+                };
+
+                var ControlJSONStr = Newtonsoft.Json.JsonConvert.SerializeObject(securityState);
+
+                list2.Add(new HDLSiriControlModel()
+                {
+                    ControlId = temp.userSecurityId,//涓嶈兘涓虹┖
+                    ControlName = temp.name,//涓嶈兘涓虹┖
+                    ControlType = "2",//涓嶈兘涓虹┖
+                    ControlJSONStr = ControlJSONStr,//涓嶈兘涓虹┖
+                    ActionName = Language.CurrentLanguage == "Chinese" ? "瀹夐槻" : "Security"//涓嶈兘涓虹┖
+
+                });
+            }
+            securityModel.List = NSArray.FromArray<HDLSiriControlModel>(list2);
+            dataSourceList.Add(securityModel);
+            //4.璺宠浆Siri娣诲姞鎴栬�呯紪杈戠鐞嗛〉闈�
+            HDLSceneSiri.HDLSiriSceneListViewController vc = new HDLSceneSiri.HDLSiriSceneListViewController();
+            vc.DataSource = dataSourceList;
+            vc.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;//涓嶈兘涓虹┖
+            if (Language.CurrentLanguage == "Chinese")
+            {
+                vc.TitleName = "蹇嵎鎸囦护";
+            }
+            else
+            {
+                vc.TitleName = "Shortcut instruction";
+            }
+
             HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(vc, true);
+
+
         }
 
-        public void SetData(bool isLogin, string accessToken, string refreshToken, string regionUrl)
+        public void SetData(bool isLogin, string accessToken, string refreshToken, string regionUrl, string homeId)
         {
-            var sDM = new SceneDateManager();
-            sDM.SetIsLoginValue(isLogin);
-            sDM.SetAccessTokenValue(accessToken);
-            sDM.SetRefreshTokenValue(refreshToken);
-            sDM.SetRegionUrlValue(regionUrl);
+            var sDM = new SiriKit.SceneDateManager();
+            sDM.IsLgoin = isLogin;
+            sDM.AccessToken = accessToken;
+            sDM.RefreshToken = refreshToken;
+            sDM.RegionUrl = regionUrl;
+            sDM.HomeId = homeId;
         }
     }
 }

--
Gitblit v1.8.0