mirror of https://github.com/procxx/kepka.git
parent
b05ea9fc25
commit
e8a28a57df
|
@ -298,7 +298,9 @@ void AddContactBox::submit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContactBox::save() {
|
void AddContactBox::save() {
|
||||||
if (_addRequest) return;
|
if (_addRequest) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto firstName = TextUtilities::PrepareForSending(_first->getLastText());
|
auto firstName = TextUtilities::PrepareForSending(_first->getLastText());
|
||||||
auto lastName = TextUtilities::PrepareForSending(_last->getLastText());
|
auto lastName = TextUtilities::PrepareForSending(_last->getLastText());
|
||||||
|
@ -331,37 +333,35 @@ void AddContactBox::save() {
|
||||||
MTP_string(phone),
|
MTP_string(phone),
|
||||||
MTP_string(firstName),
|
MTP_string(firstName),
|
||||||
MTP_string(lastName)))
|
MTP_string(lastName)))
|
||||||
)).done(crl::guard(this, [=](const MTPcontacts_ImportedContacts &res) {
|
)).done(crl::guard(this, [=](
|
||||||
})).send();
|
const MTPcontacts_ImportedContacts &result) {
|
||||||
}
|
result.match([&](const MTPDcontacts_importedContacts &data) {
|
||||||
|
_session->data().processUsers(data.vusers());
|
||||||
|
|
||||||
void AddContactBox::importDone(const MTPcontacts_ImportedContacts &result) {
|
const auto extractUser = [&](const MTPImportedContact &data) {
|
||||||
if (!isBoxShown() || !App::main()) return;
|
return data.match([&](const MTPDimportedContact &data) {
|
||||||
|
return (data.vclient_id().v == _contactId)
|
||||||
const auto &d = result.c_contacts_importedContacts();
|
? _session->data().userLoaded(data.vuser_id().v)
|
||||||
_session->data().processUsers(d.vusers());
|
: nullptr;
|
||||||
|
});
|
||||||
const auto &v = d.vimported().v;
|
};
|
||||||
const auto user = [&]() -> UserData* {
|
const auto &list = data.vimported().v;
|
||||||
if (!v.isEmpty()) {
|
const auto user = list.isEmpty()
|
||||||
auto &c = v.front().c_importedContact();
|
? nullptr
|
||||||
if (c.vclient_id().v == _contactId) {
|
: extractUser(list.front());
|
||||||
return _session->data().userLoaded(c.vuser_id().v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}();
|
|
||||||
if (user) {
|
if (user) {
|
||||||
if (user->isContact() || user->session().supportMode()) {
|
if (user->isContact() || user->session().supportMode()) {
|
||||||
Ui::showPeerHistory(user, ShowAtTheEndMsgId);
|
Ui::showPeerHistory(user, ShowAtTheEndMsgId);
|
||||||
}
|
}
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
} else {
|
} else if (isBoxShown()) {
|
||||||
hideChildren();
|
hideChildren();
|
||||||
_retrying = true;
|
_retrying = true;
|
||||||
updateButtons();
|
updateButtons();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
})).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContactBox::retry() {
|
void AddContactBox::retry() {
|
||||||
|
|
|
@ -75,7 +75,6 @@ private:
|
||||||
void retry();
|
void retry();
|
||||||
void save();
|
void save();
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
void importDone(const MTPcontacts_ImportedContacts &result);
|
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue