diff --git a/FuelBoard/SettingsView.swift b/FuelBoard/SettingsView.swift index c9a89e3..9aeaf86 100644 --- a/FuelBoard/SettingsView.swift +++ b/FuelBoard/SettingsView.swift @@ -198,7 +198,7 @@ struct SettingsView: View { .foregroundStyle(.orange) } } - .disabled(!fuelSavingsSettings.enabled) + .settingsDependencyEnabled(fuelSavingsSettings.enabled) } header: { Text("Fuel Savings") } footer: { @@ -582,7 +582,7 @@ struct SettingsView: View { ) } .buttonStyle(.plain) - .disabled(tipStore.purchaseInProgress) + .settingsDependencyEnabled(!tipStore.purchaseInProgress) } } .listRowBackground(Color.clear) @@ -925,6 +925,16 @@ 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 {