This commit is contained in:
IndieKKY
2024-10-04 15:31:51 +08:00
parent 6ffb9073ab
commit 564f032e3a
6 changed files with 27 additions and 9 deletions

View File

@@ -8,15 +8,17 @@ const useMessagingService = () => {
const dispatch = useAppDispatch()
//methods
const methods = useMemo(() => ({
[MESSAGE_TO_APP_SET_INFOS]: (params: any, from: string, context: MethodContext) => {
const methods: {
[key: string]: (params: any, context: MethodContext) => boolean
} = useMemo(() => ({
[MESSAGE_TO_APP_SET_INFOS]: (params: any, context: MethodContext) => {
dispatch(setInfos(params.infos))
dispatch(setCurInfo(undefined))
dispatch(setCurFetched(false))
dispatch(setData(undefined))
return true
},
[MESSAGE_TO_APP_SET_VIDEO_INFO]: (params: any, from: string, context: MethodContext) => {
[MESSAGE_TO_APP_SET_VIDEO_INFO]: (params: any, context: MethodContext) => {
dispatch(setInfos(params.infos))
dispatch(setUrl(params.url))
dispatch(setTitle(params.title))