Skip to content

Commit

Permalink
Merge branch 'rel-4.3' into fix-warning-clean-up-4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyu0722 authored Dec 2, 2024
2 parents b72f5ba + c1a6938 commit be699e7
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 88 deletions.
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,6 @@ public protocol OptionListPickerComponent : AnyObject {
var hint: String? { get }
}

public protocol ProgressIndicatorComponent {
var progressIndicatorText: String? { get }
}

public protocol SliderPickerComponent : AnyObject {
// sourcery: bindingProperty
// sourcery: no_view
Expand Down Expand Up @@ -253,3 +249,7 @@ public protocol ActionComponent {
// sourcery: no_view
var didSelectAction: (() -> Void)? { get }
}

public protocol ProgressIndicatorComponent {
var progressIndicatorText: String? { get }
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ struct ActionItemsModifierKey: EnvironmentKey {
public static let defaultValue = AnyViewModifier { $0 }
}

struct ProgressIndicatorTextModifierKey: EnvironmentKey {
struct TextInputValueModifierKey: EnvironmentKey {
public static let defaultValue = AnyViewModifier { $0 }
}

struct TextInputValueModifierKey: EnvironmentKey {
struct ActionTextModifierKey: EnvironmentKey {
public static let defaultValue = AnyViewModifier { $0 }
}

struct ActionTextModifierKey: EnvironmentKey {
struct ProgressIndicatorTextModifierKey: EnvironmentKey {
public static let defaultValue = AnyViewModifier { $0 }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ extension EnvironmentValues {
set { self[ActionItemsModifierKey.self] = newValue }
}

public var progressIndicatorTextModifier: AnyViewModifier {
get { return self[ProgressIndicatorTextModifierKey.self] }
set { self[ProgressIndicatorTextModifierKey.self] = newValue }
}

public var textInputValueModifier: AnyViewModifier {
get { return self[TextInputValueModifierKey.self] }
set { self[TextInputValueModifierKey.self] = newValue }
Expand All @@ -214,6 +209,11 @@ extension EnvironmentValues {
set { self[ActionTextModifierKey.self] = newValue }
}

public var progressIndicatorTextModifier: AnyViewModifier {
get { return self[ProgressIndicatorTextModifierKey.self] }
set { self[ProgressIndicatorTextModifierKey.self] = newValue }
}

public var actionModifier: AnyViewModifier {
get { return self[ActionModifierKey.self] }
set { self[ActionModifierKey.self] = newValue }
Expand Down Expand Up @@ -498,11 +498,6 @@ public extension View {
self.environment(\.actionItemsModifier, AnyViewModifier(transform))
}

@ViewBuilder
func progressIndicatorTextModifier<V: View>(_ transform: @escaping (AnyViewModifier.Content) -> V) -> some View {
self.environment(\.progressIndicatorTextModifier, AnyViewModifier(transform))
}

@ViewBuilder
func textInputValueModifier<V: View>(_ transform: @escaping (AnyViewModifier.Content) -> V) -> some View {
self.environment(\.textInputValueModifier, AnyViewModifier(transform))
Expand All @@ -513,6 +508,11 @@ public extension View {
self.environment(\.actionTextModifier, AnyViewModifier(transform))
}

@ViewBuilder
func progressIndicatorTextModifier<V: View>(_ transform: @escaping (AnyViewModifier.Content) -> V) -> some View {
self.environment(\.progressIndicatorTextModifier, AnyViewModifier(transform))
}

@ViewBuilder
func actionModifier<V: View>(_ transform: @escaping (AnyViewModifier.Content) -> V) -> some View {
self.environment(\.actionModifier, AnyViewModifier(transform))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Generated using Sourcery 2.1.7 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
//TODO: Copy commented code to new file: `FioriSwiftUICore/Views/ProgressIndicator+View.swift`
//TODO: Implement ProgressIndicator `View` body
//TODO: Copy commented code to new file: `FioriSwiftUICore/Views/_ProgressIndicator+View.swift`
//TODO: Implement _ProgressIndicator `View` body

/// - Important: to make `@Environment` properties (e.g. `horizontalSizeClass`), internally accessible
/// to extensions, add as sourcery annotation in `FioriSwiftUICore/Models/ModelDefinitions.swift`
Expand All @@ -13,21 +13,21 @@ import SwiftUI
// FIXME: - Implement Fiori style definitions
// FIXME: - Implement ProgressIndicator View body
// FIXME: - Implement _ProgressIndicator View body
extension ProgressIndicator: View {
extension _ProgressIndicator: View {
public var body: some View {
<# View body #>
}
}
// FIXME: - Implement ProgressIndicator specific LibraryContentProvider
// FIXME: - Implement _ProgressIndicator specific LibraryContentProvider
@available(iOS 14.0, macOS 11.0, *)
struct ProgressIndicatorLibraryContent: LibraryContentProvider {
struct _ProgressIndicatorLibraryContent: LibraryContentProvider {
@LibraryContentBuilder
var views: [LibraryItem] {
LibraryItem(ProgressIndicator(model: LibraryPreviewData.Person.laurelosborn),
LibraryItem(_ProgressIndicator(model: LibraryPreviewData.Person.laurelosborn),
category: .control)
}
}
Expand Down
Loading

0 comments on commit be699e7

Please sign in to comment.