add comments to notifee.ts
This commit is contained in:
@@ -7,12 +7,16 @@ import {sanitizeDisplayName} from './strings/display-names'
|
|||||||
import {resetToTab} from '../Navigation'
|
import {resetToTab} from '../Navigation'
|
||||||
|
|
||||||
export function init(store: RootStoreModel) {
|
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))
|
store.onUnreadNotifications(count => notifee.setBadgeCount(count))
|
||||||
|
// Listens to "push-notification" events and displays the notification
|
||||||
store.onPushNotification(displayNotificationFromModel)
|
store.onPushNotification(displayNotificationFromModel)
|
||||||
|
// Listens to "session-loaded" events and requests notifications permission
|
||||||
store.onSessionLoaded(() => {
|
store.onSessionLoaded(() => {
|
||||||
// request notifications permission once the user has logged in
|
// request notifications permission once the user has logged in
|
||||||
notifee.requestPermission()
|
notifee.requestPermission()
|
||||||
})
|
})
|
||||||
|
// API used to handle events when the application is in a foreground state.
|
||||||
notifee.onForegroundEvent(async ({type}: {type: EventType}) => {
|
notifee.onForegroundEvent(async ({type}: {type: EventType}) => {
|
||||||
store.log.debug('Notifee foreground event', {type})
|
store.log.debug('Notifee foreground event', {type})
|
||||||
if (type === EventType.PRESS) {
|
if (type === EventType.PRESS) {
|
||||||
|
|||||||
Reference in New Issue
Block a user