aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/Tray.js
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-09-13 13:36:29 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-09-13 13:36:29 +0530
commit9bbf76b134d0fef9ebeb04169842ab7eb2575ef7 (patch)
tree8c11bbf0abb67b828b92f6ee37a593a297d17627 /src/lib/Tray.js
parentdocs: Bumped up version for '5.6.1' (diff)
parentdocs: updated Changelog [skip ci] (diff)
downloadferdium-app-9bbf76b134d0fef9ebeb04169842ab7eb2575ef7.tar.gz
ferdium-app-9bbf76b134d0fef9ebeb04169842ab7eb2575ef7.tar.zst
ferdium-app-9bbf76b134d0fef9ebeb04169842ab7eb2575ef7.zip
Merge branch 'nightly' into release
Diffstat (limited to 'src/lib/Tray.js')
-rw-r--r--src/lib/Tray.js25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/lib/Tray.js b/src/lib/Tray.js
index c897d597a..7360611cd 100644
--- a/src/lib/Tray.js
+++ b/src/lib/Tray.js
@@ -1,5 +1,5 @@
1import { 1import {
2 app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain, dialog, 2 app, Menu, nativeImage, nativeTheme, systemPreferences, Tray, ipcMain,
3} from 'electron'; 3} from 'electron';
4import { join } from 'path'; 4import { join } from 'path';
5import macosVersion from 'macos-version'; 5import macosVersion from 'macos-version';
@@ -10,6 +10,7 @@ const INDICATOR_TRAY_PLAIN = 'tray';
10const INDICATOR_TRAY_UNREAD = 'tray-unread'; 10const INDICATOR_TRAY_UNREAD = 'tray-unread';
11const INDICATOR_TRAY_INDIRECT = 'tray-indirect'; 11const INDICATOR_TRAY_INDIRECT = 'tray-indirect';
12 12
13// TODO: Need to support i18n for a lot of the hard-coded strings in this file
13export default class TrayIcon { 14export default class TrayIcon {
14 trayIcon = null; 15 trayIcon = null;
15 16
@@ -43,7 +44,9 @@ export default class TrayIcon {
43 }, 44 },
44 { 45 {
45 label: 'Quit Ferdi', 46 label: 'Quit Ferdi',
46 click: this.quitApp, 47 click() {
48 app.quit();
49 },
47 }, 50 },
48 ]; 51 ];
49 52
@@ -176,22 +179,4 @@ export default class TrayIcon {
176 __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`, 179 __dirname, '..', 'assets', 'images', type, platform, `${asset}.${FILE_EXTENSION}`,
177 )); 180 ));
178 } 181 }
179
180 // TODO: Extract this into a reusable component and remove the duplications
181 quitApp = () => {
182 const yesButtonIndex = 0;
183 let selection = yesButtonIndex;
184 if (window.ferdi.stores.settings.app.confirmOnQuit) {
185 selection = dialog.showMessageBoxSync(app.mainWindow, {
186 // TODO: Externalize strings
187 type: 'question',
188 message: 'Quit',
189 detail: 'Do you really want to quit Ferdi?',
190 buttons: ['Yes', 'No'],
191 });
192 }
193 if (selection === yesButtonIndex) {
194 app.quit();
195 }
196 };
197} 182}