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

chat-history: Mark visible messages as viewed #286

Closed
wants to merge 3 commits into from
Closed

chat-history: Mark visible messages as viewed #286

wants to merge 3 commits into from

Conversation

marhkb
Copy link
Collaborator

@marhkb marhkb commented May 13, 2022

No description provided.

@marhkb marhkb marked this pull request as ready for review May 14, 2022 22:36
@melix99 melix99 linked an issue May 15, 2022 that may be closed by this pull request
@marhkb marhkb requested a review from melix99 May 15, 2022 20:50
@marhkb marhkb marked this pull request as draft May 18, 2022 23:59
@marhkb marhkb marked this pull request as ready for review May 19, 2022 14:24
@marhkb
Copy link
Collaborator Author

marhkb commented May 19, 2022

That should be ready now that I've set up a VPN to retrieve sponsored messages.

@marhkb marhkb marked this pull request as draft May 20, 2022 15:47
This includes both the bottommost regular message and sponsored
messages.

A regular message is considered as being viewed if parts of it are
either visible inside the specified list view or if the user needs to
scroll up in order to see it.

Inside a list view `L` a sponsored message `S` is considered as being
viewed if `L ∩ S = S` applies.
@marhkb
Copy link
Collaborator Author

marhkb commented May 21, 2022

I have revised the PR again.

Originally a timer was used which should wait for the animation of the scrolled window to finish and then check the visible messages.

I discarded the timer and now use the delta of the current vadjustment value and the previous one. This makes the code easier and now no cheating should be possible to read messages in ghost mode by quickly scrolling back and forth.

Furthermore, the efficiency has been increased by means of additional checks. It should be close to the optimum now.

Speaking of cheating: I noticed that you can read messages on the official client in ghost mode. All it takes is for the window to have no focus. Now, if you scroll with the mouse, you can read all messages. In Telegrand this does not work, unless someone wants us to include it on purpose. But I'd suggest that we to just stop auto scrolling in #304 when the window has no focus.

@marhkb marhkb marked this pull request as ready for review May 21, 2022 19:44
melix99 added a commit that referenced this pull request Feb 23, 2023
melix99 added a commit that referenced this pull request Feb 23, 2023
@melix99
Copy link
Collaborator

melix99 commented Mar 22, 2023

Closing this, I don't like the implementation because it's super hacky, but I also discovered that it's not the only problem of this PR: the view_messages API is meant to continuously keep track of the visible messages, so we ultimately need a totally different way to achieve this. There's a new attempt in #485 which does that and it's slightly less hacky. Fortunately it seems that a proper API in GTK is in the works, so we might also just wait for that instead.

@melix99 melix99 closed this Mar 22, 2023
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.

Tell TDLib when unread messages are being read by the user
2 participants