feat(decks): γ-1 bis γ-8 — AI/CSV-Import, Card-Edit, Pull-Update, Marketplace-Publish + Moderation + PDF
Vervollständigt die Cardecky-Web-Parität für Deck- und Card-Workflows. γ-1+γ-2 (AI-Deck-Generierung) - 4-Modi-Picker im DeckEditorView Create-Sheet: Leer/KI/Bild/CSV - POST /api/v1/decks/generate für Text-Prompt + 10/min Rate-Limit-UI - POST /api/v1/decks/from-image mit PhotosPicker + PDF-Importer (max 5 Files, 10 MiB/Bild, 30 MiB/PDF), Multipart-Body in CardsAPI+Generation - Loading-Overlay mit Task-Cancellation, Error-Mapping für 429/413/502 γ-3 (Card-Edit) - CardEditorView mit Mode .create(deckId:) / .edit(card:) - Image-Occlusion + Audio-Front behalten bestehenden Media-Ref, solange User nicht ersetzt — MediaCache lädt Bild nach - Type-Picker im Edit-Modus aus (Server-immutable) - CardEditorPayload + CardEditorMediaFields als Sub-Views γ-4 (Pull-Update + Duplicate + Archive) - POST /marketplace/private/:id/pull-update mit Smart-Merge-Anzeige - POST /decks/:id/duplicate - Archive-Toggle im Edit-Modus, Server filtert Liste serverseitig - DeckSecondaryActions als eigenes Sub-View γ-6 (CSV-Import) - RFC-4180-ish Parser (Quote-Escape, Header-Detect, BOM-strip) - Preview-Liste + sequentielle Card-Inserts mit Live-Progress - Image-Occlusion/Audio-Front werden geskipped (UI flaggt) γ-7 (Marketplace-Publish) + Follow-up (Report + Block + Re-Publish) - MarketplacePublishView mit lazy Author-Setup + Init + Publish 1.0.0 - Re-Publish-Modus: Picker für eigene Marketplace-Decks + Auto-Semver-Bump (Minor +1) - MarketplaceCardConverter (typing → type-in, audio-front → skipped, image-occlusion → skipped — Server hat keinen MP-Media-Re-Upload) - Toolbar-Menü auf PublicDeckView: „Deck melden …" + Author-Blockieren (App-Store-Guideline 5.1.1(v)) - ReportDeckSheet mit Reason-Picker (6 Kategorien) + optional Message - BlockedAuthorsView in Settings mit Swipe-Entblocken γ-8 (PDF-Export) - DeckPrintView mit SFSafariViewController auf cardecky.mana.how/decks/:id/print — iOS Share-Sheet → PDF speichern Side-Fixes (mid-stream) - StudySessionView: Card-Aspect-Ratio springt nicht mehr beim Flip (Bottom-Bar in ZStack fixer Höhe) - RootView: Glass-Pille für „Neues Deck"-Accessory + .guest- und .twoFactorRequired-Cases nachgezogen - DeckListView: Account-Toolbar-Button entfernt (Account-Tab unten ist alleinige Anlaufstelle) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8ca7bd3636
commit
73f9081fa1
26 changed files with 3419 additions and 442 deletions
89
Sources/Features/Settings/BlockedAuthorsView.swift
Normal file
89
Sources/Features/Settings/BlockedAuthorsView.swift
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import ManaCore
|
||||
import SwiftUI
|
||||
|
||||
/// Liste der vom User blockierten Marketplace-Authors. Entblock-Action
|
||||
/// per Swipe — analog zur iOS-Mail-Inbox.
|
||||
///
|
||||
/// App-Store-Guideline 5.1.1(v) verlangt: Block-Mechanismus für UGC
|
||||
/// muss verwaltbar sein. Diese View ist der Verwaltungs-Endpunkt.
|
||||
struct BlockedAuthorsView: View {
|
||||
@Environment(AuthClient.self) private var auth
|
||||
|
||||
@State private var blocks: [BlockEntry] = []
|
||||
@State private var isLoading = false
|
||||
@State private var errorMessage: String?
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
CardsTheme.background.ignoresSafeArea()
|
||||
content
|
||||
}
|
||||
.navigationTitle("Blockierte Authors")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#endif
|
||||
.task { await load() }
|
||||
.refreshable { await load() }
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var content: some View {
|
||||
if isLoading, blocks.isEmpty {
|
||||
ProgressView().tint(CardsTheme.primary)
|
||||
} else if blocks.isEmpty {
|
||||
ContentUnavailableView(
|
||||
"Keine blockierten Authors",
|
||||
systemImage: "hand.raised.slash",
|
||||
description: Text("Blockiere Authors über das Menü oben rechts auf Marketplace-Decks.")
|
||||
)
|
||||
.foregroundStyle(CardsTheme.mutedForeground)
|
||||
} else {
|
||||
List {
|
||||
ForEach(blocks) { block in
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(block.displayName)
|
||||
.font(.subheadline.weight(.semibold))
|
||||
Text("@\(block.authorSlug)")
|
||||
.font(.caption)
|
||||
.foregroundStyle(CardsTheme.mutedForeground)
|
||||
}
|
||||
.swipeActions {
|
||||
Button("Entblocken") {
|
||||
Task { await unblock(block) }
|
||||
}
|
||||
.tint(CardsTheme.primary)
|
||||
}
|
||||
}
|
||||
}
|
||||
.listStyle(.plain)
|
||||
.scrollContentBackground(.hidden)
|
||||
if let errorMessage {
|
||||
Text(errorMessage)
|
||||
.font(.caption)
|
||||
.foregroundStyle(CardsTheme.error)
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func load() async {
|
||||
isLoading = true
|
||||
defer { isLoading = false }
|
||||
let api = CardsAPI(auth: auth)
|
||||
do {
|
||||
blocks = try await api.myBlocks()
|
||||
} catch {
|
||||
errorMessage = (error as? LocalizedError)?.errorDescription ?? String(describing: error)
|
||||
}
|
||||
}
|
||||
|
||||
private func unblock(_ block: BlockEntry) async {
|
||||
let api = CardsAPI(auth: auth)
|
||||
do {
|
||||
try await api.unblockAuthor(slug: block.authorSlug)
|
||||
blocks.removeAll { $0.id == block.id }
|
||||
} catch {
|
||||
errorMessage = (error as? LocalizedError)?.errorDescription ?? String(describing: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,10 +40,20 @@ struct SettingsView: View {
|
|||
}
|
||||
|
||||
if notifications.authorization == .denied {
|
||||
Label("Benachrichtigungen sind in den iOS-Einstellungen blockiert.",
|
||||
systemImage: "exclamationmark.circle")
|
||||
.font(.caption)
|
||||
.foregroundStyle(CardsTheme.warning)
|
||||
Label(
|
||||
"Benachrichtigungen sind in den iOS-Einstellungen blockiert.",
|
||||
systemImage: "exclamationmark.circle"
|
||||
)
|
||||
.font(.caption)
|
||||
.foregroundStyle(CardsTheme.warning)
|
||||
}
|
||||
}
|
||||
|
||||
Section("Marketplace") {
|
||||
NavigationLink {
|
||||
BlockedAuthorsView()
|
||||
} label: {
|
||||
Label("Blockierte Authors", systemImage: "hand.raised")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue