@@ -20,9 +20,18 @@ struct PushNotificationListView: View {
2020
2121 var body : some View {
2222 NavigationStack {
23- notificationListContent
23+ notificationList
24+ . background ( NavigationBarConfigurator ( . secondarySystemBackground, alwaysVisible: true ) )
25+ . onScrollOffsetChange { offset in
26+ guard isScrollTrackingEnabled else { return }
27+ headerOffset = max ( 0 , - offset)
28+ }
29+ . safeAreaInset ( edge: . top) { safeAreaHeader }
30+ . onAppear { viewModel. send ( . fetchNotifications) }
31+ . refreshable { viewModel. send ( . fetchNotifications) }
32+ . navigationTitle ( String ( localized: " nav_push_notifications " ) )
33+ . listStyle ( . plain)
2434 }
25- . listStyle ( . sidebar)
2635 . background ( Color ( . secondarySystemBackground) . ignoresSafeArea ( ) )
2736 . alert (
2837 " " ,
@@ -79,38 +88,22 @@ struct PushNotificationListView: View {
7988 }
8089 }
8190
82- private var notificationListContent : some View {
83- notificationList
84- . background ( NavigationBarConfigurator ( . secondarySystemBackground, alwaysVisible: true ) )
85- . onScrollOffsetChange { offset in
86- guard isScrollTrackingEnabled else { return }
87- headerOffset = max ( 0 , - offset)
88- }
89- . safeAreaInset ( edge: . top) { safeAreaHeader }
90- . onAppear { viewModel. send ( . fetchNotifications) }
91- . refreshable { viewModel. send ( . fetchNotifications) }
92- . navigationTitle ( String ( localized: " nav_push_notifications " ) )
93- }
94-
9591 @ViewBuilder
9692 private var notificationList : some View {
9793 let notifications = viewModel. state. notifications. filter { !$0. isHidden }
9894 if notifications. isEmpty {
99- HStack {
100- Spacer ( )
101- Text ( String ( localized: " push_notifications_empty " ) )
102- . foregroundStyle ( Color . gray)
103- Spacer ( )
104- }
95+ Text ( String ( localized: " push_notifications_empty " ) )
96+ . foregroundStyle ( Color . gray)
97+ . frame ( maxWidth: . infinity, maxHeight: . infinity)
10598 } else {
10699 List (
107100 Array ( zip ( notifications. indices, notifications) ) ,
108101 id: \. 1 . id
109102 ) { index, notification in
110103 notificationListRow ( notification, index: index, notifications: notifications)
111- . listRowInsets ( EdgeInsets ( ) )
112- . listSectionSeparator ( . hidden, edges: . top)
113- . listRowBackground ( Color . clear)
104+ . listRowInsets ( EdgeInsets ( top : 0 , leading : 8 , bottom : 0 , trailing : 8 ) )
105+ . listSectionSeparator ( . hidden, edges: . top)
106+ . listRowBackground ( Color . clear)
114107 }
115108 }
116109 }
0 commit comments