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:
@@ -170,23 +170,51 @@ struct BackupView: View {
|
|||||||
|
|
||||||
// Arc values routed per page so the ring stays physically fixed
|
// Arc values routed per page so the ring stays physically fixed
|
||||||
private var pageOuterProgress: CGFloat {
|
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 {
|
private var pageOuterColor: Color {
|
||||||
ringPage == 1
|
switch ringPage {
|
||||||
? Color(red: 1.0, green: 0.58, blue: 0.0)
|
case 1: return Color(red: 1.0, green: 0.58, blue: 0.0)
|
||||||
: Color(red: 0.42, green: 0.52, blue: 0.68)
|
case 2: return AppTheme.positive
|
||||||
|
default: return Color(red: 0.42, green: 0.52, blue: 0.68)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private var pageInnerProgress: CGFloat {
|
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 {
|
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
|
@ViewBuilder
|
||||||
private var ringMainView: some View {
|
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) {
|
VStack(spacing: 6) {
|
||||||
Image(systemName: "iphone")
|
Image(systemName: "iphone")
|
||||||
.font(.system(size: 14, weight: .ultraLight))
|
.font(.system(size: 14, weight: .ultraLight))
|
||||||
@@ -525,27 +553,8 @@ struct BackupView: View {
|
|||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private var heroView: some View {
|
private var heroView: some View {
|
||||||
if ringPage == 2 {
|
// All 3 pages share the same circle — arc values switch in-place
|
||||||
// Cleanup page — no ring
|
circleSection
|
||||||
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
|
|
||||||
circleSection
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
|
|||||||
Reference in New Issue
Block a user