Changeset View
Changeset View
Standalone View
Standalone View
desktop/src/push-notifications.js
Show All 22 Lines | if (process.platform !== 'darwin') { | ||||
return; | return; | ||||
} | } | ||||
pushNotifications.on('received-apns-notification', (event, userInfo) => { | pushNotifications.on('received-apns-notification', (event, userInfo) => { | ||||
if ( | if ( | ||||
typeof userInfo.title !== 'string' || | typeof userInfo.title !== 'string' || | ||||
typeof userInfo.body !== 'string' || | typeof userInfo.body !== 'string' || | ||||
typeof userInfo.threadID !== 'string' | typeof userInfo.threadID !== 'string' | ||||
) { | ) { | ||||
console.error( | |||||
'Notification must contain a string title, body and threadID', | |||||
); | |||||
michal: This is no longer true when sending updateBadgeCount notifications. This will still show run on… | |||||
return; | return; | ||||
} | } | ||||
const { title, body, threadID } = userInfo; | const { title, body, threadID } = userInfo; | ||||
const notif = new Notification({ | const notif = new Notification({ | ||||
title, | title, | ||||
body, | body, | ||||
}); | }); | ||||
notif.on('click', () => { | notif.on('click', () => { | ||||
handleClick(threadID); | handleClick(threadID); | ||||
}); | }); | ||||
notif.show(); | notif.show(); | ||||
}); | }); | ||||
} | } | ||||
export { listenForNotifications, registerForNotifications }; | export { listenForNotifications, registerForNotifications }; |
This is no longer true when sending updateBadgeCount notifications. This will still show run on older clients, but it's just a console warning and only visible if you run the desktop app through a terminal.