Skip to content

Commit 6845f4d

Browse files
authored
[#444] PushNotificationListView의 내비게이선바의 경계선의 양 끝이 잘리는 현상을 해결한다 (#448)
* refactor: 불필요 뷰 코드 분리 제거 * refactor: 인덴트 수정 * fix: liststyle 수정 및 좌우 inset 수정 * fix: 보여지는 알림이 없을 때 헤더가 중앙으로 내려오는 현상 해결
1 parent ed8cd34 commit 6845f4d

1 file changed

Lines changed: 17 additions & 24 deletions

File tree

DevLog/UI/PushNotification/PushNotificationListView.swift

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)