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: 🐛 [IOSSDKBUG-487]FilterFeedbackBar list background color on visionOS #917

Merged
merged 3 commits into from
Dec 2, 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 @@ -85,7 +85,11 @@ struct CancellableResettableDialogNavigationForm<Title: View, CancelAction: View
.ignoresSafeArea()
VStack(spacing: 0) {
self.components

#if !os(visionOS)
.listRowBackground(Color.preferredColor(.secondaryGroupedBackground))
#else
.listRowBackground(Color.clear)
#endif
VStack(spacing: 0) {
self.applyAction
.accessibilityIdentifier("Apply")
Expand All @@ -106,6 +110,11 @@ struct CancellableResettableDialogNavigationForm<Title: View, CancelAction: View
}
}
}
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.chromeSecondary))
#else
.listRowBackground(Color.clear)
#endif
}
}

Expand Down
66 changes: 42 additions & 24 deletions Sources/FioriSwiftUICore/Views/SearchListPickerItem+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension SearchListPickerItem: View {
List {
if !disableListEntriesSection, !_value.isEmpty {
Section {
self.selectionHeader()
self.selectionHeader().listRowInsets(EdgeInsets())
let selectedOptions = _value.wrappedValue.map { _valueOptions[$0] }
ForEach(selectedOptions.filter { _searchText.isEmpty || $0.localizedStandardContains(_searchText) }, id: \.self) { item in
self.rowView(value: item, isSelected: true)
Expand All @@ -47,21 +47,27 @@ extension SearchListPickerItem: View {
_onTap?(index)
}
}
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.chromeSecondary))

Rectangle().fill(Color.preferredColor(.primaryGroupedBackground))
.frame(height: 30)
.listRowInsets(EdgeInsets())
#else
.listRowBackground(Color.clear)
#endif

#if !os(visionOS)
Rectangle().fill(Color.preferredColor(.primaryGroupedBackground))
.frame(height: 30)
.listRowInsets(EdgeInsets())
#endif
}
}

Section {
if allowsMultipleSelection {
if _value.count != _valueOptions.count || allowsEmptySelection {
self.selectAllView()
self.selectAllView().listRowInsets(EdgeInsets())
}
} else if _value.count == _valueOptions.count {
self.selectAllView()
self.selectAllView().listRowInsets(EdgeInsets())
} else {
EmptyView()
}
Expand All @@ -77,7 +83,11 @@ extension SearchListPickerItem: View {
_onTap?(index)
}
}
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.chromeSecondary))
#else
.listRowBackground(Color.clear)
#endif
}
}
.modifier(FioriIntrospectModifier<UIScrollView> { scrollView in
Expand Down Expand Up @@ -109,7 +119,7 @@ extension SearchListPickerItem: View {
updateSearchListPickerHeight?(self._height)
}
})
.listStyle(PlainListStyle())
.listStyle(.plain)
.frame(minWidth: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth : nil)
.scrollContentBackground(.hidden)
.padding(0)
Expand Down Expand Up @@ -170,14 +180,18 @@ extension SearchListPickerItem: View {
}
.padding([.leading, .trailing], UIDevice.current.userInterfaceIdiom != .phone ? 13 : 16)
.padding([.top, .bottom], 8)
.background(Color.preferredColor(.secondaryGroupedBackground))
.listRowInsets(EdgeInsets())
.alignmentGuide(.listRowSeparatorLeading) { dimensions in
dimensions[.leading]
}
.alignmentGuide(.listRowSeparatorTrailing) { dimensions in
dimensions[.trailing]
}
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.secondaryGroupedBackground))
#else
.listRowBackground(Color.clear)
#endif
.listRowInsets(EdgeInsets())
.alignmentGuide(.listRowSeparatorLeading) { dimensions in
dimensions[.leading]
}
.alignmentGuide(.listRowSeparatorTrailing) { dimensions in
dimensions[.trailing]
}
}

private func selectAllView() -> some View {
Expand All @@ -198,14 +212,18 @@ extension SearchListPickerItem: View {
}
.padding([.leading, .trailing], UIDevice.current.userInterfaceIdiom != .phone ? 13 : 16)
.padding([.top, .bottom], 8)
.background(Color.preferredColor(.secondaryGroupedBackground))
.listRowInsets(EdgeInsets())
.alignmentGuide(.listRowSeparatorLeading) { dimensions in
dimensions[.leading]
}
.alignmentGuide(.listRowSeparatorTrailing) { dimensions in
dimensions[.trailing]
}
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.secondaryGroupedBackground))
#else
.listRowBackground(Color.clear)
#endif
.listRowInsets(EdgeInsets())
.alignmentGuide(.listRowSeparatorLeading) { dimensions in
dimensions[.leading]
}
.alignmentGuide(.listRowSeparatorTrailing) { dimensions in
dimensions[.trailing]
}
}

private func isItemSelected(_ item: String) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct PickerMenuItem: View {

@State var isSheetVisible = false

@State var detentHeight: CGFloat = ((UIDevice.current.userInterfaceIdiom == .phone || UIDevice.current.userInterfaceIdiom != .phone) ? 88 : 0)
@State var detentHeight: CGFloat = ((UIDevice.current.userInterfaceIdiom == .phone || UIDevice.current.userInterfaceIdiom == .pad) ? 88 : 0)
let popoverWidth = 393.0
@State var _keyboardHeight = 0.0
@State var barItemFrame: CGRect = .zero
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,63 +40,73 @@ extension _SortFilterCFGItemContainer: View {
.padding([.leading, .trailing], UIDevice.current.userInterfaceIdiom != .phone ? 13 : 16)
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth : nil)
}
Rectangle().fill(Color.preferredColor(.primaryGroupedBackground))
.frame(height: 30)
.listRowInsets(EdgeInsets())
#if !os(visionOS)
Rectangle().fill(Color.preferredColor(.primaryGroupedBackground))
.frame(height: 30)
.listRowInsets(EdgeInsets())
#endif
}
.listSectionSeparator(.hidden, edges: .all)
.listRowInsets(EdgeInsets())
.background(Color.preferredColor(.secondaryGroupedBackground))
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.secondaryGroupedBackground))
#else
.listRowBackground(Color.clear)
#endif
}
}
.listRowSpacing(0)
.listStyle(.plain)
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth : nil)
.frame(height: self.height)
.background(Color.preferredColor(.secondaryGroupedBackground))
.environment(\.defaultMinListRowHeight, 0)
.environment(\.defaultMinListHeaderHeight, 0)
.modifier(FioriIntrospectModifier<UIScrollView> { scrollView in
DispatchQueue.main.async {
let popverHeight = Screen.bounds.size.height
let safeAreaInset = self.getSafeAreaInsets()
var maxScrollViewHeight = popverHeight - safeAreaInset.top - safeAreaInset.bottom - (UIDevice.current.userInterfaceIdiom != .phone ? 190 : 150)
if UIDevice.current.userInterfaceIdiom == .pad {
maxScrollViewHeight -= self._keyboardHeight
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.secondaryGroupedBackground))
#else
.listRowBackground(Color.clear)
#endif
.environment(\.defaultMinListRowHeight, 0)
.environment(\.defaultMinListHeaderHeight, 0)
.modifier(FioriIntrospectModifier<UIScrollView> { scrollView in
DispatchQueue.main.async {
let popverHeight = Screen.bounds.size.height
let safeAreaInset = self.getSafeAreaInsets()
var maxScrollViewHeight = popverHeight - safeAreaInset.top - safeAreaInset.bottom - (UIDevice.current.userInterfaceIdiom != .phone ? 190 : 150)
if UIDevice.current.userInterfaceIdiom == .pad {
maxScrollViewHeight -= self._keyboardHeight
}
self.height = min(scrollView.contentSize.height, maxScrollViewHeight)
}
self.height = min(scrollView.contentSize.height, maxScrollViewHeight)
})
.setOnChange(of: self._items) {
self.checkUpdateButtonState()
}
})
.setOnChange(of: self._items) {
self.checkUpdateButtonState()
}
.onAppear {
self.context.handleCancel = {
for r in 0 ..< self._items.count {
for c in 0 ..< self._items[r].count {
self._items[r][c].cancel()
.onAppear {
self.context.handleCancel = {
for r in 0 ..< self._items.count {
for c in 0 ..< self._items[r].count {
self._items[r][c].cancel()
}
}
}
}

self.context.handleReset = {
for r in 0 ..< self._items.count {
for c in 0 ..< self._items[r].count {
self._items[r][c].reset()
self.context.handleReset = {
for r in 0 ..< self._items.count {
for c in 0 ..< self._items[r].count {
self._items[r][c].reset()
}
}
}
}

self.context.handleApply = {
for r in 0 ..< self._items.count {
for c in 0 ..< self._items[r].count {
self._items[r][c].apply()
self.context.handleApply = {
for r in 0 ..< self._items.count {
for c in 0 ..< self._items[r].count {
self._items[r][c].apply()
}
}
}
}

self.checkUpdateButtonState()
}
self.checkUpdateButtonState()
}
}

func checkUpdateButtonState() {
Expand Down Expand Up @@ -223,7 +233,11 @@ extension _SortFilterCFGItemContainer: View {
}
}, axis: .horizontal)
}
#if !os(visionOS)
.listRowBackground(Color.preferredColor(.secondaryGroupedBackground))
#else
.listRowBackground(Color.clear)
#endif
.frame(minHeight: 44)
}

Expand Down
Loading