From 9758cd2c514164c5db386c02613319ebac1ca767 Mon Sep 17 00:00:00 2001 From: Ansh Nanda Date: Thu, 13 Jul 2023 13:17:37 -0700 Subject: [PATCH] add comments to notifee.ts --- src/lib/notifee.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/notifee.ts b/src/lib/notifee.ts index 485d79aedb..c4c4abf377 100644 --- a/src/lib/notifee.ts +++ b/src/lib/notifee.ts @@ -7,12 +7,16 @@ import {sanitizeDisplayName} from './strings/display-names' import {resetToTab} from '../Navigation' export function init(store: RootStoreModel) { + // Listens to changes in the unread notifications count by listening to the "unread-notifications" event and updates the badge store.onUnreadNotifications(count => notifee.setBadgeCount(count)) + // Listens to "push-notification" events and displays the notification store.onPushNotification(displayNotificationFromModel) + // Listens to "session-loaded" events and requests notifications permission store.onSessionLoaded(() => { // request notifications permission once the user has logged in notifee.requestPermission() }) + // API used to handle events when the application is in a foreground state. notifee.onForegroundEvent(async ({type}: {type: EventType}) => { store.log.debug('Notifee foreground event', {type}) if (type === EventType.PRESS) {