Skip to content
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 @@ -31,20 +31,20 @@ public struct PushNotificationListView: View {
public var body: some View {
NavigationStack {
notificationListContent
.listStyle(.plain)
.background(Color(.systemGroupedBackground))
.background(NavigationBarConfigurator(alwaysVisible: true))
.onScrollOffsetChange { offset in
guard isScrollTrackingEnabled else { return }
headerOffset = max(0, -offset)
}
.safeAreaInset(edge: .top) { safeAreaHeader }
.refreshable(isEnabled: PullToRefreshAvailability.isEnabled) {
let task = store.send(.view(.refresh))
await task.finish()
store.send(.view(.startObserving))
}
.onScrollOffsetChange { offset in
guard isScrollTrackingEnabled else { return }
headerOffset = max(0, -offset)
}
.safeAreaInset(edge: .top) { safeAreaHeader }
.navigationTitle(String(localized: "nav_push_notifications"))
.listStyle(.plain)
}
.prominentAlert(store, state: \.alert, action: \.alert)
.sheet(item: sheetStore) { store in
Expand Down Expand Up @@ -144,7 +144,20 @@ public struct PushNotificationListView: View {

private var safeAreaHeader: some View {
VStack(spacing: 4) {
headerView
ScrollView(.horizontal) {
headerContent
}
.scrollIndicators(.never)
.contentMargins(.leading, 16, for: .scrollContent)
.frame(maxWidth: .infinity, alignment: .leading)
.frame(height: headerHeight)
.onAppear {
headerOffset = 0
isScrollTrackingEnabled = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
isScrollTrackingEnabled = true
}
}
if #unavailable(iOS 26) {
Divider()
.padding(.horizontal, -16)
Expand All @@ -160,30 +173,6 @@ public struct PushNotificationListView: View {
.offset(y: headerOffset)
}

private var headerView: some View {
Group {
if #available(iOS 18.0, *) {
ScrollView(.horizontal) {
headerContent
}
.scrollIndicators(.never)
.contentMargins(.leading, 16, for: .scrollContent)
} else {
headerContent
.padding(.leading, 16)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.frame(height: headerHeight)
.onAppear {
headerOffset = 0
isScrollTrackingEnabled = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
isScrollTrackingEnabled = true
}
}
}

private var headerContent: some View {
HStack(spacing: 8) {
if 0 < store.appliedFilterCount {
Expand Down
Loading