Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TW-1675: status of user is not correct #1684

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

Te-Z
Copy link
Contributor

@Te-Z Te-Z commented Apr 4, 2024

Issue:

#1675

Root cause:

The root cause was in matrix-dart-sdk. Here is the copy paste of the explanation I made there:

This was the previous code:
https://github.com/linagora/matrix-dart-sdk/blob/e0b65295255b852532878a948662920d6963cc6f/lib/src/client.dart#L1793-L1799

The UI previously listened to onPresenceChanged which is a CachedStreamController . This instance had a new value added in the for each loop for every items in sync.presencelist. This means if there's different values in sync.presence , the UI will be updated 6 times.

To handle that I changed for this code:

https://github.com/linagora/matrix-dart-sdk/blob/b0c34117c60360d3f1241af9653ddaaa88aaead4/lib/src/client.dart#L1809-L1829

Here lowestLastActivePresence is updated for each items in sync.presence list if it is null or if the current item's timestamp is before the one in lowestLastActivePresence. Then when the loop is over and we are sure to have the right value, we can update onLatestPresenceChange with the right value and this way update the UI.

Warning:

Merge linagora/matrix-dart-sdk#54 before this one

Demo:

Capture.video.du.04-04-2024.14.20.22.webm
screen-20240404-141843.mp4

@Te-Z Te-Z changed the title TW-1675: ChatAppBarTitle updated TW-1675: status of user is not correct Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

This PR has been deployed to https://linagora.github.io/twake-on-matrix/1684

@hoangdat
Copy link
Member

hoangdat commented Apr 8, 2024

  • write the ADR for this problem

@hoangdat hoangdat merged commit 2a3e346 into main Apr 9, 2024
3 checks passed
@hoangdat hoangdat deleted the TW-1675-incorrect-status-of-user branch April 9, 2024 14:59
hoangdat pushed a commit that referenced this pull request May 3, 2024
hoangdat pushed a commit that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants