nheko icon indicating copy to clipboard operation
nheko copied to clipboard

Line to indicate first unread message

Open Hiers opened this issue 3 years ago • 1 comments

Closes #560.

This PR makes it so that if a room has unread messages, a line will appear to show the user the last read message/first unread message since the room was last opened. A feature that I felt was so sorely needed that I had to de-rust my Qt knowledge to implement it.

As it stands in its current state, this PR has a few problems. In no particular order:

  • If the last read event was one of a handful, the line will not show up. These events are any that aren't conventionally showed as a message (most notably redactions and reactions)
  • If the last "read" event was hidden through nheko's "Hidden events" room option, the line will also be hidden
  • To get the ID of the last read message, it currently runs getLastFullyReadEventId twice, once directly and once indirectly
  • If the line is being shown and the user sends a message, the line doesn't disappear

Handling the line disappearing on some events has been the one that's been nagging me the most so far, I still haven't found a good way of solving it.

Hiers avatar Aug 07 '22 15:08 Hiers

For the invisible events stuff, check out the "cache::lastInvisibleEventAfter" function as well as the getEventIndex function. They are used in the setCurrentIndex function to calculate where to send the next read receipt. I think you can use something similar to calculate the line position, just the other way around.

deepbluev7 avatar Aug 10 '22 22:08 deepbluev7

With that one out of the way, the other problems mentioned shouldn't be too hard or blockers. I still want to improve on the possible performance problems we talked about.

Hiers avatar Aug 12 '22 19:08 Hiers

I'll review it in ~10h, I hope. Was a bit too busy today, sorry!

deepbluev7 avatar Aug 29 '22 22:08 deepbluev7

So this seems to work nicely, but it is a bit confusing, that the line doesn't vanish after some time. How about running a timer if the line is visible and then moving it down to the last visible event or so?

deepbluev7 avatar Sep 10 '22 22:09 deepbluev7

Also do you have any other concerns or are you happy with it as is?

deepbluev7 avatar Sep 10 '22 22:09 deepbluev7

Happy with it as it is.

Hiers avatar Sep 11 '22 22:09 Hiers

Thanks, I will merge it as is then and if people complain, we will see :3

deepbluev7 avatar Sep 11 '22 23:09 deepbluev7

Nheko 0.10.2 is now in Debian testing, but I do not see any line next to the first unread message in Nheko on my Pinephone... shall I activate it somehow? How is this line supposed to look?

tiol11 avatar Oct 06 '22 20:10 tiol11

It is not in a released version yet, 0.10.2 was just a bugfix release.

deepbluev7 avatar Oct 07 '22 20:10 deepbluev7

Oh, I had seen this was pulled into master and then I assumed 0.10.2 was tagged out of master... Sorry for that!

tiol11 avatar Oct 09 '22 16:10 tiol11

I can confirm this feature works very well on pinephone (I compiled the .deb)

sc0w avatar Oct 10 '22 08:10 sc0w

Great! Does this feature make #1146 sort of unneeded ?

tiol11 avatar Oct 10 '22 18:10 tiol11

@tiol11

this PR just adds the line, but it doesn't jump to it

I think #1146 is a different feature request

sc0w avatar Oct 10 '22 20:10 sc0w

Understood, I was just curious if the user experience has really improved after this PR, as you've built the package yourself. I mean, you have to scroll manually instead of pushing a button, but at least you know where to stop scrolling and start reading without reading every message you're scrolling... :)

tiol11 avatar Oct 11 '22 13:10 tiol11