From 0edfc730dafa1407efdeb8a6eed4c88c21aa1963 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期五, 19 十一月 2021 16:40:45 +0800 Subject: [PATCH] siri --- HDL-ON_iOS/AppDelegate.cs | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index 5da920e..81d1d57 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -10,6 +10,8 @@ using HDL_ON.UI; using HDL_ON.DAL.Server; using Intents; +using Other.Siri; +using HDLSceneSiri; namespace SharedMethod { @@ -473,6 +475,51 @@ HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway(); } + + + #region Siri + public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) + { + var intent = userActivity.GetInteraction()?.Intent as HDLRunSceneIntent; + if (!(intent is null)) + { + HandleIntent(intent); + return true; + } + else if (userActivity.ActivityType == NSUserActivityHelper.ViewMenuActivityType) + { + HandleUserActivity(); + return true; + } + return false; + } + + void HandleIntent(HDLRunSceneIntent intent) + { + var handler = new HDLRunSceneIntentHandlder(); + handler.HandleRunScene(intent, (response) => { + if (response.Code != HDLRunSceneIntentResponseCode.Success) + { + Console.WriteLine("Quantity must be greater than 0 to add to order"); + } + }); + } + + void HandleUserActivity() + { + //var rootViewController = Window?.RootViewController as UINavigationController; + //var orderHistoryViewController = rootViewController?.ViewControllers?.FirstOrDefault() as OrderHistoryTableViewController; + //if (orderHistoryViewController is null) + //{ + // Console.WriteLine("Failed to access OrderHistoryTableViewController."); + // return; + //} + //var segue = OrderHistoryTableViewController.SegueIdentifiers.SoupMenu; + //orderHistoryViewController.PerformSegue(segue, null); + } + #endregion + + } } -- Gitblit v1.8.0