-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
189 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import AppIntents | ||
import UIKit | ||
|
||
@available(iOS 16.0, *) | ||
struct AmberOnIntent: AppIntent { | ||
static let title: LocalizedStringResource = "Amber On" | ||
static let description = IntentDescription( | ||
"Turn on all amber LEDs", | ||
categoryName: "Device" | ||
) | ||
static let openAppWhenRun: Bool = true | ||
|
||
func perform() async throws -> some IntentResult { | ||
if let url = URL(string: "leds://com.ps.TrollLEDs.AmberOn") { | ||
if await UIApplication.shared.canOpenURL(url) { | ||
await UIApplication.shared.open(url) | ||
} | ||
} | ||
return .result() | ||
} | ||
} | ||
|
||
@available(iOS 16.0, *) | ||
struct WhiteOnIntent: AppIntent { | ||
static let title: LocalizedStringResource = "White On" | ||
static let description = IntentDescription( | ||
"Turn on all white LEDs", | ||
categoryName: "Device" | ||
) | ||
static let openAppWhenRun: Bool = true | ||
|
||
func perform() async throws -> some IntentResult { | ||
if let url = URL(string: "leds://com.ps.TrollLEDs.WhiteOn") { | ||
if await UIApplication.shared.canOpenURL(url) { | ||
await UIApplication.shared.open(url) | ||
} | ||
} | ||
return .result() | ||
} | ||
} | ||
|
||
@available(iOS 16.0, *) | ||
struct AllOnIntent: AppIntent { | ||
static let title: LocalizedStringResource = "All On" | ||
static let description = IntentDescription( | ||
"Turn on all LEDs", | ||
categoryName: "Device" | ||
) | ||
static let openAppWhenRun: Bool = true | ||
|
||
func perform() async throws -> some IntentResult { | ||
if let url = URL(string: "leds://com.ps.TrollLEDs.AllOn") { | ||
if await UIApplication.shared.canOpenURL(url) { | ||
await UIApplication.shared.open(url) | ||
} | ||
} | ||
return .result() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"generator":{"version":"15.2","name":"xcode-tools"},"enums":[],"autoShortcutProviderMangledName":"9TrollLEDs0aB20AppShortcutsProviderV","entities":{},"autoShortcuts":[{"actionIdentifier":"AmberOnIntent","phraseTemplates":[{"key":"Turn on amber LEDs with ${applicationName}"}],"systemImageName":"flashlight.on.circle.fill","shortTitle":{"key":"Amber On"}},{"systemImageName":"flashlight.on.circle.fill","actionIdentifier":"WhiteOnIntent","shortTitle":{"key":"White On"},"phraseTemplates":[{"key":"Turn on white LEDs with ${applicationName}"}]},{"systemImageName":"flashlight.on.circle.fill","shortTitle":{"key":"All On"},"actionIdentifier":"AllOnIntent","phraseTemplates":[{"key":"Turn on all LEDs with ${applicationName}"}]}],"queries":{},"shortcutTileColor":14,"actions":{"AmberOnIntent":{"parameters":[],"presentationStyle":0,"identifier":"AmberOnIntent","outputFlags":0,"systemProtocols":[],"title":{"key":"Amber On"},"openAppWhenRun":true,"isDiscoverable":true,"mangledTypeNameByBundleIdentifier":{},"typeSpecificMetadata":[],"systemProtocolMetadata":[],"availabilityAnnotations":{"LNPlatformNameWildcard":{"introducedVersion":"*"},"LNPlatformNameIOS":{"introducedVersion":"16.0"}},"mangledTypeNameV2":"9TrollLEDs13AmberOnIntentV","mangledTypeName":"9TrollLEDs13AmberOnIntentV","effectiveBundleIdentifiers":[],"authenticationPolicy":0,"descriptionMetadata":{"descriptionText":{"key":"Turn on all amber LEDs"},"searchKeywords":[],"categoryName":{"title":{"key":"Device"}}},"requiredCapabilities":[],"mangledTypeNameByBundleIdentifierV2":{}},"WhiteOnIntent":{"identifier":"WhiteOnIntent","mangledTypeNameByBundleIdentifier":{},"isDiscoverable":true,"mangledTypeName":"9TrollLEDs13WhiteOnIntentV","requiredCapabilities":[],"openAppWhenRun":true,"authenticationPolicy":0,"mangledTypeNameByBundleIdentifierV2":{},"parameters":[],"typeSpecificMetadata":[],"descriptionMetadata":{"descriptionText":{"key":"Turn on all white LEDs"},"categoryName":{"title":{"key":"Device"}},"searchKeywords":[]},"systemProtocols":[],"presentationStyle":0,"outputFlags":0,"availabilityAnnotations":{"LNPlatformNameWildcard":{"introducedVersion":"*"},"LNPlatformNameIOS":{"introducedVersion":"16.0"}},"mangledTypeNameV2":"9TrollLEDs13WhiteOnIntentV","title":{"key":"White On"},"systemProtocolMetadata":[],"effectiveBundleIdentifiers":[]},"AllOnIntent":{"outputFlags":0,"systemProtocolMetadata":[],"availabilityAnnotations":{"LNPlatformNameWildcard":{"introducedVersion":"*"},"LNPlatformNameIOS":{"introducedVersion":"16.0"}},"presentationStyle":0,"isDiscoverable":true,"title":{"key":"All On"},"mangledTypeNameByBundleIdentifier":{},"descriptionMetadata":{"searchKeywords":[],"categoryName":{"title":{"key":"Device"}},"descriptionText":{"key":"Turn on all LEDs"}},"systemProtocols":[],"mangledTypeNameByBundleIdentifierV2":{},"parameters":[],"requiredCapabilities":[],"openAppWhenRun":true,"effectiveBundleIdentifiers":[],"authenticationPolicy":0,"mangledTypeName":"9TrollLEDs11AllOnIntentV","typeSpecificMetadata":[],"mangledTypeNameV2":"9TrollLEDs11AllOnIntentV","identifier":"AllOnIntent"}},"negativePhrases":[],"version":1} |
Binary file added
BIN
+1 Byte
Resources/Metadata.appintents/nlu/en_US.3b3c1ac8ff7d03aa7cc04f67ceedb451.version
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
apiVersion: ssu/v1 | ||
nlu: | ||
shortcuts: | ||
bundleIdentifier: com.ps.TrollLEDs | ||
intents: | ||
- metadata: | ||
name: AmberOnIntent_0 | ||
title: Amber On | ||
corpuses: | ||
training: | ||
- locale: en_US | ||
utterances: | ||
- Turn on amber LEDs with ${+applicationName} | ||
- metadata: | ||
name: WhiteOnIntent_1 | ||
title: White On | ||
corpuses: | ||
training: | ||
- locale: en_US | ||
utterances: | ||
- Turn on white LEDs with ${+applicationName} | ||
- metadata: | ||
name: AllOnIntent_2 | ||
title: All On | ||
corpuses: | ||
training: | ||
- locale: en_US | ||
utterances: | ||
- Turn on all LEDs with ${+applicationName} | ||
- metadata: | ||
name: +negative | ||
corpuses: | ||
training: | ||
- locale: en_US | ||
utterances: | ||
- ${+standardAppShortcutNegatives} | ||
variables: | ||
- name: +applicationName | ||
type: ssu/expansion | ||
definitions: | ||
- locale: en_US | ||
synomyms: | ||
- TrollLEDs | ||
- name: +prefix | ||
type: ssu/expansion | ||
definitions: | ||
- locale: en_US | ||
synomyms: | ||
$ref: ssu://Resources/prefix/en.yaml | ||
- name: +standardAppShortcutNegatives | ||
type: ssu/expansion | ||
definitions: | ||
- locale: en_US | ||
synomyms: | ||
$ref: ssu://Resources/standardAppShortcutNegatives/en.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"toolsVersion" : "15.2", | ||
"version" : "3.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import AppIntents | ||
|
||
@available(iOS 16.0, *) | ||
struct TrollLEDsAppShortcutsProvider: AppShortcutsProvider { | ||
@AppShortcutsBuilder static var appShortcuts: [AppShortcut] { | ||
AppShortcut( | ||
intent: AmberOnIntent(), | ||
phrases: [ | ||
"Turn on amber LEDs with \(.applicationName)" | ||
], | ||
shortTitle: "Amber On", | ||
systemImageName: "flashlight.on.circle.fill" | ||
) | ||
AppShortcut( | ||
intent: WhiteOnIntent(), | ||
phrases: [ | ||
"Turn on white LEDs with \(.applicationName)" | ||
], | ||
shortTitle: "White On", | ||
systemImageName: "flashlight.on.circle.fill" | ||
) | ||
AppShortcut( | ||
intent: AllOnIntent(), | ||
phrases: [ | ||
"Turn on all LEDs with \(.applicationName)" | ||
], | ||
shortTitle: "All On", | ||
systemImageName: "flashlight.on.circle.fill" | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters