[Redux Toolkit Migration] appSlice (#4018)

* Migrate to accountSlice

* Fix lint and typecheck errors

* Update types

* Fix lint

* Fix types

* Cleanup

* Rename file

* Rename state

* Cleanup

* Fix typecheck error

* Move createAppAsyncThunk

* Queries slice

* App slice

* Release notes

* Remove app state type

* [TS] Actual startOAuthServer function

* Rename slice

* Fix types

* Slice name

* Cleanup

* Fix lint errors

* Fix import

* Move sync actions to appSlice

* Revert to window

* Updates

* Revert browser-preload.browser.js
This commit is contained in:
Joel Jeremy Marquez
2025-01-18 13:34:04 -08:00
committed by GitHub
parent 7cb53502b8
commit 91c4e3e067
42 changed files with 279 additions and 222 deletions

View File

@@ -229,7 +229,7 @@ async function createWindow() {
const url = clientWin.webContents.getURL();
if (url.includes('app://') || url.includes('localhost:')) {
clientWin.webContents.executeJavaScript(
'window.__actionsForMenu.focused()',
'window.__actionsForMenu.appFocused()',
);
}
}
@@ -435,7 +435,7 @@ ipcMain.handle(
export type SaveFileDialogPayload = {
title: SaveDialogOptions['title'];
defaultPath?: SaveDialogOptions['defaultPath'];
fileContents: string | NodeJS.ArrayBufferView;
fileContents: string | Buffer;
};
ipcMain.handle(
@@ -448,7 +448,11 @@ ipcMain.handle(
return new Promise<void>((resolve, reject) => {
if (fileLocation) {
fs.writeFile(fileLocation.filePath, fileContents, error => {
const contents =
typeof fileContents === 'string'
? fileContents
: new Uint8Array(fileContents.buffer);
fs.writeFile(fileLocation.filePath, contents, error => {
return reject(error);
});
}

View File

@@ -71,7 +71,7 @@ contextBridge.exposeInMainWorld('Actual', {
isUpdateReadyForDownload: () => false,
waitForUpdateReadyForDownload: () => new Promise<void>(() => {}),
getServerSocket: () => {
getServerSocket: async () => {
return null;
},
@@ -89,4 +89,12 @@ contextBridge.exposeInMainWorld('Actual', {
newDirectory,
);
},
});
reload: async () => {
throw new Error('Reload not implemented in electron app');
},
applyAppUpdate: async () => {
throw new Error('applyAppUpdate not implemented in electron app');
},
} satisfies typeof global.Actual);