Unify disabled states and preserve station verdicts

This commit is contained in:
FuelBoard Contributor
2026-10-17 18:22:55 +01:00
parent ff6cbbe07d
commit 7111ce38af
6 changed files with 77 additions and 83 deletions
+2 -12
View File
@@ -198,7 +198,7 @@ struct SettingsView: View {
.foregroundStyle(.orange)
}
}
.settingsDependencyEnabled(fuelSavingsSettings.enabled)
.fuelBoardDisabledState(isEnabled: fuelSavingsSettings.enabled)
} header: {
Text("Fuel Savings")
} footer: {
@@ -582,7 +582,7 @@ struct SettingsView: View {
)
}
.buttonStyle(.plain)
.settingsDependencyEnabled(!tipStore.purchaseInProgress)
.fuelBoardDisabledState(isEnabled: !tipStore.purchaseInProgress)
}
}
.listRowBackground(Color.clear)
@@ -925,16 +925,6 @@ struct SettingsView: View {
}
}
/// Applies the native unavailable state to a complete dependent settings group
/// and also dims non-control content (read-outs, icons and explanatory text),
/// which does not automatically adopt a disabled appearance from SwiftUI.
private extension View {
func settingsDependencyEnabled(_ isEnabled: Bool) -> some View {
disabled(!isEnabled)
.opacity(isEnabled ? 1 : 0.65)
}
}
/// Loads the three tip tiers and drives their purchases.
@MainActor
final class TipStore: ObservableObject {