From 7e24e860a17426cdad4d3da184dfbd1f7a1242a3 Mon Sep 17 00:00:00 2001 From: Benjamin Faershtein <119711889+RCGV1@users.noreply.github.com> Date: Fri, 15 Aug 2025 12:23:09 -0700 Subject: [PATCH] Remove redundant gotFirstUnreadMessage so we can mark everythin as read on first load --- Meshtastic/Views/Messages/ChannelMessageList.swift | 4 ---- Meshtastic/Views/Messages/UserMessageList.swift | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index 42bd5c12..c2155af5 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -23,7 +23,6 @@ struct ChannelMessageList: View { // Scroll state @State private var showScrollToBottomButton = false @State private var hasReachedBottom = false - @State private var gotFirstUnreadMessage: Bool = false @State private var messageToHighlight: Int64 = 0 @@ -145,7 +144,6 @@ struct ChannelMessageList: View { .frame(maxWidth: .infinity) .id(message.messageId) .onAppear { - if gotFirstUnreadMessage { if !message.read { message.read = true do { @@ -165,7 +163,6 @@ struct ChannelMessageList: View { hasReachedBottom = true showScrollToBottomButton = false } - } } } // Invisible spacer to detect reaching bottom @@ -193,7 +190,6 @@ struct ChannelMessageList: View { } } } - gotFirstUnreadMessage = true } .onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardDidShowNotification)) { _ in withAnimation { diff --git a/Meshtastic/Views/Messages/UserMessageList.swift b/Meshtastic/Views/Messages/UserMessageList.swift index 92b30d8e..3c21bb61 100644 --- a/Meshtastic/Views/Messages/UserMessageList.swift +++ b/Meshtastic/Views/Messages/UserMessageList.swift @@ -22,7 +22,6 @@ struct UserMessageList: View { // Scroll state @State private var showScrollToBottomButton = false @State private var hasReachedBottom = false - @State private var gotFirstUnreadMessage: Bool = false @State private var messageToHighlight: Int64 = 0 var body: some View { @@ -132,7 +131,6 @@ struct UserMessageList: View { .frame(maxWidth: .infinity) .id(message.messageId) .onAppear { - if gotFirstUnreadMessage { if !message.read { message.read = true do { @@ -151,7 +149,6 @@ struct UserMessageList: View { hasReachedBottom = true showScrollToBottomButton = false } - } } } } @@ -180,7 +177,6 @@ struct UserMessageList: View { } } } - gotFirstUnreadMessage = true } .onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardDidShowNotification)) { _ in withAnimation {