use of io.reactivex.subjects.Subject in project mosby by sockeqwe.
the class MviBasePresenter method bindIntentActually.
@MainThread
private <I> Observable<I> bindIntentActually(@NonNull V view, @NonNull IntentRelayBinderPair<?> relayBinderPair) {
if (view == null) {
throw new NullPointerException("View is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
}
if (relayBinderPair == null) {
throw new NullPointerException("IntentRelayBinderPair is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
}
Subject<I> intentRelay = (Subject<I>) relayBinderPair.intentRelaySubject;
if (intentRelay == null) {
throw new NullPointerException("IntentRelay from binderPair is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
}
ViewIntentBinder<V, I> intentBinder = (ViewIntentBinder<V, I>) relayBinderPair.intentBinder;
if (intentBinder == null) {
throw new NullPointerException(ViewIntentBinder.class.getSimpleName() + " is null. This is a Mosby internal bug. Please file an issue at https://github.com/sockeqwe/mosby/issues");
}
Observable<I> intent = intentBinder.bind(view);
if (intent == null) {
throw new NullPointerException("Intent Observable returned from Binder " + intentBinder + " is null");
}
if (intentDisposables == null) {
intentDisposables = new CompositeDisposable();
}
intentDisposables.add(intent.subscribeWith(new DisposableIntentObserver<I>(intentRelay)));
return intentRelay;
}
Aggregations