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

Improve compile time.

This commit is contained in:
John Preston
2017-11-21 13:20:56 +04:00
parent 6ca105a290
commit d93c1ccbaa
69 changed files with 692 additions and 5022 deletions

View File

@@ -108,4 +108,35 @@ base::Observable<PeerUpdate, PeerUpdatedHandler> &PeerUpdated() {
return PeerUpdatedObservable;
}
rpl::producer<PeerUpdate> PeerUpdateViewer(
PeerUpdate::Flags flags) {
return [=](const auto &consumer) {
auto lifetime = rpl::lifetime();
lifetime.make_state<base::Subscription>(
PeerUpdated().add_subscription({ flags, [=](
const PeerUpdate &update) {
consumer.put_next_copy(update);
}}));
return lifetime;
};
}
rpl::producer<PeerUpdate> PeerUpdateViewer(
not_null<PeerData*> peer,
PeerUpdate::Flags flags) {
return PeerUpdateViewer(flags)
| rpl::filter([=](const PeerUpdate &update) {
return (update.peer == peer);
});
}
rpl::producer<PeerUpdate> PeerUpdateValue(
not_null<PeerData*> peer,
PeerUpdate::Flags flags) {
auto initial = PeerUpdate(peer);
initial.flags = flags;
return rpl::single(initial)
| rpl::then(PeerUpdateViewer(peer, flags));
}
} // namespace Notify