diff --git a/src/store/userApi/action.ts b/src/store/userApi/action.ts index c38f3b7..1578495 100644 --- a/src/store/userApi/action.ts +++ b/src/store/userApi/action.ts @@ -25,7 +25,8 @@ export const addUserApi = (info: LX.UserApi.UserApiInfo) => { export const setUserApiAllowShowUpdateAlert = (id: string, enable: boolean) => { const targetIndex = state.list.findIndex(api => api.id == id) if (targetIndex < 0) return - state.list.splice(targetIndex, 1, { ...state.list[targetIndex], allowShowUpdateAlert: enable }) + state.list[targetIndex].allowShowUpdateAlert = enable + state.list.splice(targetIndex, 1, { ...state.list[targetIndex] }) event.list_changed([...state.list]) } diff --git a/src/utils/nativeModules/userApi.ts b/src/utils/nativeModules/userApi.ts index 842162f..a32f93b 100644 --- a/src/utils/nativeModules/userApi.ts +++ b/src/utils/nativeModules/userApi.ts @@ -84,6 +84,8 @@ export const onScriptAction = (handler: (event: ActionsEvent) => void): () => vo if (event.action == 'init') { if (event.data.info) event.data.info = { ...loadScriptInfo, ...event.data.info } else event.data.info = { ...loadScriptInfo } + } else if (event.action == 'showUpdateAlert') { + if (!loadScriptInfo?.allowShowUpdateAlert) return } handler(event as ActionsEvent) })