Skip to content

Commit

Permalink
Fix unread badge not always updating (#1360)
Browse files Browse the repository at this point in the history
  • Loading branch information
greenfrogs authored Jun 2, 2020
1 parent 155a9c7 commit ac22f08
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 4 additions & 0 deletions source/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ ipc.answerMain('toggle-video-autoplay', () => {
toggleVideoAutoplay();
});

ipc.answerMain('reload', () => {
location.reload();
})

function setDarkMode(): void {
if (is.macos && config.get('followSystemAppearance')) {
api.nativeTheme.themeSource = 'system';
Expand Down
12 changes: 5 additions & 7 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,11 @@ async function updateBadge(conversations: Conversation[]): Promise<void> {
tray.update(messageCount);

if (is.windows) {
if (config.get('showUnreadBadge')) {
if (messageCount === 0) {
mainWindow.setOverlayIcon(null, '');
} else {
// Delegate drawing of overlay icon to renderer process
updateOverlayIcon(await ipcMain.callRenderer(mainWindow, 'render-overlay-icon', messageCount));
}
if (!config.get('showUnreadBadge') || messageCount === 0) {
mainWindow.setOverlayIcon(null, '');
} else {
// Delegate drawing of overlay icon to renderer process
updateOverlayIcon(await ipcMain.callRenderer(mainWindow, 'render-overlay-icon', messageCount));
}
}
}
Expand Down
1 change: 1 addition & 0 deletions source/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Press Command/Ctrl+R in Caprine to see your changes.
checked: config.get('showUnreadBadge'),
click() {
config.set('showUnreadBadge', !config.get('showUnreadBadge'));
sendAction('reload');
}
},
{
Expand Down

0 comments on commit ac22f08

Please sign in to comment.