package com.ss.android.ugc.aweme.bullet.bridge.framework;

import X.0CB;
import X.0CD;
import X.0CH;
import X.6Is;
import X.7he;
import X.C3363LIk;
import X.C3366LIn;
import X.C3370LIr;
import X.C3371LIs;
import X.Crj;
import X.KT7;
import X.M12;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.bullet.bridge.BaseBridgeMethod;
import org.json.JSONObject;

public final class LoadFeedsMethod extends BaseBridgeMethod implements 6Is, C3370LIr {
    public static final C3366LIn LIZJ = new C3366LIn((byte) 0);
    public String LIZIZ = "";
    public final String LIZLLL = "loadFeeds";
    public final Crj LJ = 7he.LIZ(new C3363LIk(this));

    static {
        Covode.recordClassIndex(55096);
    }

    private final C3371LIs LJIIIZ() {
        return (C3371LIs) this.LJ.getValue();
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final String LIZLLL() {
        return this.LIZLLL;
    }

    public final void LIZ() {
        super.LIZ();
        LJIIIZ().LIZ.dispose();
        Context LJ2 = LJ();
        if (LJ2 != null) {
            while (LJ2 != null) {
                if (LJ2 instanceof Activity) {
                    Activity activity = (Activity) LJ2;
                    if (activity != null) {
                        activity.findViewById(16908290).setTag(2131362898, (Object) null);
                        return;
                    }
                    return;
                } else if (LJ2 instanceof ContextWrapper) {
                    LJ2 = ((ContextWrapper) LJ2).getBaseContext();
                } else {
                    return;
                }
            }
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public LoadFeedsMethod(KT7 kt7) {
        super(kt7);
        0CD lifecycle;
        M12.LIZ((Object) kt7);
        Context LJ2 = LJ();
        0CH r1 = (0CH) (!(LJ2 instanceof 0CH) ? null : LJ2);
        if (r1 != null && (lifecycle = r1.getLifecycle()) != null) {
            lifecycle.LIZ(this);
        }
    }

    public final void LIZIZ(String str, JSONObject jSONObject) {
        M12.LIZ((Object) str, (Object) jSONObject);
        LIZ(str, jSONObject);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:17:0x006b, code lost:
        if (r7 == null) goto L_0x006d;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(org.json.JSONObject r9, X.4UQ r10) {
        /*
            r8 = this;
            X.M12.LIZ((java.lang.Object) r9, (java.lang.Object) r10)
            java.lang.String r4 = "base_url"
            boolean r0 = r9.has(r4)
            java.lang.String r2 = "size"
            java.lang.String r3 = "page"
            java.lang.String r1 = "react_id"
            r6 = 1
            r5 = 0
            if (r0 == 0) goto L_0x0074
            boolean r0 = r9.has(r1)
            if (r0 == 0) goto L_0x0074
            boolean r0 = r9.has(r3)
            if (r0 == 0) goto L_0x0074
            boolean r0 = r9.has(r2)
            if (r0 == 0) goto L_0x0074
            java.lang.String r0 = "clear"
            boolean r0 = r9.optBoolean(r0, r5)
            if (r0 != 0) goto L_0x0074
            r0 = 1
            r7 = 0
            if (r0 == 0) goto L_0x0074
            java.lang.String r0 = r9.optString(r1)
            java.lang.String r1 = ""
            kotlin.h.b.n.LIZIZ(r0, r1)
            r8.LIZIZ = r0
            java.lang.String r5 = r9.optString(r4)
            int r4 = r9.optInt(r3)
            int r3 = r9.optInt(r2)
            X.LIs r0 = r8.LJIIIZ()
            java.lang.Object r0 = r0.getData()
            X.LIp r0 = (X.C3368LIp) r0
            java.util.List<com.ss.android.ugc.aweme.feed.model.Aweme> r0 = r0.LIZ
            r0.clear()
            X.LIs r2 = r8.LJIIIZ()
            kotlin.h.b.n.LIZIZ(r5, r1)
            android.content.Context r1 = r8.LJ()
            if (r1 == 0) goto L_0x006d
        L_0x0064:
            boolean r0 = r1 instanceof android.app.Activity
            if (r0 == 0) goto L_0x0086
            android.app.Activity r1 = (android.app.Activity) r1
            r7 = r1
            if (r7 != 0) goto L_0x0070
        L_0x006d:
            kotlin.h.b.n.LIZIZ()
        L_0x0070:
            r2.LIZ(r5, r4, r3, r7)
            r5 = 1
        L_0x0074:
            org.json.JSONObject r1 = new org.json.JSONObject
            r1.<init>()
            if (r5 == 0) goto L_0x0084
        L_0x007b:
            java.lang.String r0 = "code"
            r1.put(r0, r6)
            r10.LIZ(r1)
            return
        L_0x0084:
            r6 = -1
            goto L_0x007b
        L_0x0086:
            boolean r0 = r1 instanceof android.content.ContextWrapper
            if (r0 == 0) goto L_0x006d
            android.content.ContextWrapper r1 = (android.content.ContextWrapper) r1
            android.content.Context r1 = r1.getBaseContext()
            if (r1 == 0) goto L_0x006d
            goto L_0x0064
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.bullet.bridge.framework.LoadFeedsMethod.LIZ(org.json.JSONObject, X.4UQ):void");
    }
}
