Group chat- IOS & react native issue

Hi Cometchat team.

We are testing a the development version for IOS with Cometchat SDK, but, we noted that when a user sends a message in a group, you used a library that react native deleted from the core; therefore the null values ​​are not validated and a bug appears.

What solution can you propose?

Thanks in advance.

Please, somebody can help me with this?

Thanks.

Hello @dahu93,
Can you please attach the error you are getting?

Hi support team,

As we told you before we still have an error in iOS whenever we are sending a message in a group chat. In one to one chats everything seems to be working fine but not in group chats. We are getting the following response "Entries must be arrays of the form [key: string, value: string], got: ". It seems to be AsyncStorage related, though we have checked from our end and it seems there is an exception from your side which is not being properly handled.

We require, please, your help and support regarding this issue because it is very important to our app. We are attaching an image with the error from an iPhone.

Regards,

Hi dahu93,
We have identified this issue at our end and released a beta for the same, you can use the v2.0.5-beta1 and check if everything is working as expected.

Hi Mayur,

We ran some tests using your v2.0.5 and we are still getting the same results(The app keep crashing in iOS showing the same error we have already shared).

We found a provisional solution where we are changing some code in your files, in comentchat.js, because we had to go live). What we did was changing “if (!l.isFalsy(o))” to “if (!l.isFalsy(o.id))” and it seems to work. It appears an object with undefined id was being used as an argument to the function and AsyncStorage was crashing.

Please, we are hoping you can review our fix, improve it and add it to your github so we won’t have to fix it each time we install your tools. The fix was added to your v2.0.4, NOT v.2.0.5, because your last version has another bug where it is not returning the last messages of any chat and we cannot use that version until it’s more stable.

Also, we found out there is another issue. Whenever our app is closed, the session is erased which we think it’s because your library is using the AsyncStorage from REACT CORE while we think you should be using the community one(which React Native developers advise to use in their documentation).

Regards,

Hello @dahu93,

Thank you for mentioning the issues. But i don’t think making changes in CometChat.js is a wise solution, because it may lead to some other issues.
Also can you please share your code snippet of sending media message. We did run test on v2.0.5 and media message seems to be working fine on Android and iOS both.
Regarding the last message issue, we will check this at our end and will get back to you.
And lastly can you please let us know if you kill the app or just put the app in background which causes the storage to be cleared.
We are already looking forward to use the AsyncStorage from @react-native-community/AsyncStorage, but the problem is that expo has not yet switched to using AsyncStorage from community and might cause issue to client using expo.

Hi Mayur,

This is a piece of the code used to send messages(based on the code provided by the documentation):

export const ctSendTextMessage = (GUID, txtMessage, isGroup, senderId, onSuccess, onError) => {
let receiverType = isGroup ? CometChat.RECEIVER_TYPE.GROUP : CometChat.RECEIVER_TYPE.USER;
let textMessage = new CometChat.TextMessage(GUID, txtMessage, receiverType);
textMessage.setMetadata({ reqId: uuidv4() });
CometChat.sendMessage(textMessage).then(onSuccess,onError);
… rest code …
}

We make sure the variable txtMessage is not EMPTY and then the callback is called.

Like we wrote you before, we managed to solve the session issue by editing the AsyncStorage used by @react-native-community/AsyncStorage. It seems the problems was caused because of having two AsyncStorages in the same project, we the fix we made even when the app is closed(killed) the session is kept alive.

Regards,

Hi dahu93,

We did test sending media messages and normal messages in group and one-on-one conversation on iOS and Android and everything seems to be working as expected. We tested this scenario on our latest react native SDK v2.0.6 and also tested this on v2.0.5. Can you please update to the latest version of the SDK and check if your issue is solved ?

HI Mayur,

We did the suggested update and, though some features are working fine, we see that our app keeps crashing more often than before(it was crashing sometimes since we integrated comechat to our app).

We think the problem is that your socket, sometimes, is null(or becomes null) which makes our app crash, though we will be trying to get you more info(like some logs) but it would be nice if you can check it out meanwhile please.

Regards,

Hi Mayur,

We managed to take some screenshots regarding the error that makes our app randomly crash so often. As you can see it says “Comechat.js”. Please help, it doesn’t happen in an specific action but just randomly.

Regards,

Hello dahu93,

We are unable to reproduce this issue at our end.

Please try the below things:

  1. If you are testing the app in the debug build by running the react-native metro server, please make a release build.

  2. If the hot/live reloading is turned on, please turn it off.

If this does not resolve the issue please let us know if you encounter this issue intermittently or all the time?

Hi @mayur.bhandari

Following your suggestions, we have made a compilation of the app pointing to the test database. In addition, hot/live reloading is off.

The issue persists intermittently, however, we found a routine that forces the app to close. When the user is in a view (ex: group or match) and lock the phone, after aproximmately 5 minutes, when the phone is unlocked, the app closes.

Im gonna share with you the link of the apk compilation.

https://mega.nz/#!q0ZDDIBR!KqFGmTwkx43g-_1CrdIPe536z_O4QxNWGI48VaMeyu0

Thanks in advance.

Hello @dahu93,

As your app is completely in Spanish and because we do not understand that language, we are having trouble exploring the app and i need your help to let me know how to get to the group/match view and check the issue you have reported.

Hi @mayur.bhandari .

I get it .

Please go the explore section represented by the magnifying glass. You will then see a search entry with an empty list of groups called “Grupos”. Please select Argentina and then select any result group.

There you can replicate the issue.

Thanks.

Hi @mayur.bhandari

Hope you are ok.

Do you have any news about a possible solution for the issue discussed?

Thanks.

Hello @dahu93,
We were able to replicate the issue at our end. However, since we do not have the logs or any other source to debug, we might need some more time with this. We might have a lead on how to get to the root cause of the issue. However as mentioned we might need some time with this. We will keep you posted on the progress of this. Hopefully we should have more information regarding this by tomorrow.
Appreciate your patience.

Hi @mayur.bhandari

Thanks for the info.

A moment ago I was watching the app in production, and there are users who have trouble entering a conversation. Those same users who have a problem with it, I try to open a conversation with them and can not. It seems that those users was not created in cometchat, even users who registered in our app after migrating to cometchat.

Hello @dahu93,

Can you please provide us with your appId so that we can look into this issue. Also, it would be helpful if you could share the code of your Group View(where you were facing the issue).

Hi @mayur.bhandari

The app id is com.kickup. During the day we will share the code snippet.

About the problem of users who have not been created in cometchat, I was checking in the cometchat console and of the 4100 users who registered in our app after the integration of your chat and the first migration, 2557 were not created in cometchat , therefore they had to be loaded manually. Surely for these users to access the chat, they have to log out and log in again.

What can I do to make the api create all users automatically?

Thanks.