[PM-22347] Improved Open generator intent error alert behavior (#1653)

This commit is contained in:
Federico Maccaroni 2025-06-09 18:57:49 -03:00 committed by GitHub
parent 9e54e05811
commit e0aa268b98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -2,13 +2,13 @@ import AppIntents
import BitwardenShared
/// App intent that opens the generator view.
@available(iOS 16.0, *)
struct OpenGeneratorIntent: AppIntent {
@available(iOS 16.4, *)
struct OpenGeneratorIntent: ForegroundContinuableIntent {
static var title: LocalizedStringResource = "OpenGenerator"
static var description = IntentDescription("OpenGenerator")
static var openAppWhenRun: Bool = true
static var openAppWhenRun: Bool = false
@MainActor
func perform() async throws -> some IntentResult {
@ -18,11 +18,13 @@ struct OpenGeneratorIntent: AppIntent {
let appIntentMediator = services.getAppIntentMediator()
guard try await appIntentMediator.canRunAppIntents() else {
return .result()
throw BitwardenShared.AppIntentError.notAllowed
}
await appIntentMediator.openGenerator()
try await requestToContinueInForeground()
return .result()
}
}

View File

@ -1,7 +1,7 @@
import AppIntents
/// The app shortcuts provider.
@available(iOS 16.0, *)
@available(iOS 16.4, *)
struct ShortcutsProvider: AppShortcutsProvider {
/// The app shortcuts.
static var appShortcuts: [AppShortcut] {