jimu-decompiled/sources/io/reactivex/internal/operators/mixed/ScalarXMapZHelper.java
2025-05-13 19:24:51 +02:00

94 lines
3.5 KiB
Java

package io.reactivex.internal.operators.mixed;
import android.Manifest;
import io.reactivex.CompletableObserver;
import io.reactivex.CompletableSource;
import io.reactivex.MaybeSource;
import io.reactivex.Observer;
import io.reactivex.SingleSource;
import io.reactivex.exceptions.Exceptions;
import io.reactivex.functions.Function;
import io.reactivex.internal.disposables.EmptyDisposable;
import io.reactivex.internal.functions.ObjectHelper;
import io.reactivex.internal.operators.maybe.MaybeToObservable;
import io.reactivex.internal.operators.single.SingleToObservable;
import java.util.concurrent.Callable;
/* loaded from: classes2.dex */
final class ScalarXMapZHelper {
static <T> boolean a(Object obj, Function<? super T, ? extends CompletableSource> function, CompletableObserver completableObserver) {
if (!(obj instanceof Callable)) {
return false;
}
CompletableSource completableSource = null;
try {
Manifest manifest = (Object) ((Callable) obj).call();
if (manifest != null) {
CompletableSource apply = function.apply(manifest);
ObjectHelper.a(apply, "The mapper returned a null CompletableSource");
completableSource = apply;
}
if (completableSource == null) {
EmptyDisposable.complete(completableObserver);
} else {
completableSource.a(completableObserver);
}
return true;
} catch (Throwable th) {
Exceptions.b(th);
EmptyDisposable.error(th, completableObserver);
return true;
}
}
static <T, R> boolean b(Object obj, Function<? super T, ? extends SingleSource<? extends R>> function, Observer<? super R> observer) {
if (!(obj instanceof Callable)) {
return false;
}
SingleSource<? extends R> singleSource = null;
try {
Manifest manifest = (Object) ((Callable) obj).call();
if (manifest != null) {
SingleSource<? extends R> apply = function.apply(manifest);
ObjectHelper.a(apply, "The mapper returned a null SingleSource");
singleSource = apply;
}
if (singleSource == null) {
EmptyDisposable.complete(observer);
} else {
singleSource.a(SingleToObservable.a(observer));
}
return true;
} catch (Throwable th) {
Exceptions.b(th);
EmptyDisposable.error(th, observer);
return true;
}
}
static <T, R> boolean a(Object obj, Function<? super T, ? extends MaybeSource<? extends R>> function, Observer<? super R> observer) {
if (!(obj instanceof Callable)) {
return false;
}
MaybeSource<? extends R> maybeSource = null;
try {
Manifest manifest = (Object) ((Callable) obj).call();
if (manifest != null) {
MaybeSource<? extends R> apply = function.apply(manifest);
ObjectHelper.a(apply, "The mapper returned a null MaybeSource");
maybeSource = apply;
}
if (maybeSource == null) {
EmptyDisposable.complete(observer);
} else {
maybeSource.a(MaybeToObservable.a(observer));
}
return true;
} catch (Throwable th) {
Exceptions.b(th);
EmptyDisposable.error(th, observer);
return true;
}
}
}