diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index ed044e8a4..e2cf6acb7 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1213,6 +1213,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_new_contact_block_done" = "{user} is now blocked."; "lng_new_contact_add" = "Add contact"; "lng_new_contact_share" = "Share my phone number"; +"lng_new_contact_share_sure" = "Are you sure you want to share your phone number {phone} with {user}?"; "lng_new_contact_share_done" = "{user} can now see your phone number."; "lng_new_contact_add_name" = "Add {user} to contacts"; "lng_new_contact_add_done" = "{user} is now in your contact list."; diff --git a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp index c3f537b15..ba3de328a 100644 --- a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp +++ b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/checkbox.h" #include "ui/widgets/labels.h" #include "ui/toast/toast.h" +#include "ui/text/text_utilities.h" #include "data/data_peer.h" #include "data/data_user.h" #include "data/data_chat.h" @@ -310,15 +311,34 @@ void ContactStatus::setupBlockHandler(not_null user) { void ContactStatus::setupShareHandler(not_null user) { _bar.entity()->shareClicks( ) | rpl::start_with_next([=] { - user->setSettings(0); - user->session().api().request(MTPcontacts_AcceptContact( - user->inputUser - )).done([=](const MTPUpdates &result) { - user->session().api().applyUpdates(result); + const auto box = std::make_shared>(); + const auto share = [=] { + user->setSettings(0); + user->session().api().request(MTPcontacts_AcceptContact( + user->inputUser + )).done([=](const MTPUpdates &result) { + user->session().api().applyUpdates(result); - Ui::Toast::Show( - tr::lng_new_contact_share_done(tr::now, lt_user, user->shortName())); - }).send(); + Ui::Toast::Show(tr::lng_new_contact_share_done( + tr::now, + lt_user, + user->shortName())); + }).send(); + if (*box) { + (*box)->closeBox(); + } + }; + *box = _window->show(Box( + tr::lng_new_contact_share_sure( + tr::now, + lt_phone, + Ui::Text::WithEntities( + App::formatPhone(user->session().user()->phone())), + lt_user, + Ui::Text::Bold(App::peerName(user)), + Ui::Text::WithEntities), + tr::lng_box_ok(tr::now), + share)); }, _bar.lifetime()); }