diff --git a/client/web/plugins/com.msgbyte.env.rn/manifest.json b/client/web/plugins/com.msgbyte.env.rn/manifest.json index e3b0e884..540d9b3a 100644 --- a/client/web/plugins/com.msgbyte.env.rn/manifest.json +++ b/client/web/plugins/com.msgbyte.env.rn/manifest.json @@ -6,6 +6,6 @@ "version": "0.0.0", "author": "moonrailgun", "description": "Add support for ReactNative environment in Tailchat", - "description.zh-CN": "在Tailchat添加对ReactNative环境的支持", + "description.zh-CN": "在 Tailchat 添加对 ReactNative 环境的支持", "requireRestart": true } diff --git a/client/web/plugins/com.msgbyte.env.rn/package.json b/client/web/plugins/com.msgbyte.env.rn/package.json index fba3bb3c..172cc245 100644 --- a/client/web/plugins/com.msgbyte.env.rn/package.json +++ b/client/web/plugins/com.msgbyte.env.rn/package.json @@ -2,7 +2,7 @@ "name": "@plugins/com.msgbyte.env.rn", "main": "src/index.tsx", "version": "0.0.0", - "description": "在Tailchat添加对ReactNative环境的支持", + "description": "Add support for ReactNative environment in Tailchat", "private": true, "scripts": { "sync:declaration": "tailchat declaration github" diff --git a/client/web/plugins/com.msgbyte.env.rn/src/index.tsx b/client/web/plugins/com.msgbyte.env.rn/src/index.tsx index f3435f86..4672eafc 100644 --- a/client/web/plugins/com.msgbyte.env.rn/src/index.tsx +++ b/client/web/plugins/com.msgbyte.env.rn/src/index.tsx @@ -3,10 +3,11 @@ import { sharedEvent, getCachedUserInfo, getCachedBaseGroupInfo, + getMessageTextDecorators, } from '@capital/common'; import { Translate } from './translate'; -const PLUGIN_NAME = 'ReactNative支持'; +const PLUGIN_NAME = 'ReactNative Support'; console.log(`Plugin ${PLUGIN_NAME} is loaded`); @@ -25,6 +26,11 @@ function forwardSharedEvent( let type = eventName; if (processPayload) { const res = await processPayload(payload); + if (!res) { + // Skip if res is undefined + return; + } + payload = res.payload; type = res.type; } @@ -60,7 +66,7 @@ forwardSharedEvent('receiveUnmutedMessage', async (payload) => { const content = message.content; const title = `${Translate.from} [${scopeName}] ${nickname}`; - const body = content; + const body = getMessageTextDecorators().serialize(content); return { type: 'showNotification',