package com.mbridge.msdk.mbsignalcommon.windvane; import android.text.TextUtils; import android.util.Base64; import android.webkit.WebView; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode; import org.json.JSONObject; /* loaded from: classes4.dex */ public class BaseAbsFeedBackForH5 extends h { private static int e = 0; private static int f = 1; private String a = "AbsFeedBackForH5"; public void feedbackOperate(Object obj, String str) { try { if (!TextUtils.isEmpty(str)) { a aVar = (a) obj; JSONObject jSONObject = new JSONObject(str); int optInt = jSONObject.optInt("view_visible", 1); com.mbridge.msdk.foundation.d.b.a().a(jSONObject.optString("key", ""), optInt == 1 ? 8 : 0, aVar.b); } callbackSuccess(obj); } catch (Throwable th) { callbackExcep(obj, th.getMessage()); th.printStackTrace(); } } public void feedbackLayoutOperate(Object obj, String str) { try { if (!TextUtils.isEmpty(str)) { JSONObject jSONObject = new JSONObject(str); int optInt = jSONObject.optInt("width", -1); int optInt2 = jSONObject.optInt("height", -1); int optInt3 = jSONObject.optInt("left", -1); int optInt4 = jSONObject.optInt("top", -1); double optDouble = jSONObject.optDouble("opacity", 1.0d); int optInt5 = jSONObject.optInt("radius", 20); String optString = jSONObject.optString("fontColor", ""); String optString2 = jSONObject.optString("bgColor", ""); com.mbridge.msdk.foundation.d.b.a().a(jSONObject.optString("key", ""), optInt, optInt2, optInt5, optInt3, optInt4, (float) optDouble, optString, optString2, (float) jSONObject.optDouble(TtmlNode.ATTR_TTS_FONT_SIZE, -1.0d), jSONObject.optJSONArray("padding")); } callbackSuccess(obj); } catch (Throwable th) { callbackExcep(obj, th.getMessage()); th.printStackTrace(); } } public void feedbackPopupOperate(Object obj, String str) { try { if (!TextUtils.isEmpty(str)) { JSONObject jSONObject = new JSONObject(str); int optInt = jSONObject.optInt("view_visible", 1); String optString = jSONObject.optString("key", ""); final WindVaneWebView windVaneWebView = ((a) obj).b; com.mbridge.msdk.foundation.d.b.a().a(optString, optInt, new com.mbridge.msdk.foundation.d.a() { // from class: com.mbridge.msdk.mbsignalcommon.windvane.BaseAbsFeedBackForH5.1 @Override // com.mbridge.msdk.foundation.d.a public final void showed() { String str2; try { JSONObject jSONObject2 = new JSONObject(); if (com.mbridge.msdk.foundation.controller.c.m().c() != null) { jSONObject2.put("status", 1); } str2 = jSONObject2.toString(); } catch (Throwable th) { af.b(BaseAbsFeedBackForH5.this.a, th.getMessage(), th); str2 = ""; } g.a().a((WebView) windVaneWebView, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2)); } @Override // com.mbridge.msdk.foundation.d.a public final void close() { String str2; try { JSONObject jSONObject2 = new JSONObject(); if (com.mbridge.msdk.foundation.controller.c.m().c() != null) { jSONObject2.put("status", 2); } str2 = jSONObject2.toString(); } catch (Throwable th) { af.b(BaseAbsFeedBackForH5.this.a, th.getMessage(), th); str2 = ""; } g.a().a((WebView) windVaneWebView, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2)); } @Override // com.mbridge.msdk.foundation.d.a public final void summit(String str2) { String str3; try { JSONObject jSONObject2 = new JSONObject(); if (com.mbridge.msdk.foundation.controller.c.m().c() != null) { jSONObject2.put("status", 2); } str3 = jSONObject2.toString(); } catch (Throwable th) { af.b(BaseAbsFeedBackForH5.this.a, th.getMessage(), th); str3 = ""; } g.a().a((WebView) windVaneWebView, "onFeedbackAlertStatusNotify", Base64.encodeToString(str3.getBytes(), 2)); } }); } callbackSuccess(obj); } catch (Throwable th) { callbackExcep(obj, th.getMessage()); th.printStackTrace(); } } public void callbackSuccess(Object obj) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", e); jSONObject.put("message", ""); jSONObject.put("data", new JSONObject()); g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { callbackExcep(obj, e2.getMessage()); af.a(this.a, e2.getMessage()); } } public void callbackExcep(Object obj, String str) { try { JSONObject jSONObject = new JSONObject(); jSONObject.put("code", f); jSONObject.put("message", str); jSONObject.put("data", new JSONObject()); g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { af.a(this.a, e2.getMessage()); } } public void callbackSuccessWithData(Object obj, JSONObject jSONObject) { try { JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("code", e); jSONObject2.put("message", ""); jSONObject2.put("data", jSONObject); g.a().a(obj, Base64.encodeToString(jSONObject2.toString().getBytes(), 2)); } catch (Exception e2) { callbackExcep(obj, e2.getMessage()); af.a(this.a, e2.getMessage()); } } }