Skip to content

Commit 21c42b0

Browse files
committed
#RI-4981 - fix electron theme source
1 parent bddfb99 commit 21c42b0

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

redisinsight/desktop/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import {
1313
initAutoUpdaterHandlers,
1414
launchApiServer,
1515
initCloudHandlers,
16+
electronStore,
1617
} from 'desktopSrc/lib'
1718
import { wrapErrorMessageSensitiveData } from 'desktopSrc/utils'
1819
import { configMain as config } from 'desktopSrc/config'
1920
import { deepLinkHandler, deepLinkWindowHandler } from 'desktopSrc/lib/app/deep-link.handlers'
21+
import { ElectronStorageItem } from 'uiSrc/electron/constants'
2022

2123
if (!config.isProduction) {
2224
const sourceMapSupport = require('source-map-support')
@@ -33,6 +35,8 @@ const init = async () => {
3335
initTray()
3436
initCloudHandlers()
3537

38+
nativeTheme.themeSource = electronStore?.get(ElectronStorageItem.themeSource) || config.themeSource
39+
3640
checkForUpdate(process.env.MANUAL_UPGRADES_LINK || process.env.UPGRADES_LINK)
3741

3842
app.setName(config.name)

redisinsight/desktop/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"defaultPort": 5530,
44
"host": "localhost",
55
"debug": false,
6+
"themeSource": "dark",
67
"appName": "RedisInsight",
78
"schema": "redisinsight",
89
"mainWindow": {
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { app, ipcMain, nativeTheme } from 'electron'
22
import { electronStore } from 'desktopSrc/lib'
3-
import { IpcInvokeEvent } from 'uiSrc/electron/constants'
3+
import { ElectronStorageItem, IpcInvokeEvent } from 'uiSrc/electron/constants'
44

55
export const initIPCHandlers = () => {
66
ipcMain.handle(IpcInvokeEvent.getAppVersion, () => app?.getVersion())
@@ -10,6 +10,9 @@ export const initIPCHandlers = () => {
1010
ipcMain.handle(IpcInvokeEvent.deleteStoreValue, (_event, key) => electronStore?.delete(key))
1111

1212
ipcMain.handle(IpcInvokeEvent.themeChange, (_event, theme: string) => {
13-
nativeTheme.themeSource = theme.toLowerCase()
13+
const themeSource = theme.toLowerCase() as typeof nativeTheme.themeSource
14+
15+
nativeTheme.themeSource = themeSource
16+
electronStore?.set(ElectronStorageItem.themeSource, themeSource)
1417
})
1518
}

redisinsight/ui/src/electron/constants/storageElectron.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum ElectronStorageItem {
66
isDisplayAppInTray = 'isDisplayAppInTray',
77
updatePreviousVersion = 'updatePreviousVersion',
88
zoomFactor = 'zoomFactor',
9+
themeSource = 'themeSource',
910
}
1011

1112
export default ElectronStorageItem

0 commit comments

Comments
 (0)