From a2c0491ae033483e99531ffda99915c44fad7a32 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 14 Jan 2024 05:42:21 +0300 Subject: [PATCH] Added phrases to ttl viewer widget for video messages. --- Telegram/Resources/langs/lang.strings | 2 ++ .../chat_helpers/ttl_media_layer_widget.cpp | 24 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index cec8bf36e2..8c1560cd16 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1722,6 +1722,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_ttl_voice_tooltip_in" = "This voice message can only be played once."; "lng_ttl_voice_tooltip_out" = "This message will disappear once **{user}** plays it once."; "lng_ttl_voice_close_in" = "Delete and close"; +"lng_ttl_round_tooltip_in" = "This video message can only be played once."; +"lng_ttl_round_tooltip_out" = "This message will disappear once **{user}** plays it once."; "lng_profile_add_more_after_create" = "You will be able to add more members after you create the group."; "lng_profile_camera_title" = "Capture yourself"; diff --git a/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp b/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp index e6a71d5097..120f89f9e1 100644 --- a/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "chat_helpers/ttl_media_layer_widget.h" #include "base/event_filter.h" +#include "data/data_document.h" #include "data/data_session.h" #include "editor/editor_layer_widget.h" #include "history/history.h" @@ -123,6 +124,11 @@ PreviewWrap::PreviewWrap( _style.get(), [=] { update(elementRect()); })) { + const auto isRound = _item + && _item->media() + && _item->media()->document() + && _item->media()->document()->isVideoMessage(); + std::move( theme ) | rpl::start_with_next([=](std::shared_ptr theme) { @@ -174,13 +180,17 @@ PreviewWrap::PreviewWrap( { auto text = item->out() - ? tr::lng_ttl_voice_tooltip_out( - lt_user, - rpl::single( - item->history()->peer->name() - ) | rpl::map(Ui::Text::RichLangValue), - Ui::Text::RichLangValue) - : tr::lng_ttl_voice_tooltip_in(Ui::Text::RichLangValue); + ? (isRound + ? tr::lng_ttl_round_tooltip_out + : tr::lng_ttl_voice_tooltip_out)( + lt_user, + rpl::single( + item->history()->peer->shortName() + ) | rpl::map(Ui::Text::RichLangValue), + Ui::Text::RichLangValue) + : (isRound + ? tr::lng_ttl_round_tooltip_in + : tr::lng_ttl_voice_tooltip_in)(Ui::Text::RichLangValue); const auto tooltip = Ui::CreateChild( this, object_ptr>(