2021-06-27 20:44:35 +00:00
|
|
|
package androidx.lifecycle;
|
|
|
|
|
2021-12-21 23:37:30 +00:00
|
|
|
import b.i.a.f.e.o.f;
|
2021-11-08 18:25:28 +00:00
|
|
|
import d0.z.d.m;
|
2021-06-27 20:44:35 +00:00
|
|
|
import kotlin.coroutines.CoroutineContext;
|
2021-07-09 21:07:36 +00:00
|
|
|
import kotlinx.coroutines.CoroutineDispatcher;
|
2021-06-27 20:44:35 +00:00
|
|
|
import kotlinx.coroutines.CoroutineScope;
|
2021-11-08 18:25:28 +00:00
|
|
|
import s.a.a.n;
|
2021-12-17 22:03:14 +00:00
|
|
|
import s.a.h1;
|
|
|
|
import s.a.k0;
|
|
|
|
import s.a.u;
|
2021-06-27 20:44:35 +00:00
|
|
|
/* compiled from: ViewModel.kt */
|
2022-03-02 20:59:20 +00:00
|
|
|
/* loaded from: classes.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public final class ViewModelKt {
|
|
|
|
private static final String JOB_KEY = "androidx.lifecycle.ViewModelCoroutineScope.JOB_KEY";
|
|
|
|
|
|
|
|
public static final CoroutineScope getViewModelScope(ViewModel viewModel) {
|
|
|
|
m.checkNotNullParameter(viewModel, "$this$viewModelScope");
|
2021-08-09 22:50:01 +00:00
|
|
|
CoroutineScope coroutineScope = (CoroutineScope) viewModel.getTag(JOB_KEY);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (coroutineScope != null) {
|
|
|
|
return coroutineScope;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
u d = f.d(null, 1);
|
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2022-03-30 16:43:10 +00:00
|
|
|
Object tagIfAbsent = viewModel.setTagIfAbsent(JOB_KEY, new CloseableCoroutineScope(CoroutineContext.Element.a.plus((h1) d, n.f3812b.H())));
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNullExpressionValue(tagIfAbsent, "setTagIfAbsent(\n …Main.immediate)\n )");
|
|
|
|
return (CoroutineScope) tagIfAbsent;
|
|
|
|
}
|
|
|
|
}
|