I'm new here, I hope you can help me with a question that has come up for a chat project I'm doing.
The problem is this, I get all the message history of a chat from PHP in a json and I pass it to an NSMutableArray and I show it in a TableView, on one side the messages of one and the other side of the other. If the same person sends many consecutive messages, it is very bad, because in each message the user's picture is shown and it becomes repetitive.
What I want to do is, in the array, join all the messages that belong to the same person and that have been sent consecutively, so that they are all shown together with a single photo of the person who sends them, just as it does WhatsApp and other platforms.
The array receives the values (idUserA, idUserB, fotoA, fotoB, mensaje and userQueEnvia)
I want to put together the messages in which the "userQueEnvia" is the same and consecutive.
You can guide me a bit, since I do not get anything about it.
Thank you very much.