mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
26 lines
1.7 KiB
Java
26 lines
1.7 KiB
Java
package androidx.lifecycle;
|
|
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlinx.coroutines.CoroutineScope;
|
|
import kotlinx.coroutines.Dispatchers;
|
|
import kotlinx.coroutines.Job;
|
|
import kotlinx.coroutines.SupervisorKt;
|
|
|
|
/* compiled from: ViewModel.kt */
|
|
@Metadata(d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u0015\u0010\u0002\u001a\u00020\u0003*\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u0007"}, d2 = {"JOB_KEY", "", "viewModelScope", "Lkotlinx/coroutines/CoroutineScope;", "Landroidx/lifecycle/ViewModel;", "getViewModelScope", "(Landroidx/lifecycle/ViewModel;)Lkotlinx/coroutines/CoroutineScope;", "lifecycle-viewmodel-ktx_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
|
|
/* loaded from: classes2.dex */
|
|
public final class ViewModelKt {
|
|
private static final String JOB_KEY = "androidx.lifecycle.ViewModelCoroutineScope.JOB_KEY";
|
|
|
|
public static final CoroutineScope getViewModelScope(ViewModel viewModel) {
|
|
Intrinsics.checkNotNullParameter(viewModel, "<this>");
|
|
CoroutineScope coroutineScope = (CoroutineScope) viewModel.getTag(JOB_KEY);
|
|
if (coroutineScope != null) {
|
|
return coroutineScope;
|
|
}
|
|
Object tagIfAbsent = viewModel.setTagIfAbsent(JOB_KEY, new CloseableCoroutineScope(SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null).plus(Dispatchers.getMain().getImmediate())));
|
|
Intrinsics.checkNotNullExpressionValue(tagIfAbsent, "setTagIfAbsent(\n …Main.immediate)\n )");
|
|
return (CoroutineScope) tagIfAbsent;
|
|
}
|
|
}
|