@@ -48,7 +48,10 @@ import {
4848 setUseAlternateIdleIcon ,
4949 setUseUnreadActiveIcon ,
5050} from '../utils/comms' ;
51- import { getUnreadNotificationCount } from '../utils/notifications/notifications' ;
51+ import {
52+ getNotificationCount ,
53+ getUnreadNotificationCount ,
54+ } from '../utils/notifications/notifications' ;
5255import { clearState , loadState , saveState } from '../utils/storage' ;
5356import {
5457 DEFAULT_DAY_COLOR_SCHEME ,
@@ -75,6 +78,7 @@ interface AppContextState {
7578
7679 notifications : AccountNotifications [ ] ;
7780 unreadCount : number ;
81+ hasUnreadNotifications : boolean ;
7882 hasNotifications : boolean ;
7983 fetchNotifications : ( ) => Promise < void > ;
8084 removeAccountNotifications : ( account : Account ) => Promise < void > ;
@@ -111,9 +115,17 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
111115 unsubscribeNotification,
112116 } = useNotifications ( ) ;
113117
114- const unreadCount = getUnreadNotificationCount ( notifications ) ;
118+ const notificationCount = getNotificationCount ( notifications ) ;
119+ const unreadNotificationCount = getUnreadNotificationCount ( notifications ) ;
115120
116- const hasNotifications = useMemo ( ( ) => unreadCount > 0 , [ unreadCount ] ) ;
121+ const hasNotifications = useMemo (
122+ ( ) => notificationCount > 0 ,
123+ [ notificationCount ] ,
124+ ) ;
125+ const hasUnreadNotifications = useMemo (
126+ ( ) => unreadNotificationCount > 0 ,
127+ [ unreadNotificationCount ] ,
128+ ) ;
117129
118130 // biome-ignore lint/correctness/useExhaustiveDependencies: restoreSettings is stable and should run only once
119131 useEffect ( ( ) => {
@@ -175,12 +187,12 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
175187 useEffect ( ( ) => {
176188 setUseUnreadActiveIcon ( settings . useUnreadActiveIcon ) ;
177189 setUseAlternateIdleIcon ( settings . useAlternateIdleIcon ) ;
178- setTrayIconColorAndTitle ( unreadCount , settings ) ;
190+ setTrayIconColorAndTitle ( unreadNotificationCount , settings ) ;
179191 } , [
180192 settings . showNotificationsCountInTray ,
181193 settings . useUnreadActiveIcon ,
182194 settings . useAlternateIdleIcon ,
183- unreadCount ,
195+ unreadNotificationCount ,
184196 ] ) ;
185197
186198 useEffect ( ( ) => {
@@ -359,8 +371,10 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
359371 globalError,
360372
361373 notifications,
362- unreadCount,
374+ notificationCount,
375+ unreadNotificationCount,
363376 hasNotifications,
377+ hasUnreadNotifications,
364378 fetchNotifications : fetchNotificationsWithAccounts ,
365379
366380 markNotificationsAsRead : markNotificationsAsReadWithAccounts ,
@@ -385,8 +399,10 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
385399 globalError ,
386400
387401 notifications ,
388- unreadCount ,
402+ notificationCount ,
403+ unreadNotificationCount ,
389404 hasNotifications ,
405+ hasUnreadNotifications ,
390406 fetchNotificationsWithAccounts ,
391407 markNotificationsAsReadWithAccounts ,
392408 markNotificationsAsDoneWithAccounts ,
0 commit comments