wordeck-native/Sources/Features/Settings/SettingsView.swift
Till JS 542082772a refactor(big-bang): cards-native → wordeck-native
Code + Identity-Rename zur Vorbereitung auf Apple-Dev-Portal-Aktion
(Bundle ev.mana.wordeck, App-Group group.ev.mana.wordeck, AASA
applinks:wordeck.com). Build bleibt funktional, aber gegen die
neue text-only-API können image-occlusion-Creates 422 zurückgeben —
das wird mit der Wordeck-Native v1.0-Welle (parallele Apple-Aktion)
sauber gemacht.

Umbenennung:
- 41 Files: cardecky/Cardecky → wordeck/Wordeck (Display, Strings,
  Kommentare)
- 57 Files: CardsNative → WordeckNative, CardsAPI → WordeckAPI,
  CardsTheme → WordeckTheme, CardsBrand → WordeckBrand, CardsWidget →
  WordeckWidget, CardsDueWidget → WordeckDueWidget
- Bundle-ID ev.mana.cardecky → ev.mana.wordeck (project.yml,
  Info.plist, entitlements, Keychain-Service, App-Group)
- AASA applinks:cardecky.mana.how → applinks:wordeck.com
- API-Base cardecky-api.mana.how → api.wordeck.com
- 10 Files renamed (App-Entry, API-Extensions, Theme, Widget,
  Entitlements, Tests)
- xcodeproj regenerated via xcodegen → WordeckNative.xcodeproj
- MaskRegionsTests.swift gelöscht (image-occlusion entfällt mit
  Wordeck text-only)

Forgejo-Repo git.mana.how/till/cards-native → wordeck-native umbenannt
(Auto-Redirect aktiv). Lokales Verzeichnis Code/cards-native/ bleibt
vorerst — wird beim nächsten Apple-Setup mit Bundle-Test umbenannt.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 23:10:42 +02:00

77 lines
3 KiB
Swift

import SwiftUI
/// Settings-Sheet aus AccountView. Heute: Daily-Reminder-Konfiguration.
struct SettingsView: View {
@State private var notifications = NotificationManager()
@State private var reminderDate: Date = .now
@State private var requestingAuth = false
var body: some View {
Form {
Section("Tägliche Erinnerung") {
Toggle("Erinnerung aktiv", isOn: Binding(
get: { notifications.remindersEnabled },
set: { newValue in
notifications.remindersEnabled = newValue
Task {
if newValue, notifications.authorization != .authorized {
requestingAuth = true
_ = await notifications.requestAuthorization()
requestingAuth = false
}
await notifications.reschedule()
}
}
))
.disabled(requestingAuth)
if notifications.remindersEnabled {
DatePicker(
"Uhrzeit",
selection: $reminderDate,
displayedComponents: .hourAndMinute
)
.onChange(of: reminderDate) { _, newValue in
let cal = Calendar.current
notifications.reminderHour = cal.component(.hour, from: newValue)
notifications.reminderMinute = cal.component(.minute, from: newValue)
Task { await notifications.reschedule() }
}
}
if notifications.authorization == .denied {
Label(
"Benachrichtigungen sind in den iOS-Einstellungen blockiert.",
systemImage: "exclamationmark.circle"
)
.font(.caption)
.foregroundStyle(WordeckTheme.warning)
}
}
Section("Marketplace") {
NavigationLink {
BlockedAuthorsView()
} label: {
Label("Blockierte Authors", systemImage: "hand.raised")
}
}
Section("Über") {
LabeledContent("Server", value: "api.wordeck.com")
LabeledContent("Auth", value: "auth.mana.how")
}
}
.navigationTitle("Einstellungen")
#if os(iOS)
.navigationBarTitleDisplayMode(.inline)
#endif
.task {
await notifications.refreshAuthorization()
var comp = DateComponents()
comp.hour = notifications.reminderHour
comp.minute = notifications.reminderMinute
reminderDate = Calendar.current.date(from: comp) ?? .now
}
}
}