Merge pull request #394 from h3poteto/iss-393
closes #393 Show icon badge when receive notifications
This commit is contained in:
commit
99aa6fe1b5
|
@ -395,6 +395,13 @@ ipcMain.on('remove-all-accounts', (event, _) => {
|
|||
})
|
||||
})
|
||||
|
||||
// badge
|
||||
ipcMain.on('reset-badge', () => {
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setBadge('')
|
||||
}
|
||||
})
|
||||
|
||||
// streaming
|
||||
let userStreaming = null
|
||||
|
||||
|
@ -419,6 +426,9 @@ ipcMain.on('start-user-streaming', (event, ac) => {
|
|||
},
|
||||
(notification) => {
|
||||
event.sender.send('notification-start-user-streaming', notification)
|
||||
if (process.platform === 'darwin') {
|
||||
app.dock.setBadge('•')
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
|
|
|
@ -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 () {
|
||||
|
|
|
@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue