fix: add push notification badge (#1246)

This commit is contained in:
Nolan Lawson 2019-05-27 14:25:45 -07:00 committed by GitHub
parent 3a2c56f0fa
commit 8c74d0c7c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -134,10 +134,12 @@ async function showRichNotification (data, notification) {
const { icon, body } = data const { icon, body } = data
const tag = notification.id const tag = notification.id
const { origin } = self.location const { origin } = self.location
const badge = '/icon-push-badge.png'
switch (notification.type) { switch (notification.type) {
case 'follow': { case 'follow': {
await self.registration.showNotification(data.title, { await self.registration.showNotification(data.title, {
badge,
icon, icon,
body, body,
tag, tag,
@ -151,6 +153,7 @@ async function showRichNotification (data, notification) {
case 'favourite': case 'favourite':
case 'poll': case 'poll':
await self.registration.showNotification(data.title, { await self.registration.showNotification(data.title, {
badge,
icon, icon,
body, body,
tag, tag,
@ -175,6 +178,7 @@ async function showRichNotification (data, notification) {
].filter(Boolean) ].filter(Boolean)
await self.registration.showNotification(data.title, { await self.registration.showNotification(data.title, {
badge,
icon, icon,
body, body,
tag, tag,

BIN
static/icon-push-badge.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB