Added lottie emoji to box for validate phone number in settings.

This commit is contained in:
23rd 2025-05-15 15:02:51 +03:00
parent 3907a103fc
commit da012cbf8b
4 changed files with 36 additions and 5 deletions

View file

@ -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_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" = "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_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_menu" = "Battery and Animations";
"lng_settings_power_title" = "Power Usage"; "lng_settings_power_title" = "Power Usage";

View file

@ -1,6 +1,7 @@
<RCC> <RCC>
<qresource prefix="/animations"> <qresource prefix="/animations">
<file alias="blocked_peers_empty.tgs">../../animations/blocked_peers_empty.tgs</file> <file alias="blocked_peers_empty.tgs">../../animations/blocked_peers_empty.tgs</file>
<file alias="change_number.tgs">../../animations/change_number.tgs</file>
<file alias="filters.tgs">../../animations/filters.tgs</file> <file alias="filters.tgs">../../animations/filters.tgs</file>
<file alias="cloud_filters.tgs">../../animations/cloud_filters.tgs</file> <file alias="cloud_filters.tgs">../../animations/cloud_filters.tgs</file>
<file alias="local_passcode_enter.tgs">../../animations/local_passcode_enter.tgs</file> <file alias="local_passcode_enter.tgs">../../animations/local_passcode_enter.tgs</file>

View file

@ -53,6 +53,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "lang/lang_cloud_manager.h" #include "lang/lang_cloud_manager.h"
#include "lang/lang_instance.h" #include "lang/lang_instance.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "lottie/lottie_icon.h"
#include "storage/localstorage.h" #include "storage/localstorage.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "main/main_session_settings.h" #include "main/main_session_settings.h"
@ -474,9 +475,38 @@ void SetupValidatePhoneNumberSuggestion(
st::inviteLinkButton); st::inviteLinkButton);
no->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); no->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
no->setClickedCallback([=] { no->setClickedCallback([=] {
controller->uiShow()->show( const auto sharedLabel = std::make_shared<QPointer<Ui::FlatLabel>>();
Ui::MakeInformBox( const auto height = st::boxLabel.style.font->height;
tr::lng_settings_suggestion_phone_number_change())); const auto customEmojiFactory = [=](
QStringView data,
const Ui::Text::MarkedContext &context
) -> std::unique_ptr<Ui::Text::CustomEmoji> {
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<Ui::GenericBox*> box) {
box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
*sharedLabel = box->verticalLayout()->add(
object_ptr<Ui::FlatLabel>(
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) { wrap->widthValue() | rpl::start_with_next([=](int width) {

@ -1 +1 @@
Subproject commit be3b0f60512c44b487e8680c51c6c7481a670169 Subproject commit 4038a11f635311073f6d55786490920b043cb319