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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user