package com.ss.android.ugc.aweme.crossplatform.business;

import X.2i6;
import X.95y;
import X.C3464JZf;
import X.KoL;
import android.text.TextUtils;
import android.webkit.WebView;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.crossplatform.business.BusinessService;
import org.json.JSONException;
import org.json.JSONObject;

public class DouPlusMonitorBusiness extends BusinessService.Business {
    public boolean LIZ;
    public long LIZIZ;

    static {
        Covode.recordClassIndex(62932);
    }

    private String LIZ() {
        return this.LJIIJ.LIZIZ.LJIIZILJ;
    }

    public DouPlusMonitorBusiness(KoL koL) {
        super(koL);
    }

    public final void LIZIZ(String str) {
        if (2i6.LIZ(LIZ(), str)) {
            this.LIZ = false;
        }
    }

    public final void LIZ(String str) {
        if (!TextUtils.isEmpty(str)) {
            if (2i6.LIZ(LIZ(), str)) {
                this.LIZ = true;
                this.LIZIZ = System.currentTimeMillis();
                return;
            }
            this.LIZ = false;
        }
    }

    public final void LIZ(int i, String str, WebView webView) {
        if (this.LIZ) {
            this.LIZ = false;
            long currentTimeMillis = System.currentTimeMillis() - this.LIZIZ;
            JSONObject jSONObject = new JSONObject();
            JSONObject jSONObject2 = new JSONObject();
            try {
                jSONObject.put("duration", currentTimeMillis);
                jSONObject2.put("error_status", i);
                jSONObject2.put("error_message", str);
            } catch (JSONException unused) {
            }
            95y.LIZ("douplus_delivery_show", 0, jSONObject, jSONObject2);
            if (this.LJIIJ.LIZIZ.LJIJ && webView != null) {
                webView.evaluateJavascript("ttwebview:/*getTTLogEventResult*/;", new C3464JZf(this, i, str, webView));
            }
        }
    }
}
