feat(install): add app uninstall functionality

This commit is contained in:
Elysia
2026-01-26 00:56:39 +08:00
parent d51756c124
commit ac0dc225bc
5 changed files with 92 additions and 30 deletions

View File

@@ -2,7 +2,7 @@
// console.log('[Receive Main-process message]:', ...args)
// })
import { currentApp } from "../global/storeConfig";
import { currentApp, currentAppIsInstalled } from "../global/storeConfig";
import { APM_STORE_BASE_URL, APM_STORE_ARCHITECTURE } from "../global/storeConfig";
import { downloads } from "../global/downloadStatus";
@@ -53,11 +53,20 @@ export const handleRetry = (download_: DownloadItem) => {
window.ipcRenderer.send('queue-install', JSON.stringify(download_));
};
export const handleRemove = (download_: DownloadItem) => {
export const handleRemove = () => {
if (!currentApp.value?.Pkgname) return;
console.log('请求卸载: ', currentApp.value.Pkgname);
window.ipcRenderer.send('remove-installed', currentApp.value.Pkgname);
}
window.ipcRenderer.on('remove-complete', (_event, log: DownloadResult) => {
if (log.success) {
currentAppIsInstalled.value = false;
} else {
currentAppIsInstalled.value = true;
console.error('卸载失败:', log.message);
}
});
window.ipcRenderer.on('install-status', (_event, log: InstallLog) => {
const downloadObj: any = downloads.value.find(d => d.id === log.id);
downloadObj.status = log.message;