2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add an icon to who read context menu item.

This commit is contained in:
John Preston
2021-09-09 16:16:19 +03:00
parent b4bff83266
commit 79b0bbf6cf
9 changed files with 45 additions and 8 deletions

View File

@@ -324,6 +324,20 @@ rpl::producer<Ui::WhoReadContent> WhoRead(
auto lifetime = rpl::lifetime();
const auto state = lifetime.make_state<State>();
state->current.type = [&] {
if (const auto media = item->media()) {
if (!media->webpage()) {
if (const auto document = media->document()) {
if (document->isVoiceMessage()) {
return Ui::WhoReadType::Listened;
} else if (document->isVideoMessage()) {
return Ui::WhoReadType::Watched;
}
}
}
}
return Ui::WhoReadType::Seen;
}();
const auto pushNext = [=] {
consumer.put_next_copy(state->current);
};
@@ -334,7 +348,10 @@ rpl::producer<Ui::WhoReadContent> WhoRead(
) | rpl::start_with_next([=](const std::vector<PeerId> &peers) {
if (ListUnknown(peers, item)) {
state->userpics.clear();
consumer.put_next(Ui::WhoReadContent{ .unknown = true });
consumer.put_next(Ui::WhoReadContent{
.type = state->current.type,
.unknown = true,
});
return;
} else if (UpdateUserpics(state, item, peers)) {
RegenerateParticipants(state, small, large);