refs #393 Show icon badge when receive notifications

This commit is contained in:
AkiraFukushima 2018-06-14 22:33:44 +09:00
parent 224791b205
commit 35644bcae4
3 changed files with 11 additions and 0 deletions

View File

@ -395,6 +395,11 @@ ipcMain.on('remove-all-accounts', (event, _) => {
})
})
// badge
ipcMain.on('reset-badge', () => {
app.dock.setBadge('')
})
// streaming
let userStreaming = null
@ -418,6 +423,7 @@ ipcMain.on('start-user-streaming', (event, ac) => {
event.sender.send('update-start-user-streaming', update)
},
(notification) => {
app.dock.setBadge('•')
event.sender.send('notification-start-user-streaming', notification)
},
(err) => {

View File

@ -29,6 +29,7 @@ export default {
},
mounted () {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
this.$store.dispatch('TimelineSpace/Contents/Notifications/resetBadge')
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
},
beforeUpdate () {

View File

@ -1,3 +1,4 @@
import { ipcRenderer } from 'electron'
import Mastodon from 'megalodon'
const Notifications = {
@ -87,6 +88,9 @@ const Notifications = {
commit('changeLazyLoading', false)
throw err
})
},
resetBadge () {
ipcRenderer.send('reset-badge')
}
}
}