Skip to content
Merged
Changes from 2 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
31 changes: 17 additions & 14 deletions DevLog/UI/PushNotification/PushNotificationListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ struct PushNotificationListView: View {
}
.safeAreaInset(edge: .top) { safeAreaHeader }
.background(Color(.secondarySystemBackground))
.onAppear {
viewModel.send(.fetchNotifications)
headerOffset = 0
isScrollTrackingEnabled = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
isScrollTrackingEnabled = true
}
}
.onAppear { viewModel.send(.fetchNotifications) }
.refreshable { viewModel.send(.fetchNotifications) }
.navigationTitle(String(localized: "nav_push_notifications"))
.alert(
Expand Down Expand Up @@ -135,7 +128,6 @@ struct PushNotificationListView: View {
private var safeAreaHeader: some View {
VStack(spacing: 4) {
headerView
.clipped()
if #unavailable(iOS 26) {
Divider()
.padding(.horizontal, -16)
Expand Down Expand Up @@ -164,6 +156,14 @@ struct PushNotificationListView: View {
.frame(maxWidth: .infinity, alignment: .leading)
}
}
.frame(height: UIFont.preferredFont(forTextStyle: .body).lineHeight.rounded(.up) + 20)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

UIFont을 사용하여 뷰의 높이를 직접 계산하는 방식은 SwiftUI의 선언적 UI 패턴에 부합하지 않으며, 사용자의 Dynamic Type 설정 변경에 유연하게 대응하기 어렵습니다. 고정된 높이를 지정해야 한다면 @ScaledMetric을 사용하거나, 내부 콘텐츠(headerContent)에 패딩을 추가하여 시스템이 폰트 크기에 맞춰 적절한 높이를 결정하도록 하는 것이 유지보수 및 접근성 측면에서 더 좋습니다.

.onAppear {
headerOffset = 0
isScrollTrackingEnabled = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
isScrollTrackingEnabled = true
}
}
}

private var headerContent: some View {
Expand Down Expand Up @@ -191,7 +191,9 @@ struct PushNotificationListView: View {
}

Button {
viewModel.send(.toggleSortOption)
DispatchQueue.main.async {
viewModel.send(.toggleSortOption)
}
Comment thread
opficdev marked this conversation as resolved.
} label: {
let condition = viewModel.state.query.sortOrder == .oldest
Text(
Expand All @@ -200,8 +202,8 @@ struct PushNotificationListView: View {
viewModel.state.query.sortOrder.title
)
)
.foregroundStyle(condition ? .white : Color(.label))
.adaptiveButtonStyle(color: condition ? .blue : .clear)
.foregroundStyle(condition ? .white : Color(.label))
.adaptiveButtonStyle(color: condition ? .blue : .clear)
}

Menu {
Expand All @@ -226,15 +228,16 @@ struct PushNotificationListView: View {
}

Button {
viewModel.send(.toggleUnreadOnly)
DispatchQueue.main.async {
viewModel.send(.toggleUnreadOnly)
}
Comment thread
opficdev marked this conversation as resolved.
} label: {
let condition = viewModel.state.query.unreadOnly
Text(String(localized: "push_unread"))
.foregroundStyle(condition ? .white : Color(.label))
.adaptiveButtonStyle(color: condition ? .blue : .clear)
}
}
.frame(height: 36)
}

private var filterBadge: some View {
Expand Down