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
3 changes: 2 additions & 1 deletion DevLog/UI/Home/TodoListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct TodoListView: View {
@Environment(NavigationRouter.self) var router
@Environment(\.diContainer) var container: DIContainer
@Environment(\.colorScheme) private var colorScheme
@ScaledMetric(relativeTo: .body) private var headerHeight = 41
@State private var headerOffset: CGFloat = .zero
@State private var isScrollTrackingEnabled = false

Expand Down Expand Up @@ -322,7 +323,7 @@ struct TodoListView: View {
.scrollIndicators(.never)
.scrollDisabled(!isScrollTrackingEnabled)
.contentMargins(.leading, 16, for: .scrollContent)
.frame(height: UIFont.preferredFont(forTextStyle: .body).lineHeight.rounded(.up) + 20)
.frame(height: headerHeight)
.onAppear {
headerOffset = 0
isScrollTrackingEnabled = false
Expand Down
32 changes: 18 additions & 14 deletions DevLog/UI/PushNotification/PushNotificationListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ struct PushNotificationListView: View {
@Environment(\.sceneWidth) private var sceneWidth
@Environment(\.colorScheme) private var colorScheme
@Environment(\.diContainer) private var container: DIContainer
@ScaledMetric(relativeTo: .body) private var headerHeight = 41
@State private var headerOffset: CGFloat = 0
@State private var isScrollTrackingEnabled = false

Expand All @@ -27,14 +28,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 +129,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 +157,14 @@ struct PushNotificationListView: View {
.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 {
Expand Down Expand Up @@ -191,7 +192,9 @@ struct PushNotificationListView: View {
}

Button {
viewModel.send(.toggleSortOption)
DispatchQueue.main.async {
viewModel.send(.toggleSortOption)
}
} label: {
let condition = viewModel.state.query.sortOrder == .oldest
Text(
Expand All @@ -200,8 +203,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 +229,16 @@ struct PushNotificationListView: View {
}

Button {
viewModel.send(.toggleUnreadOnly)
DispatchQueue.main.async {
viewModel.send(.toggleUnreadOnly)
}
} 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