Closed rexcode closed 3 years ago
Hi @rexcode !
Thanks for expanded description!
Before use classes and methods from ConnectyCube SDK you have to call ConnectyCube.init(...).
It will create all classes.
Please take a look on ConnectyCube.chat.markActive()
. Seems it is calling before the ConnectyCube.init(...).
. Usually methods markActive
and markInactive
are called in RN AppState's listener.
Hi, Thank you for your very quick reply.
I am relatively new to React Native, can u please guide where I need to call ConnectyCube.init(...) ie. before or after sending push notification
I see _ConnectyCube.init(...) is called in auth-service.js which is called in appWrap.js which is the entry point for my app.
I am able to debug my app crashes after getUserSession() is called by autologin() in auth-service.js
Depends of where you are calling ConnectyCube.chat.markActive()
.
Is it calling from RN AppStateListener?
You can call AppState.addEventListener('change', someFunc)
after ConnectyCube.init(...appConfig.connectyCubeConfig)
or autologin()
.
Second way is change ConnectyCube.chat.markActive()
to ConnectyCube.chat?.markActive()
. The chaining operator ?
will check possibility to call method markActive
from ConnectyCube.chat
class.
Hi, thanks for your reply. For time being I have commented out ConnectyCube.chat.markActive() and app crash error has gone away
I think this will have minor effect if not so kindly inform
I will update again in sometime
FYI - https://developers.connectycube.com/js/messaging?id=mark-a-client-as-activeinactive
Also guide by my previous message to make all correctly
I have forked RNVideochat sample code and expanded it to include chat functionality as per RNChat sample code
I have set up push notifications as provided by conectycube documentation. reference - https://developers.connectycube.com/reactnative/push-notifications
I have also setup subcribeToPushNotification() method and I can manually send notification (data only) using ConnectyCube.pushnotifications.events method
However, when there is a new chat I am able to receive new push notifications for it but when I open the push notification and try to navigate to a different screen I get one of these 2 errors as shown below. Once I get any of these errors, then even if I try to open a simple data-only notification with no processing, I get any of these 2 errors.
I have tried opening push notifications using both react-native-push-notification and @react-native-firebase/messaging packages
I am using PushNotification.configure({ onRegister: }) to subscribe to push notifications as user logs and goes to the first screen of my app I have tried to open notification using PushNotification.configure({ onNotification }) on the first screen after user logs in and also in App.js I have also used @react-native-firebase/messaging messaging().onNotificationOpenedApp method to open the notifications but every time I get the same 2 errors
I have used NavigationActions from 'react-navigation' on App.js to access the navigator
I had initially installed react-native-push-notification:@3.1.9 version as was specified in your RNChat code sample and tried to upgrade it to the latest version but due to some error I reverted to back 3.1.9 version
2 Errors I receive when I try to open a push notification and redirect to a different screen -
package.json from your reference
Please guide