Support reduced transparency

This commit is contained in:
Jacek Krasiukianis
2025-10-22 12:55:39 +00:00
committed by MargeBot
parent 27e26a6e1a
commit a78c19503b
2 changed files with 5 additions and 4 deletions
@@ -29,7 +29,7 @@ import SwiftUI
/// the blur effect is disabled by the system. In that case, the view falls
/// back to displaying a solid background color instead of a blur.
public struct BlurredBackground: View {
private let fallbackBackgroundColor: Color
private let fallbackBackgroundColor: Color?
@Environment(\.accessibilityReduceTransparency) var reduceTransparency
/// Creates a blurred background.
@@ -38,7 +38,7 @@ public struct BlurredBackground: View {
/// The color used as a solid background when the **Reduce Transparency**
/// accessibility setting is turned on. This prevents the content behind
/// the view from becoming fully visible when blur is removed.
public init(fallbackBackgroundColor: Color) {
public init(fallbackBackgroundColor: Color?) {
self.fallbackBackgroundColor = fallbackBackgroundColor
}
@@ -20,6 +20,7 @@ import InboxDesignSystem
import SwiftUI
public struct UpsellScreen: View {
@Environment(\.accessibilityReduceTransparency) var reduceTransparency
@Environment(\.dismiss) private var dismiss
@Environment(\.verticalSizeClass) private var verticalSizeClass
@EnvironmentObject private var toastStateStore: ToastStateStore
@@ -72,7 +73,7 @@ public struct UpsellScreen: View {
interactiveArea
.padding(.top, DS.Spacing.large)
.background(BlurredBackground(fallbackBackgroundColor: Color.white.opacity(0.01)))
.background(BlurredBackground(fallbackBackgroundColor: nil))
}
}
}
@@ -126,7 +127,7 @@ public struct UpsellScreen: View {
action: model.scrollingOffsetDidChange
)
}
.scrollClipDisabled()
.scrollClipDisabled(!reduceTransparency)
.coordinateSpace(name: coordinateSpaceName)
.padding(.horizontal, DS.Spacing.extraLarge)
}