package com.ss.android.ugc.aweme.compliance.protection.timelock;

import X.9EH;
import X.AnonymousClass2GO;
import X.AnonymousClass2HZ;
import X.AnonymousClass3BB;
import X.C15522sK;
import X.C45493zZ;
import X.C45513zb;
import X.Hx0;
import X.ISm;
import X.M12;
import X.Rc9;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.app.SharePrefCache;
import java.util.HashMap;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONObject;

public final class RevampPasscodeUtil implements AnonymousClass2HZ, AnonymousClass2GO {
    public static final RevampPasscodeUtil LIZ;
    public static boolean LIZIZ;

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(58, new Rc9(RevampPasscodeUtil.class, "onJsBroadCastEvent", Hx0.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    static {
        Covode.recordClassIndex(62129);
        RevampPasscodeUtil revampPasscodeUtil = new RevampPasscodeUtil();
        LIZ = revampPasscodeUtil;
        EventBus.LIZ(EventBus.LIZ(), revampPasscodeUtil);
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onJsBroadCastEvent(Hx0 hx0) {
        JSONObject jSONObject;
        JSONObject optJSONObject;
        Integer valueOf;
        M12.LIZ(hx0);
        JSONObject jSONObject2 = hx0.LIZIZ;
        String str = null;
        if (jSONObject2 != null) {
            str = jSONObject2.optString("eventName");
        }
        if ((n.LIZ("check_passcode_success", str) || n.LIZ("reset_passcode_success", str)) && (jSONObject = hx0.LIZIZ) != null && (optJSONObject = jSONObject.optJSONObject("data")) != null && (valueOf = Integer.valueOf(optJSONObject.optInt("biz_scene"))) != null) {
            if (2 == valueOf.intValue() || 1 == valueOf.intValue()) {
                C45513zb<Boolean> LIZIZ2 = C45493zZ.LIZIZ();
                if (LIZIZ2 != null) {
                    Boolean.valueOf(true);
                    LIZIZ2.LIZ();
                }
            } else if (valueOf != null && 3 == valueOf.intValue()) {
                AnonymousClass3BB r1 = new AnonymousClass3BB(9EH.LJJIFFI.LIZ());
                r1.LIZIZ(2131823782);
                r1.LIZIZ();
                SharePrefCache inst = SharePrefCache.inst();
                n.LIZIZ(inst, "");
                C15522sK lastUnlockTime = inst.getLastUnlockTime();
                n.LIZIZ(lastUnlockTime, "");
                lastUnlockTime.LIZIZ(Long.valueOf(System.currentTimeMillis()));
                LIZIZ = false;
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:32:0x0070  */
    /* JADX WARNING: Removed duplicated region for block: B:35:0x0080  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static final boolean LIZ(android.app.Activity r7, X.C45623zm<java.lang.Boolean> r8, java.lang.String r9) {
        /*
            X.M12.LIZ(r7)
            X.3zt r0 = X.C45693zt.LIZLLL
            boolean r0 = r0.LJ()
            r2 = 0
            if (r0 != 0) goto L_0x000d
            return r2
        L_0x000d:
            if (r8 == 0) goto L_0x0019
            X.3zb r1 = X.C45493zZ.LIZ()
            r0 = r7
            X.1hK r0 = (X.1hK) r0
            r1.LIZ(r0, r8)
        L_0x0019:
            X.3zt r0 = X.C45693zt.LIZLLL
            boolean r0 = r0.LIZIZ()
            r3 = 1
            if (r0 == 0) goto L_0x0091
            X.3zt r0 = X.C45693zt.LIZLLL
            boolean r0 = r0.LIZ()
            if (r0 == 0) goto L_0x0091
            r6 = 0
        L_0x002b:
            r4 = 3
            if (r9 != 0) goto L_0x0037
        L_0x002e:
            r5 = 3
            boolean r0 = LIZIZ
            if (r0 == 0) goto L_0x0034
            return r2
        L_0x0034:
            LIZIZ = r3
            goto L_0x0067
        L_0x0037:
            int r1 = r9.hashCode()
            r0 = -1097329270(0xffffffffbe98158a, float:-0.29703933)
            if (r1 == r0) goto L_0x0054
            r0 = -274828254(0xffffffffef9e7422, float:-9.8078055E28)
            if (r1 == r0) goto L_0x004b
            r0 = 141981839(0x876788f, float:7.416965E-34)
            if (r1 == r0) goto L_0x005e
            goto L_0x002e
        L_0x004b:
            java.lang.String r0 = "switch_account"
            boolean r0 = r9.equals(r0)
            if (r0 == 0) goto L_0x002e
            goto L_0x0066
        L_0x0054:
            java.lang.String r0 = "logout"
            boolean r0 = r9.equals(r0)
            if (r0 == 0) goto L_0x002e
            r5 = 1
            goto L_0x0067
        L_0x005e:
            java.lang.String r0 = "add_account"
            boolean r0 = r9.equals(r0)
            if (r0 == 0) goto L_0x002e
        L_0x0066:
            r5 = 2
        L_0x0067:
            X.3Tp r2 = new X.3Tp
            java.lang.String r0 = "aweme://lynxview/?channel=fe_privacy_and_safety_lynx&bundle=digital-wellbeing-check-passcode-page/template.js&dynamic=1&should_full_screen=1&hide_nav_bar=1&use_spark=1"
            r2.<init>(r0)
            if (r6 == 0) goto L_0x0079
            int r1 = r6.intValue()
            java.lang.String r0 = "digitalwellbeing_type"
            r2.LIZ((java.lang.String) r0, (int) r1)
        L_0x0079:
            java.lang.String r0 = "biz_scene"
            r2.LIZ((java.lang.String) r0, (int) r5)
            if (r5 != r4) goto L_0x0085
            java.lang.String r0 = "disable_back_press"
            r2.LIZ((java.lang.String) r0, (int) r3)
        L_0x0085:
            java.lang.String r0 = r2.LIZ()
            com.bytedance.router.SmartRoute r0 = com.bytedance.router.SmartRouter.buildRoute(r7, r0)
            r0.open()
            return r3
        L_0x0091:
            X.3zt r0 = X.C45693zt.LIZLLL
            boolean r0 = r0.LIZIZ()
            r0 = r0 ^ r3
            java.lang.Integer r6 = java.lang.Integer.valueOf(r0)
            goto L_0x002b
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.compliance.protection.timelock.RevampPasscodeUtil.LIZ(android.app.Activity, X.3zm, java.lang.String):boolean");
    }
}
