Skip to content

Commit

Permalink
Migrate code to App Intents
Browse files Browse the repository at this point in the history
  • Loading branch information
vincode-io committed Jul 9, 2024
1 parent 3e2d920 commit 76daacc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
22 changes: 16 additions & 6 deletions Zavala/AppIntents/Outline/RemoveOutlineAppIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,41 @@
import Foundation
import AppIntents

struct RemoveOutlineAppIntent: AppIntent, CustomIntentMigratedAppIntent, PredictableIntent {
struct RemoveOutlineAppIntent: AppIntent, CustomIntentMigratedAppIntent, PredictableIntent, ZavalaAppIntent {
static let intentClassName = "RemoveOutlineIntent"
static let title: LocalizedStringResource = "Remove Outline"
static let description = IntentDescription("Deletes an Outline.")

@Parameter(title: "Outline")
var outline: OutlineAppEntity?
var outline: OutlineAppEntity

static var parameterSummary: some ParameterSummary {
Summary("Remove\(\.$outline)")
Summary("Remove \(\.$outline)")
}

static var predictionConfiguration: some IntentPredictionConfiguration {
IntentPrediction(parameters: (\.$outline)) { outline in
DisplayRepresentation(
title: "Remove \(outline!)",
title: "Remove \(outline)",
subtitle: ""
)
}
}

func perform() async throws -> some IntentResult {
// TODO: Place your refactored intent handler code here.
return .result()
await resume()

guard let outline = await findOutline(outline) else {
await suspend()
throw ZavalaAppIntentError.outlineNotFound
}

await outline.account?.deleteDocument(.outline(outline))

await suspend()
return .result()
}

}


9 changes: 3 additions & 6 deletions Zavala/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@
}
}
}
},
"Remove ${outline}" : {

},
"Remove ${rows}" : {

Expand All @@ -905,12 +908,6 @@
},
"Remove Tag" : {
"comment" : "Control Label: Remove Tag"
},
"Remove%@" : {

},
"Remove${outline}" : {

},
"Removes a Tag from the given Outline." : {

Expand Down

0 comments on commit 76daacc

Please sign in to comment.