v0.6.0 — Phase β-5 Marketplace
Voller Marketplace-Flow mit TabBar und Universal-Link-Handler. Drei Live-Decks (Geografie, English A2, Periodensystem) sind browse-, abonnier- und lernbar. - PublicDeckEntry/PublicDeck/PublicDeckVersion/PublicDeckOwner/ PublicDeckDetail Codable mit snake_case - ExploreResponse, BrowseResponse, SubscribeResponse - MarketplaceSort-Enum (recent/popular/trending) - CardsAPI.explore/browseMarketplace/publicDeck/subscribe/unsubscribe - MarketplaceStore @Observable mit Explore + Browse States - ExploreView: Featured + Trending Horizontal-Carousels, Browse-Link - BrowseView: Searchable + Sort-Picker + List - PublicDeckView: Header/Metadata/Subscribe — Subscribe löst Auto-Fork serverseitig aus, Response liefert private_deck_id, NavigationLink zum eigenen Deck - PublicDeckCard + BrowseRow mit forest-Theme - RootView: TabBar (Decks/Entdecken/Account) statt Single-View - Universal-Link-Handler: onOpenURL + onContinueUserActivity für https://cardecky.mana.how/d/<slug> und cards://d/<slug> - associated-domains: applinks:cardecky.mana.how im entitlement - 5 neue Marketplace-Decoding-Tests (35 Total grün) Universal-Links funktionieren erst nach AASA-Setup auf cardecky.mana.how/.well-known/apple-app-site-association (Web-Aufgabe, heute 404). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
80eb3708b4
commit
07ada72b0f
10 changed files with 1015 additions and 24 deletions
|
|
@ -1,18 +1,62 @@
|
|||
import ManaCore
|
||||
import SwiftUI
|
||||
|
||||
/// Top-Level-Switch: Login vs Deck-Liste.
|
||||
/// Ab Phase β-3 könnte hier eine Tab-Bar entstehen (Decks / Study /
|
||||
/// Stats / Account) — für β-1 reicht der einfache Switch.
|
||||
/// Top-Level-Switch: Login vs Haupt-App. Haupt-App ist eine TabBar mit
|
||||
/// drei Tabs (Decks / Entdecken / Account).
|
||||
struct RootView: View {
|
||||
@Environment(AuthClient.self) private var auth
|
||||
@State private var selectedTab: AppTab = .decks
|
||||
@State private var pendingDeepLinkSlug: String?
|
||||
|
||||
var body: some View {
|
||||
switch auth.status {
|
||||
case .signedIn:
|
||||
DeckListView()
|
||||
mainTabs
|
||||
.onOpenURL { url in handle(url: url) }
|
||||
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { activity in
|
||||
if let url = activity.webpageURL { handle(url: url) }
|
||||
}
|
||||
case .unknown, .signedOut, .signingIn, .error:
|
||||
LoginView()
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var mainTabs: some View {
|
||||
TabView(selection: $selectedTab) {
|
||||
DeckListView()
|
||||
.tabItem { Label("Decks", systemImage: "rectangle.stack") }
|
||||
.tag(AppTab.decks)
|
||||
|
||||
ExploreView(deepLinkSlug: $pendingDeepLinkSlug)
|
||||
.tabItem { Label("Entdecken", systemImage: "sparkles") }
|
||||
.tag(AppTab.explore)
|
||||
|
||||
NavigationStack {
|
||||
AccountView()
|
||||
}
|
||||
.tabItem { Label("Account", systemImage: "person.crop.circle") }
|
||||
.tag(AppTab.account)
|
||||
}
|
||||
}
|
||||
|
||||
/// Universal-Link- und URL-Scheme-Handler:
|
||||
/// - `https://cardecky.mana.how/d/<slug>` → Explore-Tab + PublicDeckView
|
||||
/// - `cards://study/<deckId>` → später (β-6 Notifications)
|
||||
private func handle(url: URL) {
|
||||
Log.app.info("Open URL: \(url.absoluteString, privacy: .public)")
|
||||
if url.host == "cardecky.mana.how" || url.scheme == "cards" {
|
||||
let parts = url.pathComponents.filter { $0 != "/" }
|
||||
if parts.count >= 2, parts[0] == "d" {
|
||||
pendingDeepLinkSlug = parts[1]
|
||||
selectedTab = .explore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum AppTab: Hashable {
|
||||
case decks
|
||||
case explore
|
||||
case account
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue