得物.apk(点击下载) / MallHomeDataStore$fetchMallTabList$1.java
package com.shizhuang.duapp.modules.mall_home.viewmodel;
import a.f;
import cd.c;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.modules.du_mall_common.api.BaseFacadeKt;
import com.shizhuang.duapp.modules.du_mall_common.api.LoadResultKt;
import com.shizhuang.duapp.modules.mall_home.api.ProductFacadeV2;
import com.shizhuang.duapp.modules.mall_home.models.ABTestModel;
import com.shizhuang.duapp.modules.mall_home.models.MallTabListModel;
import com.shizhuang.duapp.modules.mall_home.models.MallTabModel;
import com.shizhuang.duapp.modules.pay.R$styleable;
import fo.a;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.CoroutineScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import zr0.b;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H@¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;", "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"}, k = 3, mv = {1, 4, 2})
@DebugMetadata(c = "com.shizhuang.duapp.modules.mall_home.viewmodel.MallHomeDataStore$fetchMallTabList$1", f = "MallHomeDataStore.kt", i = {}, l = {R$styleable.AppCompatTheme_selectableItemBackgroundBorderless, 100}, m = "invokeSuspend", n = {}, s = {})
/* compiled from: MallHomeDataStore.kt */
public final class MallHomeDataStore$fetchMallTabList$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
public static ChangeQuickRedirect changeQuickRedirect;
public int label;
public MallHomeDataStore$fetchMallTabList$1(Continuation continuation) {
super(2, continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
@NotNull
public final Continuation<Unit> create(@Nullable Object obj, @NotNull Continuation<?> continuation) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj, continuation}, this, changeQuickRedirect, false, 215990, new Class[]{Object.class, Continuation.class}, Continuation.class);
return proxy.isSupported ? (Continuation) proxy.result : new MallHomeDataStore$fetchMallTabList$1(continuation);
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{coroutineScope, continuation}, this, changeQuickRedirect, false, 215991, new Class[]{Object.class, Object.class}, Object.class);
return proxy.isSupported ? proxy.result : ((MallHomeDataStore$fetchMallTabList$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
/* JADX WARNING: Removed duplicated region for block: B:43:0x0146 */
/* JADX WARNING: Removed duplicated region for block: B:44:0x0148 */
/* JADX WARNING: Removed duplicated region for block: B:51:0x0160 */
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
@Nullable
public final Object invokeSuspend(@NotNull Object obj) {
List list;
Object obj2;
Object obj3;
boolean z = false;
PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj}, this, changeQuickRedirect, false, 215989, new Class[]{Object.class}, Object.class);
if (proxy.isSupported) {
return proxy.result;
}
Object coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
ProductFacadeV2 productFacadeV2 = ProductFacadeV2.f19440a;
PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], b.f40892a, b.changeQuickRedirect, false, 215660, new Class[0], ABTestModel[].class);
ABTestModel[] aBTestModelArr = proxy2.isSupported ? (ABTestModel[]) proxy2.result : new ABTestModel[]{new ABTestModel("categoryAB", "1")};
this.label = 1;
PatchProxyResult proxy3 = PatchProxy.proxy(new Object[]{aBTestModelArr, this}, productFacadeV2, ProductFacadeV2.changeQuickRedirect, false, 212566, new Class[]{ABTestModel[].class, Continuation.class}, Object.class);
if (proxy3.isSupported) {
obj3 = proxy3.result;
} else {
obj3 = BaseFacadeKt.getRequest$default(productFacadeV2, productFacadeV2.s().getMallTabList(c.b(TuplesKt.to("abTest", aBTestModelArr))), false, this, 2, null);
}
if (obj3 == coroutine_suspended) {
return coroutine_suspended;
}
} else if (i == 1) {
ResultKt.throwOnFailure(obj);
obj3 = obj;
} else if (i == 2) {
ResultKt.throwOnFailure(obj);
obj2 = obj;
list = (List) LoadResultKt.f((b50.b) obj2);
StringBuilder h12 = f.h("MallHomeDataStore fetchMallTabList...end from cdn, isSuccess: ");
h12.append(list == null);
a.m(h12.toString(), new Object[0]);
if (list == null || list.isEmpty()) {
z = true;
}
if (!z) {
HashSet hashSet = new HashSet();
ArrayList arrayList = new ArrayList();
for (Object obj4 : list) {
if (hashSet.add(((MallTabModel) obj4).getId())) {
arrayList.add(obj4);
}
}
MallTabListModel mallTabListModel = new MallTabListModel(arrayList);
MallHomeDataStore mallHomeDataStore = MallHomeDataStore.INSTANCE;
boolean z4 = !Intrinsics.areEqual((MallTabListModel) MallHomeDataStore._tabListState.getValue(), mallTabListModel);
MallHomeDataStore._tabListState.setValue(mallTabListModel);
if (z4) {
mallHomeDataStore.saveTabList(mallTabListModel);
}
}
return Unit.INSTANCE;
} else {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
list = (List) LoadResultKt.f((b50.b) obj3);
StringBuilder h13 = f.h("MallHomeDataStore fetchMallTabList....end from net, isSuccess: ");
h13.append(list != null);
a.m(h13.toString(), new Object[0]);
if (list == null) {
List<MallTabModel> list2 = MallHomeDataStore.INSTANCE.getTabListState().getValue().getList();
if (list2 == null || list2.isEmpty()) {
ProductFacadeV2 productFacadeV22 = ProductFacadeV2.f19440a;
this.label = 2;
PatchProxyResult proxy4 = PatchProxy.proxy(new Object[]{this}, productFacadeV22, ProductFacadeV2.changeQuickRedirect, false, 212567, new Class[]{Continuation.class}, Object.class);
if (proxy4.isSupported) {
obj2 = proxy4.result;
} else {
obj2 = BaseFacadeKt.getRequest$default(productFacadeV22, productFacadeV22.s().getMallTabListCdn("https://spucdn.dewu.com/dewu/commodity/homepage/home-tabs.json"), false, this, 2, null);
}
if (obj2 == coroutine_suspended) {
return coroutine_suspended;
}
list = (List) LoadResultKt.f((b50.b) obj2);
StringBuilder h122 = f.h("MallHomeDataStore fetchMallTabList...end from cdn, isSuccess: ");
h122.append(list == null);
a.m(h122.toString(), new Object[0]);
}
}
z = true;
if (!z) {
}
return Unit.INSTANCE;
}
}