fix: 修复应用还没有安装完,按钮就重新变成可安装状态 (#11)

fix:先用比较简单的方案解决安装之后卸载了还是显示已安装的问题

fix: 在安装成功的ipc信息之后再删除安装队列的任务

删除pnpm workspace
This commit is contained in:
Delta1035
2026-02-04 13:06:01 +08:00
committed by GitHub
parent 53eb307f5c
commit b43c6117ec
6 changed files with 138 additions and 24 deletions

View File

@@ -57,11 +57,10 @@ import InstalledAppsModal from './components/InstalledAppsModal.vue';
import UpdateAppsModal from './components/UpdateAppsModal.vue';
import UninstallConfirmModal from './components/UninstallConfirmModal.vue';
import { APM_STORE_BASE_URL, currentApp, currentAppIsInstalled } from './global/storeConfig';
import { downloads } from './global/downloadStatus';
import { downloads, removeDownloadItem, watchDownloadsChange } from './global/downloadStatus';
import { handleInstall, handleRetry, handleUpgrade } from './modeuls/processInstall';
import type { App, AppJson, DownloadItem, UpdateAppItem, InstalledAppInfo } from './global/typedefinition';
import type { App, AppJson, DownloadItem, UpdateAppItem, InstalledAppInfo, ChannelPayload } from './global/typedefinition';
import type { Ref } from 'vue';
const logger = pino();
// Axios 全局配置
@@ -167,7 +166,7 @@ const openDetail = (app: App) => {
});
};
const checkAppInstalled = (app: App) => {
const checkAppInstalled = (app: App) => {
window.ipcRenderer.invoke('check-installed', app.pkgname).then((isInstalled: boolean) => {
currentAppIsInstalled.value = isInstalled;
});
@@ -242,7 +241,7 @@ const refreshUpgradableApps = async () => {
upgradableApps.value = (result.apps || []).map((app: any) => ({
...app,
// Map properties if needed or assume main matches App interface except field names might differ
// For now assuming result.apps returns objects compatible with App for core fields,
// For now assuming result.apps returns objects compatible with App for core fields,
// but let's normalize just in case if main returns different structure.
name: app.name || app.Name || '',
pkgname: app.pkgname || app.Pkgname || '',
@@ -367,10 +366,12 @@ const refreshInstalledApps = async () => {
const requestUninstall = (app: App) => {
let target = null;
target = apps.value.find(a => a.pkgname === app.pkgname) || app;
if (target) {
uninstallTargetApp.value = target as App;
showUninstallModal.value = true;
// TODO: 挪到卸载完成ipc回调里面
removeDownloadItem(app.pkgname);
}
};
@@ -396,6 +397,14 @@ const onUninstallSuccess = () => {
}
};
const installCompleteCallback = () => {
if (currentApp.value) {
checkAppInstalled(currentApp.value);
}
}
watchDownloadsChange(installCompleteCallback);
const uninstallInstalledApp = (app: App) => {
requestUninstall(app);
};
@@ -651,7 +660,7 @@ onMounted(async () => {
}
});
window.ipcRenderer.on('deep-link-install', (_event: any, pkgname: string) => {
window.ipcRenderer.on('deep-link-install', (_event: Electron.IpcRendererEvent, pkgname: string) => {
const tryOpen = () => {
const target = apps.value.find(a => a.pkgname === pkgname);
if (target) {
@@ -673,6 +682,14 @@ onMounted(async () => {
}
});
window.ipcRenderer.on('remove-complete', (_event: Electron.IpcRendererEvent, payload: ChannelPayload) => {
const pkgname = currentApp.value?.pkgname
if(payload.success && pkgname){
removeDownloadItem(pkgname);
}
});
window.ipcRenderer.send('renderer-ready', { status: true });
logger.info('Renderer process is ready!');
});
@@ -682,4 +699,4 @@ watch(isDarkTheme, (newVal) => {
localStorage.setItem('theme', newVal ? 'dark' : 'light');
syncThemePreference(newVal);
});
</script>
</script>