Skip to content

Fix sending read receipts when entering a room #1016

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

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

jmartinesp
Copy link
Member

@jmartinesp jmartinesp commented Aug 1, 2023

The callback in TimelineScrollHelper was only called when the timeline items were empty, so no initial read receipt was sent anymore.

Instead, we're sending a read receipt when the initial items for the timeline are loaded.

@jmartinesp jmartinesp requested a review from a team as a code owner August 1, 2023 13:00
@jmartinesp jmartinesp requested review from ganfra and removed request for a team August 1, 2023 13:00
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/gnyDci

@jmartinesp
Copy link
Member Author

I'm not too happy with this solution, but I can't really think of anything better right now.

@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Patch coverage: 21.42% and project coverage change: -0.01% ⚠️

Comparison is base (62a3675) 56.91% compared to head (8df34f4) 56.91%.
Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1016      +/-   ##
===========================================
- Coverage    56.91%   56.91%   -0.01%     
===========================================
  Files          993      993              
  Lines        25265    25268       +3     
  Branches      5115     5114       -1     
===========================================
+ Hits         14380    14381       +1     
- Misses        8615     8617       +2     
  Partials      2270     2270              
Files Changed Coverage Δ
...ies/matrix/impl/notification/NotificationMapper.kt 0.00% <0.00%> (ø)
...atrix/impl/notification/RustNotificationService.kt 0.00% <0.00%> (ø)
...cation/TimelineEventToNotificationContentMapper.kt 0.00% <0.00%> (ø)
...droid/libraries/matrix/impl/room/RustMatrixRoom.kt 0.00% <0.00%> (ø)
...id/features/messages/impl/timeline/TimelineView.kt 45.00% <66.66%> (+0.34%) ⬆️
...atures/messages/impl/timeline/TimelinePresenter.kt 90.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmartinesp
Copy link
Member Author

The implementation at ad4bc79, while simpler, makes it impossible to unit test the presenter properly, so I'll have to revert it...

@jmartinesp
Copy link
Member Author

@ganfra In the end I've done a simpler implementation than the initial one, but keeping the same logic. Moving sending the read receipt for the initial items to the presenter made sense, but it made most of the logic associated with OnScrollFinished untestable.

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One remark, otherwise makes sense.
But I also encounter another issue, maybe it should handled by the sdk, but if the latest events are hidden (like reactions or edit events), the has unread won't be updated properly neither.

@@ -91,6 +91,16 @@ class TimelinePresenter @Inject constructor(
}

LaunchedEffect(timelineItems.size) {
// We just loaded the initial items, we should send a read receipt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the code?

@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@jmartinesp jmartinesp added this pull request to the merge queue Aug 2, 2023
Merged via the queue into develop with commit 58ed746 Aug 2, 2023
@jmartinesp jmartinesp deleted the fix/jme/send-read-receipts branch August 2, 2023 11:55
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