Add 'Share my phone number' click handler.

This commit is contained in:
John Preston 2019-06-11 15:17:52 +02:00
parent 08d4715ad6
commit 3a34b15841
2 changed files with 14 additions and 1 deletions
Telegram/SourceFiles

View File

@ -296,6 +296,15 @@ void ContactStatus::setupBlockHandler(not_null<UserData*> peer) {
}
void ContactStatus::setupShareHandler(not_null<UserData*> peer) {
_bar.entity()->shareClicks(
) | rpl::start_with_next([=] {
peer->setSettings(0);
peer->session().api().request(MTPcontacts_AcceptContact(
peer->inputUser
)).done([=](const MTPUpdates &result) {
peer->session().api().applyUpdates(result);
}).send();
}, _bar.lifetime());
}
void ContactStatus::setupReportHandler(not_null<PeerData*> peer) {

View File

@ -4218,7 +4218,11 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
const auto &d = update.c_updatePeerSettings();
const auto peerId = peerFromMTP(d.vpeer);
if (const auto peer = session().data().peerLoaded(peerId)) {
//peer->updateSettings(d.vsettings);
const auto settings = d.vsettings.match([](
const MTPDpeerSettings &data) {
return data.vflags.v;
});
peer->setSettings(settings);
}
} break;