package com.ss.android.ugc.aweme.ecommerce.jsb;

import X.0CB;
import X.0CH;
import X.6Is;
import X.C0697KDw;
import X.C0699KDy;
import X.C0865KKi;
import X.FIu;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.webkit.WebView;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.fe.base.BaseCommonJavaMethod;
import com.ss.android.ugc.aweme.sec.SecApiImpl;
import org.json.JSONObject;

public final class VerificationCheckMethod extends BaseCommonJavaMethod implements 6Is {
    public static final C0699KDy LIZIZ = new C0699KDy((byte) 0);
    public final C0865KKi LIZ;

    static {
        Covode.recordClassIndex(70145);
    }

    public VerificationCheckMethod(byte b) {
        this();
    }

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

    public /* synthetic */ VerificationCheckMethod() {
        this((C0865KKi) null);
    }

    public VerificationCheckMethod(C0865KKi kKi) {
        super(kKi);
        this.LIZ = kKi;
    }

    public final void handle(JSONObject jSONObject, FIu fIu) {
        int i;
        WebView webView;
        Context context;
        if (jSONObject != null) {
            i = jSONObject.optInt("verifyCode");
        } else {
            i = -1;
        }
        C0865KKi kKi = this.LIZ;
        if (kKi != null && (webView = kKi.LIZLLL) != null && (context = webView.getContext()) != null) {
            while (context != null) {
                if (context instanceof Activity) {
                    Activity activity = (Activity) context;
                    if (activity != null) {
                        SecApiImpl.LIZ().popCaptcha(activity, i, new C0697KDw(i, fIu));
                        return;
                    }
                    return;
                } else if (context instanceof ContextWrapper) {
                    context = ((ContextWrapper) context).getBaseContext();
                } else {
                    return;
                }
            }
        }
    }
}
