diff options
author | muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> | 2022-11-06 10:36:51 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 05:06:51 +0000 |
commit | e7dbea5bc6d7e6b121dbc94b21b759a29f16e0c0 (patch) | |
tree | 958d6dad84687352af27c19c50bdcac345bc3a79 /src/electron/ipc-api | |
parent | 6.2.1-nightly.39 [skip ci] (diff) | |
download | ferdium-app-e7dbea5bc6d7e6b121dbc94b21b759a29f16e0c0.tar.gz ferdium-app-e7dbea5bc6d7e6b121dbc94b21b759a29f16e0c0.tar.zst ferdium-app-e7dbea5bc6d7e6b121dbc94b21b759a29f16e0c0.zip |
Transform tray & menu files to typescript (#740)
Diffstat (limited to 'src/electron/ipc-api')
-rw-r--r-- | src/electron/ipc-api/appIndicator.ts | 8 | ||||
-rw-r--r-- | src/electron/ipc-api/index.ts | 5 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/electron/ipc-api/appIndicator.ts b/src/electron/ipc-api/appIndicator.ts index bd5f6a68f..766e6937a 100644 --- a/src/electron/ipc-api/appIndicator.ts +++ b/src/electron/ipc-api/appIndicator.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { app, ipcMain, BrowserWindow, Tray } from 'electron'; | 1 | import { app, ipcMain, BrowserWindow } from 'electron'; |
2 | import { join } from 'path'; | 2 | import { join } from 'path'; |
3 | import { autorun } from 'mobx'; | 3 | import { autorun } from 'mobx'; |
4 | import { isMac, isWindows, isLinux } from '../../environment'; | 4 | import { isMac, isWindows, isLinux } from '../../environment'; |
5 | import TrayIcon from '../../lib/Tray'; | ||
5 | 6 | ||
6 | const INDICATOR_TASKBAR = 'taskbar'; | 7 | const INDICATOR_TASKBAR = 'taskbar'; |
7 | const FILE_EXTENSION = isWindows ? 'ico' : 'png'; | 8 | const FILE_EXTENSION = isWindows ? 'ico' : 'png'; |
@@ -24,16 +25,14 @@ function getAsset(type: 'tray' | 'taskbar', asset: string) { | |||
24 | export default (params: { | 25 | export default (params: { |
25 | mainWindow: BrowserWindow; | 26 | mainWindow: BrowserWindow; |
26 | settings: any; | 27 | settings: any; |
27 | trayIcon: Tray; | 28 | trayIcon: TrayIcon; |
28 | }) => { | 29 | }) => { |
29 | autorun(() => { | 30 | autorun(() => { |
30 | isTrayIconEnabled = params.settings.app.get('enableSystemTray'); | 31 | isTrayIconEnabled = params.settings.app.get('enableSystemTray'); |
31 | 32 | ||
32 | if (!isTrayIconEnabled) { | 33 | if (!isTrayIconEnabled) { |
33 | // @ts-expect-error Property 'hide' does not exist on type 'Tray'. | ||
34 | params.trayIcon.hide(); | 34 | params.trayIcon.hide(); |
35 | } else if (isTrayIconEnabled) { | 35 | } else if (isTrayIconEnabled) { |
36 | // @ts-expect-error Property 'show' does not exist on type 'Tray'. | ||
37 | params.trayIcon.show(); | 36 | params.trayIcon.show(); |
38 | } | 37 | } |
39 | }); | 38 | }); |
@@ -87,7 +86,6 @@ export default (params: { | |||
87 | } | 86 | } |
88 | 87 | ||
89 | // Update Tray | 88 | // Update Tray |
90 | // @ts-expect-error Property 'setIndicator' does not exist on type 'Tray'. | ||
91 | params.trayIcon.setIndicator(args.indicator); | 89 | params.trayIcon.setIndicator(args.indicator); |
92 | }); | 90 | }); |
93 | }; | 91 | }; |
diff --git a/src/electron/ipc-api/index.ts b/src/electron/ipc-api/index.ts index 1a8838c4e..b57a9d881 100644 --- a/src/electron/ipc-api/index.ts +++ b/src/electron/ipc-api/index.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { BrowserWindow, Tray } from 'electron'; | 1 | import { BrowserWindow } from 'electron'; |
2 | import autoUpdate from './autoUpdate'; | 2 | import autoUpdate from './autoUpdate'; |
3 | import settings from './settings'; | 3 | import settings from './settings'; |
4 | import sessionStorage from './sessionStorage'; | 4 | import sessionStorage from './sessionStorage'; |
@@ -9,11 +9,12 @@ import localServer from './localServer'; | |||
9 | import languageDetect from './languageDetect'; | 9 | import languageDetect from './languageDetect'; |
10 | import dnd from './dnd'; | 10 | import dnd from './dnd'; |
11 | import focusState from './focusState'; | 11 | import focusState from './focusState'; |
12 | import TrayIcon from '../../lib/Tray'; | ||
12 | 13 | ||
13 | export default (params: { | 14 | export default (params: { |
14 | mainWindow: BrowserWindow; | 15 | mainWindow: BrowserWindow; |
15 | settings: any; | 16 | settings: any; |
16 | trayIcon: Tray; | 17 | trayIcon: TrayIcon; |
17 | }) => { | 18 | }) => { |
18 | settings(params); | 19 | settings(params); |
19 | sessionStorage(); | 20 | sessionStorage(); |