v0.8.0 — Phase β-7 App-Store-Vorbereitung
Feature-komplett für TestFlight. App-Icon-Platzhalter, Siri-Shortcut, Share-Extension, Release-Checklist mit allen externen Apple-Schritten. - scripts/make-appicon.swift: CoreGraphics-basierter Generator für 1024×1024 forest-green PNG mit "C"-Letter und Karten-Stack-Schatten - Asset-Catalog auf Single-Size-AppIcon-Pattern umgestellt - StudyCardsIntent + CardsAppShortcuts (App Intents): Siri- Shortcut "Karten lernen mit Cards" / "Mit Cards lernen" - CardsShareExtension Target: ShareViewController (UIKit-Bootstrap + SwiftUI-Hosting), ShareEditorView mit Text-Edit - PendingShare + PendingShareStore shared in App-Group group.ev.mana.cards - DeckListView zeigt PendingShare-Banner; Tap navigiert zu PendingShareConsumeView mit Deck-Picker + Front/Back-Felder, Submit → POST /cards, danach store.remove - Info.plist: NSPhotoLibraryUsageDescription für Image-Occlusion- Picker, NSUserActivityTypes für Universal-Links - docs/RELEASE_CHECKLIST.md mit externen Schritten: Apple-Developer- Portal, App-IDs, App-Group, AASA, Xcode-Archive, TestFlight-Plan, App-Store-Connect-Felder, Compliance-Verifikation - UI-Test robuster (akzeptiert Login oder Decks/Entdecken als Launch-Erfolg, unabhängig vom Simulator-Keychain-State) - 35 Tests + 1 UI-Test grün, alle drei Targets bauen App-Store-Submission selbst ist externe Aktion und passiert nicht durch dieses Repo — Schritte in docs/RELEASE_CHECKLIST.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55359c5333
commit
0b2ae167b7
16 changed files with 783 additions and 59 deletions
|
|
@ -12,6 +12,7 @@ struct DeckListView: View {
|
|||
@State private var store: DeckListStore?
|
||||
@State private var showAccount = false
|
||||
@State private var showCreate = false
|
||||
@State private var pendingShares: [PendingShare] = []
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
|
|
@ -23,6 +24,12 @@ struct DeckListView: View {
|
|||
.navigationDestination(for: String.self) { deckId in
|
||||
DeckDetailView(deckId: deckId)
|
||||
}
|
||||
.navigationDestination(for: PendingShareRoute.self) { route in
|
||||
PendingShareConsumeView(share: route.share, onDone: {
|
||||
PendingShareStore.remove(id: route.share.id)
|
||||
pendingShares = PendingShareStore.readAll()
|
||||
})
|
||||
}
|
||||
.toolbar { toolbar }
|
||||
.refreshable {
|
||||
await store?.refresh()
|
||||
|
|
@ -39,6 +46,10 @@ struct DeckListView: View {
|
|||
store = DeckListStore(auth: auth, context: context)
|
||||
}
|
||||
await store?.refresh()
|
||||
pendingShares = PendingShareStore.readAll()
|
||||
}
|
||||
.onAppear {
|
||||
pendingShares = PendingShareStore.readAll()
|
||||
}
|
||||
.sheet(isPresented: $showAccount) {
|
||||
NavigationStack {
|
||||
|
|
@ -59,6 +70,7 @@ struct DeckListView: View {
|
|||
emptyState
|
||||
} else {
|
||||
List {
|
||||
pendingShareSection
|
||||
inboxBannerSection
|
||||
ownDecksSection
|
||||
}
|
||||
|
|
@ -67,6 +79,38 @@ struct DeckListView: View {
|
|||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var pendingShareSection: some View {
|
||||
if !pendingShares.isEmpty {
|
||||
Section {
|
||||
ForEach(pendingShares) { share in
|
||||
NavigationLink(value: PendingShareRoute(share: share)) {
|
||||
HStack(spacing: 12) {
|
||||
Image(systemName: "square.and.arrow.down")
|
||||
.foregroundStyle(CardsTheme.primary)
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text("Aus Teilen-Menü")
|
||||
.font(.subheadline.weight(.semibold))
|
||||
.foregroundStyle(CardsTheme.foreground)
|
||||
Text(share.text)
|
||||
.font(.caption)
|
||||
.foregroundStyle(CardsTheme.mutedForeground)
|
||||
.lineLimit(2)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
.background(CardsTheme.warning.opacity(0.12), in: RoundedRectangle(cornerRadius: 10))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.listRowBackground(Color.clear)
|
||||
.listRowSeparator(.hidden)
|
||||
.listRowInsets(EdgeInsets(top: 4, leading: 16, bottom: 4, trailing: 16))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var emptyState: some View {
|
||||
VStack(spacing: 16) {
|
||||
if store?.state == .loading {
|
||||
|
|
|
|||
116
Sources/Features/Decks/PendingShareConsumeView.swift
Normal file
116
Sources/Features/Decks/PendingShareConsumeView.swift
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
import ManaCore
|
||||
import SwiftData
|
||||
import SwiftUI
|
||||
|
||||
struct PendingShareRoute: Hashable {
|
||||
let share: PendingShare
|
||||
}
|
||||
|
||||
/// User wählt Ziel-Deck, optional Back-Text. Submit → CardCreate
|
||||
/// via API, anschließend wird die PendingShare aus dem Store entfernt.
|
||||
struct PendingShareConsumeView: View {
|
||||
let share: PendingShare
|
||||
let onDone: () -> Void
|
||||
|
||||
@Environment(AuthClient.self) private var auth
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@Query(sort: \CachedDeck.updatedAt, order: .reverse) private var decks: [CachedDeck]
|
||||
|
||||
@State private var selectedDeckId: String?
|
||||
@State private var front: String
|
||||
@State private var back: String = ""
|
||||
@State private var isSubmitting = false
|
||||
@State private var errorMessage: String?
|
||||
|
||||
init(share: PendingShare, onDone: @escaping () -> Void) {
|
||||
self.share = share
|
||||
self.onDone = onDone
|
||||
_front = State(initialValue: share.text)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section("Ziel-Deck") {
|
||||
if decks.isEmpty {
|
||||
Text("Erst ein Deck erstellen.")
|
||||
.foregroundStyle(CardsTheme.mutedForeground)
|
||||
} else {
|
||||
Picker("Deck", selection: $selectedDeckId) {
|
||||
Text("Wählen …").tag(String?.none)
|
||||
ForEach(decks) { deck in
|
||||
Text(deck.name).tag(String?.some(deck.id))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Section("Vorderseite") {
|
||||
TextField("Front", text: $front, axis: .vertical)
|
||||
.lineLimit(2 ... 6)
|
||||
}
|
||||
Section("Rückseite") {
|
||||
TextField("Back (optional, default: Quell-URL)", text: $back, axis: .vertical)
|
||||
.lineLimit(2 ... 4)
|
||||
}
|
||||
if let sourceURL = share.sourceURL {
|
||||
Section("Quelle") {
|
||||
Text(sourceURL)
|
||||
.font(.caption)
|
||||
.foregroundStyle(CardsTheme.mutedForeground)
|
||||
}
|
||||
}
|
||||
if let errorMessage {
|
||||
Section {
|
||||
Text(errorMessage)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(CardsTheme.error)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Geteilten Inhalt speichern")
|
||||
#if os(iOS)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
#endif
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button("Verwerfen", role: .destructive) {
|
||||
PendingShareStore.remove(id: share.id)
|
||||
onDone()
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Speichern") { Task { await submit() } }
|
||||
.disabled(selectedDeckId == nil || front.trimmed.isEmpty || isSubmitting)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func submit() async {
|
||||
guard let deckId = selectedDeckId else { return }
|
||||
isSubmitting = true
|
||||
errorMessage = nil
|
||||
defer { isSubmitting = false }
|
||||
|
||||
let backText = back.trimmed.isEmpty ? (share.sourceURL ?? "—") : back.trimmed
|
||||
let api = CardsAPI(auth: auth)
|
||||
let body = CardCreateBody(
|
||||
deckId: deckId,
|
||||
type: .basic,
|
||||
fields: CardFieldsBuilder.basic(front: front.trimmed, back: backText),
|
||||
mediaRefs: nil
|
||||
)
|
||||
do {
|
||||
_ = try await api.createCard(body)
|
||||
onDone()
|
||||
dismiss()
|
||||
} catch {
|
||||
errorMessage = (error as? LocalizedError)?.errorDescription ?? String(describing: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension String {
|
||||
var trimmed: String {
|
||||
trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue