Skip to content

Commit

Permalink
feat: download manager (#91)
Browse files Browse the repository at this point in the history
## Motivation

<!-- List motivation and changes here -->

add a download manager that handles queued downloads

## Issues closed

<!-- List closed issues here -->
  • Loading branch information
pixelass committed Mar 20, 2024
1 parent 9abeff7 commit a792c16
Show file tree
Hide file tree
Showing 10 changed files with 2,986 additions and 4,081 deletions.
6,428 changes: 2,354 additions & 4,074 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -114,9 +114,11 @@
"gray-matter": "^4.0.3",
"husky": "^9.0.11",
"i18next": "23.10.1",
"install": "^0.13.0",
"jest": "^29.7.0",
"jest-config": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-mock": "^29.7.0",
"jest-mock-extended": "^3.0.5",
"jest-ts-webcompat-resolver": "^1.0.0",
"jotai": "2.7.0",
Expand All @@ -130,7 +132,9 @@
"nextron": "^8.13.0",
"node-7z": "^3.0.0",
"node-loader": "^2.0.0",
"npm": "^10.5.0",
"openai": "^4.28.4",
"p-wait-for": "^5.0.2",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-codemirror2": "^7.3.0",
Expand Down
4 changes: 2 additions & 2 deletions src/client/pages/[locale]/installer/02.tsx
Expand Up @@ -47,9 +47,9 @@ function useInstallProgress() {
}
);
const unsubscribeCancelled = window.ipc.on(
buildKey([ID.INSTALL], { suffix: ":cancelled" }),
buildKey([ID.INSTALL], { suffix: ":canceled" }),
() => {
setStatus(DownloadState.CANCELLED);
setStatus(DownloadState.CANCELED);
}
);
const unsubscribeCompleted = window.ipc.on(
Expand Down
2 changes: 1 addition & 1 deletion src/electron/future/ipc/global.ts
Expand Up @@ -259,7 +259,7 @@ ipcMain.handle(
}
},
onCancel() {
downloadsStore.set(item.id, DownloadState.CANCELLED);
downloadsStore.set(item.id, DownloadState.CANCELED);
},
}).catch(() => {
downloadsStore.set(item.id, DownloadState.FAILED);
Expand Down
4 changes: 2 additions & 2 deletions src/electron/future/ipc/install.ts
Expand Up @@ -38,10 +38,10 @@ ipcMain.on(
},
onCancel() {
window_.webContents.send(
buildKey([ID.INSTALL], { suffix: ":cancelled" }),
buildKey([ID.INSTALL], { suffix: ":canceled" }),
true
);
appSettingsStore.set("status", DownloadState.CANCELLED);
appSettingsStore.set("status", DownloadState.CANCELED);
},
async onCompleted(file) {
const targetPath = getCaptainData(destination);
Expand Down

0 comments on commit a792c16

Please sign in to comment.