From da012cbf8b14f16bc7dccef67d15681c2003d22d Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 15 May 2025 15:02:51 +0300 Subject: [PATCH] Added lottie emoji to box for validate phone number in settings. --- Telegram/Resources/langs/lang.strings | 2 +- .../Resources/qrc/telegram/animations.qrc | 1 + .../SourceFiles/settings/settings_main.cpp | 36 +++++++++++++++++-- Telegram/lib_lottie | 2 +- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 753e2e7171..ebc40fcd8e 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -839,7 +839,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_suggestion_phone_number_title" = "Is {phone} still your number?"; "lng_settings_suggestion_phone_number_about" = "Keep your number up to date to ensure you can always log into Telegram. {link}"; "lng_settings_suggestion_phone_number_about_link" = "https://telegram.org/faq#q-i-have-a-new-phone-number-what-do-i-do"; -"lng_settings_suggestion_phone_number_change" = "Please change your phone number in the official Telegram app on your phone as soon as possible."; +"lng_settings_suggestion_phone_number_change" = "Please change your phone number in the official Telegram app on your phone as soon as possible. {emoji}"; "lng_settings_power_menu" = "Battery and Animations"; "lng_settings_power_title" = "Power Usage"; diff --git a/Telegram/Resources/qrc/telegram/animations.qrc b/Telegram/Resources/qrc/telegram/animations.qrc index 5feeeacbc6..50cf186e02 100644 --- a/Telegram/Resources/qrc/telegram/animations.qrc +++ b/Telegram/Resources/qrc/telegram/animations.qrc @@ -1,6 +1,7 @@ ../../animations/blocked_peers_empty.tgs + ../../animations/change_number.tgs ../../animations/filters.tgs ../../animations/cloud_filters.tgs ../../animations/local_passcode_enter.tgs diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 30c76ec733..07ad5e1f99 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_cloud_manager.h" #include "lang/lang_instance.h" #include "lang/lang_keys.h" +#include "lottie/lottie_icon.h" #include "storage/localstorage.h" #include "main/main_session.h" #include "main/main_session_settings.h" @@ -474,9 +475,38 @@ void SetupValidatePhoneNumberSuggestion( st::inviteLinkButton); no->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); no->setClickedCallback([=] { - controller->uiShow()->show( - Ui::MakeInformBox( - tr::lng_settings_suggestion_phone_number_change())); + const auto sharedLabel = std::make_shared>(); + const auto height = st::boxLabel.style.font->height; + const auto customEmojiFactory = [=]( + QStringView data, + const Ui::Text::MarkedContext &context + ) -> std::unique_ptr { + auto repaint = [=] { + if (*sharedLabel) { + (*sharedLabel)->update(); + } + }; + return Lottie::MakeEmoji( + { .name = u"change_number"_q, .sizeOverride = Size(height) }, + std::move(repaint)); + }; + + controller->uiShow()->show(Box([=](not_null box) { + box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); }); + *sharedLabel = box->verticalLayout()->add( + object_ptr( + box->verticalLayout(), + tr::lng_settings_suggestion_phone_number_change( + lt_emoji, + rpl::single(Ui::Text::SingleCustomEmoji(u"@"_q)), + Ui::Text::WithEntities), + st::boxLabel, + st::defaultPopupMenu, + Ui::Text::MarkedContext{ + .customEmojiFactory = customEmojiFactory, + }), + st::boxPadding); + })); }); wrap->widthValue() | rpl::start_with_next([=](int width) { diff --git a/Telegram/lib_lottie b/Telegram/lib_lottie index be3b0f6051..4038a11f63 160000 --- a/Telegram/lib_lottie +++ b/Telegram/lib_lottie @@ -1 +1 @@ -Subproject commit be3b0f60512c44b487e8680c51c6c7481a670169 +Subproject commit 4038a11f635311073f6d55786490920b043cb319