From 0edfc730dafa1407efdeb8a6eed4c88c21aa1963 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 19 十一月 2021 16:40:45 +0800
Subject: [PATCH] siri
---
SiriIntents/Entitlements.plist | 6
SiriIntents/SiriIntents.csproj | 4
HDL-ON_iOS/HDL-ON_iOS.csproj | 24 +
HDL-ON_iOS/AppDelegate.cs | 47 ++
SiriIntentsUI/Entitlements.plist | 6
HDL-ON_iOS/Base.lproj/Intents.intentdefinition | 181 ++++++++++
HDL-ON_iOS/Other/Siri/Data/DataManager.cs | 202 +++++++++++
.vs/HDL_APP_Project/xs/UserPrefs.xml | 60 ++
SiriIntentsUI/SiriIntentsUI.csproj | 4
HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs | 40 ++
HDL_ON/UI/UI1-Login/LoginPage.cs | 5
SiriIntentsUI/Info.plist | 9
HDL-ON_iOS/Other/Siri/SiriBaseView.cs | 38 ++
HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png | 0
HDL_APP_Project.sln | 28
HDL-ON_iOS/Other/Siri/UI/Cells.cs | 14
HDL-ON_iOS/Entitlements.plist | 4
HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs | 38 ++
HDL-ON_iOS/Other/SkipControl.cs | 24 +
SiriIntents/Info.plist | 7
HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs | 79 ++++
HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs | 56 +++
HDL-ON_iOS/Other/Siri/HDLRunSceneIntentHandlder.cs | 26 +
HDL-ON_iOS/Other/Siri/SiriScene.cs | 10
HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 76 ++++
25 files changed, 932 insertions(+), 56 deletions(-)
diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 50014a3..5785953 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -6,25 +6,59 @@
<MonoDevelop.Ide.ItemProperties.SiriIntents>
<MonoDevelop.MacDev.AppleDevelopmentTeam />
</MonoDevelop.Ide.ItemProperties.SiriIntents>
- <MonoDevelop.Ide.Workbench ActiveDocument="SiriBinding/obj/Debug/iOS/HdlSiri/HDLRunSceneIntent.g.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="HDL-ON_iOS/Other/SkipControl.cs">
<Files>
- <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="203" Column="35" />
- <File FileName="HDL-ON_iOS/Other/SkipControl.cs" Line="18" Column="36" />
- <File FileName="HDL-ON_iOS/Other/Siri/SiriBaseView.cs" Line="34" Column="101" />
- <File FileName="SiriBinding/Structs.cs" />
+ <File FileName="HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs" Line="10" Column="102" />
+ <File FileName="HDL-ON_iOS/Other/Siri/UI/Cells.cs" />
+ <File FileName="HDL-ON_iOS/Other/Siri/HDLRunSceneIntentHandlder.cs" />
<File FileName="SiriIntents/IntentHandler.cs" />
- <File FileName="HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" Line="23" Column="45" />
- <File FileName="SiriBinding/obj/Debug/iOS/HdlSiri/HDLRunSceneIntent.g.cs" Line="63" Column="1" />
+ <File FileName="HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs" />
+ <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" />
+ <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalDataPage.cs" />
+ <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" />
+ <File FileName="HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs" />
+ <File FileName="HDL-ON_iOS/Other/Siri/SiriBaseView.cs" />
+ <File FileName="HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" />
+ <File FileName="HDL-ON_iOS/Other/Siri/Data/DataManager.cs" />
+ <File FileName="HDL-ON_iOS/Other/SkipControl.cs" Line="30" Column="57" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="HDL_APP_Project" expanded="True">
- <Node name="HDL-ON_iOS" selected="True" />
- <Node name="SiriBinding" expanded="True">
- <Node name="NativeReferenceFolder" expanded="True" />
+ <Node name="HDL_ON" expanded="True">
+ <Node name="DAL" expanded="True">
+ <Node name="Server" expanded="True" />
+ </Node>
+ <Node name="UI" expanded="True">
+ <Node name="CSS" expanded="True" />
+ <Node name="UI1-Login" expanded="True" />
+ <Node name="UI2" expanded="True">
+ <Node name="4-PersonalCenter" expanded="True" />
+ </Node>
+ </Node>
</Node>
+ <Node name="HDL-ON_iOS" expanded="True">
+ <Node name="Base.lproj" expanded="True" />
+ <Node name="Other" expanded="True">
+ <Node name="Siri" expanded="True">
+ <Node name="Data" expanded="True" />
+ <Node name="Support" expanded="True" />
+ </Node>
+ <Node name="SkipControl.cs" selected="True" />
+ </Node>
+ <Node name="Resources" expanded="True">
+ <Node name="Phone" expanded="True" />
+ </Node>
+ </Node>
+ <Node name="SiriIntents" expanded="True" />
+ <Node name="SiriIntentsUI" expanded="True" />
</Node>
+ </State>
+ </Pad>
+ <Pad Id="MonoDevelop.Debugger.WatchPad">
+ <State>
+ <Value>GetType().Assembly</Value>
</State>
</Pad>
</Pads>
@@ -38,6 +72,7 @@
<String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
<String>Shared.IOS/Shared.IOS.csproj</String>
<String>SiriIntent/SiriIntent.csproj</String>
+ <String>SiriBinding/SiriBinding.csproj</String>
</DisabledProjects>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" />
@@ -47,6 +82,11 @@
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="333" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" line="251" column="1" />
<Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" line="185" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs" line="894" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" relfile="HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" line="62" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" relfile="HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" line="60" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" relfile="HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs" line="64" column="1" />
+ <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL-ON_iOS/Other/Siri/SiriBaseView.cs" relfile="HDL-ON_iOS/Other/Siri/SiriBaseView.cs" line="60" column="1" />
</BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MultiItemStartupConfigurations />
diff --git a/HDL-ON_iOS/AppDelegate.cs b/HDL-ON_iOS/AppDelegate.cs
index 5da920e..81d1d57 100644
--- a/HDL-ON_iOS/AppDelegate.cs
+++ b/HDL-ON_iOS/AppDelegate.cs
@@ -10,6 +10,8 @@
using HDL_ON.UI;
using HDL_ON.DAL.Server;
using Intents;
+using Other.Siri;
+using HDLSceneSiri;
namespace SharedMethod
{
@@ -473,6 +475,51 @@
HDL_ON.DriverLayer.Control.Ins.SearchLoaclGateway();
}
+
+
+ #region Siri
+ public override bool ContinueUserActivity(UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
+ {
+ var intent = userActivity.GetInteraction()?.Intent as HDLRunSceneIntent;
+ if (!(intent is null))
+ {
+ HandleIntent(intent);
+ return true;
+ }
+ else if (userActivity.ActivityType == NSUserActivityHelper.ViewMenuActivityType)
+ {
+ HandleUserActivity();
+ return true;
+ }
+ return false;
+ }
+
+ void HandleIntent(HDLRunSceneIntent intent)
+ {
+ var handler = new HDLRunSceneIntentHandlder();
+ handler.HandleRunScene(intent, (response) => {
+ if (response.Code != HDLRunSceneIntentResponseCode.Success)
+ {
+ Console.WriteLine("Quantity must be greater than 0 to add to order");
+ }
+ });
+ }
+
+ void HandleUserActivity()
+ {
+ //var rootViewController = Window?.RootViewController as UINavigationController;
+ //var orderHistoryViewController = rootViewController?.ViewControllers?.FirstOrDefault() as OrderHistoryTableViewController;
+ //if (orderHistoryViewController is null)
+ //{
+ // Console.WriteLine("Failed to access OrderHistoryTableViewController.");
+ // return;
+ //}
+ //var segue = OrderHistoryTableViewController.SegueIdentifiers.SoupMenu;
+ //orderHistoryViewController.PerformSegue(segue, null);
+ }
+ #endregion
+
+
}
}
diff --git a/HDL-ON_iOS/Base.lproj/Intents.intentdefinition b/HDL-ON_iOS/Base.lproj/Intents.intentdefinition
new file mode 100644
index 0000000..f49bdce
--- /dev/null
+++ b/HDL-ON_iOS/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/Entitlements.plist b/HDL-ON_iOS/Entitlements.plist
index cb782f8..c3acdcc 100644
--- a/HDL-ON_iOS/Entitlements.plist
+++ b/HDL-ON_iOS/Entitlements.plist
@@ -10,5 +10,9 @@
</array>
<key>com.apple.developer.siri</key>
<true/>
+ <key>com.apple.security.application-groups</key>
+ <array>
+ <string>group.com.hdl.onpro</string>
+ </array>
</dict>
</plist>
diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj
index a817328..a33f04f 100644
--- a/HDL-ON_iOS/HDL-ON_iOS.csproj
+++ b/HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -28,6 +28,7 @@
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC";-w</MtouchExtraArgs>
<CodesignProvision>On+Dev-20210616-1</CodesignProvision>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
@@ -38,6 +39,7 @@
<MtouchLink>SdkOnly</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
+<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
@@ -56,6 +58,7 @@
<MtouchEnableSGenConc>false</MtouchEnableSGenConc>
<CodesignProvision>OnPro211116-1</CodesignProvision>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
+<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
@@ -70,6 +73,7 @@
<MtouchExtraArgs>-gcc_flags="-dead_strip -ObjC"</MtouchExtraArgs>
<MtouchI18n>cjk</MtouchI18n>
<CodesignProvision>OnPro-Hoc20211117-1</CodesignProvision>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -103,6 +107,9 @@
</Reference>
<Reference Include="Shared.IOS.HDLLinphoneSDK">
<HintPath>..\DLL\Linphone\iOS\Shared.IOS.HDLLinphoneSDK.dll</HintPath>
+ </Reference>
+ <Reference Include="Shared.IOS.HDLSceneSiri">
+ <HintPath>..\..\HDLXamarinSceneSiri\Shared.IOS.HDLSceneSiri\Shared.IOS.HDLSceneSiri\bin\Release\Shared.IOS.HDLSceneSiri.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -464,6 +471,9 @@
<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\" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="LaunchScreen.storyboard" />
@@ -499,6 +509,12 @@
</Compile>
<Compile Include="Other\Siri\VoiceShortcutDataManager.cs" />
<Compile Include="Other\Siri\SiriScene.cs" />
+ <Compile Include="Other\Siri\HDLRunSceneIntentHandlder.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" />
@@ -1366,6 +1382,7 @@
<BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\btnCloseIcon.png" />
<BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\btnInfoIcon.png" />
<BundleResource Include="Resources\Phone\FunctionIcon\AirFresh\HumiOnIcon.png" />
+ <BundleResource Include="Resources\Phone\PersonalCenter\SiriIcon.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="iTunesArtwork" />
@@ -1410,10 +1427,6 @@
<Project>{2DDF4C3C-6998-432E-9F43-6786D82F0630}</Project>
<Name>Blufi</Name>
</ProjectReference>
- <ProjectReference Include="..\SiriBinding\SiriBinding.csproj">
- <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>
@@ -1425,6 +1438,9 @@
<Name>SiriIntentsUI</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Content Include="Base.lproj\Intents.intentdefinition" />
+ </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" />
<ProjectExtensions>
diff --git a/HDL-ON_iOS/Other/Siri/Data/DataManager.cs b/HDL-ON_iOS/Other/Siri/Data/DataManager.cs
new file mode 100644
index 0000000..d77053f
--- /dev/null
+++ b/HDL-ON_iOS/Other/Siri/Data/DataManager.cs
@@ -0,0 +1,202 @@
+锘�/*
+See LICENSE folder for this sample鈥檚 licensing information.
+
+Abstract:
+A data manager that manages data conforming to `Codable` and stores it in `UserDefaults`.
+*/
+
+using System;
+using Foundation;
+using CoreFoundation;
+
+namespace Other.Siri
+{
+ public struct UserDefaultsStorageDescriptor
+ {
+ public string Key { get; set; }
+ public UserDefaultsStorageDescriptor(string key)
+ {
+ Key = key;
+ }
+ }
+
+ public static class NotificationKeys
+ {
+ // Clients of `DataManager` that want to know when the data changes can
+ // listen for this notification.
+ public const string DataChanged = "DataChangedNotification";
+ }
+
+ public class DataManager<ManagedDataType> : NSObject
+ where ManagedDataType : NSObject, INSCoding
+ {
+ // This sample uses App Groups to share a suite of data between the
+ // main app and the different extensions.
+ protected NSUserDefaults UserDefaults = NSUserDefaultsHelper.DataSuite;
+
+ // To prevent data races, all access to `UserDefaults` uses this queue.
+ protected DispatchQueue UserDefaultsAccessQueue = new DispatchQueue("User Defaults Access Queue");
+
+ // Storage and observation information.
+ protected UserDefaultsStorageDescriptor StorageDescriptor;
+
+ // A flag to avoid receiving notifications about data this instance just
+ // wrote to `UserDefaults`.
+ protected bool IgnoreLocalUserDefaultsChanges = false;
+
+ // The observer object handed back after registering to observe a
+ // property.
+ IDisposable UserDefaultsObserver;
+
+ // The data managed by this `DataManager`.
+ //姝も�淒ataManager鈥濈鐞嗙殑鏁版嵁銆�
+ protected ManagedDataType ManagedDataBackingInstance;
+
+ // Access to `managedDataBackingInstance` needs to occur on a dedicated
+ // queue to avoid data races.
+ protected DispatchQueue DataAccessQueue = new DispatchQueue("Data Access Queue");
+
+ // Public access to the managed data for clients of `DataManager`
+ public ManagedDataType ManagedData
+ {
+ get
+ {
+ ManagedDataType data = null;
+ DataAccessQueue.DispatchSync(() => data = ManagedDataBackingInstance);
+ return data;
+ }
+ }
+
+ // See note below about createInitialData and initialData
+ public DataManager(UserDefaultsStorageDescriptor storageDescriptor, ManagedDataType initialData)
+ {
+ StorageDescriptor = storageDescriptor;
+ LoadData();
+ if (ManagedDataBackingInstance is null)
+ {
+ ManagedDataBackingInstance = initialData;
+ WriteData();
+ }
+ ObserveChangesInUserDefaults();
+ }
+
+ // createInitialData
+ //
+ // The Swift version of this app has a createInitialData method.
+ // Each child class of the DataManager class overrides this method, and
+ // then the DataManager base class calls the derived versions to get
+ // the initial data. C# gives a compiler warning for this ("Virtual
+ // member call in constructor"). Since in C# the base class constructor
+ // is run before the child class constructor, having the base clas
+ // constructor call out to a method on the derived class is calling
+ // a method on an object that has not yet been fully constructed.
+ // The C# version of this sample works around this problem by passing
+ // in the initial data to the constructor.
+
+ void ObserveChangesInUserDefaults()
+ {
+ var weakThis = new WeakReference<DataManager<ManagedDataType>>(this);
+ Action<NSObservedChange> changeHandler = (change) =>
+ {
+ if (weakThis.TryGetTarget(out var dataManager))
+ {
+ // Ignore any change notifications coming from data this
+ // instance just saved to `NSUserDefaults`.
+ if (dataManager is null || dataManager.IgnoreLocalUserDefaultsChanges)
+ {
+ return;
+ }
+
+ // The underlying data changed in `NSUserDefaults`, so
+ // update this instance with the change and notify clients
+ // of the change.
+ dataManager.LoadData();
+ dataManager.NotifyClientsDataChanged();
+ }
+ };
+ UserDefaultsObserver = UserDefaults.AddObserver(
+ StorageDescriptor.Key,
+ NSKeyValueObservingOptions.Initial | NSKeyValueObservingOptions.New,
+ changeHandler
+ );
+ }
+
+ // Notifies clients the data changed by posting an `NSNotification` with
+ // the key `NotificationKeys.DataChanged`
+ void NotifyClientsDataChanged()
+ {
+ var notification = NSNotification.FromName(NotificationKeys.DataChanged, this);
+ NSNotificationCenter.DefaultCenter.PostNotification(notification);
+ }
+
+ protected virtual void FinishUnarchiving(NSObject unarchivedData)
+ {
+ throw new NotImplementedException();
+ }
+
+ // Loads the data from `NSUserDefaults`.
+ void LoadData()
+ {
+ UserDefaultsAccessQueue.DispatchSync(() =>
+ {
+ NSData archivedData = UserDefaults.DataForKey(StorageDescriptor.Key);
+ try
+ {
+ // Let the derived classes handle the specifics of
+ // putting the unarchived data in the correct format.
+ // This is necessary because the derived classes
+ // (SoupMenuManager, SoupOrderMenuManager) are using
+ // generic data formats (NSMutableSet<T> or NSMutableArray<T>)
+ // and these types cannot be casted directly from the
+ // deserialized data.
+ NSObject unarchivedData = NSKeyedUnarchiver.UnarchiveObject(archivedData);
+ FinishUnarchiving(unarchivedData);
+ }
+ catch (Exception e)
+ {
+ if (!(e is null))
+ {
+ Console.WriteLine($"Error: {e.Message}");
+ }
+ }
+ });
+ }
+
+ // Writes the data to `NSUserDefaults`
+ protected void WriteData()
+ {
+ UserDefaultsAccessQueue.DispatchAsync(() =>
+ {
+ try
+ {
+ NSData encodedData = NSKeyedArchiver.ArchivedDataWithRootObject(ManagedDataBackingInstance);
+ IgnoreLocalUserDefaultsChanges = true;
+ UserDefaults.SetValueForKey(encodedData, (NSString)StorageDescriptor.Key);
+ IgnoreLocalUserDefaultsChanges = false;
+ NotifyClientsDataChanged();
+ }
+ catch (Exception e)
+ {
+ throw new Exception($"Could not save data. Reason: {e.Message}");
+ }
+ });
+ }
+
+ protected void SetIsLoginValue()
+ {
+ UserDefaults.SetBool(true, NSUserDefaultsHelper.StorageKeys.GLOBAL_GIsLogin);
+ }
+ public void SetAccessTokenValue(string accessToken)
+ {
+ UserDefaults.SetString(accessToken, NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken);
+ }
+ public void SetRefreshTokenValue(string refreshToken)
+ {
+ UserDefaults.SetString(refreshToken, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken);
+ }
+ public void SetRegionUrlValue(string regionUrl)
+ {
+ UserDefaults.SetString(regionUrl, NSUserDefaultsHelper.StorageKeys.GLOBAL_GRegionUrl);
+ }
+ }
+}
diff --git a/HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs b/HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs
new file mode 100644
index 0000000..d796abc
--- /dev/null
+++ b/HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs
@@ -0,0 +1,79 @@
+锘縰sing Foundation;
+using Intents;
+using System;
+using System.Linq;
+
+namespace Other.Siri
+{
+ public class SceneDateManager : DataManager<NSMutableArray<SiriScene>>
+ {
+ 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
+ // sense in the caller's context.
+ public NSMutableArray<SiriScene> OrderHistory
+ {
+ get
+ {
+ return ManagedData as NSMutableArray<SiriScene>;
+ }
+ }
+
+ 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
+ override protected void FinishUnarchiving(NSObject unarchivedData)
+ {
+ var array = (NSArray)unarchivedData;
+ SiriScene[] orders = NSArray.FromArray<SiriScene>(array);
+ ManagedDataBackingInstance = new NSMutableArray<SiriScene>(orders);
+ }
+ #endregion
+ }
+}
diff --git a/HDL-ON_iOS/Other/Siri/HDLRunSceneIntentHandlder.cs b/HDL-ON_iOS/Other/Siri/HDLRunSceneIntentHandlder.cs
new file mode 100644
index 0000000..e3df810
--- /dev/null
+++ b/HDL-ON_iOS/Other/Siri/HDLRunSceneIntentHandlder.cs
@@ -0,0 +1,26 @@
+锘縰sing System;
+using HDLSceneSiri;
+using ObjCRuntime;
+
+namespace Other.Siri
+{
+ 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/HDL-ON_iOS/Other/Siri/SiriBaseView.cs b/HDL-ON_iOS/Other/Siri/SiriBaseView.cs
index bf375b9..87c302e 100644
--- a/HDL-ON_iOS/Other/Siri/SiriBaseView.cs
+++ b/HDL-ON_iOS/Other/Siri/SiriBaseView.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using CoreGraphics;
using Foundation;
+using HDL_ON.Entity;
using Intents;
using IntentsUI;
using UIKit;
@@ -9,14 +10,41 @@
{
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;
+
@@ -24,14 +52,12 @@
var btn = UIButton.FromType(UIButtonType.System);
btn.Frame = new CGRect(20, 200, 280, 44);
btn.SetTitle("Click Me", UIControlState.Normal);
-
-
- VoiceShortcutDataManager VoiceShortcutDataManager = new VoiceShortcutDataManager();
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);
+ INVoiceShortcut existingShortcut = VoiceShortcutDataManager?.VoiceShortcutForOrder(ss);
//if (!(existingShortcut is null))
//{
// var editVoiceShortcutViewController = new INUIEditVoiceShortcutViewController(existingShortcut);
@@ -42,6 +68,10 @@
{
// 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))
{
diff --git a/HDL-ON_iOS/Other/Siri/SiriScene.cs b/HDL-ON_iOS/Other/Siri/SiriScene.cs
index 8dcb815..bad1588 100644
--- a/HDL-ON_iOS/Other/Siri/SiriScene.cs
+++ b/HDL-ON_iOS/Other/Siri/SiriScene.cs
@@ -1,6 +1,7 @@
锘縰sing System;
using Foundation;
-using HdlSiri;
+using HDLSceneSiri;
+//using HdlSiri;
using Intents;
using UIKit;
@@ -25,9 +26,10 @@
{
get
{
- var orderSoupIntent = new HDLRunSceneIntent() { SceneId = Id, SceneName = Name };
- //orderSoupIntent.Quantity = new NSNumber(Quantity);
- //orderSoupIntent.Soup = new INObject(MenuItem.ItemNameKey, MenuItem.LocalizedString);
+
+ 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))
diff --git a/HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs b/HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs
new file mode 100644
index 0000000..e5bdc79
--- /dev/null
+++ b/HDL-ON_iOS/Other/Siri/Support/NSUserActivityHelper.cs
@@ -0,0 +1,56 @@
+锘縰sing System;
+using Foundation;
+
+#if __IOS__
+using CoreSpotlight;
+using UIKit;
+using System.Linq.Expressions;
+using System.Xml;
+#endif
+
+namespace Other.Siri
+{
+ public static class NSUserActivityHelper
+ {
+ public static class ActivityKeys
+ {
+ public const string MenuItems = "menuItems";
+ public const string SegueId = "segueID";
+ }
+
+ static string SearchableItemContentType = "Soup Menu";
+
+ public static string ViewMenuActivityType = "com.xamarin.SoupChef.viewMenu";
+
+ public static NSUserActivity ViewMenuActivity {
+ get
+ {
+ var userActivity = new NSUserActivity(ViewMenuActivityType)
+ {
+ Title = "娴嬭瘯title", //NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_TITLE", "View menu activity title"),
+ EligibleForSearch = true,
+ EligibleForPrediction = true
+ };
+
+ var attributes = new CSSearchableItemAttributeSet(NSUserActivityHelper.SearchableItemContentType)
+ {
+ //ThumbnailData = UIImage.FromBundle("tomato").AsPNG(),
+ Keywords = ViewMenuSearchableKeywords,
+ DisplayName = "娴嬭瘯DisplayName",// NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_TITLE", "View menu activity title"),
+ ContentDescription = "娴嬭瘯ContentDescription",//NSBundleHelper.SoupKitBundle.GetLocalizedString("VIEW_MENU_CONTENT_DESCRIPTION", "View menu content description")
+ };
+ userActivity.ContentAttributeSet = attributes;
+
+ //var phrase = NSBundleHelper.SoupKitBundle.GetLocalizedString("ORDER_LUNCH_SUGGESTED_PHRASE", "Voice shortcut suggested phrase");
+ userActivity.SuggestedInvocationPhrase = "娴嬭瘯phrase";
+ return userActivity;
+ }
+ }
+
+ static string[] ViewMenuSearchableKeywords = new string[] {
+ "Searchable Keyword",
+ "Searchable Keyword",
+ "Searchable Keyword"
+ };
+ }
+}
diff --git a/HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs b/HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs
new file mode 100644
index 0000000..b7f5592
--- /dev/null
+++ b/HDL-ON_iOS/Other/Siri/Support/NSUserDefaultsHelper.cs
@@ -0,0 +1,40 @@
+锘縰sing System;
+using Foundation;
+using System.Resources;
+namespace Other.Siri
+{
+ public static class NSUserDefaultsHelper
+ {
+ private const string AppGroup = "group.com.hdl.onpro";
+
+ public static class StorageKeys
+ {
+ public const string SoupMenu = "soupMenu";
+ public const string OrderHistory = "orderHistory";
+ public const string VoiceShortcutHistory = "voiceShortcutHistory";
+
+ public const string APP_KEY = "HDL-HOME-APP-TEST";
+ public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
+
+
+ public const string GLOBAL_GIsLogin = "IsLogin";
+
+ public const string GLOBAL_GAccessToken = "AccessToken";
+
+ public const string GLOBAL_GRefreshToken = "RefreshToken";
+
+ public const string GLOBAL_GRegionUrl = "RegionUrl";
+ }
+
+ public static NSUserDefaults DataSuite {
+ get {
+ var dataSuite = new NSUserDefaults(AppGroup, NSUserDefaultsType.SuiteName);
+ if( dataSuite is null )
+ {
+ throw new Exception($"Could not load UserDefaults for app group {AppGroup}");
+ }
+ return dataSuite;
+ }
+ }
+ }
+}
diff --git a/HDL-ON_iOS/Other/Siri/UI/Cells.cs b/HDL-ON_iOS/Other/Siri/UI/Cells.cs
new file mode 100644
index 0000000..d58e00c
--- /dev/null
+++ b/HDL-ON_iOS/Other/Siri/UI/Cells.cs
@@ -0,0 +1,14 @@
+锘縰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
index 041374d..98ba68b 100644
--- a/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs
+++ b/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs
@@ -8,6 +8,7 @@
using System;
using Intents;
using System.Linq;
+using HDLSceneSiri;
namespace Other.Siri
{
@@ -20,11 +21,16 @@
UpdateVoiceShortcuts(null);
}
+ public VoiceShortcutDataManager(Action action)
+ {
+ UpdateVoiceShortcuts(action);
+ }
+
public INVoiceShortcut VoiceShortcutForOrder(SiriScene ss)
{
var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) =>
{
- var intent = shortcut.Shortcut.Intent as HdlSiri.HDLRunSceneIntent;
+ var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent;
if (intent is null) { return false; }
var orderFromIntent = SiriScene.FromOrderSoupIntent(intent);
if (orderFromIntent is null) { return false; }
@@ -33,6 +39,36 @@
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) =>
diff --git a/HDL-ON_iOS/Other/SkipControl.cs b/HDL-ON_iOS/Other/SkipControl.cs
index 408138f..7bcbc47 100644
--- a/HDL-ON_iOS/Other/SkipControl.cs
+++ b/HDL-ON_iOS/Other/SkipControl.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using CoreGraphics;
+using Foundation;
using Intents;
using IntentsUI;
using Other.Siri;
@@ -15,14 +16,27 @@
public void SkipSiriView()
{
- var user = new SiriBaseView();
- user.View.BackgroundColor = UIColor.Magenta;
+ //var user = new SiriBaseView();
+ //user.View.BackgroundColor = new UIColor(242, 243, 247, 1);
- 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);
+ NSMutableArray list = new NSMutableArray();
+ foreach (var localScene in HDL_ON.Entity.FunctionList.List.scenes)
+ {
+ list.Add(new HDLSceneSiri.HDLSiriSceneModel()
+ {
+ UserSceneId = localScene.userSceneId,
+ Name = localScene.name,
+ });
+ }
+ var vc = new HDLSceneSiri.HDLSiriSceneListViewController();
+ vc.DataSource = list;
+ //vc.TitleName
+ //PresentViewController(vc, true, null);
+ HDL_ON_iOS.AppDelegate.rootViewController.PushViewController(vc, true);
+
}
}
}
diff --git a/HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png b/HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png
new file mode 100644
index 0000000..30d4f8c
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/PersonalCenter/SiriIcon.png
Binary files differ
diff --git a/HDL_APP_Project.sln b/HDL_APP_Project.sln
index 5623565..9bffd46 100644
--- a/HDL_APP_Project.sln
+++ b/HDL_APP_Project.sln
@@ -10,11 +10,11 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blufi", "HdlBluWi\Blufi.csproj", "{2DDF4C3C-6998-432E-9F43-6786D82F0630}"
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
+Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "SiriBinding", "SiriBinding\SiriBinding.csproj", "{3ED45164-1242-414A-8B08-2751710F6E05}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -69,18 +69,6 @@
{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{2DDF4C3C-6998-432E-9F43-6786D82F0630}.Debug|Any CPU.Build.0 = Debug|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
{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
@@ -105,6 +93,18 @@
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index 9fcc952..6b63775 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -198,11 +198,6 @@
bool b = false;
btnIcon.MouseUpEventHandler += (sender, e) =>
{
-#if __IOS__
- var dd =new Other.SkipControl();
- dd.SkipSiriView();
- return;
-#endif
//ESOnVideo.Current.Test(false);
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
index b333fe4..52d41b6 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs
@@ -152,6 +152,10 @@
/// 鏅鸿兘闊崇鏂囨湰
/// </summary>
Button btnSmartSpeakerText;
+ /// <summary>
+ /// Siri鏂囨湰
+ /// </summary>
+ Button btnSiriText;
public PersonalCenterPage()
@@ -850,6 +854,78 @@
#endregion
+ #region Siri
+ #if __IOS__
+ //if (Application.PhoneType >= 12)
+ {
+ //supportView 鍔犻珮 鏄剧ず3琛� 3*44
+ supportView.Height = Application.GetRealWidth(3 * 44);
+
+ FrameLayout siriView = new FrameLayout()
+ {
+ Height = Application.GetRealWidth(44),
+ };
+ supportView.AddChidren(siriView);
+
+ //浣忓畢涓哄綋鍓嶈处鍙锋墠鏄剧ず鏅鸿兘闊崇鍏ュ彛
+ Button btnSiriIcon = new Button()
+ {
+ X = Application.GetRealWidth(12),
+ Y = Application.GetRealWidth(10),
+ Width = Application.GetMinRealAverage(24),
+ Height = Application.GetMinRealAverage(24),
+ UnSelectedImagePath = "PersonalCenter/SiriIcon.png",
+ };
+ siriView.AddChidren(btnSiriIcon);
+
+ btnSiriText = new Button()
+ {
+ X = Application.GetRealWidth(48),
+ Width = Application.GetRealWidth(270),
+ Height = Application.GetRealWidth(44),
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextAlignment = TextAlignment.CenterLeft,
+ TextSize = CSS_FontSize.TextFontSize
+ };
+ if(Language.CurrentLanguage == "Chinese")
+ {
+ btnSiriText.Text = "Siri蹇嵎鏂瑰紡";
+ }else
+ {
+ btnSiriText.Text = "Siri Shortcut";
+ }
+
+ siriView.AddChidren(btnSiriText);
+
+
+ btnSiriText.MouseUpEventHandler = (sender, e) => {
+ var ddd =new Other.SkipControl();
+ ddd.SkipSiriView();
+ };
+
+ Button btnSiriRight = new Button()
+ {
+ X = Application.GetRealWidth(315),
+ Y = Application.GetRealWidth(14),
+ Width = Application.GetMinRealAverage(16),
+ Height = Application.GetMinRealAverage(16),
+ UnSelectedImagePath = "Public/Right.png",
+ };
+ siriView.AddChidren(btnSiriRight);
+
+ var btnSmartSpeakerViewLine = new Button()
+ {
+ X = Application.GetRealWidth(48),
+ Y = Application.GetRealWidth(43),
+ Height = Application.GetRealHeight(1),
+ Width = Application.GetRealWidth(279),
+ BackgroundColor = CSS_Color.DividingLineColor
+ };
+ siriView.AddChidren(btnSmartSpeakerViewLine);
+ }
+ #endif
+ #endregion
+
#region 鑾峰彇鏀寔
//FrameLayout supView = new FrameLayout()
//{
diff --git a/SiriIntents/Entitlements.plist b/SiriIntents/Entitlements.plist
index 9ae5993..0c0f62c 100644
--- a/SiriIntents/Entitlements.plist
+++ b/SiriIntents/Entitlements.plist
@@ -1,6 +1,10 @@
-锘�<?xml version="1.0" encoding="UTF-8" ?>
+<?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>com.apple.security.application-groups</key>
+ <array>
+ <string>group.com.hdl.onpro</string>
+ </array>
</dict>
</plist>
diff --git a/SiriIntents/Info.plist b/SiriIntents/Info.plist
index 63023d3..c619699 100644
--- a/SiriIntents/Info.plist
+++ b/SiriIntents/Info.plist
@@ -7,7 +7,7 @@
<key>CFBundleName</key>
<string>SiriIntents</string>
<key>CFBundleIdentifier</key>
- <string>com.hdl.onpro.SiriIntents</string>
+ <string>com.hdl.onpro.siri</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -28,11 +28,10 @@
<array/>
<key>IntentsSupported</key>
<array>
- <string>INSendMessageIntent</string>
- <string>INSearchForMessagesIntent</string>
- <string>INSetMessageAttributeIntent</string>
<string>HDLRunSceneIntent</string>
</array>
+ <key>IntentsRestrictedWhileProtectedDataUnavailable</key>
+ <array/>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.intents-service</string>
diff --git a/SiriIntents/SiriIntents.csproj b/SiriIntents/SiriIntents.csproj
index bf9fe11..36f35e5 100644
--- a/SiriIntents/SiriIntents.csproj
+++ b/SiriIntents/SiriIntents.csproj
@@ -79,12 +79,16 @@
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
+ <CodesignProvision>OnproSiri211116-1</CodesignProvision>
</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\" />
diff --git a/SiriIntentsUI/Entitlements.plist b/SiriIntentsUI/Entitlements.plist
index 9ae5993..0c0f62c 100644
--- a/SiriIntentsUI/Entitlements.plist
+++ b/SiriIntentsUI/Entitlements.plist
@@ -1,6 +1,10 @@
-锘�<?xml version="1.0" encoding="UTF-8" ?>
+<?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>com.apple.security.application-groups</key>
+ <array>
+ <string>group.com.hdl.onpro</string>
+ </array>
</dict>
</plist>
diff --git a/SiriIntentsUI/Info.plist b/SiriIntentsUI/Info.plist
index b9e141f..24f1df7 100644
--- a/SiriIntentsUI/Info.plist
+++ b/SiriIntentsUI/Info.plist
@@ -7,7 +7,7 @@
<key>CFBundleName</key>
<string>SiriIntentsUI</string>
<key>CFBundleIdentifier</key>
- <string>com.hdl.onpro.SiriIntentsui</string>
+ <string>com.hdl.onpro.siriui</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -19,16 +19,19 @@
<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>IntentsSupported</key>
<array>
- <string>INSendMessageIntent</string>
<string>HDLRunSceneIntent</string>
</array>
+ <key>IntentsRestrictedWhileLocked</key>
+ <array/>
+ <key>IntentsRestrictedWhileProtectedDataUnavailable</key>
+ <array/>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
diff --git a/SiriIntentsUI/SiriIntentsUI.csproj b/SiriIntentsUI/SiriIntentsUI.csproj
index ee08b49..01fee2b 100644
--- a/SiriIntentsUI/SiriIntentsUI.csproj
+++ b/SiriIntentsUI/SiriIntentsUI.csproj
@@ -79,12 +79,16 @@
<MtouchArch>ARM64</MtouchArch>
<MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
<MtouchVerbosity></MtouchVerbosity>
+ <CodesignProvision>OnproSiriUI211116-1</CodesignProvision>
</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\" />
--
Gitblit v1.8.0