得物.apk(点击下载) / AsyncUploadUtils$uploadImages$1.java


package com.shizhuang.duapp.common.utils;

import a.f;
import androidx.activity.ComponentActivity;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.common.utils.AsyncUploadUtils;
import com.shizhuang.duapp.libs.upload.UploadParams;
import com.shizhuang.duapp.modules.pay.R$styleable;
import com.shizhuang.model.AliToken;
import df.d;
import df.x0;
import ik1.k;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.Boxing;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Ref;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Deferred;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import wq.a;

@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.common.utils.AsyncUploadUtils$uploadImages$1", f = "AsyncUploadUtils.kt", i = {0, 1, 1, 1}, l = {51, R$styleable.AppCompatTheme_panelBackground}, m = "invokeSuspend", n = {"$this$launch", "results", "index$iv", "index"}, s = {"L$0", "L$0", "I$0", "I$1"})
/* compiled from: AsyncUploadUtils.kt */
public final class AsyncUploadUtils$uploadImages$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final /* synthetic */ ComponentActivity $context;
    public final /* synthetic */ List $filePaths;
    public final /* synthetic */ AsyncUploadUtils.IUploadImageListener $listener;
    public final /* synthetic */ AsyncUploadUtils.a $params;
    public int I$0;
    public int I$1;
    private /* synthetic */ Object L$0;
    public Object L$1;
    public int label;

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public AsyncUploadUtils$uploadImages$1(ComponentActivity componentActivity, List list, AsyncUploadUtils.a aVar, AsyncUploadUtils.IUploadImageListener iUploadImageListener, Continuation continuation) {
        super(2, continuation);
        this.$context = componentActivity;
        this.$filePaths = list;
        this.$params = aVar;
        this.$listener = iUploadImageListener;
    }

    @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, 8495, new Class[]{Object.class, Continuation.class}, Continuation.class);
        if (proxy.isSupported) {
            return (Continuation) proxy.result;
        }
        AsyncUploadUtils$uploadImages$1 asyncUploadUtils$uploadImages$1 = new AsyncUploadUtils$uploadImages$1(this.$context, this.$filePaths, this.$params, this.$listener, continuation);
        asyncUploadUtils$uploadImages$1.L$0 = obj;
        return asyncUploadUtils$uploadImages$1;
    }

    /* 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, 8496, new Class[]{Object.class, Object.class}, Object.class);
        return proxy.isSupported ? proxy.result : ((AsyncUploadUtils$uploadImages$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
    }

    /* JADX WARNING: Removed duplicated region for block: B:54:0x018c  */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    @Nullable
    public final Object invokeSuspend(@NotNull Object obj) {
        int i;
        ArrayList arrayList;
        Iterator it2;
        AsyncUploadUtils$uploadImages$1 asyncUploadUtils$uploadImages$1;
        CoroutineScope coroutineScope;
        Object obj2;
        AliToken aliToken;
        ArrayList arrayList2;
        Exception e;
        int i3 = 0;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj}, this, changeQuickRedirect, false, 8494, new Class[]{Object.class}, Object.class);
        if (proxy.isSupported) {
            return proxy.result;
        }
        Object coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
        int i12 = this.label;
        int i13 = 2;
        if (i12 == 0) {
            ResultKt.throwOnFailure(obj);
            CoroutineScope coroutineScope2 = (CoroutineScope) this.L$0;
            ComponentActivity componentActivity = this.$context;
            this.L$0 = coroutineScope2;
            this.label = 1;
            k kVar = new k(IntrinsicsKt__IntrinsicsJvmKt.intercepted(this), 1);
            kVar.v();
            x0.e.getAliToken(2, 1, new d(kVar, componentActivity, componentActivity));
            obj2 = kVar.n();
            if (obj2 == IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED()) {
                DebugProbesKt.probeCoroutineSuspended(this);
            }
            if (obj2 == coroutine_suspended) {
                return coroutine_suspended;
            }
            coroutineScope = coroutineScope2;
        } else if (i12 == 1) {
            ResultKt.throwOnFailure(obj);
            coroutineScope = (CoroutineScope) this.L$0;
            obj2 = obj;
        } else if (i12 == 2) {
            int i14 = this.I$1;
            int i15 = this.I$0;
            it2 = (Iterator) this.L$1;
            arrayList = (ArrayList) this.L$0;
            ResultKt.throwOnFailure(obj);
            i = 2;
            int i16 = i14;
            i3 = i15;
            asyncUploadUtils$uploadImages$1 = this;
            Object obj3 = obj;
            String str = (String) obj3;
            asyncUploadUtils$uploadImages$1.$listener.onSuccessByPosition(i16, str);
            arrayList.add(str);
            if (it2.hasNext()) {
                Object next = it2.next();
                int i17 = i3 + 1;
                if (i3 < 0) {
                    CollectionsKt__CollectionsKt.throwIndexOverflow();
                }
                i16 = Boxing.boxInt(i3).intValue();
                asyncUploadUtils$uploadImages$1.L$0 = arrayList;
                asyncUploadUtils$uploadImages$1.L$1 = it2;
                asyncUploadUtils$uploadImages$1.I$0 = i17;
                asyncUploadUtils$uploadImages$1.I$1 = i16;
                asyncUploadUtils$uploadImages$1.label = i;
                obj3 = ((Deferred) next).await(asyncUploadUtils$uploadImages$1);
                if (obj3 == coroutine_suspended) {
                    return coroutine_suspended;
                }
                i3 = i17;
                String str2 = (String) obj3;
                asyncUploadUtils$uploadImages$1.$listener.onSuccessByPosition(i16, str2);
                arrayList.add(str2);
                if (it2.hasNext()) {
                    asyncUploadUtils$uploadImages$1.$listener.onSuccess(arrayList);
                }
                return coroutine_suspended;
            }
            asyncUploadUtils$uploadImages$1.$listener.onSuccess(arrayList);
            return Unit.INSTANCE;
        } else {
            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
        AliToken aliToken2 = (AliToken) obj2;
        ArrayList arrayList3 = new ArrayList();
        ArrayList arrayList4 = new ArrayList();
        if (aliToken2 != null) {
            Ref.IntRef intRef = new Ref.IntRef();
            intRef.element = 0;
            for (String str3 : this.$filePaths) {
                UploadParams.a aVar = new UploadParams.a(aliToken2.AccessKeyId, aliToken2.AccessKeySecret, aliToken2.SecurityToken);
                UploadParams uploadParams = new UploadParams();
                uploadParams.setEndpoint("http://oss-cn-shanghai.aliyuncs.com");
                uploadParams.setBucket("dewu-image");
                uploadParams.setBufferPath(a.e + "/community/");
                String str4 = aliToken2.cdnHost;
                if (!(str4 == null || str4.length() == 0)) {
                    String str5 = aliToken2.cdnHost;
                    String str6 = File.separator;
                    uploadParams.setCdnUrl(StringsKt__StringsJVMKt.endsWith$default(str5, str6, false, i13, null) ? aliToken2.cdnHost : f.g(new StringBuilder(), aliToken2.cdnHost, str6));
                }
                try {
                    aliToken = aliToken2;
                    try {
                        arrayList2 = arrayList3;
                        try {
                            arrayList2.add(ik1.f.b(coroutineScope, null, null, new AsyncUploadUtils$uploadImages$1$invokeSuspend$$inlined$let$lambda$2(ik1.f.b(coroutineScope, null, null, new AsyncUploadUtils$uploadImages$1$invokeSuspend$$inlined$let$lambda$1(str3, null, intRef, this, coroutineScope, aliToken2, arrayList3, arrayList4), 3, null), aVar, uploadParams, null, intRef, this, coroutineScope, aliToken2, arrayList3, arrayList4), 3, null));
                        } catch (Exception e6) {
                            e = e6;
                        }
                    } catch (Exception e12) {
                        e = e12;
                        arrayList2 = arrayList3;
                        this.$listener.onError(e.getMessage());
                        i13 = 2;
                        arrayList3 = arrayList2;
                        aliToken2 = aliToken;
                        intRef = intRef;
                    }
                } catch (Exception e13) {
                    e = e13;
                    arrayList2 = arrayList3;
                    aliToken = aliToken2;
                    this.$listener.onError(e.getMessage());
                    i13 = 2;
                    arrayList3 = arrayList2;
                    aliToken2 = aliToken;
                    intRef = intRef;
                }
                i13 = 2;
                arrayList3 = arrayList2;
                aliToken2 = aliToken;
                intRef = intRef;
            }
            it2 = arrayList3.iterator();
            asyncUploadUtils$uploadImages$1 = this;
            arrayList = arrayList4;
            i = 2;
            if (it2.hasNext()) {
            }
            asyncUploadUtils$uploadImages$1.$listener.onSuccess(arrayList);
        }
        return Unit.INSTANCE;
    }
}