Skip to content

Commit

Permalink
Fix Electron Build (#1926)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazib authored Nov 20, 2023
1 parent 9c6d9ec commit e6e184c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/desktop-client/src/browser-preload.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ global.Actual = {
return worker;
},

setTheme: () => {},
setTheme: theme => {
window.__actionsForMenu.saveGlobalPrefs({ theme: theme });
},
};

document.addEventListener('keydown', e => {
Expand Down
4 changes: 0 additions & 4 deletions packages/desktop-client/src/global-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export function handleGlobalEvents(actions, store) {
// to update.
});

global.Actual.setTheme = theme => {
actions.saveGlobalPrefs({ theme });
};

listen('server-error', info => {
actions.addGenericErrorNotification();
});
Expand Down
8 changes: 8 additions & 0 deletions packages/desktop-electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,3 +407,11 @@ ipcMain.on('apply-update', () => {
ipcMain.on('update-menu', (event, isBudgetOpen) => {
updateMenu(isBudgetOpen);
});

ipcMain.on('set-theme', theme => {
let obj = { theme: theme };

clientWin.webContents.executeJavaScript(
`window.__actionsForMenu && window.__actionsForMenu.saveGlobalPrefs(${obj})`,
);
});
4 changes: 3 additions & 1 deletion packages/desktop-electron/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,7 @@ contextBridge.exposeInMainWorld('Actual', {
return socketPromise;
},

setTheme: () => {},
setTheme: theme => {
ipcRenderer.send('set-theme', theme);
},
});
6 changes: 6 additions & 0 deletions upcoming-release-notes/1926.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [Shazib]
---

Fix issue with electron builds being stuck on a blank screen.

0 comments on commit e6e184c

Please sign in to comment.