Don't use notification-badge'd favicon for badges in notifications
This commit is contained in:
parent
f449bfe2f1
commit
77e270ef58
|
@ -55,10 +55,13 @@ const createFaviconService = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getOriginalFavicons = () => [...favicons]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initFaviconService,
|
initFaviconService,
|
||||||
clearFaviconBadge,
|
clearFaviconBadge,
|
||||||
drawFaviconBadge
|
drawFaviconBadge,
|
||||||
|
getOriginalFavicons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { filter, sortBy, includes } from 'lodash'
|
import { filter, sortBy, includes } from 'lodash'
|
||||||
import { muteWordHits } from '../status_parser/status_parser.js'
|
import { muteWordHits } from '../status_parser/status_parser.js'
|
||||||
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
import { showDesktopNotification } from '../desktop_notification_utils/desktop_notification_utils.js'
|
||||||
|
import FaviconService from 'src/services/favicon_service/favicon_service.js'
|
||||||
|
|
||||||
|
let cachedBadgeUrl = null
|
||||||
|
|
||||||
export const notificationsFromStore = store => store.state.statuses.notifications.data
|
export const notificationsFromStore = store => store.state.statuses.notifications.data
|
||||||
|
|
||||||
|
@ -76,12 +79,14 @@ export const unseenNotificationsFromStore = store =>
|
||||||
filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
|
filter(filteredNotificationsFromStore(store), ({ seen }) => !seen)
|
||||||
|
|
||||||
export const prepareNotificationObject = (notification, i18n) => {
|
export const prepareNotificationObject = (notification, i18n) => {
|
||||||
const nodes = document.querySelectorAll('link[rel="icon"]')
|
if (cachedBadgeUrl === null) {
|
||||||
const badge = nodes[0].href
|
const favicon = FaviconService.getOriginalFavicons()[0]
|
||||||
|
cachedBadgeUrl = favicon.favcanvas.toDataURL()
|
||||||
|
}
|
||||||
|
|
||||||
const notifObj = {
|
const notifObj = {
|
||||||
tag: notification.id,
|
tag: notification.id,
|
||||||
badge
|
badge: cachedBadgeUrl
|
||||||
}
|
}
|
||||||
const status = notification.status
|
const status = notification.status
|
||||||
const title = notification.from_profile.name
|
const title = notification.from_profile.name
|
||||||
|
|
Loading…
Reference in New Issue