2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

NB Broken! Moving from registerPeerObserver() to base::Subscriber.

This commit is contained in:
John Preston
2016-09-26 17:50:24 +03:00
parent 8546814a25
commit c91bdf3fef
5 changed files with 61 additions and 35 deletions

View File

@@ -48,6 +48,8 @@ void FinishCallback() {
}
ObservedEventRegistrator<PeerUpdate::Flags, PeerUpdateHandler> creator(StartCallback, FinishCallback);
base::Observable<PeerUpdate, PeerUpdatedHandler> PeerUpdatedObservable;
} // namespace
namespace internal {
@@ -116,10 +118,20 @@ void peerUpdatedSendDelayed() {
for_const (auto &update, allList) {
creator.notify(update.flags, update);
}
for (auto &update : smallList) {
PeerUpdated().notify(std_::move(update), true);
}
for (auto &update : allList) {
PeerUpdated().notify(std_::move(update), true);
}
if (SmallUpdates->isEmpty()) {
std::swap(smallList, *SmallUpdates);
SmallUpdates->resize(0);
}
}
base::Observable<PeerUpdate, PeerUpdatedHandler> &PeerUpdated() {
return PeerUpdatedObservable;
}
} // namespace Notify