mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 22:10:21 +08:00
fix: ensure correct handling of custom mini app updates and removals (#5922)
* fix: ensure correct handling of custom mini app updates and removals * fix: update title for custom mini app to be more concise in localization files --------- Co-authored-by: George Zhao <georgezhao@SKJLAB>
This commit is contained in:
parent
6314b391db
commit
d456b3d4ed
@ -1148,7 +1148,7 @@
|
|||||||
"miniapps": {
|
"miniapps": {
|
||||||
"title": "Mini Apps Settings",
|
"title": "Mini Apps Settings",
|
||||||
"custom": {
|
"custom": {
|
||||||
"title": "Custom Mini App",
|
"title": "Custom",
|
||||||
"edit_title": "Edit Custom Mini App",
|
"edit_title": "Edit Custom Mini App",
|
||||||
"save_success": "Custom mini app saved successfully.",
|
"save_success": "Custom mini app saved successfully.",
|
||||||
"save_error": "Failed to save custom mini app.",
|
"save_error": "Failed to save custom mini app.",
|
||||||
|
|||||||
@ -1154,7 +1154,7 @@
|
|||||||
"title": "在浏览器中打开新窗口链接"
|
"title": "在浏览器中打开新窗口链接"
|
||||||
},
|
},
|
||||||
"custom": {
|
"custom": {
|
||||||
"title": "自定义小程序",
|
"title": "自定义",
|
||||||
"edit_title": "编辑自定义小程序",
|
"edit_title": "编辑自定义小程序",
|
||||||
"save_success": "自定义小程序保存成功。",
|
"save_success": "自定义小程序保存成功。",
|
||||||
"save_error": "自定义小程序保存失败。",
|
"save_error": "自定义小程序保存失败。",
|
||||||
|
|||||||
@ -1156,7 +1156,7 @@
|
|||||||
"custom": {
|
"custom": {
|
||||||
"duplicate_ids": "發現重複的ID: {{ids}}",
|
"duplicate_ids": "發現重複的ID: {{ids}}",
|
||||||
"conflicting_ids": "與預設應用ID衝突: {{ids}}",
|
"conflicting_ids": "與預設應用ID衝突: {{ids}}",
|
||||||
"title": "自定義小程序",
|
"title": "自定義",
|
||||||
"edit_title": "編輯自定義小程序",
|
"edit_title": "編輯自定義小程序",
|
||||||
"save_success": "自定義小程序保存成功。",
|
"save_success": "自定義小程序保存成功。",
|
||||||
"save_error": "自定義小程序保存失敗。",
|
"save_error": "自定義小程序保存失敗。",
|
||||||
|
|||||||
@ -53,7 +53,7 @@ const App: FC<Props> = ({ app, onClick, size = 60, isLast }) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const newApp = {
|
const newApp: MinAppType = {
|
||||||
id: values.id,
|
id: values.id,
|
||||||
name: values.name,
|
name: values.name,
|
||||||
url: values.url,
|
url: values.url,
|
||||||
@ -70,7 +70,7 @@ const App: FC<Props> = ({ app, onClick, size = 60, isLast }) => {
|
|||||||
// 重新加载应用列表
|
// 重新加载应用列表
|
||||||
const reloadedApps = [...ORIGIN_DEFAULT_MIN_APPS, ...(await loadCustomMiniApp())]
|
const reloadedApps = [...ORIGIN_DEFAULT_MIN_APPS, ...(await loadCustomMiniApp())]
|
||||||
updateDefaultMinApps(reloadedApps)
|
updateDefaultMinApps(reloadedApps)
|
||||||
updateMinapps(reloadedApps)
|
updateMinapps([...minapps, newApp])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(t('settings.miniapps.custom.save_error'))
|
message.error(t('settings.miniapps.custom.save_error'))
|
||||||
console.error('Failed to save custom mini app:', error)
|
console.error('Failed to save custom mini app:', error)
|
||||||
@ -143,7 +143,9 @@ const App: FC<Props> = ({ app, onClick, size = 60, isLast }) => {
|
|||||||
message.success(t('settings.miniapps.custom.remove_success'))
|
message.success(t('settings.miniapps.custom.remove_success'))
|
||||||
const reloadedApps = [...ORIGIN_DEFAULT_MIN_APPS, ...(await loadCustomMiniApp())]
|
const reloadedApps = [...ORIGIN_DEFAULT_MIN_APPS, ...(await loadCustomMiniApp())]
|
||||||
updateDefaultMinApps(reloadedApps)
|
updateDefaultMinApps(reloadedApps)
|
||||||
updateMinapps(reloadedApps)
|
updateMinapps(minapps.filter((item) => item.id !== app.id))
|
||||||
|
updatePinnedMinapps(pinned.filter((item) => item.id !== app.id))
|
||||||
|
updateDisabledMinapps(disabled.filter((item) => item.id !== app.id))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(t('settings.miniapps.custom.remove_error'))
|
message.error(t('settings.miniapps.custom.remove_error'))
|
||||||
console.error('Failed to remove custom mini app:', error)
|
console.error('Failed to remove custom mini app:', error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user