Anchor ring to all 3 pages — page 2 cleanup uses same circle

All pages now share circleSection. Page 2 shows a green arc
(freeable/backed-up fractions) with a leaf icon and GB FREEABLE
label at center, matching the anchored position of pages 0 and 1.

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-21 13:58:50 +03:00
parent 5361d03a5c
commit 3674e5fb06

View File

@@ -170,23 +170,51 @@ struct BackupView: View {
// Arc values routed per page so the ring stays physically fixed
private var pageOuterProgress: CGFloat {
ringPage == 1 ? usedFraction : outerRingProgress
switch ringPage {
case 1: return usedFraction
case 2: return CGFloat(min(junkGB / max(1, deviceTotalGB), 1))
default: return outerRingProgress
}
}
private var pageOuterColor: Color {
ringPage == 1
? Color(red: 1.0, green: 0.58, blue: 0.0)
: Color(red: 0.42, green: 0.52, blue: 0.68)
switch ringPage {
case 1: return Color(red: 1.0, green: 0.58, blue: 0.0)
case 2: return AppTheme.positive
default: return Color(red: 0.42, green: 0.52, blue: 0.68)
}
}
private var pageInnerProgress: CGFloat {
ringPage == 1 ? safeFraction : innerRingProgressWidget
switch ringPage {
case 1: return safeFraction
case 2: return CGFloat(min(backedUpPhotosGB / max(1, deviceTotalGB), 1))
default: return innerRingProgressWidget
}
}
private var pageInnerColor: Color {
ringPage == 1 ? AppTheme.positive : innerRingColor
switch ringPage {
case 1: return AppTheme.positive
case 2: return AppTheme.positive.opacity(0.55)
default: return innerRingColor
}
}
@ViewBuilder
private var ringMainView: some View {
if ringPage == 1 {
if ringPage == 2 {
VStack(spacing: 6) {
Image(systemName: "leaf")
.font(.system(size: 14, weight: .ultraLight))
.foregroundStyle(AppTheme.positive)
Text(String(format: "%.1f", totalFreeableGB))
.font(.system(size: 46, weight: .ultraLight))
.foregroundStyle(AppTheme.positive)
.kerning(-2)
Text("GB FREEABLE")
.font(.system(size: 8, weight: .regular, design: .monospaced))
.foregroundStyle(AppTheme.positive.opacity(0.75))
.tracking(2)
}
} else if ringPage == 1 {
VStack(spacing: 6) {
Image(systemName: "iphone")
.font(.system(size: 14, weight: .ultraLight))
@@ -525,28 +553,9 @@ struct BackupView: View {
@ViewBuilder
private var heroView: some View {
if ringPage == 2 {
// Cleanup page no ring
HStack(alignment: .lastTextBaseline, spacing: 6) {
Text(String(format: "%.1f", totalFreeableGB))
.font(.system(size: 64, weight: .ultraLight))
.foregroundStyle(AppTheme.positive)
.kerning(-2)
Text("GB FREED")
.font(.system(size: 8, weight: .regular, design: .monospaced))
.foregroundStyle(AppTheme.inkTertiary)
.tracking(2)
.offset(y: -10)
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, AppTheme.hPad)
.padding(.bottom, 8)
.gesture(pageSwitchGesture)
} else {
// Pages 0 and 1 share the same circle arc values switch in-place
// All 3 pages share the same circle arc values switch in-place
circleSection
}
}
@ViewBuilder
private var belowContent: some View {