2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Move contacts list loading to ApiWrap.

This commit is contained in:
John Preston
2018-01-03 20:06:43 +03:00
parent 31234cb487
commit ac57000437
6 changed files with 76 additions and 73 deletions

View File

@@ -84,6 +84,7 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
_cancelSearchFromUser->hide();
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
subscribe(Auth().data().contactsLoaded(), [this](bool) { refresh(); });
Auth().data().itemRemoved(
) | rpl::start_with_next(
[this](auto item) { itemRemoved(item); },
@@ -1621,21 +1622,6 @@ void DialogsInner::peerSearchReceived(const QString &query, const QVector<MTPPee
refresh();
}
void DialogsInner::contactsReceived(const QVector<MTPContact> &result) {
for_const (auto contact, result) {
if (contact.type() != mtpc_contact) continue;
auto userId = contact.c_contact().vuser_id.v;
if (userId == Auth().userId() && App::self()) {
if (App::self()->contact < 1) {
App::self()->contact = 1;
Notify::userIsContactChanged(App::self());
}
}
}
refresh();
}
void DialogsInner::notify_userIsContactChanged(UserData *user, bool fromThisApp) {
if (user->loadedStatus != PeerData::FullLoaded) {
LOG(("API Error: notify_userIsContactChanged() called for a not loaded user!"));