From 0de3ac9b3e2afea565dd9d028a89986a2e0a377d Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 18 十一月 2021 10:07:18 +0800 Subject: [PATCH] 增加siri扩展 --- SiriIntents/Entitlements.plist | 6 SiriIntents/SiriIntents.csproj | 100 ++++++++++ SiriIntentsUI/Info.plist | 38 +++ HDL_APP_Project.sln | 28 ++ HDL-ON_iOS/HDL-ON_iOS.csproj | 10 + SiriIntentsUI/IntentViewController.cs | 51 +++++ HDL-ON_iOS/Other/SkipControl.cs | 4 SiriIntentsUI/MainInterface.storyboard | 28 ++ SiriIntents/Info.plist | 42 ++++ SiriIntentsUI/Entitlements.plist | 6 SiriIntents/IntentHandler.cs | 128 ++++++++++++ SiriIntentsUI/IntentViewController.designer.cs | 17 + .vs/HDL_APP_Project/xs/UserPrefs.xml | 19 + SiriIntentsUI/SiriIntentsUI.csproj | 106 ++++++++++ 14 files changed, 575 insertions(+), 8 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 9f981cb..203c887 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -3,29 +3,34 @@ <MonoDevelop.MacDev.AppleDevelopmentTeam /> </MonoDevelop.Ide.ItemProperties.SiriIntentUI> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> - <MonoDevelop.Ide.Workbench ActiveDocument="SiriBinding/Structs.cs"> + <MonoDevelop.Ide.ItemProperties.SiriIntents FirstBuild="True"> + <MonoDevelop.MacDev.AppleDevelopmentTeam /> + </MonoDevelop.Ide.ItemProperties.SiriIntents> + <MonoDevelop.Ide.Workbench ActiveDocument="SiriIntents/IntentHandler.cs"> <Files> <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="203" Column="35" /> <File FileName="HDL-ON_iOS/Other/SkipControl.cs" Line="35" Column="1" /> <File FileName="HDL-ON_iOS/Other/Siri/SiriBaseView.cs" Line="25" Column="2" /> <File FileName="SiriBinding/ApiDefinition.cs" Line="8" Column="18" /> - <File FileName="SiriBinding/Structs.cs" Line="7" Column="1" /> + <File FileName="SiriBinding/Structs.cs" Line="19" Column="1" /> + <File FileName="SiriIntents/IntentHandler.cs" Line="1" Column="1" /> </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="SiriIntents" expanded="True"> + <Node name="IntentHandler.cs" selected="True" /> </Node> - <Node name="SiriBinding" expanded="True"> - <Node name="Structs.cs" selected="True" /> - </Node> + <Node name="SiriIntentsUI" expanded="True" /> </Node> </State> </Pad> </Pads> </MonoDevelop.Ide.Workbench> + <MonoDevelop.Ide.ItemProperties.SiriIntentsUI FirstBuild="True"> + <MonoDevelop.MacDev.AppleDevelopmentTeam /> + </MonoDevelop.Ide.ItemProperties.SiriIntentsUI> <MonoDevelop.Ide.DebuggingService.PinnedWatches /> <DisabledProjects> <String>Shared.IOS.TBL/Shared.IOS.TBL.csproj</String> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index dd1bd11..418934f 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1412,6 +1412,16 @@ <Project>{77FFAB61-395D-4AD3-863E-C4E32B5038E7}</Project> <Name>SiriBinding</Name> </ProjectReference> + <ProjectReference Include="..\SiriIntents\SiriIntents.csproj"> + <IsAppExtension>true</IsAppExtension> + <Project>{760980F5-1CD3-4F4F-9134-34D87BECD790}</Project> + <Name>SiriIntents</Name> + </ProjectReference> + <ProjectReference Include="..\SiriIntentsUI\SiriIntentsUI.csproj"> + <IsAppExtension>true</IsAppExtension> + <Project>{ACC48A7F-250B-4915-A250-9BC399DBD6B3}</Project> + <Name>SiriIntentsUI</Name> + </ProjectReference> </ItemGroup> <Import Project="..\HDL_ON\HDL_ON.projitems" Label="Shared" Condition="Exists('..\HDL_ON\HDL_ON.projitems')" /> <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> diff --git a/HDL-ON_iOS/Other/SkipControl.cs b/HDL-ON_iOS/Other/SkipControl.cs index 0de65c3..dc94297 100644 --- a/HDL-ON_iOS/Other/SkipControl.cs +++ b/HDL-ON_iOS/Other/SkipControl.cs @@ -23,9 +23,11 @@ HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden = true; HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden = false; - HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(user, true); + HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(user, true); + btn.TouchUpInside += (sender, e) => { + HDL_ON_iOS.AppDelegate.rootViewController.SetNavigationBarHidden(HDL_ON_iOS.AppDelegate.rootViewController.NavigationBarHidden ? false : true, true); }; user.View.AddSubview(btn); diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln index cc499ca..5623565 100644 --- a/HDL_APP_Project.sln +++ b/HDL_APP_Project.sln @@ -12,6 +12,10 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriBinding", "SiriBinding\SiriBinding.csproj", "{77FFAB61-395D-4AD3-863E-C4E32B5038E7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriIntents", "SiriIntents\SiriIntents.csproj", "{760980F5-1CD3-4F4F-9134-34D87BECD790}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SiriIntentsUI", "SiriIntentsUI\SiriIntentsUI.csproj", "{ACC48A7F-250B-4915-A250-9BC399DBD6B3}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution HDL_ON\HDL_ON.projitems*{09712674-2a38-407b-b1e2-560b2c352f9a}*SharedItemsImports = 4 @@ -77,6 +81,30 @@ {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 + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|Any CPU.ActiveCfg = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|Any CPU.Build.0 = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhone.ActiveCfg = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhone.Build.0 = Debug|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhone.ActiveCfg = Release|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhone.Build.0 = Release|iPhone + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator + {760980F5-1CD3-4F4F-9134-34D87BECD790}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|Any CPU.ActiveCfg = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|Any CPU.Build.0 = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhone.ActiveCfg = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhone.Build.0 = Debug|iPhone + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|Any CPU.Build.0 = Release|iPhoneSimulator + {ACC48A7F-250B-4915-A250-9BC399DBD6B3}.Release|iPhone.ActiveCfg = Release|iPhone + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SiriIntents/Entitlements.plist b/SiriIntents/Entitlements.plist new file mode 100644 index 0000000..9ae5993 --- /dev/null +++ b/SiriIntents/Entitlements.plist @@ -0,0 +1,6 @@ +锘�<?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> +</dict> +</plist> diff --git a/SiriIntents/Info.plist b/SiriIntents/Info.plist new file mode 100644 index 0000000..bf03fa4 --- /dev/null +++ b/SiriIntents/Info.plist @@ -0,0 +1,42 @@ +锘�<?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>CFBundleDisplayName</key> + <string>SiriIntents</string> + <key>CFBundleName</key> + <string>SiriIntents</string> + <key>CFBundleIdentifier</key> + <string>com.hdl.onpro.SiriIntents</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.3.202111171</string> + <key>CFBundleVersion</key> + <string>1.3.11171</string> + <key>MinimumOSVersion</key> + <string>15.0</string> + <key>NSExtension</key> + <dict> + <key>NSExtensionAttributes</key> + <dict> + <key>IntentsRestrictedWhileLocked</key> + <array/> + <key>IntentsSupported</key> + <array> + <string>INSendMessageIntent</string> + <string>INSearchForMessagesIntent</string> + <string>INSetMessageAttributeIntent</string> + </array> + </dict> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.intents-service</string> + <key>NSExtensionPrincipalClass</key> + <string>IntentHandler</string> + </dict> +</dict> +</plist> diff --git a/SiriIntents/IntentHandler.cs b/SiriIntents/IntentHandler.cs new file mode 100644 index 0000000..c4086f2 --- /dev/null +++ b/SiriIntents/IntentHandler.cs @@ -0,0 +1,128 @@ +锘縰sing System; +using System.Collections.Generic; + +using Foundation; +using Intents; + +namespace SiriIntents +{ + // As an example, this class is set up to handle Message intents. + // You will want to replace this or add other intents as appropriate. + // The intents you wish to handle must be declared in the extension's Info.plist. + + // You can test your example integration by saying things to Siri like: + // "Send a message using <myApp>" + // "<myApp> John saying hello" + // "Search for messages in <myApp>" + [Register("IntentHandler")] + public class IntentHandler : INExtension, IINSendMessageIntentHandling, IINSearchForMessagesIntentHandling, IINSetMessageAttributeIntentHandling + { + protected IntentHandler(IntPtr handle) : base(handle) + { + // Note: this .ctor should not contain any initialization logic. + } + + public override NSObject GetHandler(INIntent intent) + { + // 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. + + 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; + } + + 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); + } + } + + 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); + } + + // 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); + } + + // 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); + } + + // 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. + + 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); + } + + 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); + } + } +} diff --git a/SiriIntents/SiriIntents.csproj b/SiriIntents/SiriIntents.csproj new file mode 100644 index 0000000..bf9fe11 --- /dev/null +++ b/SiriIntents/SiriIntents.csproj @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> + <ProjectGuid>{760980F5-1CD3-4F4F-9134-34D87BECD790}</ProjectGuid> + <ProjectTypeGuids>{EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <RootNamespace>SiriIntents</RootNamespace> + <AssemblyName>SiriIntents</AssemblyName> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhoneSimulator\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <IOSDebuggerPort>28717</IOSDebuggerPort> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <DeviceSpecificBuild>false</DeviceSpecificBuild> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhone\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchUseLlvm>true</MtouchUseLlvm> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhoneSimulator\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhone\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <DeviceSpecificBuild>true</DeviceSpecificBuild> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <IOSDebuggerPort>52238</IOSDebuggerPort> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Core" /> + <Reference Include="Xamarin.iOS" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </ItemGroup> + <ItemGroup> + <None Include="Info.plist" /> + <None Include="Entitlements.plist" /> + </ItemGroup> + <ItemGroup> + <Compile Include="IntentHandler.cs" /> + </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 new file mode 100644 index 0000000..9ae5993 --- /dev/null +++ b/SiriIntentsUI/Entitlements.plist @@ -0,0 +1,6 @@ +锘�<?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> +</dict> +</plist> diff --git a/SiriIntentsUI/Info.plist b/SiriIntentsUI/Info.plist new file mode 100644 index 0000000..269af89 --- /dev/null +++ b/SiriIntentsUI/Info.plist @@ -0,0 +1,38 @@ +锘�<?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>CFBundleDisplayName</key> + <string>SiriIntentsUI</string> + <key>CFBundleName</key> + <string>SiriIntentsUI</string> + <key>CFBundleIdentifier</key> + <string>com.hdl.onpro.SiriIntentsui</string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>XPC!</string> + <key>CFBundleShortVersionString</key> + <string>1.3.202111171</string> + <key>CFBundleVersion</key> + <string>1.3.11171</string> + <key>MinimumOSVersion</key> + <string>15.0</string> + <key>NSExtension</key> + <dict> + <key>NSExtensionAttributes</key> + <dict> + <key>IntentsSupported</key> + <array> + <string>INSendMessageIntent</string> + </array> + </dict> + <key>NSExtensionMainStoryboard</key> + <string>MainInterface</string> + <key>NSExtensionPointIdentifier</key> + <string>com.apple.intents-ui-service</string> + </dict> +</dict> +</plist> diff --git a/SiriIntentsUI/IntentViewController.cs b/SiriIntentsUI/IntentViewController.cs new file mode 100644 index 0000000..44ac701 --- /dev/null +++ b/SiriIntentsUI/IntentViewController.cs @@ -0,0 +1,51 @@ +锘縰sing System; + +using CoreGraphics; +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(); + + // Do any required interface initialization here. + } + + 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. + } + + 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()); + } + + CGSize DesiredSize() + { + return ExtensionContext.GetHostedViewMaximumAllowedSize(); + } + } +} diff --git a/SiriIntentsUI/IntentViewController.designer.cs b/SiriIntentsUI/IntentViewController.designer.cs new file mode 100644 index 0000000..412778b --- /dev/null +++ b/SiriIntentsUI/IntentViewController.designer.cs @@ -0,0 +1,17 @@ +锘�// +// 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. +// Manual changes to this file may not be handled correctly. +// +using Foundation; + +namespace SiriIntentsUI +{ + [Register("IntentViewController")] + partial class IntentViewController + { + void ReleaseDesignerOutlets() + { + } + } +} diff --git a/SiriIntentsUI/MainInterface.storyboard b/SiriIntentsUI/MainInterface.storyboard new file mode 100644 index 0000000..ffe51bf --- /dev/null +++ b/SiriIntentsUI/MainInterface.storyboard @@ -0,0 +1,28 @@ +锘�<?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"> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/> + <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"> + <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"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </view> + <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> + <size key="freeformSize" width="320" height="150"/> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + </scene> + </scenes> +</document> diff --git a/SiriIntentsUI/SiriIntentsUI.csproj b/SiriIntentsUI/SiriIntentsUI.csproj new file mode 100644 index 0000000..ee08b49 --- /dev/null +++ b/SiriIntentsUI/SiriIntentsUI.csproj @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> + <ProjectGuid>{ACC48A7F-250B-4915-A250-9BC399DBD6B3}</ProjectGuid> + <ProjectTypeGuids>{EE2C853D-36AF-4FDB-B1AD-8E90477E2198};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <RootNamespace>SiriIntentsUI</RootNamespace> + <AssemblyName>SiriIntentsUI</AssemblyName> + <IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhoneSimulator\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <IOSDebuggerPort>51713</IOSDebuggerPort> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <DeviceSpecificBuild>false</DeviceSpecificBuild> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhone\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchUseLlvm>true</MtouchUseLlvm> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\iPhoneSimulator\Release</OutputPath> + <DefineConstants></DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchLink>None</MtouchLink> + <MtouchArch>x86_64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\iPhone\Debug</OutputPath> + <DefineConstants>DEBUG;</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodesignKey>iPhone Developer</CodesignKey> + <DeviceSpecificBuild>true</DeviceSpecificBuild> + <MtouchDebug>true</MtouchDebug> + <MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> + <MtouchFastDev>true</MtouchFastDev> + <MtouchFloat32>true</MtouchFloat32> + <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> + <IOSDebuggerPort>50971</IOSDebuggerPort> + <MtouchLink>SdkOnly</MtouchLink> + <MtouchArch>ARM64</MtouchArch> + <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler> + <MtouchVerbosity></MtouchVerbosity> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Core" /> + <Reference Include="Xamarin.iOS" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Resources\" /> + </ItemGroup> + <ItemGroup> + <None Include="Info.plist" /> + <None Include="Entitlements.plist" /> + </ItemGroup> + <ItemGroup> + <InterfaceDefinition Include="MainInterface.storyboard" /> + </ItemGroup> + <ItemGroup> + <Compile Include="IntentViewController.cs" /> + <Compile Include="IntentViewController.designer.cs"> + <DependentUpon>IntentViewController.cs</DependentUpon> + </Compile> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.AppExtension.CSharp.targets" /> +</Project> \ No newline at end of file -- Gitblit v1.8.0