From 3330c88c490ab77b9eeb1a1c3fdcb3ab4c855a5b Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Sun, 3 Sep 2023 17:46:57 -0700 Subject: [PATCH] Update unread app icon when messages are read --- Meshtastic/Views/Messages/ChannelMessageList.swift | 1 + Meshtastic/Views/Messages/UserMessageList.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/Meshtastic/Views/Messages/ChannelMessageList.swift b/Meshtastic/Views/Messages/ChannelMessageList.swift index 5a1924c4..be3c2911 100644 --- a/Meshtastic/Views/Messages/ChannelMessageList.swift +++ b/Meshtastic/Views/Messages/ChannelMessageList.swift @@ -235,6 +235,7 @@ struct ChannelMessageList: View { try context.save() print("Read message \(message.messageId) ") appState.unreadChannelMessages = myInfo.unreadMessages + UIApplication.shared.applicationIconBadgeNumber = appState.unreadChannelMessages + appState.unreadDirectMessages } catch { print("Failed to read message \(message.messageId)") } diff --git a/Meshtastic/Views/Messages/UserMessageList.swift b/Meshtastic/Views/Messages/UserMessageList.swift index 40320633..5715d0b8 100644 --- a/Meshtastic/Views/Messages/UserMessageList.swift +++ b/Meshtastic/Views/Messages/UserMessageList.swift @@ -224,6 +224,7 @@ struct UserMessageList: View { try context.save() print("Read message \(message.messageId) ") appState.unreadDirectMessages = user.unreadMessages + UIApplication.shared.applicationIconBadgeNumber = appState.unreadChannelMessages + appState.unreadDirectMessages } catch { print("Failed to read message \(message.messageId)")