.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 /> 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> 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 } 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" /> 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> HDL-ON_iOS/Other/Siri/SiriBaseView.cs
File was deleted HDL-ON_iOS/Other/Siri/SiriBaseView.designer.cs
File was deleted HDL-ON_iOS/Other/Siri/SiriBaseView.xib
File was deleted HDL-ON_iOS/Other/Siri/SiriScene.cs
File was deleted HDL-ON_iOS/Other/Siri/UI/Cells.cs
File was deleted HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs
File was deleted 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); 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 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> /// 获取子账号token并跳转设备列表页面 @@ -703,6 +705,6 @@ { IsBackground = true }.Start(); } #endregion #endregion } } 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"; SiriIntents/Entitlements.plist
@@ -6,5 +6,7 @@ <array> <string>group.com.hdl.onpro</string> </array> <key>com.apple.developer.siri</key> <true/> </dict> </plist> SiriIntents/HDLRunSceneIntentHandlder.cs
File was deleted 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> 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); } } } 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> 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> 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> SiriIntentsUI/IntentViewController.cs
@@ -1,51 +1,116 @@ using 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); } } } 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; } } } } 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> 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" /> SiriKit/Base.lproj/Intents.intentdefinition
New file @@ -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> SiriKit/Data/DataManager.cs
SiriKit/Data/SceneDateManager.cs
File was renamed from HDL-ON_iOS/Other/Siri/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 SiriKit/HDLRunSceneIntentHandlder.cs
New file @@ -0,0 +1,51 @@ using 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(); } } } SiriKit/Properties/AssemblyInfo.cs
New file @@ -0,0 +1,36 @@ using 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")] SiriKit/SiriKit.csproj
New file @@ -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> SiriKit/SiriScene.cs
New file @@ -0,0 +1,20 @@ using System; using Foundation; using Intents; using UIKit; namespace Other.Siri { public class SiriScene : NSObject { public SiriScene() { } public string Id; public string Name; } } SiriKit/Support/NSUserActivityHelper.cs
SiriKit/Support/NSUserDefaultsHelper.cs
SiriKit/VoiceShortcutDataManager.cs
New file @@ -0,0 +1,93 @@ ///* //See LICENSE folder for this sample’s 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(); // } // }); // } // } //}