electron: Update some setter/getters to user newer properties.

This removes a few deprecation warnings on app startup.
This commit is contained in:
Tim Abbott
2020-02-29 21:23:00 -08:00
parent e2fc9241fa
commit f4b9605742
4 changed files with 8 additions and 8 deletions

View File

@@ -200,7 +200,7 @@ app.on('ready', () => {
// Auto-hide menu bar on Windows + Linux
if (process.platform !== 'darwin') {
const shouldHideMenu = ConfigUtil.getConfigItem('autoHideMenubar') || false;
mainWindow.setAutoHideMenuBar(shouldHideMenu);
mainWindow.autoHideMenuBar = shouldHideMenu;
mainWindow.setMenuBarVisibility(!shouldHideMenu);
}
@@ -298,7 +298,7 @@ app.on('ready', () => {
});
ipcMain.on('toggle-menubar', (_event: Electron.IpcMainEvent, showMenubar: boolean) => {
mainWindow.setAutoHideMenuBar(showMenubar);
mainWindow.autoHideMenuBar = showMenubar;
mainWindow.setMenuBarVisibility(!showMenubar);
page.send('toggle-autohide-menubar', showMenubar, true);
});

View File

@@ -10,7 +10,7 @@ import Logger = require('../renderer/js/utils/logger-util');
import ConfigUtil = require('../renderer/js/utils/config-util');
import t = require('../renderer/js/utils/translation-util');
const appName = app.getName();
const appName = app.name;
const logger = new Logger({
file: 'errors.log',
@@ -179,7 +179,7 @@ class AppMenu {
click(_item: any, focusedWindow: any) {
if (focusedWindow) {
const newValue = !ConfigUtil.getConfigItem('autoHideMenubar');
focusedWindow.setAutoHideMenuBar(newValue);
focusedWindow.autoHideMenuBar = newValue;
focusedWindow.setMenuBarVisibility(!newValue);
focusedWindow.webContents.send('toggle-autohide-menubar', newValue);
ConfigUtil.setConfigItem('autoHideMenubar', newValue);
@@ -287,7 +287,7 @@ class AppMenu {
const { tabs, activeTabIndex, enableMenu } = props;
return [{
label: `${app.getName()}`,
label: app.name,
submenu: [{
label: t.__('Add Organization'),
accelerator: 'Cmd+Shift+N',

View File

@@ -22,13 +22,13 @@ class BadgeSettings {
this.updateOverlayIcon(messageCount, mainWindow);
} else {
// This should work on both macOS and Linux
app.setBadgeCount(messageCount);
app.badgeCount = messageCount;
}
}
hideBadgeCount(mainWindow: electron.BrowserWindow): void {
if (process.platform === 'darwin') {
app.setBadgeCount(0);
app.badgeCount = 0;
}
if (process.platform === 'win32') {
mainWindow.setOverlayIcon(null, '');

View File

@@ -385,7 +385,7 @@ class GeneralSection extends BaseSection {
async clearAppDataDialog(): Promise<void> {
const clearAppDataMessage = 'By clicking proceed you will be removing all added accounts and preferences from Zulip. When the application restarts, it will be as if you are starting Zulip for the first time.';
const getAppPath = path.join(app.getPath('appData'), app.getName());
const getAppPath = path.join(app.getPath('appData'), app.name);
const { response } = await dialog.showMessageBox({
type: 'warning',