Align Settings dependent disabled states
This commit is contained in:
@@ -198,7 +198,7 @@ struct SettingsView: View {
|
|||||||
.foregroundStyle(.orange)
|
.foregroundStyle(.orange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.disabled(!fuelSavingsSettings.enabled)
|
.settingsDependencyEnabled(fuelSavingsSettings.enabled)
|
||||||
} header: {
|
} header: {
|
||||||
Text("Fuel Savings")
|
Text("Fuel Savings")
|
||||||
} footer: {
|
} footer: {
|
||||||
@@ -582,7 +582,7 @@ struct SettingsView: View {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.disabled(tipStore.purchaseInProgress)
|
.settingsDependencyEnabled(!tipStore.purchaseInProgress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.listRowBackground(Color.clear)
|
.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.
|
/// Loads the three tip tiers and drives their purchases.
|
||||||
@MainActor
|
@MainActor
|
||||||
final class TipStore: ObservableObject {
|
final class TipStore: ObservableObject {
|
||||||
|
|||||||
Reference in New Issue
Block a user