82 lines
2.5 KiB
Java
82 lines
2.5 KiB
Java
package io.reactivex.internal.operators.observable;
|
|
|
|
import io.reactivex.Notification;
|
|
import io.reactivex.ObservableSource;
|
|
import io.reactivex.Observer;
|
|
import io.reactivex.disposables.Disposable;
|
|
import io.reactivex.internal.disposables.DisposableHelper;
|
|
import io.reactivex.plugins.RxJavaPlugins;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class ObservableDematerialize<T> extends AbstractObservableWithUpstream<Notification<T>, T> {
|
|
|
|
static final class DematerializeObserver<T> implements Observer<Notification<T>>, Disposable {
|
|
final Observer<? super T> a;
|
|
boolean b;
|
|
Disposable c;
|
|
|
|
DematerializeObserver(Observer<? super T> observer) {
|
|
this.a = observer;
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onNext(Notification<T> notification) {
|
|
if (this.b) {
|
|
if (notification.d()) {
|
|
RxJavaPlugins.b(notification.a());
|
|
}
|
|
} else if (notification.d()) {
|
|
this.c.dispose();
|
|
onError(notification.a());
|
|
} else if (!notification.c()) {
|
|
this.a.onNext(notification.b());
|
|
} else {
|
|
this.c.dispose();
|
|
onComplete();
|
|
}
|
|
}
|
|
|
|
@Override // io.reactivex.disposables.Disposable
|
|
public void dispose() {
|
|
this.c.dispose();
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onComplete() {
|
|
if (this.b) {
|
|
return;
|
|
}
|
|
this.b = true;
|
|
this.a.onComplete();
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onError(Throwable th) {
|
|
if (this.b) {
|
|
RxJavaPlugins.b(th);
|
|
} else {
|
|
this.b = true;
|
|
this.a.onError(th);
|
|
}
|
|
}
|
|
|
|
@Override // io.reactivex.Observer
|
|
public void onSubscribe(Disposable disposable) {
|
|
if (DisposableHelper.validate(this.c, disposable)) {
|
|
this.c = disposable;
|
|
this.a.onSubscribe(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
public ObservableDematerialize(ObservableSource<Notification<T>> observableSource) {
|
|
super(observableSource);
|
|
}
|
|
|
|
@Override // io.reactivex.Observable
|
|
public void subscribeActual(Observer<? super T> observer) {
|
|
this.a.subscribe(new DematerializeObserver(observer));
|
|
}
|
|
}
|