Skip to content

Commit 4785ad1

Browse files
restauranttdyongxu
andauthored
fix: 🐛 [IOSSDKBUG-449]FilterFeedbackBar list apply space (SAP#897)
* fix: 🐛 [JIRA:0]FilterFeedbackBar list apply space Improve space between list view and apply button. * fix: 🐛 [IOSSDKBUG-449]FilterFeedbackBar list apply space * fix: 🐛 [IOSSDKBUG-449]FilterFeedbackBar list apply space --------- Co-authored-by: dyongxu <[email protected]>
1 parent 117790e commit 4785ad1

File tree

4 files changed

+55
-21
lines changed

4 files changed

+55
-21
lines changed

Sources/FioriSwiftUICore/Components/CancellableResettableForm.swift

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ struct CancellableResettableDialogNavigationForm<Title: View, CancelAction: View
8383
ZStack {
8484
Color.preferredColor(.chromeSecondary)
8585
.ignoresSafeArea()
86-
VStack(spacing: isNotIphone ? 8 : 16) {
86+
VStack(spacing: 0) {
8787
self.components
8888

8989
VStack(spacing: 0) {
9090
self.applyAction
9191
.accessibilityIdentifier("Apply")
92-
Spacer().frame(height: isNotIphone ? 13 : 16)
92+
Spacer().frame(height: isNotIphone ? 16 : 6)
9393
}
9494
}
9595
}
@@ -119,8 +119,7 @@ struct ApplyButtonStyle: PrimitiveButtonStyle {
119119
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth - 13 * 2 :
120120
Screen.bounds.size.width - 16 * 2)
121121
.padding([.top, .bottom], 8)
122-
.font(.body)
123-
.fontWeight(.semibold)
122+
.font(.fiori(forTextStyle: .body, weight: .semibold))
124123
#if !os(visionOS)
125124
.foregroundStyle(Color.preferredColor(.base2))
126125
.background(RoundedRectangle(cornerRadius: 8).fill(Color.preferredColor(.tintColor)))
@@ -132,30 +131,28 @@ struct ApplyButtonStyle: PrimitiveButtonStyle {
132131
.onTapGesture {
133132
configuration.trigger()
134133
}
135-
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 8)
134+
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 6)
136135
} else {
137136
configuration.label
138137
.frame(width: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth - 13 * 2 :
139138
Screen.bounds.size.width - 16 * 2)
140139
.padding([.top, .bottom], 8)
141-
.font(.body)
142-
.fontWeight(.semibold)
140+
.font(.fiori(forTextStyle: .body, weight: .semibold))
143141
#if !os(visionOS)
144142
.foregroundStyle(Color.preferredColor(.grey1))
145143
#else
146144
.foregroundStyle(Color.preferredColor(.primaryLabel))
147145
#endif
148146
.background(RoundedRectangle(cornerRadius: 8).fill(Color.preferredColor(.grey5)))
149-
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 8)
147+
.padding([.top], UIDevice.current.userInterfaceIdiom != .phone ? 16 : 6)
150148
}
151149
}
152150
}
153151

154152
struct CancelButtonStyle: PrimitiveButtonStyle {
155153
func makeBody(configuration: Configuration) -> some View {
156154
configuration.label
157-
.font(.body)
158-
.fontWeight(.bold)
155+
.font(.fiori(forTextStyle: .body, weight: .semibold))
159156
#if !os(visionOS)
160157
.foregroundStyle(Color.preferredColor(.tintColor))
161158
#else
@@ -173,8 +170,7 @@ struct ResetButtonStyle: PrimitiveButtonStyle {
173170
func makeBody(configuration: Configuration) -> some View {
174171
if self.isEnabled {
175172
configuration.label
176-
.font(.body)
177-
.fontWeight(.bold)
173+
.font(.fiori(forTextStyle: .body, weight: .semibold))
178174
#if !os(visionOS)
179175
.foregroundStyle(Color.preferredColor(.tintColor))
180176
#else
@@ -185,8 +181,7 @@ struct ResetButtonStyle: PrimitiveButtonStyle {
185181
}
186182
} else {
187183
configuration.label
188-
.font(.body)
189-
.fontWeight(.bold)
184+
.font(.fiori(forTextStyle: .body, weight: .semibold))
190185
#if !os(visionOS)
191186
.foregroundStyle(Color.preferredColor(.separator))
192187
#else

Sources/FioriSwiftUICore/Views/SearchListPickerItem+View.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ extension SearchListPickerItem: View {
8585
DispatchQueue.main.async {
8686
let popverHeight = Screen.bounds.size.height
8787
let safeAreaInset = self.getSafeAreaInsets()
88-
var maxScrollViewHeight = popverHeight - (self.isSearchBarHidden ? 0 : 52) - 56 - safeAreaInset.top - safeAreaInset.bottom - (UIDevice.current.userInterfaceIdiom != .phone ? 250 : 30)
88+
var maxScrollViewHeight = popverHeight - self.additionalHeight() - safeAreaInset.top - (UIDevice.current.userInterfaceIdiom != .phone ? 250 : 30)
8989
maxScrollViewHeight -= self._keyboardHeight
9090
if self._keyboardHeight > 0 {
91-
maxScrollViewHeight += 56
91+
maxScrollViewHeight -= 52
9292
}
9393
self._height = min(scrollView.contentSize.height, maxScrollViewHeight)
9494
updateSearchListPickerHeight?(self._height)
@@ -214,6 +214,19 @@ extension SearchListPickerItem: View {
214214
}
215215
return keyWindow.safeAreaInsets
216216
}
217+
218+
private func additionalHeight() -> CGFloat {
219+
let isNotIphone = UIDevice.current.userInterfaceIdiom != .phone
220+
var height = 0.0
221+
height += self.getSafeAreaInsets().bottom + (isNotIphone ? 13 : 16)
222+
height += isNotIphone ? 50 : 56
223+
if !self.isSearchBarHidden {
224+
if self._keyboardHeight == 0 {
225+
height += 52
226+
}
227+
}
228+
return height
229+
}
217230
}
218231

219232
#Preview {

Sources/FioriSwiftUICore/Views/SortFilter/FilterFeedbackBarItem+View.swift

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,41 @@ struct PickerMenuItem: View {
292292
.onReceive(NotificationCenter.default.publisher(for: UIApplication.keyboardDidHideNotification)) { _ in
293293
self._keyboardHeight = 0
294294
}
295-
Spacer()
296295
}
297296
.frame(minWidth: UIDevice.current.userInterfaceIdiom != .phone ? self.popoverWidth : nil)
298-
.frame(height: UIDevice.current.userInterfaceIdiom != .phone ? self.detentHeight + (self.item.isSearchBarHidden ? 0 : 52) + (self._keyboardHeight == 0 ? 56 : 0) + 93 : nil)
299-
.presentationDetents([.height(self.detentHeight + (self.item.isSearchBarHidden ? 0 : 52) + (self._keyboardHeight == 0 ? 56 : 0) + 93), .medium, .large])
297+
.frame(height: UIDevice.current.userInterfaceIdiom != .phone ? self.calculateDetentHeight() : nil)
298+
.presentationDetents([.height(self.calculateDetentHeight()), .medium, .large])
300299
}
301300
}
302301

302+
private func calculateDetentHeight() -> CGFloat {
303+
let isNotIphone = UIDevice.current.userInterfaceIdiom != .phone
304+
var height = self.detentHeight
305+
height += isNotIphone ? 13 : 16
306+
height += isNotIphone ? 50 : 56
307+
if !self.item.isSearchBarHidden {
308+
if self._keyboardHeight == 0 {
309+
height += 52
310+
}
311+
}
312+
height += UIDevice.current.userInterfaceIdiom != .phone ? 63 : 33
313+
if height > Screen.bounds.size.height - self.getSafeAreaInsets().top - 60 {
314+
return Screen.bounds.size.height / 2
315+
}
316+
return height
317+
}
318+
319+
private func getSafeAreaInsets() -> UIEdgeInsets {
320+
guard let keyWindow = UIApplication.shared.connectedScenes
321+
.first(where: { $0.activationState == .foregroundActive })
322+
.flatMap({ $0 as? UIWindowScene })?.windows
323+
.first(where: \.isKeyWindow)
324+
else {
325+
return .zero
326+
}
327+
return keyWindow.safeAreaInsets
328+
}
329+
303330
private func resetButtonDisable() -> Bool {
304331
if self.item.resetButtonConfiguration.type == .reset {
305332
return self.item.isOriginal

Sources/FioriSwiftUICore/Views/SortFilter/SortFilterItemTitle.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ struct SortFilterItemTitle: TitleComponent, View {
1111

1212
public var body: some View {
1313
Text(self.title)
14-
.font(.body)
15-
.fontWeight(/*@START_MENU_TOKEN@*/ .bold/*@END_MENU_TOKEN@*/)
14+
.font(.fiori(forTextStyle: .subheadline, weight: .black))
1615
.foregroundStyle(Color.preferredColor(.primaryLabel))
1716
.multilineTextAlignment(.center)
1817
}

0 commit comments

Comments
 (0)