feat(backup): page 2 pull-down triggers refresh instead of clean

Pull-to-refresh on page 2 reloads device storage and cleanup data, then
calls statusService.refresh. Pages 0 and 1 retain backup and clean actions
respectively.

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-22 02:19:14 +03:00
parent 8bd0149a60
commit 255addd9f8
2 changed files with 21 additions and 3 deletions

View File

@@ -51,3 +51,4 @@ struct RootView: View {
} }
} }
} }

View File

@@ -708,8 +708,13 @@ struct BackupView: View {
private var pullZone: some View { private var pullZone: some View {
let pct = min(pullProgress / 58, 1.0) let pct = min(pullProgress / 58, 1.0)
let ready = pullProgress >= 58 let ready = pullProgress >= 58
let pullLabel = ringPage == 0 ? "PULL TO BACK UP" : "PULL TO CLEAN" let pullLabel: String
let releaseLabel = ringPage == 0 ? "RELEASE TO BACK UP" : "RELEASE TO CLEAN" let releaseLabel: String
switch ringPage {
case 0: pullLabel = "PULL TO BACK UP"; releaseLabel = "RELEASE TO BACK UP"
case 1: pullLabel = "PULL TO CLEAN"; releaseLabel = "RELEASE TO CLEAN"
default: pullLabel = "PULL TO REFRESH"; releaseLabel = "RELEASE TO REFRESH"
}
return VStack(spacing: 3) { return VStack(spacing: 3) {
Text("") Text("")
.font(.system(size: 13)) .font(.system(size: 13))
@@ -825,7 +830,11 @@ struct BackupView: View {
withAnimation(.spring(response: 0.38, dampingFraction: 0.85)) { pullProgress = 0 } withAnimation(.spring(response: 0.38, dampingFraction: 0.85)) { pullProgress = 0 }
if fired { if fired {
UIImpactFeedbackGenerator(style: .medium).impactOccurred() UIImpactFeedbackGenerator(style: .medium).impactOccurred()
if ringPage == 0 { triggerBackupViaPull() } else { triggerCleanViaPull() } switch ringPage {
case 0: triggerBackupViaPull()
case 1: triggerCleanViaPull()
default: triggerRefreshViaPull()
}
} }
} }
} }
@@ -836,6 +845,14 @@ struct BackupView: View {
if engine.job.status == .paused { engine.resume() } else { startBackup() } if engine.job.status == .paused { engine.resume() } else { startBackup() }
} }
private func triggerRefreshViaPull() {
rippleScale = 0.88; rippleOpacity = 0.4
withAnimation(.easeOut(duration: 0.65)) { rippleScale = 1.35; rippleOpacity = 0 }
loadDeviceStorage()
loadCleanupData()
statusService.refresh(force: true)
}
private func triggerCleanViaPull() { private func triggerCleanViaPull() {
rippleScale = 0.88; rippleOpacity = 0.6 rippleScale = 0.88; rippleOpacity = 0.6
withAnimation(.easeOut(duration: 0.65)) { rippleScale = 1.35; rippleOpacity = 0 } withAnimation(.easeOut(duration: 0.65)) { rippleScale = 1.35; rippleOpacity = 0 }