2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Update API scheme on layer 145.

This commit is contained in:
John Preston
2022-08-29 10:10:15 +04:00
parent da6d580348
commit d9a6d5f508
6 changed files with 68 additions and 34 deletions

View File

@@ -780,30 +780,36 @@ Manager::DisplayOptions Manager::getNotificationOptions(
return result;
}
TextWithEntities Manager::ComposeReactionEmoji(
not_null<Main::Session*> session,
const Data::ReactionId &reaction) {
if (const auto emoji = std::get_if<QString>(&reaction.data)) {
return TextWithEntities{ *emoji };
}
const auto id = v::get<DocumentId>(reaction.data);
auto entities = EntitiesInText();
const auto document = session->data().document(id);
const auto sticker = document->sticker();
const auto text = sticker ? sticker->alt : PlaceholderReactionText();
return TextWithEntities{
text,
{
EntityInText(
EntityType::CustomEmoji,
0,
text.size(),
Data::SerializeCustomEmojiId(Data::CustomEmojiId{ id }))
}
};
}
TextWithEntities Manager::ComposeReactionNotification(
not_null<HistoryItem*> item,
const Data::ReactionId &reaction,
bool hideContent) {
const auto reactionWithEntities = [&] {
if (const auto emoji = std::get_if<QString>(&reaction.data)) {
return TextWithEntities{ *emoji };
}
const auto id = v::get<DocumentId>(reaction.data);
auto entities = EntitiesInText();
const auto document = item->history()->owner().document(id);
const auto sticker = document->sticker();
const auto text = sticker ? sticker->alt : PlaceholderReactionText();
return TextWithEntities{
text,
{
EntityInText(
EntityType::CustomEmoji,
0,
text.size(),
Data::SerializeCustomEmojiId(Data::CustomEmojiId{ id }))
}
};
}();
const auto reactionWithEntities = ComposeReactionEmoji(
&item->history()->session(),
reaction);
const auto simple = [&](const auto &phrase) {
return phrase(
tr::now,