ζ-3.5b: Pending-Queue-UI + NWPathMonitor-Reconnect-Flush
Pending-Queue-UI: - AccountView.pendingQueueCard listet alle wartenden Submissions mit Text-Preview (120c), Author, createdAt, retryCount, lastError - "Jetzt versuchen"-Button triggert tryFlush(api:) - Trash-Icon pro Row löscht einzeln aus der Queue - Pull-to-Refresh aktualisiert beide Listen - Card-View nur sichtbar wenn Queue-Tiefe > 0 ReachabilityWatcher: - NWPathMonitor erkennt Reconnect-Flanke (offline → online) - Bei Reconnect: SubmissionQueue.tryFlush auf @MainActor - Filtert reine Wifi↔Mobil-Switches raus (nur "wieder erreichbar" zählt) - Lebt im App-Root, startet nach Launch via .task Files: - Sources/Core/Submit/ReachabilityWatcher.swift (neu) - Sources/App/ZitareNativeApp.swift: reachability.start in .task - Sources/Features/Account/AccountView.swift: pendingQueueCard iOS + macOS BUILD SUCCEEDED. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
61927d27a3
commit
53f8043a2d
3 changed files with 148 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ struct ZitareNativeApp: App {
|
|||
@State private var authGate: ManaAuthGate
|
||||
@State private var submissionQueue: SubmissionQueue
|
||||
private let snapshotContainer: ModelContainer?
|
||||
private let reachability = ReachabilityWatcher()
|
||||
|
||||
init() {
|
||||
let auth = AuthClient(config: AppConfig.manaAppConfig)
|
||||
|
|
@ -51,6 +52,7 @@ struct ZitareNativeApp: App {
|
|||
.task {
|
||||
await refreshSnapshot()
|
||||
await flushPending()
|
||||
startReachability()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -63,6 +65,24 @@ struct ZitareNativeApp: App {
|
|||
}
|
||||
}
|
||||
|
||||
/// Startet den NWPathMonitor und hooked Reconnect → Flush.
|
||||
/// `Task.detached` + `await MainActor`, weil das Reconnect-Closure
|
||||
/// vom Network-Framework auf einer privaten Queue feuert.
|
||||
private func startReachability() {
|
||||
let queue = submissionQueue
|
||||
let auth = auth
|
||||
reachability.start { [weak queue] in
|
||||
guard let queue else { return }
|
||||
Task { @MainActor in
|
||||
let api = ZitareAPI(auth: auth)
|
||||
let sent = await queue.tryFlush(api: api)
|
||||
if sent > 0 {
|
||||
Log.app.info("Reachability-Flush: \(sent) Submission(s) nachgereicht")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func refreshSnapshot() async {
|
||||
guard let container = snapshotContainer else { return }
|
||||
let sync = SnapshotSync(container: container)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue