Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: download manager #91

Merged
merged 11 commits into from Mar 20, 2024
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