【发布时间】:2021-05-21 06:23:50
【问题描述】:
我正在尝试集成react-native-freshchat-sdk 以响应本机应用程序,但是当firebase 远程消息到来时,freshchatNotification 为0,但它应该为1。即使我将notification 传递给Freshchat.handlePushNotification 也没有任何反应。我假设 Freshchat.handlePushNotification 应该将用户导航到对话
实际结果
- freshchatNotification 如果是 fcm 通知则为 0
- Freshchat.handlePushNotification(notification) 什么都不做
预期结果:
- 如果是 fcm 通知,freshchatNotification 应该等于 1
- Freshchat.handlePushNotification(notification) 应该将用户导航到聊天
import messaging from '@react-native-firebase/messaging'
import { Freshchat} from 'react-native-freshchat-sdk'
//...
useEffect(() => {
const unsubscribe = messaging().onMessage(notification => {
Freshchat.isFreshchatNotification(notification, (freshchatNotification) => {
Freshchat.handlePushNotification(notification);
if (freshchatNotification) {
Freshchat.handlePushNotification(notification);
} else {//...}
})
});
return unsubscribe
}, [])
【问题讨论】:
-
我将 notification.data 传递给 Freshchat.isFreshchatNotification、Freshchat.handlePushNotification 并且一切正常