Skip to content

Setting to Mark as Read when Sending a Message #956

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andymandias
Copy link
Collaborator

Adds an option to mark a buffer as read when sending a message. Required a bit more plumbing than I was hoping for, but seems to work in my testing.

@casperstorm
Copy link
Member

Looks great, and make sense to have it on by default. Perhaps @tarkah can go through it as it touches a lot he is used to look at.

@andymandias andymandias marked this pull request as draft April 24, 2025 17:12
@andymandias andymandias marked this pull request as draft April 24, 2025 17:12
@andymandias
Copy link
Collaborator Author

Realized I missed one case where MARKREAD needs to be set. Will re-open after adding.

@andymandias andymandias marked this pull request as ready for review April 24, 2025 17:30
Comment on lines 487 to 494
record_message_tasks
.into_iter()
.map(Task::future),
.map(Task::future)
.chain(
update_read_marker_tasks
.into_iter()
.map(Task::future),
),
Copy link
Member

Choose a reason for hiding this comment

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

Why not chain these when returning from the original function if they don't need to be handled separately?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I originally tried to return a single Vec, but I couldn't get the compiler to accept the two Futures in the same Vec (and some of what I looked up trying to get it to work said it's impossible). I had assumed these iterators could be chained because they're mapped into Task::future, but Task isn't available in iced_core as far as I could tell. Wasn't sure we wanted to introduce iced as a dependency for data, so I went with this.

Copy link
Collaborator Author

@andymandias andymandias Apr 29, 2025

Choose a reason for hiding this comment

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

Don't know why I listened to those that said impossible, after thinking on a bit I realized there are a couple ways to do it at least. Went with boxing as that seemed like the simplest way.

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.

3 participants