These are chat archives for ReactiveX/RxJava

May 2018
Volkan Yazıcı
May 31 2018 10:54
@peterholak Maybe you can create a separate .filter()ed Observable that is later on .replay()ed.
Peter Holák
May 31 2018 12:01
That doesn't achieve what I need, if I understand it correctly
Peter Holák
May 31 2018 12:08
The reason I want this is, I have a stream of events such as LoadingStarted, DataReady, FailedToLoad, and a few others. I have a shared Flowable of these events, used by different parts of the UI. It already emits the latest "cached" data to every new subscriber, but I also want it to replay the latest event - but only if that event is LoadingStarted for example. After these initial emissions (to a new subscriber), it should simply keep multi-casting the unaltered source to all downstream subscribers as usual. So I would need something like .replayLatestIf { item == LoadingStarted }.
Ignacio Baca Moreno-Torres
May 31 2018 21:16
I think the easiest way is to create two subjects, one Behaviour and the other Publish, and merge it to subscribe to them, and push the LoadingStarted using the Behaviour and the other non-cacheable events to the Publish...
(if you can avoid the subject just do the same with two observables, one cached and the other shared, but looks like you are using subjects already)