pageta-native/Sources/Core/AppShortcuts.swift
Till JS dd795c799e feat: Feed-Tab dormant stellen (iOS + macOS)
Pendant zum Web-Repo: der Feed widerspricht Pagetas Anti-Engagement-
Versprechen und ist der commodity-Teil. Tab aus iOS-TabView und macOS-
Sidebar genommen; FeedTabView + PagetaAPI.fetchFeed bleiben dormant
kompiliert (Enum-Case .feed bleibt). Ein in SceneStorage persistierter
.feed-Zustand fällt jetzt auf .liste zurück, sonst startet die App auf
einem nicht mehr existierenden Tab.

Der OpenFeedIntent (Siri) behauptete fälschlich, die App lande "im Feed-
Tab (Default)" — auf OpenAppIntent umgestellt (landet auf dem Stapel).

Begründung + Revival-Bedingung: ../pageta/docs/FEED.md

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 13:54:10 +02:00

67 lines
2.2 KiB
Swift

import AppIntents
import Foundation
/// App-Intents für Siri + Shortcuts.app. iOS-Standard ab 16, hier
/// 18+ (deploymentTarget). Zwei Intents, beide bewusst klein:
///
/// 1. **OpenAppIntent** — öffnet die App. Boot landet auf dem Stapel
/// (Lese-Liste, Default-Tab). Trivialer Use-Case, aber Siri-tauglich
/// („Hey Siri, Pageta öffnen").
/// 2. **SaveURLIntent** — nimmt eine URL als Parameter und schreibt
/// sie in den PendingShareStore. App synct beim nächsten Launch.
/// Funktioniert auch headless (`openAppWhenRun: false`) — Siri
/// kann von überall „Speichere [URL] in Pageta" hören.
///
/// AppShortcutsProvider wird vom System automatisch entdeckt (kein
/// Manifest-Entry nötig). Phrasen verwenden `.applicationName`-
/// Substitution, damit Apple's Branding-Match (Default vs. Custom-
/// Display-Name) sauber greift.
struct OpenAppIntent: AppIntent {
static let title: LocalizedStringResource = "Pageta öffnen"
static let openAppWhenRun: Bool = true
func perform() async throws -> some IntentResult {
// openAppWhenRun reicht — App-Boot landet auf dem Stapel (Default-Tab).
.result()
}
}
struct SaveURLIntent: AppIntent {
static let title: LocalizedStringResource = "Artikel in Pageta speichern"
static let description = IntentDescription(
"Speichert die übergebene URL auf den Pageta-Stapel. Beim nächsten App-Start synct die Queue zum Server."
)
static let openAppWhenRun: Bool = false
@Parameter(title: "URL", description: "Die URL des Artikels.")
var url: URL
func perform() async throws -> some IntentResult {
PendingShareStore().enqueue(url)
return .result()
}
}
struct PagetaShortcuts: AppShortcutsProvider {
static var appShortcuts: [AppShortcut] {
AppShortcut(
intent: OpenAppIntent(),
phrases: [
"Öffne \(.applicationName)",
"\(.applicationName) öffnen",
"Zeig mir meinen Stapel in \(.applicationName)",
],
shortTitle: "Pageta öffnen",
systemImageName: "books.vertical"
)
AppShortcut(
intent: SaveURLIntent(),
phrases: [
"In \(.applicationName) speichern",
"Artikel in \(.applicationName) ablegen",
],
shortTitle: "Artikel speichern",
systemImageName: "tray.and.arrow.down"
)
}
}