Fix pull gesture, ring size, and manifest NAS count consistency

BackupView:
- Move circle hero outside ScrollView so DragGesture no longer
  competes with the ScrollView's pull-to-refresh capture
- Pull-to-refresh (native iOS gesture) now starts/resumes backup
  instead of only refreshing status
- Ring diameter 240 → 270pt, ripple circle 258 → 288pt
- Restructure: heroView (fixed) + ScrollView(belowContent) + pageNav
- page1/page2 content split into heroView + belowContent dispatch

BackupStatusService:
- refreshAfterBackup now bumps nasArchiveTotal by newlyOnNAS count
  (fileSize > 0 entries only), preventing the NAS stat from
  flickering back to the pre-backup value while writeManifest runs

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-20 20:31:43 +03:00
parent ca333918a6
commit 13806a2089
2 changed files with 118 additions and 100 deletions

View File

@@ -66,12 +66,15 @@ final class BackupStatusService: NSObject, ObservableObject {
}
func refreshAfterBackup(entries: [ManifestEntry], connection: NASConnection) {
let uploaded = entries.count
snapshot.alreadySafe = min(snapshot.phoneTotal, snapshot.alreadySafe + uploaded)
// nasArchiveTotal is NOT updated optimistically writeManifest will update
// NASManifestCache with the full merged count, and refresh(force: true) reads it.
let safe = entries.count
// Only count files actually uploaded (fileSize > 0) toward nasArchiveTotal.
// Collision-skipped and fileExists-skipped entries have fileSize 0 and were
// already counted in the last directory scan adding them would double-count.
let newlyOnNAS = entries.filter { $0.fileSize > 0 }.count
snapshot.alreadySafe = min(snapshot.phoneTotal, snapshot.alreadySafe + safe)
snapshot.nasArchiveTotal += newlyOnNAS
saveSnapshot()
log.info("Post-backup optimistic update: +\(uploaded) safe")
log.info("Post-backup optimistic update: +\(safe) safe, +\(newlyOnNAS) NAS")
Task {
await writeManifest(entries: entries, connection: connection)
refresh(force: true)