diff --git a/DevLog/UI/Home/TodoListView.swift b/DevLog/UI/Home/TodoListView.swift index 566eef3e..0b194299 100644 --- a/DevLog/UI/Home/TodoListView.swift +++ b/DevLog/UI/Home/TodoListView.swift @@ -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 @@ -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 diff --git a/DevLog/UI/PushNotification/PushNotificationListView.swift b/DevLog/UI/PushNotification/PushNotificationListView.swift index b75bf445..f266e18f 100644 --- a/DevLog/UI/PushNotification/PushNotificationListView.swift +++ b/DevLog/UI/PushNotification/PushNotificationListView.swift @@ -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 @@ -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( @@ -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) @@ -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 { @@ -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( @@ -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 { @@ -226,7 +229,9 @@ 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")) @@ -234,7 +239,6 @@ struct PushNotificationListView: View { .adaptiveButtonStyle(color: condition ? .blue : .clear) } } - .frame(height: 36) } private var filterBadge: some View {