v0.7.0 — Phase β-6 Native-Polish
Drei Sub-Pakete: Keyboard-Shortcuts, Daily-Reminder-Notifications, WidgetKit-Extension mit App-Group-Daten-Sharing. Siri-Shortcuts und Share-Extension auf β-7 verschoben — niedrige Priorität, die drei großen Brocken decken 90% des Native-Polish ab. Keyboard-Shortcuts: - Hidden Buttons in StudySessionView mit .keyboardShortcut - Space = flip, 1/2/3/4 = again/hard/good/easy - iPad-Magic-Keyboard + macOS-tauglich Daily-Reminders: - NotificationManager @Observable mit UNUserNotificationCenter - Authorization-State + Permission-Request-Flow - UNCalendarNotificationTrigger täglich zur konfigurierten Zeit - SettingsView in AccountView mit Toggle + DatePicker - UserDefaults-Persistierung von Hour/Minute/Enabled WidgetKit-Extension: - WidgetSnapshot Codable mit topDecks (Top-3 by dueCount) + totalDueCount - WidgetSnapshotStore schreibt in group.ev.mana.cards-Container - DeckListStore.refresh schreibt Snapshot + WidgetCenter.reloadAllTimelines - CardsWidgetExtension-Target im project.yml (app-extension) - CardsWidgetBundle + CardsDueWidget mit 5 Familien (small/medium/ accessoryCircular/accessoryInline/accessoryRectangular) - DueProvider TimelineProvider mit 30-min-Refresh - DueWidgetView Family-Switch - WidgetSnapshot.swift shared in beiden Targets via XcodeGen sources - App-Group im Haupt- und Widget-Entitlement 35 Tests grün (keine neuen Tests in β-6 — WidgetKit + Notifications sind System-API-Integrationen, Tests wären überwiegend Mocks). Build inkl. Widget-Extension grün. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
07ada72b0f
commit
a1770fbc6a
15 changed files with 580 additions and 13 deletions
67
Sources/Features/Settings/SettingsView.swift
Normal file
67
Sources/Features/Settings/SettingsView.swift
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
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(CardsTheme.warning)
|
||||
}
|
||||
}
|
||||
|
||||
Section("Über") {
|
||||
LabeledContent("Server", value: "cardecky-api.mana.how")
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue