From 46eb23fa64bad4e6fdaad66bd22f0c08d974c44c Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Thu, 8 Oct 2026 14:30:33 +0300 Subject: [PATCH] Show the unread notification count on the chats tab Set the chats tab's badge count from the same value used for the app badge. The tab bar already renders it through the .badge modifier but that has no effect outside of a TabView or List, so the iPad tab rail now overlays a small NotificationCountBadge instead. --- .../Application/Navigation/NavigationTabCoordinator.swift | 7 ++++++- .../FlowCoordinators/UserSessionFlowCoordinator.swift | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift b/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift index 8519dd1b6..6d28cca1c 100644 --- a/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift +++ b/ElementX/Sources/Application/Navigation/NavigationTabCoordinator.swift @@ -447,7 +447,12 @@ struct TabRailView: View { } .buttonStyle(TabButtonStyle(isSelected: isSelected)) .accessibilityAddTraits(isSelected ? .isSelected : []) - .badge(10) // TODO: Check if this works. + .overlay(alignment: .topTrailing) { + if module.details.badgeCount > 0 { + NotificationCountBadge(count: module.details.badgeCount, size: .small) + .allowsHitTesting(false) + } + } } } .padding(.horizontal, 8) diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index e15dc861a..308891c7f 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -540,6 +540,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { let badgeCount = Int(userSession.clientProxy.totalUnreadNotifications) + chatsTabDetails.badgeCount = badgeCount + await flowParameters.notificationManager.removeDeliveredNotificationsForFullyReadRooms(roomSummaries) await flowParameters.notificationManager.updateAppBadgeCount(badgeCount) }