|
|
@@ -4,32 +4,32 @@ import Foundation
|
|
|
/// An App Intent that allows users to activate an override preset through the Shortcuts app.
|
|
|
struct ApplyOverridePresetIntent: AppIntent {
|
|
|
/// The title displayed for this action in the Shortcuts app.
|
|
|
- static var title = LocalizedStringResource("Activate an override", table: "ShortcutsDetail")
|
|
|
+ static var title = LocalizedStringResource("Activate an override")
|
|
|
|
|
|
/// The description displayed for this action in the Shortcuts app.
|
|
|
- static var description = IntentDescription(.init("Activate an override", table: "ShortcutsDetail"))
|
|
|
+ static var description = IntentDescription(.init("Activate an override"))
|
|
|
|
|
|
/// The override preset to be applied.
|
|
|
@Parameter(
|
|
|
- title: LocalizedStringResource("Override", table: "ShortcutsDetail"),
|
|
|
- description: LocalizedStringResource("Override choice", table: "ShortcutsDetail")
|
|
|
+ title: LocalizedStringResource("Override"),
|
|
|
+ description: LocalizedStringResource("Override choice")
|
|
|
) var preset: OverridePreset?
|
|
|
|
|
|
/// A boolean parameter that determines whether confirmation is required before applying the override.
|
|
|
@Parameter(
|
|
|
- title: LocalizedStringResource("Confirm Before applying", table: "ShortcutsDetail"),
|
|
|
- description: LocalizedStringResource("If toggled, you will need to confirm before applying", table: "ShortcutsDetail"),
|
|
|
+ title: LocalizedStringResource("Confirm Before applying"),
|
|
|
+ description: LocalizedStringResource("If toggled, you will need to confirm before applying"),
|
|
|
default: true
|
|
|
) var confirmBeforeApplying: Bool
|
|
|
|
|
|
/// Defines the summary format shown in the Shortcuts app when configuring this intent.
|
|
|
static var parameterSummary: some ParameterSummary {
|
|
|
When(\ApplyOverridePresetIntent.$confirmBeforeApplying, .equalTo, true, {
|
|
|
- Summary("Applying \(\.$preset) override", table: "ShortcutsDetail") {
|
|
|
+ Summary("Applying \(\.$preset) override") {
|
|
|
\.$confirmBeforeApplying
|
|
|
}
|
|
|
}, otherwise: {
|
|
|
- Summary("Immediately applying \(\.$preset) override", table: "ShortcutsDetail") {
|
|
|
+ Summary("Immediately applying \(\.$preset) override") {
|
|
|
\.$confirmBeforeApplying
|
|
|
}
|
|
|
})
|
|
|
@@ -49,7 +49,7 @@ struct ApplyOverridePresetIntent: AppIntent {
|
|
|
// Request user selection if no preset is provided
|
|
|
presetToApply = try await $preset.requestDisambiguation(
|
|
|
among: await OverridePresetsIntentRequest().fetchAndProcessOverrides(),
|
|
|
- dialog: IntentDialog(LocalizedStringResource("Select override", table: "ShortcutsDetail"))
|
|
|
+ dialog: IntentDialog(LocalizedStringResource("Select override"))
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -59,10 +59,11 @@ struct ApplyOverridePresetIntent: AppIntent {
|
|
|
if confirmBeforeApplying {
|
|
|
try await requestConfirmation(
|
|
|
result: .result(
|
|
|
- dialog: IntentDialog(LocalizedStringResource(
|
|
|
- "Confirm to apply override '\(displayName)'",
|
|
|
- table: "ShortcutsDetail"
|
|
|
- ))
|
|
|
+ dialog: IntentDialog(
|
|
|
+ LocalizedStringResource(
|
|
|
+ "Confirm to apply override '\(displayName)'"
|
|
|
+ )
|
|
|
+ )
|
|
|
)
|
|
|
)
|
|
|
}
|
|
|
@@ -72,8 +73,7 @@ struct ApplyOverridePresetIntent: AppIntent {
|
|
|
return .result(
|
|
|
dialog: IntentDialog(
|
|
|
LocalizedStringResource(
|
|
|
- "Override '\(presetToApply.name)' applied",
|
|
|
- table: "ShortcutsDetail"
|
|
|
+ "Override '\(presetToApply.name)' applied"
|
|
|
)
|
|
|
)
|
|
|
)
|
|
|
@@ -81,8 +81,7 @@ struct ApplyOverridePresetIntent: AppIntent {
|
|
|
return .result(
|
|
|
dialog: IntentDialog(
|
|
|
LocalizedStringResource(
|
|
|
- "Override '\(presetToApply.name)' failed",
|
|
|
- table: "ShortcutsDetail"
|
|
|
+ "Override '\(presetToApply.name)' failed"
|
|
|
)
|
|
|
)
|
|
|
)
|