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

Added icon for forwarded messages in dialogs list.

This commit is contained in:
23rd
2023-08-28 20:52:08 +03:00
parent 4b503ad7ed
commit 089432be5e
9 changed files with 39 additions and 6 deletions

View File

@@ -66,7 +66,15 @@ constexpr auto kSystemAlertDuration = crl::time(0);
return result;
}
QString TextWithPermanentSpoiler(const TextWithEntities &textWithEntities) {
[[nodiscard]] QString TextWithForwardedChar(
const QString &text,
bool forwarded) {
static const auto result = QString::fromUtf8("\xE2\x9E\xA1\xEF\xB8\x8F");
return forwarded ? result + text : text;
}
[[nodiscard]] QString TextWithPermanentSpoiler(
const TextWithEntities &textWithEntities) {
auto text = textWithEntities.text;
for (const auto &e : textWithEntities.entities) {
if (e.type() == EntityType::Spoiler) {
@@ -1175,9 +1183,11 @@ void NativeManager::doShowNotification(NotificationFields &&fields) {
? tr::lng_forward_messages(tr::now, lt_count, fields.forwardedCount)
: item->groupId()
? tr::lng_in_dlg_album(tr::now)
: TextWithPermanentSpoiler(item->notificationText({
.spoilerLoginCode = options.spoilerLoginCode,
}));
: TextWithForwardedChar(
TextWithPermanentSpoiler(item->notificationText({
.spoilerLoginCode = options.spoilerLoginCode,
})),
(fields.forwardedCount == 1));
// #TODO optimize
auto userpicView = item->history()->peer->createUserpicView();