-
Notifications
You must be signed in to change notification settings - Fork 489
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
Fix: Update the read marker position even if it is not displayed #7461
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## develop #7461 +/- ##
===========================================
- Coverage 12.30% 12.29% -0.01%
===========================================
Files 1645 1645
Lines 163052 163135 +83
Branches 66936 66982 +46
===========================================
+ Hits 20059 20064 +5
- Misses 142344 142421 +77
- Partials 649 650 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
@giomfo I've updated this PR to reflect your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM, let go for an actual Review by leaving the Draft status
@@ -7946,6 +7955,9 @@ -(void)reloadRoomWihtEventId:(NSString *)eventId | |||
|
|||
// Give the data source ownership to the room view controller. | |||
self.hasRoomDataSourceOwnership = YES; | |||
|
|||
// Force the read marker update if needed (this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment seems truncated
5c18086
to
dc18e22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me but of course statically checking it is prone to errors. I would be great if any of this would be testable..
contentBottomOffsetY = _bubblesTableView.contentSize.height; | ||
} | ||
// Be a bit less retrictive, consider visible an event at the bottom even if is partially hidden. | ||
contentBottomOffsetY += 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This 8
is a bit magical, maybe you should move it to a constant at the top of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I moved this value to a new constant: kCellVisibilityMinimumHeight
- (void)updateReadMarkerEvent | ||
{ | ||
// Compute the content offset corresponding to the line displayed at the table bottom (just above the toolbar). | ||
CGFloat contentBottomOffsetY = _bubblesTableView.contentOffset.y + (_bubblesTableView.frame.size.height - _bubblesTableView.adjustedContentInset.bottom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need any special handling for when the keyboard is displayed or better yet do we need to tweak the ContentInsetAdjustmentBehavior
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure. I used the same mechanism as the one used to find the event to acknowledge because the read marker was updated in the same process as the acknowledgement.
cell = visibleCells[index]; | ||
|
||
// Check whether the cell is actually visible | ||
if (cell && (cell.frame.origin.y < contentBottomOffsetY)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code would be a lot cleaner with early bail outs e.g.:
if (!cell || cell.frame.origin.y > contentBottomOffsetY) {
continue
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It's done.
while (componentIndex --) | ||
{ | ||
component = bubbleComponents[componentIndex]; | ||
if (![cell isKindOfClass:MXKRoomBubbleTableViewCell.class]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we combine this check with the previous isKindOfClass:MXKTableViewCell.class
and maybe use the casted version from then on? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, it should be much easier to understand now.
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR fixes #7420
The current implementation only updates the read marker if we are able to display the read marker view and we have identified some cases where the read marker is not updated because its view cannot be displayed:
Also, relatesTo events can be problematic as they can cause the user to jump backwards in the timeline, even if the current read marker timestamp is more recent than the related event.
To fix these issues:
Pull Request Checklist