mirror of https://github.com/procxx/kepka.git
Version 1.7.10: Add share phone confirmation.
This commit is contained in:
parent
022fb0c81b
commit
764490b4a9
|
@ -1213,6 +1213,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_new_contact_block_done" = "{user} is now blocked.";
|
"lng_new_contact_block_done" = "{user} is now blocked.";
|
||||||
"lng_new_contact_add" = "Add contact";
|
"lng_new_contact_add" = "Add contact";
|
||||||
"lng_new_contact_share" = "Share my phone number";
|
"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_share_done" = "{user} can now see your phone number.";
|
||||||
"lng_new_contact_add_name" = "Add {user} to contacts";
|
"lng_new_contact_add_name" = "Add {user} to contacts";
|
||||||
"lng_new_contact_add_done" = "{user} is now in your contact list.";
|
"lng_new_contact_add_done" = "{user} is now in your contact list.";
|
||||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
|
#include "ui/text/text_utilities.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
|
@ -310,15 +311,34 @@ void ContactStatus::setupBlockHandler(not_null<UserData*> user) {
|
||||||
void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
||||||
_bar.entity()->shareClicks(
|
_bar.entity()->shareClicks(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
user->setSettings(0);
|
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||||
user->session().api().request(MTPcontacts_AcceptContact(
|
const auto share = [=] {
|
||||||
user->inputUser
|
user->setSettings(0);
|
||||||
)).done([=](const MTPUpdates &result) {
|
user->session().api().request(MTPcontacts_AcceptContact(
|
||||||
user->session().api().applyUpdates(result);
|
user->inputUser
|
||||||
|
)).done([=](const MTPUpdates &result) {
|
||||||
|
user->session().api().applyUpdates(result);
|
||||||
|
|
||||||
Ui::Toast::Show(
|
Ui::Toast::Show(tr::lng_new_contact_share_done(
|
||||||
tr::lng_new_contact_share_done(tr::now, lt_user, user->shortName()));
|
tr::now,
|
||||||
}).send();
|
lt_user,
|
||||||
|
user->shortName()));
|
||||||
|
}).send();
|
||||||
|
if (*box) {
|
||||||
|
(*box)->closeBox();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*box = _window->show(Box<ConfirmBox>(
|
||||||
|
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());
|
}, _bar.lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue