Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 [JIRA:IOSSDKBUG-413] Adapt FilterFeedbackBar popover background color in visionOS #852

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@ struct CancellableResettableDialogForm<Title: View, CancelAction: View, ResetAct
}
.padding([.leading, .trailing], UIDevice.current.userInterfaceIdiom == .pad ? 13 : 16)

self.components.background(Color.preferredColor(.secondaryGroupedBackground))
#if !os(visionOS)
self.components.background(Color.preferredColor(.secondaryGroupedBackground))
#else
self.components.background(Color.clear)
#endif
self.applyAction
}
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? 393 : nil)
.padding([.top, .bottom], UIDevice.current.userInterfaceIdiom == .pad ? 13 : 16)
.background(Color.preferredColor(.chromeSecondary))
#if !os(visionOS)
.background(Color.preferredColor(.chromeSecondary))
#else
.background(Color.clear)
#endif
}
}

Expand Down Expand Up @@ -68,7 +76,11 @@ struct CancellableResettableDialogNavigationForm<Title: View, CancelAction: View
var body: some View {
NavigationStack {
VStack(spacing: UIDevice.current.userInterfaceIdiom == .pad ? 8 : 16) {
self.components.background(Color.preferredColor(.secondaryGroupedBackground))
#if !os(visionOS)
self.components.background(Color.preferredColor(.secondaryGroupedBackground))
#else
self.components.background(Color.clear)
#endif
self.applyAction
}
.navigationBarTitleDisplayMode(.inline)
Expand All @@ -86,7 +98,11 @@ struct CancellableResettableDialogNavigationForm<Title: View, CancelAction: View
}
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? 393 : nil)
.padding([.bottom], UIDevice.current.userInterfaceIdiom == .pad ? 13 : 16)
.background(Color.preferredColor(.chromeSecondary))
#if !os(visionOS)
.background(Color.preferredColor(.chromeSecondary))
#else
.background(Color.clear)
#endif
}
}

Expand All @@ -101,8 +117,14 @@ struct ApplyButtonStyle: PrimitiveButtonStyle {
.padding([.top, .bottom], 8)
.font(.body)
.fontWeight(.bold)
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.base2))
.background(RoundedRectangle(cornerRadius: 8).fill(Color.preferredColor(.tintColor)))
#else
.foregroundStyle(Color.preferredColor(.primaryLabel))
.background(RoundedRectangle(cornerRadius: 8).fill(Color.clear))
#endif

.onTapGesture {
configuration.trigger()
}
Expand All @@ -114,7 +136,11 @@ struct ApplyButtonStyle: PrimitiveButtonStyle {
.padding([.top, .bottom], 8)
.font(.body)
.fontWeight(.bold)
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.grey1))
#else
.foregroundStyle(Color.preferredColor(.primaryLabel))
#endif
.background(RoundedRectangle(cornerRadius: 8).fill(Color.preferredColor(.grey5)))
.padding([.top], UIDevice.current.userInterfaceIdiom == .pad ? 16 : 8)
}
Expand All @@ -126,7 +152,11 @@ struct CancelButtonStyle: PrimitiveButtonStyle {
configuration.label
.font(.body)
.fontWeight(.bold)
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.tintColor))
#else
.foregroundStyle(Color.preferredColor(.primaryLabel))
#endif
.onTapGesture {
configuration.trigger()
}
Expand All @@ -141,15 +171,23 @@ struct ResetButtonStyle: PrimitiveButtonStyle {
configuration.label
.font(.body)
.fontWeight(.bold)
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.tintColor))
#else
.foregroundStyle(Color.preferredColor(.primaryLabel))
#endif
.onTapGesture {
configuration.trigger()
}
} else {
configuration.label
.font(.body)
.fontWeight(.bold)
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.separator))
#else
.foregroundStyle(Color.preferredColor(.primaryLabel))
#endif
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ public protocol OptionListPickerStyle {
func makeBody(configuration: OptionListPickerButtonConfiguration) -> AnyView
}

#if !os(visionOS)
/// Default option list picker foreground color
public let DefaultOptionListPickerForegroundColor = Color.preferredColor(.tintColor)
#else
/// Default option list picker foreground color
public let DefaultOptionListPickerForegroundColor = Color.preferredColor(.primaryLabel)
#endif

/// Default option list picker style
public struct DefaultOptionListPickerStyle: OptionListPickerStyle {
let font: Font
Expand All @@ -68,7 +76,7 @@ public struct DefaultOptionListPickerStyle: OptionListPickerStyle {
let minTouchHeight: CGFloat

/// :nodoc:
public init(font: Font = .system(.body), foregroundColorSelected: Color = .preferredColor(.tintColor), foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = .preferredColor(.secondaryGroupedBackground), fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = .preferredColor(.tintColor), strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 16, spacing: CGFloat = 4, borderWidth: CGFloat = 1, minHeight: CGFloat = 44, minTouchHeight: CGFloat = 50) {
public init(font: Font = .system(.body), foregroundColorSelected: Color = DefaultOptionListPickerForegroundColor, foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = .preferredColor(.secondaryGroupedBackground), fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = DefaultOptionListPickerForegroundColor, strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 16, spacing: CGFloat = 4, borderWidth: CGFloat = 1, minHeight: CGFloat = 44, minTouchHeight: CGFloat = 50) {
self.font = font
self.foregroundColorSelected = foregroundColorSelected
self.foregroundColorUnselected = foregroundColorUnselected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ extension SearchListPickerItem: View {
Spacer()
if isSelected {
Image(systemName: "checkmark")
.foregroundColor(.preferredColor(.tintColor))
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.tintColor))
#else
.foregroundStyle(Color.preferredColor(.primaryLabel))
#endif
}
}
.padding(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ public protocol FilterFeedbackBarStyle {
func makeBody(configuration: Self.Configuration) -> AnyView
}

#if !os(visionOS)
/// default filter feedbackbar foreground color
public let DefaultFilterFeedbackBarForegroundColor = Color.preferredColor(.tintColor)
#else
/// default filter feedbackbar foreground color
public let DefaultFilterFeedbackBarForegroundColor = Color.preferredColor(.primaryLabel)
#endif

/// Default style for sort and filer menu item
public struct DefaultFilterFeedbackBarStyle: FilterFeedbackBarStyle {
let font: Font
Expand All @@ -40,7 +48,7 @@ public struct DefaultFilterFeedbackBarStyle: FilterFeedbackBarStyle {
let minHeight: CGFloat

/// :nodoc:
public init(font: Font = .system(.body), foregroundColorSelected: Color = .preferredColor(.tintColor), foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = Color.clear, fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = .preferredColor(.tintColor), strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 10, spacing: CGFloat = 6, padding: CGFloat = 8, borderWidth: CGFloat = 1, minHeight: CGFloat = 38) {
public init(font: Font = .system(.body), foregroundColorSelected: Color = DefaultFilterFeedbackBarForegroundColor, foregroundColorUnselected: Color = .preferredColor(.tertiaryLabel), fillColorSelected: Color = Color.clear, fillColorUnselected: Color = .preferredColor(.tertiaryFill), strokeColorSelected: Color = DefaultFilterFeedbackBarForegroundColor, strokeColorUnselected: Color = .preferredColor(.separator), cornerRadius: CGFloat = 10, spacing: CGFloat = 6, padding: CGFloat = 8, borderWidth: CGFloat = 1, minHeight: CGFloat = 38) {
self.font = font
self.foregroundColorSelected = foregroundColorSelected
self.foregroundColorUnselected = foregroundColorUnselected
Expand Down
Loading