@@ -13,6 +13,7 @@ struct PushNotificationListView: View {
1313 @Environment ( \. sceneWidth) private var sceneWidth
1414 @Environment ( \. colorScheme) private var colorScheme
1515 @Environment ( \. diContainer) private var container : DIContainer
16+ @ScaledMetric ( relativeTo: . body) private var headerHeight = 41
1617 @State private var headerOffset : CGFloat = 0
1718 @State private var isScrollTrackingEnabled = false
1819
@@ -27,14 +28,7 @@ struct PushNotificationListView: View {
2728 }
2829 . safeAreaInset ( edge: . top) { safeAreaHeader }
2930 . background ( Color ( . secondarySystemBackground) )
30- . onAppear {
31- viewModel. send ( . fetchNotifications)
32- headerOffset = 0
33- isScrollTrackingEnabled = false
34- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.3 ) {
35- isScrollTrackingEnabled = true
36- }
37- }
31+ . onAppear { viewModel. send ( . fetchNotifications) }
3832 . refreshable { viewModel. send ( . fetchNotifications) }
3933 . navigationTitle ( String ( localized: " nav_push_notifications " ) )
4034 . alert (
@@ -135,7 +129,6 @@ struct PushNotificationListView: View {
135129 private var safeAreaHeader : some View {
136130 VStack ( spacing: 4 ) {
137131 headerView
138- . clipped ( )
139132 if #unavailable( iOS 26 ) {
140133 Divider ( )
141134 . padding ( . horizontal, - 16 )
@@ -164,6 +157,14 @@ struct PushNotificationListView: View {
164157 . frame ( maxWidth: . infinity, alignment: . leading)
165158 }
166159 }
160+ . frame ( height: headerHeight)
161+ . onAppear {
162+ headerOffset = 0
163+ isScrollTrackingEnabled = false
164+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.3 ) {
165+ isScrollTrackingEnabled = true
166+ }
167+ }
167168 }
168169
169170 private var headerContent : some View {
@@ -191,7 +192,9 @@ struct PushNotificationListView: View {
191192 }
192193
193194 Button {
194- viewModel. send ( . toggleSortOption)
195+ DispatchQueue . main. async {
196+ viewModel. send ( . toggleSortOption)
197+ }
195198 } label: {
196199 let condition = viewModel. state. query. sortOrder == . oldest
197200 Text (
@@ -200,8 +203,8 @@ struct PushNotificationListView: View {
200203 viewModel. state. query. sortOrder. title
201204 )
202205 )
203- . foregroundStyle ( condition ? . white : Color ( . label) )
204- . adaptiveButtonStyle ( color: condition ? . blue : . clear)
206+ . foregroundStyle ( condition ? . white : Color ( . label) )
207+ . adaptiveButtonStyle ( color: condition ? . blue : . clear)
205208 }
206209
207210 Menu {
@@ -226,15 +229,16 @@ struct PushNotificationListView: View {
226229 }
227230
228231 Button {
229- viewModel. send ( . toggleUnreadOnly)
232+ DispatchQueue . main. async {
233+ viewModel. send ( . toggleUnreadOnly)
234+ }
230235 } label: {
231236 let condition = viewModel. state. query. unreadOnly
232237 Text ( String ( localized: " push_unread " ) )
233238 . foregroundStyle ( condition ? . white : Color ( . label) )
234239 . adaptiveButtonStyle ( color: condition ? . blue : . clear)
235240 }
236241 }
237- . frame ( height: 36 )
238242 }
239243
240244 private var filterBadge : some View {
0 commit comments