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-449]FilterFeedbackBar list apply space #897

Merged
merged 4 commits into from
Nov 25, 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 @@ -83,13 +83,13 @@ struct CancellableResettableDialogNavigationForm<Title: View, CancelAction: View
ZStack {
Color.preferredColor(.chromeSecondary)
.ignoresSafeArea()
VStack(spacing: isNotIphone ? 8 : 16) {
VStack(spacing: 0) {
self.components

VStack(spacing: 0) {
self.applyAction
.accessibilityIdentifier("Apply")
Spacer().frame(height: isNotIphone ? 13 : 16)
Spacer().frame(height: isNotIphone ? 16 : 6)
}
}
}
Expand Down Expand Up @@ -119,8 +119,7 @@ struct ApplyButtonStyle: PrimitiveButtonStyle {
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth - 13 * 2 :
Screen.bounds.size.width - 16 * 2)
.padding([.top, .bottom], 8)
.font(.body)
.fontWeight(.semibold)
.font(.fiori(forTextStyle: .body, weight: .semibold))
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.base2))
.background(RoundedRectangle(cornerRadius: 8).fill(Color.preferredColor(.tintColor)))
Expand All @@ -132,30 +131,28 @@ struct ApplyButtonStyle: PrimitiveButtonStyle {
.onTapGesture {
configuration.trigger()
}
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 8)
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 6)
} else {
configuration.label
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth - 13 * 2 :
Screen.bounds.size.width - 16 * 2)
.padding([.top, .bottom], 8)
.font(.body)
.fontWeight(.semibold)
.font(.fiori(forTextStyle: .body, weight: .semibold))
#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 != .phone ? 16 : 8)
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 6)
}
}
}

struct CancelButtonStyle: PrimitiveButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.font(.body)
.fontWeight(.bold)
.font(.fiori(forTextStyle: .body, weight: .semibold))
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.tintColor))
#else
Expand All @@ -173,8 +170,7 @@ struct ResetButtonStyle: PrimitiveButtonStyle {
func makeBody(configuration: Configuration) -> some View {
if self.isEnabled {
configuration.label
.font(.body)
.fontWeight(.bold)
.font(.fiori(forTextStyle: .body, weight: .semibold))
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.tintColor))
#else
Expand All @@ -185,8 +181,7 @@ struct ResetButtonStyle: PrimitiveButtonStyle {
}
} else {
configuration.label
.font(.body)
.fontWeight(.bold)
.font(.fiori(forTextStyle: .body, weight: .semibold))
#if !os(visionOS)
.foregroundStyle(Color.preferredColor(.separator))
#else
Expand Down
17 changes: 15 additions & 2 deletions Sources/FioriSwiftUICore/Views/SearchListPickerItem+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ extension SearchListPickerItem: View {
DispatchQueue.main.async {
let popverHeight = Screen.bounds.size.height
let safeAreaInset = self.getSafeAreaInsets()
var maxScrollViewHeight = popverHeight - (self.isSearchBarHidden ? 0 : 52) - 56 - safeAreaInset.top - safeAreaInset.bottom - (UIDevice.current.userInterfaceIdiom != .phone ? 250 : 30)
var maxScrollViewHeight = popverHeight - self.additionalHeight() - safeAreaInset.top - (UIDevice.current.userInterfaceIdiom != .phone ? 250 : 30)
maxScrollViewHeight -= self._keyboardHeight
if self._keyboardHeight > 0 {
maxScrollViewHeight += 56
maxScrollViewHeight -= 52
}
self._height = min(scrollView.contentSize.height, maxScrollViewHeight)
updateSearchListPickerHeight?(self._height)
Expand Down Expand Up @@ -214,6 +214,19 @@ extension SearchListPickerItem: View {
}
return keyWindow.safeAreaInsets
}

private func additionalHeight() -> CGFloat {
let isNotIphone = UIDevice.current.userInterfaceIdiom != .phone
var height = 0.0
height += self.getSafeAreaInsets().bottom + (isNotIphone ? 13 : 16)
height += isNotIphone ? 50 : 56
if !self.isSearchBarHidden {
if self._keyboardHeight == 0 {
height += 52
}
}
return height
}
}

#Preview {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,41 @@ struct PickerMenuItem: View {
.onReceive(NotificationCenter.default.publisher(for: UIApplication.keyboardDidHideNotification)) { _ in
self._keyboardHeight = 0
}
Spacer()
}
.frame(minWidth: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth : nil)
.frame(height: UIDevice.current.userInterfaceIdiom != .phone ? self.detentHeight + (self.item.isSearchBarHidden ? 0 : 52) + (self._keyboardHeight == 0 ? 56 : 0) + 93 : nil)
.presentationDetents([.height(self.detentHeight + (self.item.isSearchBarHidden ? 0 : 52) + (self._keyboardHeight == 0 ? 56 : 0) + 93), .medium, .large])
.frame(height: UIDevice.current.userInterfaceIdiom != .phone ? self.calculateDetentHeight() : nil)
.presentationDetents([.height(self.calculateDetentHeight()), .medium, .large])
}
}

private func calculateDetentHeight() -> CGFloat {
let isNotIphone = UIDevice.current.userInterfaceIdiom != .phone
var height = self.detentHeight
height += isNotIphone ? 13 : 16
height += isNotIphone ? 50 : 56
if !self.item.isSearchBarHidden {
if self._keyboardHeight == 0 {
height += 52
}
}
height += UIDevice.current.userInterfaceIdiom != .phone ? 63 : 33
if height > Screen.bounds.size.height - self.getSafeAreaInsets().top - 60 {
return Screen.bounds.size.height / 2
}
return height
}

private func getSafeAreaInsets() -> UIEdgeInsets {
guard let keyWindow = UIApplication.shared.connectedScenes
.first(where: { $0.activationState == .foregroundActive })
.flatMap({ $0 as? UIWindowScene })?.windows
.first(where: \.isKeyWindow)
else {
return .zero
}
return keyWindow.safeAreaInsets
}

private func resetButtonDisable() -> Bool {
if self.item.resetButtonConfiguration.type == .reset {
return self.item.isOriginal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ struct SortFilterItemTitle: TitleComponent, View {

public var body: some View {
Text(self.title)
.font(.body)
.fontWeight(/*@START_MENU_TOKEN@*/ .bold/*@END_MENU_TOKEN@*/)
.font(.fiori(forTextStyle: .subheadline, weight: .black))
.foregroundStyle(Color.preferredColor(.primaryLabel))
.multilineTextAlignment(.center)
}
Expand Down
Loading