Skip to content

Commit

Permalink
Migrate from deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 11, 2019
1 parent 833c42b commit 20e81fd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 160 deletions.
164 changes: 19 additions & 145 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"test": "npm run lint",
"start": "tsc && electron .",
"pack": "tsc && electron-builder --dir",
"dist": "tsc && electron-builder --macos --linux --windows",
"dist": "tsc && electron-builder --macos --linux --windows --config.snap.publish=github",
"release": "np && npm run publish-snap",
"publish-snap": "del dist && tsc && electron-builder --linux && snapcraft push --release=stable dist/*.snap"
},
Expand Down Expand Up @@ -50,7 +50,7 @@
"@typescript-eslint/parser": "^2.6.1",
"del-cli": "^3.0.0",
"electron": "^7.1.1",
"electron-builder": "^22.1.0",
"electron-builder": "22.0.0",
"eslint-config-xo-typescript": "^0.21.0",
"husky": "^3.0.9",
"np": "^5.1.3",
Expand Down
7 changes: 4 additions & 3 deletions source/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,13 @@ ipc.on('toggle-video-autoplay', () => {
});

function setDarkMode(): void {
if (is.macos && config.get('followSystemAppearance')) {
document.documentElement.classList.toggle('dark-mode', api.systemPreferences.isDarkMode());
if (config.get('followSystemAppearance')) {
api.nativeTheme.themeSource = 'system';
} else {
document.documentElement.classList.toggle('dark-mode', config.get('darkMode'));
api.nativeTheme.themeSource = config.get('darkMode') ? 'dark' : 'light';
}

document.documentElement.classList.toggle('dark-mode', api.nativeTheme.shouldUseDarkColors);
updateVibrancy();
}

Expand Down
11 changes: 2 additions & 9 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
app,
ipcMain,
nativeImage,
systemPreferences,
screen as electronScreen,
session,
shell,
Expand Down Expand Up @@ -99,7 +98,7 @@ function updateBadge(conversations: Conversation[]): void {

if (is.macos || is.linux) {
if (config.get('showUnreadBadge') && !isDNDEnabled) {
app.setBadgeCount(messageCount);
app.badgeCount = messageCount;
}

if (
Expand Down Expand Up @@ -261,7 +260,7 @@ function createMainWindow(): BrowserWindow {
'https://www.messenger.com/login/';

const win = new BrowserWindow({
title: app.getName(),
title: app.name,
show: false,
x: lastWindowState.x,
y: lastWindowState.y,
Expand Down Expand Up @@ -524,12 +523,6 @@ if (is.macos) {
ipcMain.on('set-vibrancy', () => {
mainWindow.setBackgroundColor('#00000000'); // Transparent, workaround for vibrancy issue.
mainWindow.setVibrancy('sidebar');

if (config.get('followSystemAppearance')) {
systemPreferences.setAppLevelAppearance(systemPreferences.isDarkMode() ? 'dark' : 'light');
} else {
systemPreferences.setAppLevelAppearance(config.get('darkMode') ? 'dark' : 'light');
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion source/tray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function updateToolTip(counter: number): void {
return;
}

let tooltip = app.getName();
let tooltip = app.name;

if (counter > 0) {
tooltip += `- ${counter} unread ${counter === 1 ? 'message' : 'messages'}`;
Expand Down

0 comments on commit 20e81fd

Please sign in to comment.