* 更新固定列表顺序
(newOrder: any[])
| 971 | * 更新固定列表顺序 |
| 972 | */ |
| 973 | private updatePinnedOrder(newOrder: any[]): void { |
| 974 | try { |
| 975 | // 清理数据,只保存必要字段 |
| 976 | const cleanData = newOrder.map((app) => { |
| 977 | const isDirectApp = app.type === 'direct' && app.subType === 'app' |
| 978 | return { |
| 979 | name: isDirectApp ? app.persistedName || app.name : app.name, |
| 980 | path: app.path, |
| 981 | icon: app.icon, |
| 982 | type: app.type, |
| 983 | subType: app.subType, |
| 984 | featureCode: app.featureCode, |
| 985 | pluginExplain: app.pluginExplain, |
| 986 | pinyin: app.pinyin, |
| 987 | pinyinAbbr: app.pinyinAbbr, |
| 988 | pluginName: app.pluginName, |
| 989 | cmdType: app.cmdType, |
| 990 | originalName: app.originalName, |
| 991 | persistedName: app.persistedName |
| 992 | } |
| 993 | }) |
| 994 | |
| 995 | databaseAPI.dbPut('pinned-commands', cleanData) |
| 996 | console.log('[Commands] 固定列表顺序已更新') |
| 997 | |
| 998 | // 通知前端重新加载固定列表 |
| 999 | this.notifyRenderer('pinned-changed') |
| 1000 | } catch (error) { |
| 1001 | console.error('[Commands] 更新固定列表顺序失败:', error) |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | /** |
| 1006 | * 从数据库加载上次匹配状态 |
no test coverage detected