fix: fix rn plugin error and plain message

pull/90/head
moonrailgun 2 years ago
parent 0e5692dc86
commit fcf837394a

@ -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
}

@ -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"

@ -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',

Loading…
Cancel
Save