import AppIntents import SwiftUI /// Siri-Shortcut: "Karten lernen". Öffnet die App im Decks-Tab. /// Tatsächliche Tab-Aktivierung passiert via `cards://` URL-Scheme, das /// RootView bereits handhabt. struct StudyCardsIntent: AppIntent { static let title: LocalizedStringResource = "Karten lernen" static let description = IntentDescription( "Öffnet Cardecky und zeigt deine Decks mit fälligen Karten.", categoryName: "Lernen" ) static let openAppWhenRun: Bool = true @MainActor func perform() async throws -> some IntentResult { // Die App ist beim Ausführen schon geöffnet (openAppWhenRun); // weitere Navigation passiert in RootView via Deep-Link, falls // ein Parameter dazukommt. v1: simple App-Open. .result() } } /// Macht Intents direkt nach Install in Siri/Shortcuts-App sichtbar. struct CardsAppShortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: StudyCardsIntent(), phrases: [ "Karten lernen mit \(.applicationName)", "Mit \(.applicationName) lernen", "\(.applicationName) öffnen", ], shortTitle: "Karten lernen", systemImageName: "rectangle.stack" ) } }