From 26a9dba22236bc22a7612107630282cfe02d20e0 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Mon, 16 Aug 2021 18:10:23 +0200 Subject: chore: update outdated node_modules (#1807) - upgrade 'uuid', '@types/uuid', 'macos-version', 'normalize-url' and 'os-name' dependencies to latest - updated 'macos-version' imports to named imports --- src/lib/Tray.js | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Tray.js b/src/lib/Tray.js index f5970f7e7..c629e212d 100644 --- a/src/lib/Tray.js +++ b/src/lib/Tray.js @@ -1,8 +1,14 @@ import { - app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, + app, + Menu, + nativeImage, + nativeTheme, + systemPreferences, + Tray, + ipcMain, } from 'electron'; import { join } from 'path'; -import macosVersion from 'macos-version'; +import { isMacOSVersionGreaterThanOrEqualTo } from 'macos-version'; import { isMac, isWindows, isLinux } from '../environment'; const FILE_EXTENSION = isWindows ? 'ico' : 'png'; @@ -64,7 +70,9 @@ export default class TrayIcon { if (appSettings.type === 'app') { const { isAppMuted } = appSettings.data; - this.trayMenuTemplate[1].label = isAppMuted ? 'Enable Notifications && Audio' : 'Disable Notifications && Audio'; + this.trayMenuTemplate[1].label = isAppMuted + ? 'Enable Notifications && Audio' + : 'Disable Notifications && Audio'; this.trayMenu = Menu.buildFromTemplate(this.trayMenuTemplate); if (isLinux) { this.trayIcon.setContextMenu(this.trayMenu); @@ -107,9 +115,12 @@ export default class TrayIcon { } if (isMac) { - this.themeChangeSubscriberId = systemPreferences.subscribeNotification('AppleInterfaceThemeChangedNotification', () => { - this._refreshIcon(); - }); + this.themeChangeSubscriberId = systemPreferences.subscribeNotification( + 'AppleInterfaceThemeChangedNotification', + () => { + this._refreshIcon(); + }, + ); } } @@ -149,7 +160,8 @@ export default class TrayIcon { _getAssetFromIndicator(indicator) { if (indicator === '•') { return INDICATOR_TRAY_INDIRECT; - } if (indicator !== 0) { + } + if (indicator !== 0) { return INDICATOR_TRAY_UNREAD; } return INDICATOR_TRAY_PLAIN; @@ -158,11 +170,16 @@ export default class TrayIcon { _refreshIcon() { if (!this.trayIcon) return; - this.trayIcon.setImage(this._getAsset('tray', this._getAssetFromIndicator(this.indicator))); + this.trayIcon.setImage( + this._getAsset('tray', this._getAssetFromIndicator(this.indicator)), + ); if (isMac) { this.trayIcon.setPressedImage( - this._getAsset('tray', `${this._getAssetFromIndicator(this.indicator)}-active`), + this._getAsset( + 'tray', + `${this._getAssetFromIndicator(this.indicator)}-active`, + ), ); } } @@ -170,12 +187,24 @@ export default class TrayIcon { _getAsset(type, asset) { let { platform } = process; - if (isMac && (nativeTheme.shouldUseDarkColors || macosVersion.isGreaterThanOrEqualTo('11'))) { + if ( + isMac && + (nativeTheme.shouldUseDarkColors || + isMacOSVersionGreaterThanOrEqualTo('11')) + ) { platform = `${platform}-dark`; } - return nativeImage.createFromPath(join( - __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, - )); + return nativeImage.createFromPath( + join( + __dirname, + '..', + 'assets', + 'images', + type, + platform, + `${asset}.${FILE_EXTENSION}`, + ), + ); } } -- cgit v1.2.3-70-g09d2