Skip to content

Commit

Permalink
feat: notifications logger
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Oct 12, 2024
1 parent 079043f commit 97041ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/main/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { getIconPath } from "./helper"
import { t } from "./lib/i18n"
import { store } from "./lib/store"
import { updateNotificationsToken } from "./lib/user"
import { logger } from "./logger"
import { registerAppMenu } from "./menu"
import type { RendererHandlers } from "./renderer-handlers"
import { initializeSentry } from "./sentry"
Expand Down Expand Up @@ -154,12 +155,15 @@ const registerPushNotifications = async () => {
persistentIds: persistentIds || [],
credentials,
})
logger.info(`PushReceiver initialized with token ${credentials?.fcm?.token}`)

instance.onCredentialsChanged(({ newCredentials }) => {
logger.info(`PushReceiver credentials changed to ${newCredentials?.fcm?.token}`)
updateNotificationsToken(newCredentials)
})

instance.onNotification((notification) => {
logger.info(`PushReceiver received notification: ${JSON.stringify(notification.message.data)}`)
const data = notification.message.data as MessagingData
switch (data.type) {
case "new-entry": {
Expand Down

0 comments on commit 97041ab

Please sign in to comment.