aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2023-07-30 11:23:57 -0600
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2023-07-30 23:57:51 +0000
commitb35dd897a94d98faeee84645ca885114494e45c0 (patch)
treeddb0610e24a628f2a5960950480363b8e94bd82a
parentrefactor: more lint improvements (diff)
downloadferdium-app-b35dd897a94d98faeee84645ca885114494e45c0.tar.gz
ferdium-app-b35dd897a94d98faeee84645ca885114494e45c0.tar.zst
ferdium-app-b35dd897a94d98faeee84645ca885114494e45c0.zip
- convert require statement to dynamic import in index.ts
- import color from darkThemeGrayDarkest instead of hardcoding it in index.ts - convert require statement to dynamic import in dnd.ts
-rw-r--r--src/electron/ipc-api/dnd.ts3
-rw-r--r--src/index.ts15
2 files changed, 10 insertions, 8 deletions
diff --git a/src/electron/ipc-api/dnd.ts b/src/electron/ipc-api/dnd.ts
index 9bef0fe3c..6e6e0920f 100644
--- a/src/electron/ipc-api/dnd.ts
+++ b/src/electron/ipc-api/dnd.ts
@@ -9,8 +9,7 @@ export default async () => {
9 return false; 9 return false;
10 } 10 }
11 11
12 // eslint-disable-next-line global-require 12 const { getDoNotDisturb } = await import('macos-notification-state');
13 const { getDoNotDisturb } = require('macos-notification-state');
14 13
15 if (!getDoNotDisturb) { 14 if (!getDoNotDisturb) {
16 debug("Could not load 'macos-notification-state' module"); 15 debug("Could not load 'macos-notification-state' module");
diff --git a/src/index.ts b/src/index.ts
index 5507a9ac4..e76298dec 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -16,6 +16,7 @@ import windowStateKeeper from 'electron-window-state';
16import minimist from 'minimist'; 16import minimist from 'minimist';
17import ms from 'ms'; 17import ms from 'ms';
18import { EventEmitter } from 'node:events'; 18import { EventEmitter } from 'node:events';
19import { initialize } from 'electron-react-titlebar/main';
19import { enableWebContents, initializeRemote } from './electron-util'; 20import { enableWebContents, initializeRemote } from './electron-util';
20import enforceMacOSAppLocation from './enforce-macos-app-location'; 21import enforceMacOSAppLocation from './enforce-macos-app-location';
21 22
@@ -47,6 +48,7 @@ import { asarPath } from './helpers/asar-helpers';
47import { openExternalUrl } from './helpers/url-helpers'; 48import { openExternalUrl } from './helpers/url-helpers';
48import userAgent from './helpers/userAgent-helpers'; 49import userAgent from './helpers/userAgent-helpers';
49import { translateTo } from './helpers/translation-helpers'; 50import { translateTo } from './helpers/translation-helpers';
51import { darkThemeGrayDarkest } from './themes/legacy';
50 52
51const debug = require('./preload-safe-debug')('Ferdium:App'); 53const debug = require('./preload-safe-debug')('Ferdium:App');
52 54
@@ -199,7 +201,7 @@ const createWindow = () => {
199 'darkMode', 201 'darkMode',
200 DEFAULT_APP_SETTINGS.darkMode, 202 DEFAULT_APP_SETTINGS.darkMode,
201 ) 203 )
202 ? '#1E1E1E' 204 ? darkThemeGrayDarkest
203 : (retrieveSettingValue( 205 : (retrieveSettingValue(
204 'accentColor', 206 'accentColor',
205 DEFAULT_APP_SETTINGS.accentColor, 207 DEFAULT_APP_SETTINGS.accentColor,
@@ -389,9 +391,11 @@ const createWindow = () => {
389 }); 391 });
390 392
391 if (isMac) { 393 if (isMac) {
392 // eslint-disable-next-line global-require 394 import('./electron/macOSPermissions').then(macOSPermissions => {
393 const { askFormacOSPermissions } = require('./electron/macOSPermissions'); 395 const { askFormacOSPermissions } = macOSPermissions;
394 setTimeout(() => askFormacOSPermissions(mainWindow), ms('30s')); 396
397 setTimeout(() => askFormacOSPermissions(mainWindow!), ms('30s'));
398 });
395 } 399 }
396 400
397 mainWindow.on('show', () => { 401 mainWindow.on('show', () => {
@@ -498,8 +502,7 @@ app.on('ready', () => {
498 ]); 502 ]);
499 } 503 }
500 504
501 // eslint-disable-next-line global-require 505 initialize();
502 require('electron-react-titlebar/main').initialize();
503 506
504 createWindow(); 507 createWindow();
505}); 508});