| | |
| | | using System; |
| | | using Intents; |
| | | using System.Linq; |
| | | using HDLSceneSiri; |
| | | |
| | | namespace Other.Siri |
| | | { |
| | |
| | | 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; } |
| | |
| | | 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) => |