diff --git a/src/apps/launchpad/index.ts b/src/apps/launchpad/index.ts index eb10c79..93f820b 100644 --- a/src/apps/launchpad/index.ts +++ b/src/apps/launchpad/index.ts @@ -3,6 +3,7 @@ import { h, render } from 'vue' import { Apps, stdMenus } from '../../composables/useApps' import LaunchpadComponent from './Launchpad.vue' import { ui } from '../../composables/useUI' +import { store } from '../../composables/useStore' let _AppStoreApp: any = null export function setAppStoreForLaunchpad(a: any) { _AppStoreApp = a } @@ -46,7 +47,13 @@ Apps.open = function (id: string, args?: any) { if (id === 'launchpad') { Launchpad.show(); return null } if (id === 'stickies' && !(args && args.noteId)) { (Apps.get('stickies') as any)?.openAll(); return null } const app = this.get(id) - if (app && app.storeApp && !(_AppStoreApp && _AppStoreApp.isInstalled(id))) { + // storeApp 检查:优先通过 _AppStoreApp(App Store 打开后注入), + // 若 _AppStoreApp 为 null(App Store 尚未打开过),直接从 store 读取 + const isStoreApp = app?.storeApp + const installed = isStoreApp + ? (_AppStoreApp ? _AppStoreApp.isInstalled(id) : (store.get('appstore-installed', []) as string[]).includes(id)) + : true + if (app && isStoreApp && !installed) { ui.alert('尚未安装', `请先在 App Store 中获取"${app.name}"。`, '/assets/icons/appstore.png') return null }