mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Improve compile time.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user