App Group group.app.banyaro.ios verbindet App und Widget-Extension (Entitlements in beiden Targets, CODE_SIGN_ENTITLEMENTS fürs Widget). Home-Screen-Widget (D): - BanYaroHomeWidget (klein + mittel): Tagesfoto, Hundename, nächster Termin. - App schreibt beim Heim-Laden einen Snapshot (HomeWidgetData) in die App Group und triggert WidgetCenter-Reload; Snapshot wird bei Logout/401 geleert. Siri-/Kurzbefehl (E): - StartWalkIntent „Gassi gehen" + AppShortcutsProvider (öffnet die App). - WalkLauncher überbrückt Intent → UI: Flag in der App Group, beim Aktivwerden eingelöst → Aufnehmen-Tab + Aufnahme-Start (TrackingView.startFresh). - MainTabView mit Tab-Auswahl (Tags), BanYaroGoApp liest scenePhase.
32 lines
1.2 KiB
Swift
32 lines
1.2 KiB
Swift
import AppIntents
|
|
|
|
/// Siri-/Kurzbefehl-Intent „Gassi gehen": öffnet die App und stößt die
|
|
/// Aufzeichnung an (über das App-Group-Flag, das die App beim Aktivwerden liest).
|
|
struct StartWalkIntent: AppIntent {
|
|
static var title: LocalizedStringResource = "Gassi gehen"
|
|
static var description = IntentDescription("Startet die Aufzeichnung einer Gassi-Tour in Ban Yaro Go.")
|
|
static var openAppWhenRun: Bool = true
|
|
|
|
@MainActor
|
|
func perform() async throws -> some IntentResult {
|
|
WalkLauncher.requestStartViaAppGroup()
|
|
WalkLauncher.shared.pendingStart = true // Fast-Path, falls in-process
|
|
return .result()
|
|
}
|
|
}
|
|
|
|
/// Macht den Intent als Siri-Phrase + Kurzbefehl verfügbar (automatisch erkannt).
|
|
struct BanYaroAppShortcuts: AppShortcutsProvider {
|
|
static var appShortcuts: [AppShortcut] {
|
|
AppShortcut(
|
|
intent: StartWalkIntent(),
|
|
phrases: [
|
|
"Gassi gehen mit \(.applicationName)",
|
|
"Geh Gassi mit \(.applicationName)",
|
|
"\(.applicationName) Gassi gehen"
|
|
],
|
|
shortTitle: "Gassi gehen",
|
|
systemImageName: "figure.walk"
|
|
)
|
|
}
|
|
}
|