From 8655407ab6987bb7268fab55b6380051f26668fe Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 24 十一月 2021 10:17:15 +0800 Subject: [PATCH] 备份 --- SiriIntents/Entitlements.plist | 2 SiriIntents/SiriIntents.csproj | 7 HDL-ON_Android/Properties/AndroidManifest.xml | 2 SiriKit/SiriKit.csproj | 64 +++ SiriKit/Base.lproj/Intents.intentdefinition | 181 ++++++++++ HDL-ON_iOS/HDL-ON_iOS.csproj | 21 SiriIntentsUI/IntentViewController.cs | 111 ++++- SiriKit/Properties/AssemblyInfo.cs | 36 ++ HDL-ON_iOS/AppDelegate.cs | 43 - SiriIntentsUI/MainInterface.storyboard | 35 + HDL-ON_iOS/Info.plist | 2 SiriIntentsUI/Entitlements.plist | 4 HDL_ON/Common/HDLCommon.cs | 12 SiriKit/SiriScene.cs | 20 + SiriIntents/IntentHandler.cs | 171 ++++---- .vs/HDL_APP_Project/xs/UserPrefs.xml | 45 +- SiriIntentsUI/SiriIntentsUI.csproj | 4 HDL_ON/UI/UI1-Login/LoginPage.cs | 6 SiriKit/Support/NSUserDefaultsHelper.cs | 0 SiriKit/Data/SceneDateManager.cs | 44 -- SiriIntentsUI/Info.plist | 8 SiriKit/Support/NSUserActivityHelper.cs | 0 HDL_APP_Project.sln | 40 + SiriKit/HDLRunSceneIntentHandlder.cs | 51 ++ HDL-ON_iOS/Other/SkipControl.cs | 5 SiriKit/VoiceShortcutDataManager.cs | 93 +++++ /dev/null | 26 - SiriIntents/Info.plist | 16 SiriIntentsUI/IntentViewController.designer.cs | 29 + SiriKit/Data/DataManager.cs | 0 30 files changed, 776 insertions(+), 302 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 38b6359..b85694b 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -3,36 +3,40 @@ <MonoDevelop.MacDev.AppleDevelopmentTeam /> </MonoDevelop.Ide.ItemProperties.SiriIntentUI> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench ActiveDocument="SiriIntents/HDLRunSceneIntentHandlder.cs"> + <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI1-Login/LoginPage.cs"> <Files> - <File FileName="HDL-ON_iOS/Other/SkipControl.cs" Line="24" Column="30" /> - <File FileName="HDL_ON/DAL/Server/HttpServerRequest.cs" Line="603" Column="1" /> - <File FileName="HDL_ON/Entity/DB_ResidenceData.cs" Line="1" Column="1" /> - <File FileName="HDL_ON/Common/UserInfo.cs" Line="96" Column="22" /> - <File FileName="HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs" Line="95" Column="21" /> - <File FileName="HDL-ON_iOS/Other/Siri/Data/DataManager.cs" Line="30" Column="18" /> - <File FileName="HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs" Line="8" Column="52" /> - <File FileName="SiriIntents/HDLRunSceneIntentHandlder.cs" Line="18" Column="33" /> + <File FileName="SiriIntents/IntentHandler.cs" Line="28" Column="24" /> + <File FileName="SiriIntentsUI/IntentViewController.cs" Line="37" Column="1" /> + <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="220" Column="56" /> + <File FileName="HDL-ON_iOS/AppDelegate.cs" Line="475" Column="35" /> + <File FileName="SiriKit/HDLRunSceneIntentHandlder.cs" Line="30" Column="30" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> - <Node name="HDL-ON_iOS" expanded="True"> - <Node name="Other" expanded="True"> - <Node name="Siri" expanded="True" /> + <Node name="HDL_ON" expanded="True"> + <Node name="UI" expanded="True"> + <Node name="UI1-Login" expanded="True"> + <Node name="LoginPage.cs" selected="True" /> + </Node> </Node> </Node> + <Node name="HDL-ON_iOS" expanded="True"> + <Node name="References" expanded="True" /> + </Node> <Node name="SiriIntents" expanded="True"> - <Node name="HDLRunSceneIntentHandlder.cs" selected="True" /> + <Node name="References" expanded="True" /> + </Node> + <Node name="SiriIntentsUI" expanded="True" /> + <Node name="SiriKit" expanded="True"> + <Node name="References" expanded="True" /> + <Node name="Base.lproj" expanded="True" /> + <Node name="Data" expanded="True" /> + <Node name="Properties" expanded="True" /> + <Node name="Support" expanded="True" /> </Node> </Node> - </State> - </Pad> - <Pad Id="MonoDevelop.Debugger.WatchPad"> - <State> - <Value>tempFunction.deviceId</Value> - <Value>updata2.ToString()</Value> </State> </Pad> </Pads> @@ -44,15 +48,14 @@ <String>Shared.IOS/Shared.IOS.csproj</String> <String>SiriIntent/SiriIntent.csproj</String> <String>SceneKit/SceneKit.csproj</String> + <String>SiriBinding/SiriBinding.csproj</String> </DisabledProjects> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HdlSiriKit/SkipControl.cs" relfile="HdlSiriKit/SkipControl.cs" line="28" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/Other/SkipControl.cs" relfile="HDL-ON_iOS/Other/SkipControl.cs" line="28" column="1" /> <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HdlSiriKit/SkipControl.cs" relfile="HdlSiriKit/SkipControl.cs" line="14" column="1" /> - <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/Other/SkipControl.cs" relfile="HDL-ON_iOS/Other/SkipControl.cs" line="47" column="1" /> </BreakpointStore> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> diff --git a/HDL-ON_Android/Properties/AndroidManifest.xml b/HDL-ON_Android/Properties/AndroidManifest.xml index fb3d44f..64c39b9 100644 --- a/HDL-ON_Android/Properties/AndroidManifest.xml +++ b/HDL-ON_Android/Properties/AndroidManifest.xml @@ -176,5 +176,7 @@ <meta-data android:name="OPPO_APPID" android:value="OP-30619979" /> <meta-data android:name="OPPO_APPSECRET" android:value="OP-11d511c42f654cafac99588322681003" /> <!-- 鏋佸厜鎺ㄩ�佺粨鏉� --> + <!-- 璁剧疆楂樺痉鍦板浘key --> + <meta-data android:name="com.amap.api.v2.apikey" android:value="9901dd06e30b229efdd4c5bf5e076224" /> </application> </manifest> \ No newline at end of file diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs index 81d1d57..4568b86 100644 --- a/HDL-ON_iOS/AppDelegate.cs +++ b/HDL-ON_iOS/AppDelegate.cs @@ -11,7 +11,6 @@ using HDL_ON.DAL.Server; using Intents; using Other.Siri; -using HDLSceneSiri; namespace SharedMethod { @@ -279,32 +278,8 @@ // //RemoteInfo.Current.ReadMsgList(true); //} - #region Siri - // Request access to Siri - INPreferences.RequestSiriAuthorization((INSiriAuthorizationStatus status) => { - // Respond to returned status - switch (status) - { - case INSiriAuthorizationStatus.Authorized: - break; - case INSiriAuthorizationStatus.Denied: - break; - case INSiriAuthorizationStatus.NotDetermined: - break; - case INSiriAuthorizationStatus.Restricted: - break; - } - }); - - var language = INPreferences.SiriLanguageCode; - - // Take action based on language - if (language == "en-US") - { - // Do something... - } - - #endregion + //楂樺痉key + GDMapKit.setGDApiKey("f0635ea15c5d579c6e93d9f07a06da69"); Console.WriteLine("FinishedLaunching"); return true; @@ -477,10 +452,10 @@ - #region Siri + public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { - var intent = userActivity.GetInteraction()?.Intent as HDLRunSceneIntent; + var intent = userActivity.GetInteraction()?.Intent as HDLSceneSiri.HDLRunSceneIntent; if (!(intent is null)) { HandleIntent(intent); @@ -494,13 +469,13 @@ return false; } - void HandleIntent(HDLRunSceneIntent intent) + void HandleIntent(HDLSceneSiri.HDLRunSceneIntent intent) { - var handler = new HDLRunSceneIntentHandlder(); + var handler = new SiriKit.HDLRunSceneIntentHandlder(); handler.HandleRunScene(intent, (response) => { - if (response.Code != HDLRunSceneIntentResponseCode.Success) + if (response.Code != HDLSceneSiri.HDLRunSceneIntentResponseCode.Success) { - Console.WriteLine("Quantity must be greater than 0 to add to order"); + Console.WriteLine("Siri鎵ц澶辫触銆�"); } }); } @@ -517,8 +492,6 @@ //var segue = OrderHistoryTableViewController.SegueIdentifiers.SoupMenu; //orderHistoryViewController.PerformSegue(segue, null); } - #endregion - } diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 906a197..78772e7 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -470,10 +470,7 @@ <Folder Include="Resources\Phone\FunctionIcon\Light\LightScene\" /> <Folder Include="Resources\Phone\PersonalCenter\FacePassage\" /> <Folder Include="Resources\Phone\FunctionIcon\Electrical\AirSwitch\" /> - <Folder Include="Other\Siri\" /> - <Folder Include="Other\Siri\Data\" /> - <Folder Include="Other\Siri\Support\" /> - <Folder Include="Other\Siri\UI\" /> + <Folder Include="Base.lproj\" /> </ItemGroup> <ItemGroup> <InterfaceDefinition Include="LaunchScreen.storyboard" /> @@ -483,7 +480,6 @@ <InterfaceDefinition Include="Resources\EZ\Base.lproj\EZSupportViewController.xib" /> <InterfaceDefinition Include="Resources\EZ\Base.lproj\EZMain.storyboard" /> <InterfaceDefinition Include="Resources\EZ\Base.lproj\AddDevice.storyboard" /> - <InterfaceDefinition Include="Other\Siri\SiriBaseView.xib" /> </ItemGroup> <ItemGroup> <None Include="Info.plist" /> @@ -503,17 +499,6 @@ <Compile Include="Other\JLCountrycode.cs" /> <Compile Include="BlueWifi.cs" /> <Compile Include="Other\SkipControl.cs" /> - <Compile Include="Other\Siri\SiriBaseView.cs" /> - <Compile Include="Other\Siri\SiriBaseView.designer.cs"> - <DependentUpon>SiriBaseView.cs</DependentUpon> - </Compile> - <Compile Include="Other\Siri\VoiceShortcutDataManager.cs" /> - <Compile Include="Other\Siri\SiriScene.cs" /> - <Compile Include="Other\Siri\Data\SceneDateManager.cs" /> - <Compile Include="Other\Siri\Data\DataManager.cs" /> - <Compile Include="Other\Siri\Support\NSUserDefaultsHelper.cs" /> - <Compile Include="Other\Siri\Support\NSUserActivityHelper.cs" /> - <Compile Include="Other\Siri\UI\Cells.cs" /> </ItemGroup> <ItemGroup> <BundleResource Include="Resources\Phone\LoginIcon\ShowPasswordIcon.png" /> @@ -1436,6 +1421,10 @@ <Project>{ACC48A7F-250B-4915-A250-9BC399DBD6B3}</Project> <Name>SiriIntentsUI</Name> </ProjectReference> + <ProjectReference Include="..\SiriKit\SiriKit.csproj"> + <Project>{8B1652FA-5158-4D57-B90D-07BB91766625}</Project> + <Name>SiriKit</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Content Include="Base.lproj\Intents.intentdefinition" /> diff --git a/HDL-ON_iOS/Info.plist b/HDL-ON_iOS/Info.plist index a8ea6d3..1c5f842 100644 --- a/HDL-ON_iOS/Info.plist +++ b/HDL-ON_iOS/Info.plist @@ -42,7 +42,7 @@ <key>LSRequiresIPhoneOS</key> <true/> <key>MinimumOSVersion</key> - <string>11.0</string> + <string>12.0</string> <key>UIDeviceFamily</key> <array> <integer>1</integer> diff --git a/HDL-ON_iOS/Other/Siri/SiriBaseView.cs b/HDL-ON_iOS/Other/Siri/SiriBaseView.cs deleted file mode 100644 index 87c302e..0000000 --- a/HDL-ON_iOS/Other/Siri/SiriBaseView.cs +++ /dev/null @@ -1,121 +0,0 @@ -锘縰sing System; -using CoreGraphics; -using Foundation; -using HDL_ON.Entity; -using Intents; -using IntentsUI; -using UIKit; - -namespace Other.Siri -{ - public partial class SiriBaseView : UIViewController, IINUIAddVoiceShortcutViewControllerDelegate, IINUIEditVoiceShortcutViewControllerDelegate - { - VoiceShortcutDataManager VoiceShortcutDataManager; - public SiriBaseView() : base("SiriBaseView", null) - { - VoiceShortcutDataManager = new VoiceShortcutDataManager(); - } - - public override void ViewWillAppear(bool animated) - { - base.ViewWillAppear(animated); - - //HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden = true; - HDL_ON_iOS.AppDelegate.rootViewController.SetNavigationBarHidden(false, true); - } - - public override void ViewDidLoad() - { - base.ViewDidLoad(); - // Perform any additional setup after loading the view, typically from a nib. - UserActivity = NSUserActivityHelper.ViewMenuActivity; - - - // var btnVS = new INUIAddVoiceShortcutButton(INUIAddVoiceShortcutButtonStyle.White); - // btnVS.Frame = new CGRect(20, 500, 280, 44); - //btnVS.Shortcut = VoiceShortcutDataManager.FirstTemp().Shortcut ; - // View.AddSubview(btnVS); - - foreach(var localScene in FunctionList.List.scenes) - { - var cell = new UIView(); - cell.Frame = new CGRect(20, 800, 300, 60); - } - - - var ddd = Xamarin.Essentials.DeviceInfo.VersionString; - - - - - - var btn = UIButton.FromType(UIButtonType.System); - btn.Frame = new CGRect(20, 200, 280, 44); - btn.SetTitle("Click Me", UIControlState.Normal); - btn.TouchUpInside += (sender, e) => - { - - //HDL_ON_iOS.AppDelegate.rootViewController.SetNavigationBarHidden(HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden ? false : true, true); - var ss = new SiriScene() { Id = Guid.NewGuid().ToString(), Name = Guid.NewGuid().ToString() }; - INVoiceShortcut existingShortcut = VoiceShortcutDataManager?.VoiceShortcutForOrder(ss); - //if (!(existingShortcut is null)) - //{ - // var editVoiceShortcutViewController = new INUIEditVoiceShortcutViewController(existingShortcut); - // editVoiceShortcutViewController.Delegate = this; - // PresentViewController(editVoiceShortcutViewController, true, null); - //} - //else - { - // Since the app isn't yet managing a voice shortcut for - // this order, present the add view controller - - - new SceneDateManager().PlaceOrder(ss); - - INShortcut newShortcut = new INShortcut(ss.Intent); - if (!(newShortcut is null)) - { - var addVoiceShortcutVC = new INUIAddVoiceShortcutViewController(newShortcut); - addVoiceShortcutVC.Delegate = this; - PresentViewController(addVoiceShortcutVC, true, null); - } - } - - }; - - View.AddSubview(btn); - } - - public override void DidReceiveMemoryWarning() - { - base.DidReceiveMemoryWarning(); - // Release any cached data, images, etc that aren't in use. - } - - public void DidFinish(INUIAddVoiceShortcutViewController controller, INVoiceShortcut voiceShortcut, NSError error) - { - Console.WriteLine("didF"); - } - - public void DidCancel(INUIAddVoiceShortcutViewController controller) - { - Console.WriteLine("didC"); - } - - public void DidUpdate(INUIEditVoiceShortcutViewController controller, INVoiceShortcut voiceShortcut, NSError error) - { - Console.WriteLine("didU"); - } - - public void DidDelete(INUIEditVoiceShortcutViewController controller, NSUuid deletedVoiceShortcutIdentifier) - { - Console.WriteLine("didD"); - } - - public void DidCancel(INUIEditVoiceShortcutViewController controller) - { - Console.WriteLine("didC"); - } - } -} - diff --git a/HDL-ON_iOS/Other/Siri/SiriBaseView.designer.cs b/HDL-ON_iOS/Other/Siri/SiriBaseView.designer.cs deleted file mode 100644 index f6eb304..0000000 --- a/HDL-ON_iOS/Other/Siri/SiriBaseView.designer.cs +++ /dev/null @@ -1,21 +0,0 @@ -锘�// WARNING -// -// This file has been generated automatically by Xamarin Studio from the outlets and -// actions declared in your storyboard file. -// Manual changes to this file will not be maintained. -// -using Foundation; -using System; -using System.CodeDom.Compiler; -using UIKit; - -namespace Other.Siri -{ - [Register("SiriBaseView")] - partial class SiriBaseView - { - void ReleaseDesignerOutlets() - { - } - } -} diff --git a/HDL-ON_iOS/Other/Siri/SiriBaseView.xib b/HDL-ON_iOS/Other/Siri/SiriBaseView.xib deleted file mode 100644 index 0e30fad..0000000 --- a/HDL-ON_iOS/Other/Siri/SiriBaseView.xib +++ /dev/null @@ -1,21 +0,0 @@ -锘�<?xml version="1.0" encoding="UTF-8" standalone="no"?> - -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> - - - <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/> - </dependencies> - <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SiriBaseView"> - <connections> - <outlet property="view" destination="2" id="RRd-Eg-VrN"/> - </connections> - </placeholder> - <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <view contentMode="scaleToFill" id="2"> - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> - </view> - </objects> -</document> diff --git a/HDL-ON_iOS/Other/Siri/SiriScene.cs b/HDL-ON_iOS/Other/Siri/SiriScene.cs deleted file mode 100644 index bad1588..0000000 --- a/HDL-ON_iOS/Other/Siri/SiriScene.cs +++ /dev/null @@ -1,102 +0,0 @@ -锘縰sing System; -using Foundation; -using HDLSceneSiri; -//using HdlSiri; -using Intents; -using UIKit; - -namespace Other.Siri -{ - public class SiriScene : NSObject , INSCoding - { - public SiriScene() - { - } - - public string Id; - - public string Name; - - public void EncodeTo(NSCoder encoder) - { - Console.WriteLine("nscoder"); - } - - public HDLRunSceneIntent Intent - { - get - { - - var orderSoupIntent = new HDLRunSceneIntent();// { SceneId = Id, SceneName = Name }; - orderSoupIntent.SceneId = Id;//orderSoupIntent.Quantity = new NSNumber(Quantity); - orderSoupIntent.SceneName = Name;//orderSoupIntent.Soup = new INObject(MenuItem.ItemNameKey, MenuItem.LocalizedString); - - //var image = UIImage.FromBundle(MenuItem.IconImageName); - //if (!(image is null)) - //{ - // var data = image.AsPNG(); - // orderSoupIntent.SetImage(INImage.FromData(data), "soup"); - //} - - //orderSoupIntent.Options = MenuItemOptions - // .ToArray<MenuItemOption>() - // .Select<MenuItemOption, INObject>(arg => new INObject(arg.Value, arg.LocalizedString)) - // .ToArray<INObject>(); - - //var comment = "Suggested phrase for ordering a specific soup"; - //var phrase = NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_SOUP_SUGGESTED_PHRASE", comment); - //orderSoupIntent.SuggestedInvocationPhrase = String.Format(phrase, MenuItem.LocalizedString); - - return orderSoupIntent; - } - } - - public static SiriScene FromOrderSoupIntent(HDLRunSceneIntent intent) - { - //var menuManager = new SoupMenuManager(); - - //var soupID = intent.Soup?.Identifier; - //if (soupID is null) - //{ - // return null; - //} - - //var menuItem = menuManager.FindItem(soupID); - //if (menuItem is null) - //{ - // return null; - //} - - //var quantity = intent.Quantity; - //if (menuItem is null) - //{ - // return null; - //} - - //MenuItemOption[] rawOptions; - //if (intent.Options is null) - //{ - // rawOptions = new MenuItemOption[0]; - //} - //else - //{ - // // For the equivalent code in Apple's Swift sample, compactMap - // // is used. This eliminates nil values from the final result. - // // Here, LINQ's Where method is used to filter out the null - // // values. - // rawOptions = intent.Options.Select<INObject, MenuItemOption>((option) => - // { - // var optionID = option.Identifier; - // return (optionID is null) ? null : new MenuItemOption(optionID); - // }).Where((option) => !(option is null)).ToArray<MenuItemOption>(); - //} - - //var order = new Order(quantity.Int32Value, menuItem, new NSMutableSet<MenuItemOption>(rawOptions)); - - //return order; - return null; - } - - - } -} diff --git a/HDL-ON_iOS/Other/Siri/UI/Cells.cs b/HDL-ON_iOS/Other/Siri/UI/Cells.cs deleted file mode 100644 index d58e00c..0000000 --- a/HDL-ON_iOS/Other/Siri/UI/Cells.cs +++ /dev/null @@ -1,14 +0,0 @@ -锘縰sing System; -using UIKit; - -namespace Other.Siri.UI -{ - public class Cells : UITableViewCell - { - public Cells() - { - } - - //public string - } -} diff --git a/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs b/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs deleted file mode 100644 index 98ba68b..0000000 --- a/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs +++ /dev/null @@ -1,93 +0,0 @@ -锘�/* -See LICENSE folder for this sample鈥檚 licensing information. - -Abstract: -A data manager that surfaces INVoiceShortcuts managed by INVoiceShortcutCenter. -*/ - -using System; -using Intents; -using System.Linq; -using HDLSceneSiri; - -namespace Other.Siri -{ - public class VoiceShortcutDataManager - { - INVoiceShortcut[] VoiceShortcuts; - - public VoiceShortcutDataManager() - { - UpdateVoiceShortcuts(null); - } - - public VoiceShortcutDataManager(Action action) - { - UpdateVoiceShortcuts(action); - } - - public INVoiceShortcut VoiceShortcutForOrder(SiriScene ss) - { - var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => - { - var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; - if (intent is null) { return false; } - var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); - if (orderFromIntent is null) { return false; } - return ss.IsEqual(orderFromIntent); - }); - return voiceShortcut; - } - - - public INVoiceShortcut VoiceShortcutForOrder2(SiriScene ss) - { - var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => - { - var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; - if (intent is null) { return false; } - var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); - if (orderFromIntent is null) { return false; } - return ss.IsEqual(orderFromIntent); - }); - return voiceShortcut; - } - - public INVoiceShortcut FirstTemp () - { - try - { - if(VoiceShortcuts == null) - { - UpdateVoiceShortcuts(null); - } - return VoiceShortcuts[0]; - } - catch - { - return null; - } - } - - public void UpdateVoiceShortcuts(Action completion) - { - INVoiceShortcutCenter.SharedCenter.GetAllVoiceShortcuts((voiceShortcutsFromCenter, error) => - { - if (voiceShortcutsFromCenter is null) - { - if (!(error is null)) - { - Console.WriteLine($"Failed to fetch voice shortcuts with error {error}"); - } - return; - } - VoiceShortcuts = voiceShortcutsFromCenter; - if (!(completion is null)) - { - completion(); - } - }); - } - - } -} diff --git a/HDL-ON_iOS/Other/SkipControl.cs b/HDL-ON_iOS/Other/SkipControl.cs index 1613887..59928ac 100644 --- a/HDL-ON_iOS/Other/SkipControl.cs +++ b/HDL-ON_iOS/Other/SkipControl.cs @@ -3,7 +3,6 @@ using Foundation; using Intents; using IntentsUI; -using Other.Siri; using UIKit; namespace Other @@ -20,8 +19,6 @@ //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); @@ -43,7 +40,7 @@ public void SetData(bool isLogin, string accessToken, string refreshToken, string regionUrl) { - var sDM = new SceneDateManager(); + var sDM = new Other.Siri.SceneDateManager(); sDM.SetIsLoginValue(isLogin); sDM.SetAccessTokenValue(accessToken); sDM.SetRefreshTokenValue(refreshToken); diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln index 9bffd46..c7069cc 100644 --- a/HDL_APP_Project.sln +++ b/HDL_APP_Project.sln @@ -14,7 +14,9 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriIntentsUI", "SiriIntentsUI\SiriIntentsUI.csproj", "{ACC48A7F-250B-4915-A250-9BC399DBD6B3}" EndProject -Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "SiriBinding", "SiriBinding\SiriBinding.csproj", "{3ED45164-1242-414A-8B08-2751710F6E05}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriBinding", "SiriBinding\SiriBinding.csproj", "{77FFAB61-395D-4AD3-863E-C4E32B5038E7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriKit", "SiriKit\SiriKit.csproj", "{8B1652FA-5158-4D57-B90D-07BB91766625}" EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution @@ -93,18 +95,30 @@ {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhone.Build.0 = Release|iPhone {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator - {3ED45164-1242-414A-8B08-2751710F6E05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Debug|iPhone.Build.0 = Debug|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Release|Any CPU.Build.0 = Release|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Release|iPhone.ActiveCfg = Release|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Release|iPhone.Build.0 = Release|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {3ED45164-1242-414A-8B08-2751710F6E05}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Debug|iPhone.Build.0 = Debug|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Release|Any CPU.Build.0 = Release|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Release|iPhone.ActiveCfg = Release|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Release|iPhone.Build.0 = Release|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {77FFAB61-395D-4AD3-863E-C4E32B5038E7}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhone.Build.0 = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|Any CPU.Build.0 = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhone.ActiveCfg = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhone.Build.0 = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {8B1652FA-5158-4D57-B90D-07BB91766625}.Release|iPhoneSimulator.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs index 9caea08..6502c89 100644 --- a/HDL_ON/Common/HDLCommon.cs +++ b/HDL_ON/Common/HDLCommon.cs @@ -426,8 +426,10 @@ DB_ResidenceData.Instance.EixtAccount(); //4.娉ㄩ攢HDLSIP璐﹀彿鐧诲綍 2021-08-20 HDLLinphone.Current.LogoutAllAccount(); +#if __IOS__ //5.娓呯┖Siri鍏变韩鏁版嵁淇℃伅 new Other.SkipControl().SetData(false, "", "", ""); +#endif } catch (Exception ex) { @@ -524,9 +526,9 @@ } - #endregion +#endregion - #region 鈻� 甯哥敤鏂规硶_______________________ +#region 鈻� 甯哥敤鏂规硶_______________________ /// <summary> /// 璁剧疆涓嬪垝绾挎寜閽姸鎬� /// 缁熶竴灏佽璁剧疆鏂规硶 @@ -599,9 +601,9 @@ Control.Ins.SearchLoaclGateway(); } } - #endregion +#endregion - #region 璺宠浆鎵撳紑钀ょ煶浜戞柟娉� +#region 璺宠浆鎵撳紑钀ょ煶浜戞柟娉� /// <summary> /// 鑾峰彇瀛愯处鍙穞oken骞惰烦杞澶囧垪琛ㄩ〉闈� @@ -703,6 +705,6 @@ { IsBackground = true }.Start(); } - #endregion +#endregion } } diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs index 6b63775..9938df1 100644 --- a/HDL_ON/UI/UI1-Login/LoginPage.cs +++ b/HDL_ON/UI/UI1-Login/LoginPage.cs @@ -212,7 +212,7 @@ etAccount.Text = "13226233133";//璞嗚眴 etAccount.Text = "18316672920"; //etAccount.Text = "18316120654";//tujie - //etAccount.Text = "15626203746"; + etAccount.Text = "15626203746"; //etAccount.Text = "13450425807";//榛勭婧� knx椤圭洰 } else @@ -238,8 +238,8 @@ //etAccount.Text = "13709260805"; //etAccount.Text = "support5@hdlchina.com.cn"; //etAccount.Text = "13375012441"; - etAccount.Text = "info@smartlife-ks.com"; - etAccount.Text = "551775569@qq.com";//wcf + //etAccount.Text = "info@smartlife-ks.com"; + //etAccount.Text = "551775569@qq.com";//wcf } b = !b; etPassword.Text = "123456"; diff --git a/SiriIntents/Entitlements.plist b/SiriIntents/Entitlements.plist index 0c0f62c..0dde1e0 100644 --- a/SiriIntents/Entitlements.plist +++ b/SiriIntents/Entitlements.plist @@ -6,5 +6,7 @@ <array> <string>group.com.hdl.onpro</string> </array> + <key>com.apple.developer.siri</key> + <true/> </dict> </plist> diff --git a/SiriIntents/HDLRunSceneIntentHandlder.cs b/SiriIntents/HDLRunSceneIntentHandlder.cs deleted file mode 100644 index 78adabf..0000000 --- a/SiriIntents/HDLRunSceneIntentHandlder.cs +++ /dev/null @@ -1,26 +0,0 @@ -锘縰sing System; -using HDLSceneSiri; -using ObjCRuntime; - -namespace SiriIntents -{ - public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling - { - public HDLRunSceneIntentHandlder() - { - } - - public override void ConfirmRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) - { - Console.WriteLine("asjdkfasdfa"); - - - base.ConfirmRunScene(intent, completion); - } - - public override void HandleRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) - { - throw new NotImplementedException(); - } - } -} diff --git a/SiriIntents/Info.plist b/SiriIntents/Info.plist index c619699..4e0984e 100644 --- a/SiriIntents/Info.plist +++ b/SiriIntents/Info.plist @@ -2,10 +2,6 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>CFBundleDisplayName</key> - <string>SiriIntents</string> - <key>CFBundleName</key> - <string>SiriIntents</string> <key>CFBundleIdentifier</key> <string>com.hdl.onpro.siri</string> <key>CFBundleDevelopmentRegion</key> @@ -19,24 +15,30 @@ <key>CFBundleVersion</key> <string>1.3.11171</string> <key>MinimumOSVersion</key> - <string>15.0</string> + <string>12.0</string> <key>NSExtension</key> <dict> <key>NSExtensionAttributes</key> <dict> <key>IntentsRestrictedWhileLocked</key> - <array/> + <array> + <string>HDLRunSceneIntent</string> + </array> <key>IntentsSupported</key> <array> <string>HDLRunSceneIntent</string> </array> <key>IntentsRestrictedWhileProtectedDataUnavailable</key> - <array/> + <array> + <string>HDLRunSceneIntent</string> + </array> </dict> <key>NSExtensionPointIdentifier</key> <string>com.apple.intents-service</string> <key>NSExtensionPrincipalClass</key> <string>IntentHandler</string> </dict> + <key>CFBundleDisplayName</key> + <string>SiriIntents</string> </dict> </plist> diff --git a/SiriIntents/IntentHandler.cs b/SiriIntents/IntentHandler.cs index 9270fdf..8837700 100644 --- a/SiriIntents/IntentHandler.cs +++ b/SiriIntents/IntentHandler.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Foundation; +using HDLSceneSiri; using Intents; namespace SiriIntents @@ -15,7 +16,7 @@ // "<myApp> John saying hello" // "Search for messages in <myApp>" [Register("IntentHandler")] - public class IntentHandler : INExtension//, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling, IINSetMessageAttributeIntentHandling + public class IntentHandler : INExtension, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling, IINSetMessageAttributeIntentHandling { protected IntentHandler(IntPtr handle) : base(handle) { @@ -27,107 +28,107 @@ // This is the default implementation. If you want different objects to handle different intents, // you can override this and return the handler you want for that particular intent. - if(intent is HDLSceneSiri.HDLRunSceneIntent) - { - return new HDLRunSceneIntentHandlder(); - } + //if (intent is HDLRunSceneIntent) + //{ + // return new SiriKit.HDLRunSceneIntentHandlder(); + //} return this; } - //// Implement resolution methods to provide additional information about your intent (optional). - //[Export("resolveRecipientsForSearchForMessages:withCompletion:")] - //public void ResolveRecipients(INSendMessageIntent intent, Action<INPersonResolutionResult[]> completion) - //{ - // var recipients = intent.Recipients; - // // If no recipients were provided we'll need to prompt for a value. - // if (recipients.Length == 0) - // { - // completion(new INPersonResolutionResult[] { INPersonResolutionResult.NeedsValue }); - // return; - // } + // Implement resolution methods to provide additional information about your intent (optional). + [Export("resolveRecipientsForSearchForMessages:withCompletion:")] + public void ResolveRecipients(INSendMessageIntent intent, Action<INPersonResolutionResult[]> completion) + { + var recipients = intent.Recipients; + // If no recipients were provided we'll need to prompt for a value. + if (recipients.Length == 0) + { + completion(new INPersonResolutionResult[] { INPersonResolutionResult.NeedsValue }); + return; + } - // var resolutionResults = new List<INPersonResolutionResult>(); + var resolutionResults = new List<INPersonResolutionResult>(); - // foreach (var recipient in recipients) - // { - // var matchingContacts = new INPerson[] { recipient }; // Implement your contact matching logic here to create an array of matching contacts - // if (matchingContacts.Length > 1) - // { - // // We need Siri's help to ask user to pick one from the matches. - // resolutionResults.Add(INPersonResolutionResult.GetDisambiguation(matchingContacts)); - // } - // else if (matchingContacts.Length == 1) - // { - // // We have exactly one matching contact - // resolutionResults.Add(INPersonResolutionResult.GetSuccess(recipient)); - // } - // else - // { - // // We have no contacts matching the description provided - // resolutionResults.Add(INPersonResolutionResult.Unsupported); - // } - // } + foreach (var recipient in recipients) + { + var matchingContacts = new INPerson[] { recipient }; // Implement your contact matching logic here to create an array of matching contacts + if (matchingContacts.Length > 1) + { + // We need Siri's help to ask user to pick one from the matches. + resolutionResults.Add(INPersonResolutionResult.GetDisambiguation(matchingContacts)); + } + else if (matchingContacts.Length == 1) + { + // We have exactly one matching contact + resolutionResults.Add(INPersonResolutionResult.GetSuccess(recipient)); + } + else + { + // We have no contacts matching the description provided + resolutionResults.Add(INPersonResolutionResult.Unsupported); + } + } - // completion(resolutionResults.ToArray()); - //} + completion(resolutionResults.ToArray()); + } - //[Export("resolveContentForSendMessage:withCompletion:")] - //public void ResolveContent(INSendMessageIntent intent, Action<INStringResolutionResult> completion) - //{ - // var text = intent.Content; - // if (!string.IsNullOrEmpty(text)) - // completion(INStringResolutionResult.GetSuccess(text)); - // else - // completion(INStringResolutionResult.NeedsValue); - //} + [Export("resolveContentForSendMessage:withCompletion:")] + public void ResolveContent(INSendMessageIntent intent, Action<INStringResolutionResult> completion) + { + var text = intent.Content; + if (!string.IsNullOrEmpty(text)) + completion(INStringResolutionResult.GetSuccess(text)); + else + completion(INStringResolutionResult.NeedsValue); + } - //// Once resolution is completed, perform validation on the intent and provide confirmation (optional). - //[Export("confirmSendMessage:completion:")] - //public void ConfirmSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) - //{ - // // Verify user is authenticated and your app is ready to send a message. + // Once resolution is completed, perform validation on the intent and provide confirmation (optional). + [Export("confirmSendMessage:completion:")] + public void ConfirmSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) + { + // Verify user is authenticated and your app is ready to send a message. - // var userActivity = new NSUserActivity("INSendMessageIntent"); - // var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Ready, userActivity); - // completion(response); - //} + var userActivity = new NSUserActivity("INSendMessageIntent"); + var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Ready, userActivity); + completion(response); + } - //// Handle the completed intent (required). - //public void HandleSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) - //{ - // // Implement your application logic to send a message here. + // Handle the completed intent (required). + public void HandleSendMessage(INSendMessageIntent intent, Action<INSendMessageIntentResponse> completion) + { + // Implement your application logic to send a message here. - // var userActivity = new NSUserActivity("INSendMessageIntent"); - // var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Success, userActivity); - // completion(response); - //} + var userActivity = new NSUserActivity("INSendMessageIntent"); + var response = new INSendMessageIntentResponse(INSendMessageIntentResponseCode.Success, userActivity); + completion(response); + } - //// Implement handlers for each intent you wish to handle. - //// As an example for messages, you may wish to add HandleSearchForMessages and HandleSetMessageAttribute. + // Implement handlers for each intent you wish to handle. + // As an example for messages, you may wish to add HandleSearchForMessages and HandleSetMessageAttribute. - //public void HandleSearchForMessages(INSearchForMessagesIntent intent, Action<INSearchForMessagesIntentResponse> completion) - //{ - // // Implement your application logic to find a message that matches the information in the intent. + public void HandleSearchForMessages(INSearchForMessagesIntent intent, Action<INSearchForMessagesIntentResponse> completion) + { + // Implement your application logic to find a message that matches the information in the intent. - // var userActivity = new NSUserActivity("INSearchForMessagesIntent"); - // var response = new INSearchForMessagesIntentResponse(INSearchForMessagesIntentResponseCode.Success, userActivity); + var userActivity = new NSUserActivity("INSearchForMessagesIntent"); + var response = new INSearchForMessagesIntentResponse(INSearchForMessagesIntentResponseCode.Success, userActivity); - // // Initialize with found message's attributes - // var sender = new INPerson(new INPersonHandle("sarah@example.com", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null); - // var recipient = new INPerson(new INPersonHandle("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null); - // var message = new INMessage("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson[] { recipient }); - // response.Messages = new INMessage[] { message }; - // completion(response); - //} + // Initialize with found message's attributes + var sender = new INPerson(new INPersonHandle("sarah@example.com", INPersonHandleType.EmailAddress), null, "Sarah", null, null, null); + var recipient = new INPerson(new INPersonHandle("+1-415-555-5555", INPersonHandleType.PhoneNumber), null, "John", null, null, null); + var message = new INMessage("identifier", "I am so excited about SiriKit!", NSDate.Now, sender, new INPerson[] { recipient }); + response.Messages = new INMessage[] { message }; + completion(response); + } - //public void HandleSetMessageAttribute(INSetMessageAttributeIntent intent, Action<INSetMessageAttributeIntentResponse> completion) - //{ - // // Implement your application logic to set the message attribute here. + public void HandleSetMessageAttribute(INSetMessageAttributeIntent intent, Action<INSetMessageAttributeIntentResponse> completion) + { + // Implement your application logic to set the message attribute here. - // var userActivity = new NSUserActivity("INSetMessageAttributeIntent"); - // var response = new INSetMessageAttributeIntentResponse(INSetMessageAttributeIntentResponseCode.Success, userActivity); - // completion(response); - //} + var userActivity = new NSUserActivity("INSetMessageAttributeIntent"); + var response = new INSetMessageAttributeIntentResponse(INSetMessageAttributeIntentResponseCode.Success, userActivity); + completion(response); + } } } diff --git a/SiriIntents/SiriIntents.csproj b/SiriIntents/SiriIntents.csproj index ef7a6ef..9cc3cf4 100644 --- a/SiriIntents/SiriIntents.csproj +++ b/SiriIntents/SiriIntents.csproj @@ -99,7 +99,12 @@ </ItemGroup> <ItemGroup> <Compile Include="IntentHandler.cs" /> - <Compile Include="HDLRunSceneIntentHandlder.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\SiriKit\SiriKit.csproj"> + <Project>{8B1652FA-5158-4D57-B90D-07BB91766625}</Project> + <Name>SiriKit</Name> + </ProjectReference> </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.AppExtension.CSharp.targets" /> </Project> \ No newline at end of file diff --git a/SiriIntentsUI/Entitlements.plist b/SiriIntentsUI/Entitlements.plist index 0c0f62c..92ed64b 100644 --- a/SiriIntentsUI/Entitlements.plist +++ b/SiriIntentsUI/Entitlements.plist @@ -6,5 +6,9 @@ <array> <string>group.com.hdl.onpro</string> </array> + <key>com.apple.developer.siri</key> + <true/> + <key>com.apple.developer.associated-domains</key> + <array/> </dict> </plist> diff --git a/SiriIntentsUI/Info.plist b/SiriIntentsUI/Info.plist index 24f1df7..c85f32c 100644 --- a/SiriIntentsUI/Info.plist +++ b/SiriIntentsUI/Info.plist @@ -29,9 +29,13 @@ <string>HDLRunSceneIntent</string> </array> <key>IntentsRestrictedWhileLocked</key> - <array/> + <array> + <string>HDLRunSceneIntent</string> + </array> <key>IntentsRestrictedWhileProtectedDataUnavailable</key> - <array/> + <array> + <string>HDLRunSceneIntent</string> + </array> </dict> <key>NSExtensionMainStoryboard</key> <string>MainInterface</string> diff --git a/SiriIntentsUI/IntentViewController.cs b/SiriIntentsUI/IntentViewController.cs index 44ac701..a613809 100644 --- a/SiriIntentsUI/IntentViewController.cs +++ b/SiriIntentsUI/IntentViewController.cs @@ -1,51 +1,116 @@ 锘縰sing System; using CoreGraphics; +using Foundation; +//using HDLSceneSiri; using Intents; using IntentsUI; using UIKit; namespace SiriIntentsUI { - // As an example, this extension's Info.plist has been configured to handle interactions for INSendMessageIntent. - // You will want to replace this or add other intents as appropriate. - // The intents whose interactions you wish to handle must be declared in the extension's Info.plist. - - // You can test this example integration by saying things to Siri like: - // "Send a message using <myApp>" public partial class IntentViewController : UIViewController, IINUIHostedViewControlling { protected IntentViewController(IntPtr handle) : base(handle) { - // Note: this .ctor should not contain any initialization logic. } - public override void ViewDidLoad() - { - base.ViewDidLoad(); + //public override void ViewDidLoad() + //{ + // base.ViewDidLoad(); - // Do any required interface initialization here. - } + // // Do any required interface here. + //} - public override void DidReceiveMemoryWarning() - { - // Releases the view if it doesn't have a superview. - base.DidReceiveMemoryWarning(); + //public override void DidReceiveMemoryWarning() + //{ + // // Releases the view if it doesn't have a superview. + // base.DidReceiveMemoryWarning(); - // Release any cached data, images, etc that aren't in use. - } - + // // Release any cached data, images, etc that aren't in use. + //} + [Export("configureWithInteraction:context:completion:")] public void Configure(INInteraction interaction, INUIHostedViewContext context, Action<CGSize> completion) { - // Do configuration here, including preparing views and calculating a desired size for presentation. - - if (completion != null) - completion(DesiredSize()); + throw new NotImplementedException(); } CGSize DesiredSize() { return ExtensionContext.GetHostedViewMaximumAllowedSize(); } + + + + + [Export("configureViewForParameters:ofInteraction:interactiveBehavior:context:completion:")] + public void ConfigureView( + NSSet<INParameter> parameters, + INInteraction interaction, + INUIInteractiveBehavior interactiveBehavior, + INUIHostedViewContext context, + INUIHostedViewControllingConfigureViewHandler completion) + { + + + + + //if (@available(iOS 12.0, *)) + { + //HDLRunSceneIntentResponse rsp = interaction.IntentResponse as HDLRunSceneIntentResponse; + //if (rsp.Code == HDLRunSceneIntentResponseCode.Success) + //{ + // this.messageLabel.Text = rsp.SuccessMessage; + //} + //else if (rsp.Code == HDLRunSceneIntentResponseCode.Failure || rsp.Code == HDLRunSceneIntentResponseCode.Error) + //{ + // this.messageLabel.Text = rsp.ErrorMessage; + //} + //else + { + //messageLabel.Text = "鎵ц鎴愬姛";// rsp.SuccessMessage; + } + } + CGSize size = new CGSize(DesiredSize().Width, 80); + + + //if (completion != null) + completion(true, parameters, size); + + + //var intent = interaction.Intent as OrderSoupIntent; + //if (intent is null) + //{ + // completion(false, new NSSet<INParameter>(), CGSize.Empty); + //} + + //var order = Order.FromOrderSoupIntent(intent); + + //foreach (var view in View.Subviews) + //{ + // view.RemoveFromSuperview(); + //} + + //// Different UIs can be displayed depending if the intent is in the + //// confirmation phase or the handle phase. + //var desiredSize = CGSize.Empty; + + //if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Ready) + //{ + // desiredSize = DisplayInvoice(order, intent); + //} + //else if (interaction.IntentHandlingStatus == INIntentHandlingStatus.Success) + //{ + // var response = interaction.IntentResponse as OrderSoupIntentResponse; + // if (!(response is null)) + // { + // desiredSize = DisplayOrderConfirmation(order, intent, response); + // } + //} + + //completion(true, parameters, desiredSize); + } + + } } diff --git a/SiriIntentsUI/IntentViewController.designer.cs b/SiriIntentsUI/IntentViewController.designer.cs index 412778b..31d49c2 100644 --- a/SiriIntentsUI/IntentViewController.designer.cs +++ b/SiriIntentsUI/IntentViewController.designer.cs @@ -1,17 +1,26 @@ -锘�// -// This file has been generated automatically by MonoDevelop to store outlets and -// actions made in the Xcode designer. If it is removed, they will be lost. +// WARNING +// +// This file has been generated automatically by Visual Studio to store outlets and +// actions made in the UI designer. If it is removed, they will be lost. // Manual changes to this file may not be handled correctly. // using Foundation; +using System.CodeDom.Compiler; namespace SiriIntentsUI { - [Register("IntentViewController")] - partial class IntentViewController - { - void ReleaseDesignerOutlets() - { - } - } + [Register ("IntentViewController")] + partial class IntentViewController + { + [Outlet] + UIKit.UILabel messageLabel { get; set; } + + void ReleaseDesignerOutlets () + { + if (messageLabel != null) { + messageLabel.Dispose (); + messageLabel = null; + } + } + } } diff --git a/SiriIntentsUI/MainInterface.storyboard b/SiriIntentsUI/MainInterface.storyboard index ffe51bf..463b4cb 100644 --- a/SiriIntentsUI/MainInterface.storyboard +++ b/SiriIntentsUI/MainInterface.storyboard @@ -1,28 +1,51 @@ -锘�<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ObA-dk-sSI"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ObA-dk-sSI"> + <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--Intent View Controller--> <scene sceneID="7MM-of-jgj"> <objects> - <viewController id="ObA-dk-sSI" customClass="IntentViewController" customModuleProvider="" sceneMemberID="viewController"> + <viewController id="ObA-dk-sSI" customClass="IntentViewController" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="qkL-Od-lgU"/> <viewControllerLayoutGuide type="bottom" id="n38-gi-rB5"/> </layoutGuides> <view key="view" contentMode="scaleToFill" id="zMn-AG-sqS"> - <rect key="frame" x="0.0" y="0.0" width="320" height="150"/> + <rect key="frame" x="0.0" y="0.0" width="320" height="81"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NjV-Uo-AhC"> + <rect key="frame" x="16" y="44" width="288" height="37"/> + <constraints> + <constraint firstAttribute="height" constant="80" id="nTr-aC-LKs"/> + </constraints> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <constraints> + <constraint firstItem="NjV-Uo-AhC" firstAttribute="top" secondItem="qkL-Od-lgU" secondAttribute="bottom" id="FYi-qJ-8bD"/> + <constraint firstAttribute="trailingMargin" secondItem="NjV-Uo-AhC" secondAttribute="trailing" id="Gl4-Hb-09m"/> + <constraint firstItem="n38-gi-rB5" firstAttribute="top" secondItem="NjV-Uo-AhC" secondAttribute="bottom" id="IeL-md-xmX"/> + <constraint firstItem="NjV-Uo-AhC" firstAttribute="leading" secondItem="zMn-AG-sqS" secondAttribute="leadingMargin" id="QQ2-K1-0tQ"/> + </constraints> </view> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> - <size key="freeformSize" width="320" height="150"/> + <size key="freeformSize" width="320" height="81"/> + <connections> + <outlet property="messageLabel" destination="NjV-Uo-AhC" id="Jnc-sC-lVC"/> + </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> + <point key="canvasLocation" x="20" y="80"/> </scene> </scenes> </document> diff --git a/SiriIntentsUI/SiriIntentsUI.csproj b/SiriIntentsUI/SiriIntentsUI.csproj index 01fee2b..00597b7 100644 --- a/SiriIntentsUI/SiriIntentsUI.csproj +++ b/SiriIntentsUI/SiriIntentsUI.csproj @@ -28,6 +28,7 @@ <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> <DeviceSpecificBuild>false</DeviceSpecificBuild> <MtouchVerbosity></MtouchVerbosity> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> <DebugType>pdbonly</DebugType> @@ -44,6 +45,7 @@ <MtouchArch>ARM64</MtouchArch> <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> <MtouchVerbosity></MtouchVerbosity> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> <DebugType>pdbonly</DebugType> @@ -58,6 +60,7 @@ <MtouchArch>x86_64</MtouchArch> <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> <MtouchVerbosity></MtouchVerbosity> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> <DebugSymbols>true</DebugSymbols> @@ -80,6 +83,7 @@ <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> <MtouchVerbosity></MtouchVerbosity> <CodesignProvision>OnproSiriUI211116-1</CodesignProvision> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Reference Include="System" /> diff --git a/SiriKit/Base.lproj/Intents.intentdefinition b/SiriKit/Base.lproj/Intents.intentdefinition new file mode 100644 index 0000000..f49bdce --- /dev/null +++ b/SiriKit/Base.lproj/Intents.intentdefinition @@ -0,0 +1,181 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>INEnums</key> + <array/> + <key>INIntentDefinitionModelVersion</key> + <string>1.2</string> + <key>INIntentDefinitionNamespace</key> + <string>8yVV3C</string> + <key>INIntentDefinitionSystemVersion</key> + <string>20G165</string> + <key>INIntentDefinitionToolsBuildVersion</key> + <string>13A233</string> + <key>INIntentDefinitionToolsVersion</key> + <string>13.0</string> + <key>INIntents</key> + <array> + <dict> + <key>INIntentCategory</key> + <string>generic</string> + <key>INIntentDescription</key> + <string>Run Scene</string> + <key>INIntentDescriptionID</key> + <string>Pe02nj</string> + <key>INIntentLastParameterTag</key> + <integer>2</integer> + <key>INIntentName</key> + <string>HDLRunScene</string> + <key>INIntentParameterCombinations</key> + <dict> + <key>sceneName,sceneId</key> + <dict> + <key>INIntentParameterCombinationIsPrimary</key> + <true/> + <key>INIntentParameterCombinationSupportsBackgroundExecution</key> + <true/> + <key>INIntentParameterCombinationTitle</key> + <string>鎵ц鍦烘櫙鈥�${sceneName}鈥�</string> + <key>INIntentParameterCombinationTitleID</key> + <string>oCGdw4</string> + </dict> + </dict> + <key>INIntentParameters</key> + <array> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Scene Name</string> + <key>INIntentParameterDisplayNameID</key> + <string>wC0SgK</string> + <key>INIntentParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>xz2KkJ</string> + </dict> + <key>INIntentParameterName</key> + <string>sceneName</string> + <key>INIntentParameterTag</key> + <integer>1</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentParameterDisplayName</key> + <string>Scene Id</string> + <key>INIntentParameterDisplayNameID</key> + <string>MtgGtd</string> + <key>INIntentParameterDisplayPriority</key> + <integer>2</integer> + <key>INIntentParameterMetadata</key> + <dict> + <key>INIntentParameterMetadataCapitalization</key> + <string>Sentences</string> + <key>INIntentParameterMetadataDefaultValueID</key> + <string>hQHCm1</string> + </dict> + <key>INIntentParameterName</key> + <string>sceneId</string> + <key>INIntentParameterTag</key> + <integer>2</integer> + <key>INIntentParameterType</key> + <string>String</string> + </dict> + </array> + <key>INIntentResponse</key> + <dict> + <key>INIntentResponseCodes</key> + <array> + <dict> + <key>INIntentResponseCodeFormatString</key> + <string>${sceneName}</string> + <key>INIntentResponseCodeFormatStringID</key> + <string>Pq8YBC</string> + <key>INIntentResponseCodeName</key> + <string>success</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + <dict> + <key>INIntentResponseCodeFormatString</key> + <string>${errorMessage}</string> + <key>INIntentResponseCodeFormatStringID</key> + <string>CX5DVI</string> + <key>INIntentResponseCodeName</key> + <string>failure</string> + </dict> + <dict> + <key>INIntentResponseCodeName</key> + <string>error</string> + <key>INIntentResponseCodeSuccess</key> + <true/> + </dict> + </array> + <key>INIntentResponseLastParameterTag</key> + <integer>3</integer> + <key>INIntentResponseParameters</key> + <array> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Error Message</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>HxQb2M</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>1</integer> + <key>INIntentResponseParameterName</key> + <string>errorMessage</string> + <key>INIntentResponseParameterTag</key> + <integer>1</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Success Message</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>BaAbSP</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>2</integer> + <key>INIntentResponseParameterName</key> + <string>successMessage</string> + <key>INIntentResponseParameterTag</key> + <integer>2</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + <dict> + <key>INIntentResponseParameterDisplayName</key> + <string>Scene Name</string> + <key>INIntentResponseParameterDisplayNameID</key> + <string>pqg7cb</string> + <key>INIntentResponseParameterDisplayPriority</key> + <integer>3</integer> + <key>INIntentResponseParameterName</key> + <string>sceneName</string> + <key>INIntentResponseParameterTag</key> + <integer>3</integer> + <key>INIntentResponseParameterType</key> + <string>String</string> + </dict> + </array> + </dict> + <key>INIntentRestrictions</key> + <integer>1</integer> + <key>INIntentTitle</key> + <string>Run Scene</string> + <key>INIntentTitleID</key> + <string>j3jRXP</string> + <key>INIntentType</key> + <string>Custom</string> + <key>INIntentVerb</key> + <string>Do</string> + </dict> + </array> + <key>INTypes</key> + <array/> +</dict> +</plist> diff --git a/HDL-ON_iOS/Other/Siri/Data/DataManager.cs b/SiriKit/Data/DataManager.cs similarity index 100% rename from HDL-ON_iOS/Other/Siri/Data/DataManager.cs rename to SiriKit/Data/DataManager.cs diff --git a/HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs b/SiriKit/Data/SceneDateManager.cs similarity index 63% rename from HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs rename to SiriKit/Data/SceneDateManager.cs index a7651af..b06cb30 100644 --- a/HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs +++ b/SiriKit/Data/SceneDateManager.cs @@ -9,26 +9,6 @@ { public SceneDateManager() : base(new UserDefaultsStorageDescriptor(NSUserDefaultsHelper.StorageKeys.OrderHistory), new NSMutableArray<SiriScene>()) { } - // Converts an `Order` into `OrderSoupIntent` and donates it as an - // interaction to the system so that this order can be suggested in the - // future or turned into a voice shortcut for quickly placing the same - // order in the future. - void DonateInteraction(SiriScene order) - { - var interaction = new INInteraction(order.Intent, null); - interaction.Identifier = order.Id.ToString(); - interaction.DonateInteraction((error) => - { - if (!(error is null)) - { - Console.WriteLine($"Interaction donation failed: {error}"); - } - else - { - Console.WriteLine("Successfully donated interaction."); - } - }); - } #region Public API for clients of `SoupOrderDataManager` // Convenience method to access the data with a property name that makes @@ -41,30 +21,6 @@ } } - public void PlaceOrder(SiriScene order) - { - // Access to `ManagedDataBackingInstance` is only valid on - // `DataAccessQueue`. - DataAccessQueue.DispatchSync(() => - { - if (ManagedDataBackingInstance.Count == 0) - { - // Getting an error trying to insert at 0 for an empty - // NSMutableArray<Order> - ManagedDataBackingInstance.Add(order); - } - else - { - ManagedDataBackingInstance.Insert(order, 0); - } - }); - - // Access to UserDefaults is gated behind a separate access queue. - WriteData(); - - // Donate an interaction to the system. - DonateInteraction(order); - } #endregion #region Support methods for unarchiving saved data diff --git a/SiriKit/HDLRunSceneIntentHandlder.cs b/SiriKit/HDLRunSceneIntentHandlder.cs new file mode 100644 index 0000000..ee43db0 --- /dev/null +++ b/SiriKit/HDLRunSceneIntentHandlder.cs @@ -0,0 +1,51 @@ +锘縰sing System; +using HDLSceneSiri; +//using HdlSiri; + +namespace SiriKit +{ + public class HDLRunSceneIntentHandlder : HDLRunSceneIntentHandling + { + + override public void ConfirmRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) + { + Console.WriteLine("ConfirmRunScene"); + + //SceneDateManager sdm = new SceneDateManager(); + //if(sdm.IsLgoin) + { + //鎵ц鎴愬姛 + HDLRunSceneIntentResponse rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Success,null); + rsp.SceneName = intent.SceneName; + rsp.SuccessMessage = @"璇风瓑寰�..."; + completion(rsp); + } + //else + //{ + // completion(new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Error, null) { ErrorMessage = "鏈櫥褰�" }); + //} + + } + + public override void HandleRunScene(HDLRunSceneIntent intent, Action<HDLRunSceneIntentResponse> completion) + { + Console.WriteLine("HandleRunScene"); + + //SceneDateManager sdm = new SceneDateManager(); + //if (sdm.IsLgoin) + { + //鎵ц鎴愬姛 + HDLRunSceneIntentResponse rsp = new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Success, null); + rsp.SceneName = intent.SceneName; + rsp.SuccessMessage = @"鎵ц鎴愬姛"; + completion(rsp); + } + //else + //{ + // completion(new HDLRunSceneIntentResponse(HDLRunSceneIntentResponseCode.Error, null) { ErrorMessage = "鏈櫥褰�" }); + //} + + //throw new NotImplementedException(); + } + } +} diff --git a/SiriKit/Properties/AssemblyInfo.cs b/SiriKit/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a273fa2 --- /dev/null +++ b/SiriKit/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +锘縰sing System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SiriKit")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SiriKit")] +[assembly: AssemblyCopyright("Copyright 漏 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("50c7b8c9-e664-45af-b88e-0c9b8b9c1be1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SiriKit/SiriKit.csproj b/SiriKit/SiriKit.csproj new file mode 100644 index 0000000..bd8265b --- /dev/null +++ b/SiriKit/SiriKit.csproj @@ -0,0 +1,64 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{8B1652FA-5158-4D57-B90D-07BB91766625}</ProjectGuid> + <ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <TemplateGuid>{a52b8a63-bc84-4b47-910d-692533484892}</TemplateGuid> + <OutputType>Library</OutputType> + <RootNamespace>SiriKit</RootNamespace> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + <AssemblyName>SiriKit</AssemblyName> + <RestoreProjectStyle>PackageReference</RestoreProjectStyle> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>portable</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>portable</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release</OutputPath> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Core" /> + <Reference Include="Xamarin.iOS" /> + <Reference Include="Shared.IOS.HDLSceneSiri"> + <HintPath>..\..\HDLXamarinSceneSiri\Shared.IOS.HDLSceneSiri\Shared.IOS.HDLSceneSiri\bin\Release\Shared.IOS.HDLSceneSiri.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + <Folder Include="Data\" /> + <Folder Include="Support\" /> + <Folder Include="Base.lproj\" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SiriScene.cs" /> + <Compile Include="VoiceShortcutDataManager.cs" /> + <Compile Include="Data\DataManager.cs" /> + <Compile Include="Data\SceneDateManager.cs" /> + <Compile Include="Support\NSUserActivityHelper.cs" /> + <Compile Include="Support\NSUserDefaultsHelper.cs" /> + <Compile Include="HDLRunSceneIntentHandlder.cs" /> + </ItemGroup> + <ItemGroup> + <Content Include="Base.lproj\Intents.intentdefinition" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> +</Project> \ No newline at end of file diff --git a/SiriKit/SiriScene.cs b/SiriKit/SiriScene.cs new file mode 100644 index 0000000..52d3d31 --- /dev/null +++ b/SiriKit/SiriScene.cs @@ -0,0 +1,20 @@ +锘縰sing System; +using Foundation; +using Intents; +using UIKit; + +namespace Other.Siri +{ + public class SiriScene : NSObject + { + public SiriScene() + { + } + + public string Id; + + public string Name; + + + } +} diff --git a/HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs b/SiriKit/Support/NSUserActivityHelper.cs similarity index 100% rename from HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs rename to SiriKit/Support/NSUserActivityHelper.cs diff --git a/HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs b/SiriKit/Support/NSUserDefaultsHelper.cs similarity index 100% rename from HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs rename to SiriKit/Support/NSUserDefaultsHelper.cs diff --git a/SiriKit/VoiceShortcutDataManager.cs b/SiriKit/VoiceShortcutDataManager.cs new file mode 100644 index 0000000..8a3a84e --- /dev/null +++ b/SiriKit/VoiceShortcutDataManager.cs @@ -0,0 +1,93 @@ +锘�///* +//See LICENSE folder for this sample鈥檚 licensing information. + +//Abstract: +//A data manager that surfaces INVoiceShortcuts managed by INVoiceShortcutCenter. +//*/ + +//using System; +//using Intents; +//using System.Linq; +//using HDLSceneSiri; + +//namespace Other.Siri +//{ +// public class VoiceShortcutDataManager +// { +// INVoiceShortcut[] VoiceShortcuts; + +// public VoiceShortcutDataManager() +// { +// UpdateVoiceShortcuts(null); +// } + +// public VoiceShortcutDataManager(Action action) +// { +// UpdateVoiceShortcuts(action); +// } + +// public INVoiceShortcut VoiceShortcutForOrder(SiriScene ss) +// { +// var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => +// { +// var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; +// if (intent is null) { return false; } +// var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); +// if (orderFromIntent is null) { return false; } +// return ss.IsEqual(orderFromIntent); +// }); +// return voiceShortcut; +// } + + +// public INVoiceShortcut VoiceShortcutForOrder2(SiriScene ss) +// { +// var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => +// { +// var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; +// if (intent is null) { return false; } +// var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); +// if (orderFromIntent is null) { return false; } +// return ss.IsEqual(orderFromIntent); +// }); +// return voiceShortcut; +// } + +// public INVoiceShortcut FirstTemp () +// { +// try +// { +// if(VoiceShortcuts == null) +// { +// UpdateVoiceShortcuts(null); +// } +// return VoiceShortcuts[0]; +// } +// catch +// { +// return null; +// } +// } + +// public void UpdateVoiceShortcuts(Action completion) +// { +// INVoiceShortcutCenter.SharedCenter.GetAllVoiceShortcuts((voiceShortcutsFromCenter, error) => +// { +// if (voiceShortcutsFromCenter is null) +// { +// if (!(error is null)) +// { +// Console.WriteLine($"Failed to fetch voice shortcuts with error {error}"); +// } +// return; +// } +// VoiceShortcuts = voiceShortcutsFromCenter; +// if (!(completion is null)) +// { +// completion(); +// } +// }); +// } + +// } +//} -- Gitblit v1.8.0