Added phrases to ttl viewer widget for video messages.

This commit is contained in:
23rd 2024-01-14 05:42:21 +03:00 committed by John Preston
parent c686ac8603
commit a2c0491ae0
2 changed files with 19 additions and 7 deletions

View File

@ -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";

View File

@ -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<Ui::ChatTheme> 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<Ui::ImportantTooltip>(
this,
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(