In 2.0 there are new reactive types (Flowable, Single, Maybe) which do not extend from a base type. Currently, this change only supports the Observable type. I'm open to supporting other types, if there is demand.
The other big change that affects RxGroups is the change to disposables. Observers can no longer be used multiple times if they are disposed. The locking/unlocking mechanism relies on subscribing/disposing observers. Thus, we need some sort of observer wrapper. The cleanest integration seems to be to send the emitter to the SubscriptionProxy and wrap it with a fresh DisposableObserver every time we subscribe. With the changes to disposables, it is now safe to call dispose on the observer used on the transformed observable directly, instead of going through SourceSubscription. Of course, this will still leave the SourceSubscription subscribed, until cancel is called.
The test changes may seem like a lot, but most of the changes are caused by:
The fact that ObservableGroup#add takes an emitter -- this means the easiest way to test was using the GroupSubscriptionTransformer
closes https://github.com/airbnb/RxGroups/issues/34
This is a stab at migrating to RxJava2:
Code changes: b8e5313 Test changes: ab21d32
Most of the code changes are simple mappings from: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0.
Two things to note:
SubscriptionProxy
and wrap it with a freshDisposableObserver
every time we subscribe. With the changes to disposables, it is now safe to calldispose
on the observer used on the transformed observable directly, instead of going throughSourceSubscription
. Of course, this will still leave theSourceSubscription
subscribed, untilcancel
is called.The test changes may seem like a lot, but most of the changes are caused by:
ObservableGroup#add
takes an emitter -- this means the easiest way to test was using theGroupSubscriptionTransformer