@@ -6,8 +6,6 @@ import type {
66import type { GitifySubject , Notification } from '../../typesGitHub' ;
77import { listNotificationsForAuthenticatedUser } from '../api/client' ;
88import { determineFailureType } from '../api/errors' ;
9- import { getAccountUUID } from '../auth/utils' ;
10- import { updateTrayColor , updateTrayTitle } from '../comms' ;
119import { rendererLogError , rendererLogWarn } from '../logger' ;
1210import {
1311 filterBaseNotifications ,
@@ -16,27 +14,6 @@ import {
1614import { getFlattenedNotificationsByRepo } from './group' ;
1715import { createNotificationHandler } from './handlers' ;
1816
19- /**
20- * Sets the tray icon color and title based on the number of unread notifications.
21- *
22- * @param notifications
23- * @param settings
24- */
25- export function setTrayIconColorAndTitle (
26- notifications : AccountNotifications [ ] ,
27- settings : SettingsState ,
28- ) {
29- const totalUnreadNotifications = getUnreadNotificationCount ( notifications ) ;
30-
31- let title = '' ;
32- if ( settings . showNotificationsCountInTray && totalUnreadNotifications > 0 ) {
33- title = totalUnreadNotifications . toString ( ) ;
34- }
35-
36- updateTrayColor ( totalUnreadNotifications ) ;
37- updateTrayTitle ( title ) ;
38- }
39-
4017/**
4118 * Get the count of unread notifications.
4219 *
@@ -206,49 +183,3 @@ export function stabilizeNotificationsOrder(
206183 n . order = orderIndex ++ ;
207184 }
208185}
209-
210- /**
211- * Find the account index for a given notification
212- *
213- * @param allNotifications - The list of all account notifications
214- * @param notification - The notification to find the account index for
215- * @returns The index of the account in the allNotifications array
216- */
217- export const findAccountIndex = (
218- allNotifications : AccountNotifications [ ] ,
219- notification : Notification ,
220- ) : number => {
221- return allNotifications . findIndex (
222- ( accountNotifications ) =>
223- getAccountUUID ( accountNotifications . account ) ===
224- getAccountUUID ( notification . account ) ,
225- ) ;
226- } ;
227-
228- /**
229- * Find notifications that exist in newNotifications but not in previousNotifications
230- */
231- export const getNewNotifications = (
232- previousNotifications : AccountNotifications [ ] ,
233- newNotifications : AccountNotifications [ ] ,
234- ) : Notification [ ] => {
235- return newNotifications . flatMap ( ( accountNotifications ) => {
236- const accountPreviousNotifications = previousNotifications . find (
237- ( item ) =>
238- getAccountUUID ( item . account ) ===
239- getAccountUUID ( accountNotifications . account ) ,
240- ) ;
241-
242- if ( ! accountPreviousNotifications ) {
243- return accountNotifications . notifications ;
244- }
245-
246- const previousIds = new Set (
247- accountPreviousNotifications . notifications . map ( ( item ) => item . id ) ,
248- ) ;
249-
250- return accountNotifications . notifications . filter (
251- ( notification ) => ! previousIds . has ( notification . id ) ,
252- ) ;
253- } ) ;
254- } ;
0 commit comments