fix: App Store 未打开时 _AppStoreApp=null 导致已安装应用弹窗'尚未安装'——改为直接读 store
This commit is contained in:
parent
b4badc5897
commit
3b9c82af3d
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user