Closed richanshah closed 10 months ago
do you need to skip reading the message if any other opponent already read it? but in this case, only one user will present in the readIds
array and you will not know if other users read the message.
@TatankaConCube no, u misunderstood it. If possible then only if all group members have read the chats then do a green tick of the message , so if any members has not read message yet then i dont want to do green tick.
@TatankaConCube let me know the changes require for this feature
then you need to check if the array readIds
of the message contains all items from the array occupantsIds
of the dialog.
bool? containsAllReadIds(List<int>? readIds, List<int?> occupantsIds) {
if (readIds == null) {
return false;
}
// Filter out the IDs that are not equal to the user's ID and check if all remaining IDs are in occupantsIds.
final filteredIds = readIds.where((id) => id != controller.cubeUser.id).toList();
return occupantsIds.every((id) => filteredIds.contains(id));
}
i tried this logic , but its not working as expected
what do you mean? does the sender receive the read status events from all read users? what issues do you have here?
containsAllReadIds(message.readIds, controller.occupants.keys.toList()) == true this condition is not getting true , do u think any other changes needed?
here you delete current user
final filteredIds = readIds.where((id) => id != controller.cubeUser.id).toList();
and here you check if occupants' ids contains all read ids
occupantsIds.every((id) => filteredIds.contains(id))
your filteredIds
always doesn't contains the current user and occupantsIds always contain it. I'm right?
yes i have removed filteredIds concept but still its not updating. so i guess there is something missing
first of all, compare these two arrays in the log. Do they contain the same IDs?
then investigate how you add users to the readIds, do you add all users who read the message?
add users to the readIds, do you add all users who read the message?
its the same logic as per your demo
first of all, compare these two arrays in the log. Do they contain the same IDs?
yes
filteredIds= [10909924, 10999317], occupantsIds= [10999317, 10909924, 10909837], readIds = [10909837, 10909924, 10999317]
and the method every
returns false
?
no I dont think this logic has any issue but still its not updating in the ui , if u can try and check in ur demo please let me know if it gets done, i have alredy tried.
but you said before
containsAllReadIds(message.readIds, controller.occupants.keys.toList()) == true this condition is not getting true
I don't know how to help here, it is your requirements and your app. Here are a lot of reasons why UI is not updating. Our API in this case works as expected (all read packages arrive on the sender side).
ok will check and if gets resolve will update u
thanks for help
no activity for a long time. closing...
@TatankaConCube , For group chat I have observed that if one memeber of that group read the message then sender side it got changed to green tick but other group members have read the message yet, is there any way to handle this?