From afdd22d15404bedc88ff88448d7e13afcef8e7dd Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 22 Feb 2024 15:17:59 +0300 Subject: [PATCH] Fixed phone formatting generally. --- .../SourceFiles/history/view/media/history_view_contact.cpp | 2 +- Telegram/SourceFiles/ui/text/format_values.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_contact.cpp b/Telegram/SourceFiles/history/view/media/history_view_contact.cpp index 908bf1c0c..a6cb9635c 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_contact.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_contact.cpp @@ -97,7 +97,7 @@ Contact::Contact( _phoneLine.setText( st::webPageDescriptionStyle, - Ui::FormatPhone(QString(phone).replace(QChar('+'), QString())), + Ui::FormatPhone(phone), Ui::WebpageTextTitleOptions()); #if 0 // No info. diff --git a/Telegram/SourceFiles/ui/text/format_values.cpp b/Telegram/SourceFiles/ui/text/format_values.cpp index c5dd7763b..e792e6560 100644 --- a/Telegram/SourceFiles/ui/text/format_values.cpp +++ b/Telegram/SourceFiles/ui/text/format_values.cpp @@ -388,7 +388,9 @@ QString FormatPhone(const QString &phone) { if (phone.at(0) == '0') { return phone; } - return Countries::Instance().format({ .phone = phone }).formatted; + return Countries::Instance().format({ + .phone = (phone.at(0) == '+') ? phone.mid(1) : phone, + }).formatted; } QString FormatTTL(float64 ttl) {