得物.apk(点击下载) / LiveNoticeHelper$checkLiveNotice$1.java


package com.shizhuang.duapp.modules.live.audience.notice.helper;

import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.sensorsdata.analytics.android.sdk.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.shizhuang.duapp.modules.live.audience.notice.model.LiveNoticeModel;
import com.shizhuang.duapp.modules.live.common.constant.LivePageConstant;
import com.shizhuang.duapp.modules.live.common.utils.LiveConfigHelper;
import com.shizhuang.duapp.modules.pay.R$styleable;
import com.shizhuang.duapp.modules.router.ServiceManager;
import com.shizhuang.duapp.modules.router.service.ILiveService;
import df.b0;
import ik1.f;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.ResultKt;
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.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlinx.coroutines.CoroutineScope;
import lm0.c;
import lm0.d;
import nq.b;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONArray;
import org.json.JSONObject;
import u91.e;
import yp0.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.modules.live.audience.notice.helper.LiveNoticeHelper$checkLiveNotice$1", f = "LiveNoticeHelper.kt", i = {}, l = {R$styleable.AppCompatTheme_panelMenuListWidth}, m = "invokeSuspend", n = {}, s = {})
/* compiled from: LiveNoticeHelper.kt */
public final class LiveNoticeHelper$checkLiveNotice$1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final /* synthetic */ Fragment $fragment;
    public int label;

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public LiveNoticeHelper$checkLiveNotice$1(Fragment fragment, Continuation continuation) {
        super(2, continuation);
        this.$fragment = fragment;
    }

    @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, 190209, new Class[]{Object.class, Continuation.class}, Continuation.class);
        return proxy.isSupported ? (Continuation) proxy.result : new LiveNoticeHelper$checkLiveNotice$1(this.$fragment, 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, 190210, new Class[]{Object.class, Object.class}, Object.class);
        return proxy.isSupported ? proxy.result : ((LiveNoticeHelper$checkLiveNotice$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    @Nullable
    public final Object invokeSuspend(@NotNull Object obj) {
        boolean z;
        int i;
        int i3;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj}, this, changeQuickRedirect, false, 190208, new Class[]{Object.class}, Object.class);
        if (proxy.isSupported) {
            return proxy.result;
        }
        Object coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
        int i12 = this.label;
        if (i12 == 0) {
            ResultKt.throwOnFailure(obj);
            this.label = 1;
            if (f.e(4300, this) == coroutine_suspended) {
                return coroutine_suspended;
            }
        } else if (i12 == 1) {
            ResultKt.throwOnFailure(obj);
        } else {
            throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
        if (!b.e(this.$fragment) || !this.$fragment.isVisible() || !this.$fragment.isResumed()) {
            return Unit.INSTANCE;
        }
        c.a aVar = c.b;
        PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], aVar, c.a.changeQuickRedirect, false, 190187, new Class[0], Boolean.TYPE);
        if (proxy2.isSupported) {
            z = ((Boolean) proxy2.result).booleanValue();
        } else {
            String a5 = c.a.a(aVar, null, 1);
            if (ServiceManager.s() != null && ServiceManager.s().isUserLogin()) {
                PatchProxyResult proxy3 = PatchProxy.proxy(new Object[0], null, a.changeQuickRedirect, true, 205243, new Class[0], Integer.TYPE);
                if (proxy3.isSupported) {
                    i3 = ((Integer) proxy3.result).intValue();
                } else {
                    i3 = fd.c.d("live_notice_time_interval", 10);
                }
                if ((System.currentTimeMillis() - ((Number) b0.g(a40.f.g("key_live_notice_interval", a5), 0L, "live_notice")).longValue()) / ((long) 60000) >= ((long) i3) && ((Integer) b0.g(a40.f.g("key_live_notice_count", a5), 0, "live_notice")).intValue() < 1) {
                    z = true;
                }
            }
            z = false;
        }
        if (z) {
            LiveNoticeHelper liveNoticeHelper = LiveNoticeHelper.f18097a;
            ArrayList<c> c5 = liveNoticeHelper.c();
            if (!(c5 == null || c5.isEmpty())) {
                if (liveNoticeHelper.b() >= liveNoticeHelper.c().size()) {
                    liveNoticeHelper.d(0);
                    return Unit.INSTANCE;
                }
                if (liveNoticeHelper.b() == 0) {
                    Iterator<T> it2 = liveNoticeHelper.c().iterator();
                    while (it2.hasNext()) {
                        it2.next().a();
                    }
                }
                Class cls = Integer.TYPE;
                PatchProxyResult proxy4 = PatchProxy.proxy(new Object[0], null, a.changeQuickRedirect, true, 205240, new Class[0], cls);
                if (proxy4.isSupported) {
                    i = ((Integer) proxy4.result).intValue();
                } else {
                    i = fd.c.d("live_entrance_mail", 0);
                }
                LiveNoticeHelper liveNoticeHelper2 = LiveNoticeHelper.f18097a;
                c cVar = liveNoticeHelper2.c().get(liveNoticeHelper2.b());
                if (cVar.a()) {
                    liveNoticeHelper2.d(0);
                    ArrayList<c> c12 = liveNoticeHelper2.c();
                    AnonymousClass2 r15 = new Function1<LiveNoticeModel, Unit>(this) {
                        /* class com.shizhuang.duapp.modules.live.audience.notice.helper.LiveNoticeHelper$checkLiveNotice$1.AnonymousClass2 */
                        public static ChangeQuickRedirect changeQuickRedirect;
                        public final /* synthetic */ LiveNoticeHelper$checkLiveNotice$1 this$0;

                        {
                            this.this$0 = r1;
                        }

                        /* Return type fixed from 'java.lang.Object' to match base method */
                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                        @Override // kotlin.jvm.functions.Function1
                        public /* bridge */ /* synthetic */ Unit invoke(LiveNoticeModel liveNoticeModel) {
                            invoke(liveNoticeModel);
                            return Unit.INSTANCE;
                        }

                        public final void invoke(@NotNull final LiveNoticeModel liveNoticeModel) {
                            String str;
                            LiveNoticeModel.LiveNoticeComment liveNoticeComment;
                            LiveNoticeModel.LiveNoticeComment liveNoticeComment2;
                            String str2;
                            boolean z = true;
                            if (!PatchProxy.proxy(new Object[]{liveNoticeModel}, this, changeQuickRedirect, false, 190211, new Class[]{LiveNoticeModel.class}, Void.TYPE).isSupported && b.e(this.this$0.$fragment) && liveNoticeModel.streamLogId != 0 && this.this$0.$fragment.isVisible() && this.this$0.$fragment.isResumed()) {
                                StringBuilder h12 = a.f.h("https://m.dewu.com/router/live/LiveRoomPage?roomId=");
                                h12.append(liveNoticeModel.roomId);
                                String sb2 = h12.toString();
                                String str3 = liveNoticeModel.title;
                                String str4 = liveNoticeModel.copy;
                                String str5 = liveNoticeModel.cover;
                                LiveNoticeHelper liveNoticeHelper = LiveNoticeHelper.f18097a;
                                PatchProxyResult proxy = PatchProxy.proxy(new Object[]{liveNoticeModel, sb2}, liveNoticeHelper, LiveNoticeHelper.changeQuickRedirect, false, 190206, new Class[]{LiveNoticeModel.class, String.class}, String.class);
                                if (proxy.isSupported) {
                                    str = (String) proxy.result;
                                } else {
                                    LiveNoticeModel.Extra extra = liveNoticeModel.extra;
                                    LiveNoticeModel.LiveNoticeComment liveNoticeComment3 = extra != null ? extra.comment : null;
                                    boolean z4 = liveNoticeComment3 == null;
                                    JSONArray jSONArray = new JSONArray();
                                    JSONObject jSONObject = new JSONObject();
                                    if (z4) {
                                        str2 = String.valueOf(liveNoticeModel.streamLogId);
                                    } else {
                                        str2 = String.valueOf(liveNoticeComment3 != null ? Long.valueOf(liveNoticeComment3.f18101id) : null);
                                    }
                                    jSONObject.put("push_content_id", str2);
                                    jSONObject.put("push_content_type_origin", z4 ? "0" : "1");
                                    int i = liveNoticeModel.scene;
                                    Object[] objArr = {new Integer(i)};
                                    ChangeQuickRedirect changeQuickRedirect2 = LiveNoticeHelper.changeQuickRedirect;
                                    Class cls = Integer.TYPE;
                                    PatchProxyResult proxy2 = PatchProxy.proxy(objArr, liveNoticeHelper, changeQuickRedirect2, false, 190207, new Class[]{cls}, cls);
                                    jSONObject.put("push_reason", proxy2.isSupported ? ((Integer) proxy2.result).intValue() : i != 1 ? i != 2 ? i != 3 ? i != 4 ? 2 : 4 : 3 : 0 : 1);
                                    String str6 = liveNoticeModel.alReqId;
                                    if (!(str6 == null || str6.length() == 0)) {
                                        jSONObject.put("algorithm_request_Id", liveNoticeModel.alReqId);
                                    }
                                    String str7 = liveNoticeModel.alCn;
                                    if (!(str7 == null || str7.length() == 0)) {
                                        jSONObject.put("algorithm_channel_Id", liveNoticeModel.alCn);
                                    }
                                    Unit unit = Unit.INSTANCE;
                                    str = jSONArray.put(jSONObject).toString();
                                }
                                if (!PatchProxy.proxy(new Object[]{liveNoticeModel}, liveNoticeHelper, LiveNoticeHelper.changeQuickRedirect, false, 190205, new Class[]{LiveNoticeModel.class}, Void.TYPE).isSupported) {
                                    LiveNoticeModel.Extra extra2 = liveNoticeModel.extra;
                                    if (!(extra2 == null || (liveNoticeComment2 = extra2.comment) == null)) {
                                        LiveConfigHelper liveConfigHelper = LiveConfigHelper.f18615a;
                                        String str8 = liveNoticeComment2.url;
                                        PatchProxyResult proxy3 = PatchProxy.proxy(new Object[]{str8}, liveConfigHelper, LiveConfigHelper.changeQuickRedirect, false, 201489, new Class[]{String.class}, String.class);
                                        if (proxy3.isSupported) {
                                            str8 = (String) proxy3.result;
                                        } else {
                                            PatchProxyResult proxy4 = PatchProxy.proxy(new Object[]{str8}, null, hr.b.changeQuickRedirect, true, 37127, new Class[]{String.class}, String.class);
                                            if (proxy4.isSupported) {
                                                str8 = (String) proxy4.result;
                                            } else if (str8 == null || str8.trim().isEmpty()) {
                                                str8 = "";
                                            } else {
                                                Uri parse = Uri.parse(str8);
                                                if (!parse.getQueryParameterNames().contains("streamBizType")) {
                                                    str8 = parse.buildUpon().appendQueryParameter("streamBizType", PushConstants.PUSH_TYPE_UPLOAD_LOG).toString();
                                                }
                                            }
                                        }
                                        liveNoticeComment2.url = str8;
                                    }
                                    LiveNoticeModel.Extra extra3 = liveNoticeModel.extra;
                                    String str9 = (extra3 == null || (liveNoticeComment = extra3.comment) == null) ? null : liveNoticeComment.url;
                                    ILiveService q8 = ServiceManager.q();
                                    String[] strArr = new String[1];
                                    if (str9 != null && !StringsKt__StringsJVMKt.isBlank(str9)) {
                                        z = false;
                                    }
                                    if (z) {
                                        str9 = liveNoticeModel.jumpTo;
                                    }
                                    strArr[0] = str9;
                                    q8.preLoadVideo(strArr);
                                }
                                ServiceManager.x().showPrivacyLetterWithParams(str5, str3, str4, "", sb2, true, str, new View.OnClickListener(this) {
                                    /* class com.shizhuang.duapp.modules.live.audience.notice.helper.LiveNoticeHelper$checkLiveNotice$1.AnonymousClass2.AnonymousClass1 */
                                    public static ChangeQuickRedirect changeQuickRedirect;
                                    public final /* synthetic */ AnonymousClass2 b;

                                    {
                                        this.b = r1;
                                    }

                                    @SensorsDataInstrumented
                                    public final void onClick(View view) {
                                        if (!PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 190212, new Class[]{View.class}, Void.TYPE).isSupported) {
                                            LiveNoticeModel.Extra extra = liveNoticeModel.extra;
                                            LiveNoticeModel.LiveNoticeComment liveNoticeComment = extra != null ? extra.comment : null;
                                            if (liveNoticeComment == null) {
                                                Bundle bundle = new Bundle();
                                                bundle.putInt("roomId", liveNoticeModel.roomId);
                                                bundle.putString("playUrl", liveNoticeModel.jumpTo);
                                                bundle.putLong("streamLogId", liveNoticeModel.streamLogId);
                                                bundle.putInt("sourcePage", LivePageConstant.LIVE_NOTICE.getSourcePage());
                                                e.q(this.b.this$0.$fragment.requireActivity(), bundle);
                                            } else {
                                                Bundle bundle2 = new Bundle();
                                                bundle2.putInt("roomId", liveNoticeModel.roomId);
                                                bundle2.putLong("commentateStartTime", liveNoticeComment.startTime);
                                                bundle2.putLong("commentateEndTime", liveNoticeComment.endTime);
                                                bundle2.putLong("streamLogId", liveNoticeModel.streamLogId);
                                                bundle2.putInt("productId", liveNoticeComment.spuId);
                                                bundle2.putInt("commentateStatus", liveNoticeComment.status);
                                                bundle2.putString("commentateUrl", liveNoticeComment.url);
                                                bundle2.putLong("commentateId", liveNoticeComment.f18101id);
                                                bundle2.putInt("sourcePage", LivePageConstant.LIVE_NOTICE.getSourcePage());
                                                e.q(this.b.this$0.$fragment.requireActivity(), bundle2);
                                            }
                                            SensorsDataAutoTrackHelper.trackViewOnClick(view);
                                        }
                                    }
                                });
                            }
                        }
                    };
                    if (!PatchProxy.proxy(new Object[]{c12, new Integer(i), r15}, cVar, c.changeQuickRedirect, false, 190182, new Class[]{ArrayList.class, cls, Function1.class}, Void.TYPE).isSupported) {
                        StringBuilder h12 = a.f.h("key_live_notice_interval");
                        h12.append(c.a.a(c.b, null, 1));
                        b0.m(h12.toString(), Long.valueOf(System.currentTimeMillis()), "live_notice");
                        HashMap<String, Object> hashMap = new HashMap<>();
                        hashMap.put("scene", Integer.valueOf(cVar.d()));
                        Iterator<T> it3 = c12.iterator();
                        while (it3.hasNext()) {
                            it3.next().g(hashMap);
                        }
                        hashMap.put("ab", Integer.valueOf(i));
                        mn0.e.f35721a.r(hashMap, new d(cVar, c12, r15));
                    }
                } else {
                    liveNoticeHelper2.d(liveNoticeHelper2.b() + 1);
                    liveNoticeHelper2.a(this.$fragment);
                }
                return Unit.INSTANCE;
            }
        }
        return Unit.INSTANCE;
    }
}