花瓣 v4.6.12版本的 MD5 值为:6a3515d4d16d98931f1b3d25a91b257e
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.sigmob.sdk.mraid;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Rect;
import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.Base64;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.alibaba.fastjson.parser.JSONLexer;
import com.czhj.sdk.common.ClientMetadata;
import com.czhj.sdk.common.json.JSONSerializer;
import com.czhj.sdk.common.network.Networking;
import com.czhj.sdk.common.utils.Md5Util;
import com.czhj.sdk.common.utils.ReflectionUtil;
import com.czhj.sdk.common.utils.TouchLocation;
import com.czhj.sdk.logger.SigmobLog;
import com.google.android.exoplayer2.util.b0;
import com.huawei.hms.framework.common.ContainerUtils;
import com.sigmob.sdk.base.common.ag;
import com.sigmob.sdk.base.common.k;
import com.sigmob.sdk.base.common.x;
import com.sigmob.sdk.base.models.AppInfo;
import com.sigmob.sdk.base.models.BaseAdUnit;
import com.sigmob.sdk.base.models.ClickCommon;
import com.sigmob.sdk.base.models.CurrentAppOrientation;
import com.sigmob.sdk.base.models.ExposureChange;
import com.sigmob.sdk.base.models.MraidEnv;
import com.sigmob.sdk.base.models.PlacementType;
import com.sigmob.sdk.base.models.SigMacroCommon;
import com.sigmob.sdk.base.models.VideoItem;
import com.sigmob.sdk.base.models.ViewState;
import com.sigmob.sdk.base.models.rtb.Ad;
import com.sigmob.sdk.base.models.rtb.MaterialMeta;
import com.sigmob.sdk.base.models.rtb.RvAdSetting;
import com.sigmob.sdk.base.mta.PointEntitySigmob;
import com.sigmob.sdk.mraid.a;
import com.sigmob.sdk.mraid.h;
import com.sigmob.sdk.mraid.o;
import com.sigmob.sdk.videoAd.BaseAdActivity;
import com.sigmob.windad.WindAdError;
import com.sigmob.windad.WindAds;
import com.ubix.monitor.adcache.AdDBConfig;
import com.umeng.analytics.pro.au;
import com.umeng.analytics.pro.bi;
import com.umeng.socialize.net.utils.SocializeProtocolConstants;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class b {
static final String a = "mraid://open?url=";
private final BaseAdUnit b;
private final PlacementType c;
private final h f11298d;
private String f11299e;
private InterfaceC0701b f11300f;
private o f11301g;
private ag f11302h;
private boolean f11303i;
private final WebViewClient j;
private c k;
public static class AnonymousClass6 {
static final int[] a;
static {
int[] iArr = new int[g.values().length];
a = iArr;
try {
iArr[g.CLOSE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[g.UNLOAD.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[g.OPENFOURELEMENTS.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[g.RESIZE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[g.EXPAND.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[g.USE_CUSTOM_CLOSE.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[g.OPEN.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
a[g.SET_ORIENTATION_PROPERTIES.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
a[g.PLAY_VIDEO.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
a[g.STORE_PICTURE.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
a[g.CREATE_CALENDAR_EVENT.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
a[g.VPAID.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
try {
a[g.EXTENSION.ordinal()] = 13;
} catch (NoSuchFieldError unused13) {
}
try {
a[g.UNSPECIFIED.ordinal()] = 14;
} catch (NoSuchFieldError unused14) {
}
}
}
static class a {
private final WeakReference<b> a;
public a(b bVar) {
this.a = new WeakReference<>(bVar);
}
public b a() {
return this.a.get();
}
@JavascriptInterface
public String addMacro(JSONObject jSONObject) {
try {
BaseAdUnit b = b();
String string = jSONObject.has("key") ? jSONObject.getString("key") : null;
String string2 = jSONObject.has(com.ubixnow.utils.monitor.data.adapter.c.w) ? jSONObject.getString(com.ubixnow.utils.monitor.data.adapter.c.w) : null;
if (!TextUtils.isEmpty(string) && !TextUtils.isEmpty(string2)) {
b.getMacroCommon().addMarcoKey(string, string2);
return b.a(200, "addMacro success", (Object) null);
}
return b.a(300, "key or value is empty", (Object) null);
} catch (Throwable th) {
return b.a(500, "addMacro add fail " + th.getMessage(), (Object) null);
}
}
public BaseAdUnit b() {
b a = a();
if (a != null) {
return a.b;
}
return null;
}
@JavascriptInterface
public String excuteRewardAdTrack(JSONObject jSONObject) {
try {
BaseAdUnit b = b();
String string = jSONObject.getString("event");
int a = com.sigmob.sdk.base.network.e.a(b, string, true);
if (a == 0) {
return b.a(200, "excuteRewardAdTrack success", (Object) null);
}
if (a == -1) {
return b.a(300, "event is empty", (Object) null);
}
if (a == -2) {
return b.a(300, string + " can't find in trackers", (Object) null);
}
return b.a(400, "unknown error: " + a, (Object) null);
} catch (Throwable th) {
return b.a(500, "unknown error: " + th.getMessage(), (Object) null);
}
}
@JavascriptInterface
public String func(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
String string = jSONObject.has("func") ? jSONObject.getString("func") : null;
if (TextUtils.isEmpty(string)) {
return b.a(400, "func is empty", (Object) null);
}
ReflectionUtil.MethodBuilder methodBuilder = new ReflectionUtil.MethodBuilder(this, string.replace(Constants.COLON_SEPARATOR, ""));
methodBuilder.addParam(JSONObject.class, jSONObject);
return (String) methodBuilder.execute();
} catch (Throwable th) {
return b.a(500, th.getMessage(), (Object) null);
}
}
@JavascriptInterface
public String getAppInfo(JSONObject jSONObject) {
Object deviceId;
int densityDpi;
try {
JSONObject jSONObject2 = new JSONObject();
BaseAdUnit b = b();
if (jSONObject != null && b != null && jSONObject.has("arguments")) {
JSONArray jSONArray = jSONObject.getJSONArray("arguments");
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
String string = jSONArray.getString(i2);
char c = 65535;
try {
switch (string.hashCode()) {
case -1776992973:
if (string.equals("ad_source_logo")) {
c = 20;
break;
}
break;
case -1590994477:
if (string.equals("display_orientation")) {
c = ' ';
break;
}
break;
case -1581153970:
if (string.equals("settlement_price_enc")) {
c = 29;
break;
}
break;
case -1534836170:
if (string.equals("google_aid")) {
c = 3;
break;
}
break;
case -1342627961:
if (string.equals("bid_price")) {
c = 27;
break;
}
break;
case -1295727824:
if (string.equals("device_height")) {
c = '\n';
break;
}
break;
case -1152230954:
if (string.equals("ad_type")) {
c = 16;
break;
}
break;
case -1093016302:
if (string.equals("client_pixel")) {
c = '\b';
break;
}
break;
case -918718184:
if (string.equals("forbiden_parse_landingpage")) {
c = 31;
break;
}
break;
case -901870406:
if (string.equals("app_version")) {
c = 5;
break;
}
break;
case -702722614:
if (string.equals("creative_type")) {
c = 15;
break;
}
break;
case -582019427:
if (string.equals("device_width")) {
c = '\t';
break;
}
break;
case -568274923:
if (string.equals("screen_density")) {
c = 11;
break;
}
break;
case -516987305:
if (string.equals("pkgname")) {
c = com.gaoding.foundations.sdk.b.i.f4094e;
break;
}
break;
case -376724013:
if (string.equals("sdk_version")) {
c = 6;
break;
}
break;
case -205033663:
if (string.equals("is_override")) {
c = 30;
break;
}
break;
case -41411609:
if (string.equals("screenangle")) {
c = 14;
break;
}
break;
case -19457365:
if (string.equals(bi.T)) {
c = '\f';
break;
}
break;
case 3556:
if (string.equals("os")) {
c = 0;
break;
}
break;
case 116753:
if (string.equals("vid")) {
c = 23;
break;
}
break;
case 3062218:
if (string.equals("crid")) {
c = 24;
break;
}
break;
case 3236040:
if (string.equals("imei")) {
c = 1;
break;
}
break;
case 37109963:
if (string.equals(AdDBConfig.requestId)) {
c = 17;
break;
}
break;
case 93029116:
if (string.equals("appid")) {
c = 19;
break;
}
break;
case 549673881:
if (string.equals("camp_id")) {
c = 25;
break;
}
break;
case 672836989:
if (string.equals("os_version")) {
c = 7;
break;
}
break;
case 722989291:
if (string.equals(SocializeProtocolConstants.PROTOCOL_KEY_ANDROID_ID)) {
c = 2;
break;
}
break;
case 1103406469:
if (string.equals("clienttype")) {
c = 4;
break;
}
break;
case 1127917191:
if (string.equals("cust_id")) {
c = JSONLexer.EOI;
break;
}
break;
case 1139668345:
if (string.equals("adslot_id")) {
c = 22;
break;
}
break;
case 1224358069:
if (string.equals("placement_id")) {
c = 18;
break;
}
break;
case 1437471655:
if (string.equals("expired_time")) {
c = '!';
break;
}
break;
case 1753008747:
if (string.equals("product_id")) {
c = 28;
break;
}
break;
case 1765767291:
if (string.equals("ad_source_channel")) {
c = 21;
break;
}
break;
}
switch (c) {
case 0:
jSONObject2.put(string, 2);
break;
case 1:
deviceId = ClientMetadata.getInstance().getDeviceId();
jSONObject2.put(string, deviceId);
break;
case 2:
deviceId = ClientMetadata.getInstance().getAndroidId();
jSONObject2.put(string, deviceId);
break;
case 3:
deviceId = ClientMetadata.getInstance().getAdvertisingId();
jSONObject2.put(string, deviceId);
break;
case 4:
deviceId = ClientMetadata.getDeviceModel();
jSONObject2.put(string, deviceId);
break;
case 5:
deviceId = ClientMetadata.getInstance().getAppVersion();
jSONObject2.put(string, deviceId);
break;
case 6:
deviceId = "4.4.0";
jSONObject2.put(string, deviceId);
break;
case 7:
deviceId = ClientMetadata.getDeviceOsVersion();
jSONObject2.put(string, deviceId);
break;
case '\b':
deviceId = String.format("%sx%s", Integer.valueOf(ClientMetadata.getInstance().getDisplayMetrics().widthPixels), Integer.valueOf(ClientMetadata.getInstance().getDisplayMetrics().heightPixels));
jSONObject2.put(string, deviceId);
break;
case '\t':
deviceId = ClientMetadata.getInstance().getDeviceScreenWidthDip();
jSONObject2.put(string, deviceId);
break;
case '\n':
deviceId = ClientMetadata.getInstance().getDeviceScreenHeightDip();
jSONObject2.put(string, deviceId);
break;
case 11:
densityDpi = ClientMetadata.getInstance().getDensityDpi();
jSONObject2.put(string, densityDpi);
break;
case '\f':
densityDpi = ClientMetadata.getInstance().getActiveNetworkType();
jSONObject2.put(string, densityDpi);
break;
case '\r':
deviceId = ClientMetadata.getInstance().getAppPackageName();
jSONObject2.put(string, deviceId);
break;
case 14:
densityDpi = Math.abs(ClientMetadata.getInstance().getOrientationInt().intValue() - 1) * 90;
jSONObject2.put(string, densityDpi);
break;
case 15:
densityDpi = b.getCreativeType();
jSONObject2.put(string, densityDpi);
break;
case 16:
densityDpi = b.getAd_type();
jSONObject2.put(string, densityDpi);
break;
case 17:
deviceId = b.getRequestId();
jSONObject2.put(string, deviceId);
break;
case 18:
case 22:
deviceId = b.getadslot_id();
jSONObject2.put(string, deviceId);
break;
case 19:
deviceId = WindAds.sharedAds().getAppId();
jSONObject2.put(string, deviceId);
break;
case 20:
deviceId = b.getAd_source_logo();
jSONObject2.put(string, deviceId);
break;
case 21:
deviceId = b.getAd_source_channel();
jSONObject2.put(string, deviceId);
break;
case 23:
deviceId = b.getAd().vid;
jSONObject2.put(string, deviceId);
break;
case 24:
deviceId = b.getCrid();
jSONObject2.put(string, deviceId);
break;
case 25:
deviceId = b.getCamp_id();
jSONObject2.put(string, deviceId);
break;
case 26:
deviceId = b.getAd().cust_id;
jSONObject2.put(string, deviceId);
break;
case 27:
deviceId = b.getAd().bid_price;
jSONObject2.put(string, deviceId);
break;
case 28:
deviceId = b.getAd().product_id;
jSONObject2.put(string, deviceId);
break;
case 29:
deviceId = b.getAd().settlement_price_enc;
jSONObject2.put(string, deviceId);
break;
case 30:
deviceId = b.getAd().is_override;
jSONObject2.put(string, deviceId);
break;
case 31:
deviceId = b.getAd().forbiden_parse_landingpage;
jSONObject2.put(string, deviceId);
break;
case ' ':
deviceId = b.getAd().display_orientation;
jSONObject2.put(string, deviceId);
break;
case '!':
deviceId = b.getAd().expired_time;
jSONObject2.put(string, deviceId);
break;
}
} catch (Throwable unused) {
}
}
}
return b.a(200, "getAppInfo success ", jSONObject2);
} catch (Throwable th) {
return b.a(500, "getAppInfo error: " + th.getMessage(), (Object) null);
}
}
@JavascriptInterface
public String hello(JSONObject jSONObject) {
try {
return jSONObject.toString();
} catch (Throwable unused) {
return null;
}
}
@JavascriptInterface
public String javascriptAddDcLog(final JSONObject jSONObject) {
try {
if (jSONObject == null) {
return b.a(400, "not params", (Object) null);
}
if (jSONObject.has("_ac_type")) {
x.a(jSONObject.getString("_ac_type"), b(), new x.a() {
@Override
public void a(Object obj) {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
if (next.equalsIgnoreCase("ext")) {
try {
try {
JSONObject jSONObject2 = new JSONObject(jSONObject.optString(next));
Iterator<String> keys2 = jSONObject2.keys();
while (keys2.hasNext()) {
String next2 = keys2.next();
hashMap.put(next2, jSONObject2.optString(next2));
}
} catch (JSONException e2) {
e2.printStackTrace();
}
} catch (Exception unused) {
hashMap.put("ext", Base64.encodeToString(jSONObject.getString("ext").getBytes(), 2));
}
} else if (!next.equalsIgnoreCase("_ac_type")) {
try {
hashMap.put(next, jSONObject.getString(next));
} catch (Throwable unused2) {
}
}
}
hashMap.put("source", "js");
if (obj instanceof PointEntitySigmob) {
((PointEntitySigmob) obj).setOptions(hashMap);
}
}
});
return b.a(200, "add dc log success", (Object) null);
}
return b.a(300, "_ac_type is empty", (Object) null);
} catch (Throwable th) {
return b.a(500, th.toString(), (Object) null);
}
}
@JavascriptInterface
public String mraidJsLoaded() {
b a = a();
if (a == null || a.f11300f == null) {
return null;
}
a.f11300f.b();
return null;
}
@JavascriptInterface
public void postMessage(final String str) {
final b a = a();
SigmobLog.d("postMessage: raw " + str);
if (a != null) {
a.f11301g.post(new Runnable() {
@Override
public void run() {
try {
JSONObject jSONObject = new JSONObject(str);
a.a(jSONObject.optString("event"), jSONObject.optString("subEvent"), jSONObject.optJSONObject("args"));
} catch (JSONException e2) {
e2.printStackTrace();
}
a.e(str);
}
});
}
}
@JavascriptInterface
public String tracking(JSONObject jSONObject) {
try {
BaseAdUnit b = b();
String optString = jSONObject.optString("event");
JSONArray optJSONArray = jSONObject.optJSONArray("urls");
if (optJSONArray == null || optJSONArray.length() <= 0) {
return b.a(300, "urls is empty", (Object) null);
}
for (int i2 = 0; i2 < optJSONArray.length(); i2++) {
com.sigmob.sdk.base.common.e eVar = new com.sigmob.sdk.base.common.e(optJSONArray.optString(i2), optString, b.getRequestId());
eVar.a(Integer.valueOf(b.getTrackingRetryNum()));
eVar.a("js");
com.sigmob.sdk.base.network.e.a(eVar, b, false);
}
return b.a(200, "tracking success", (Object) null);
} catch (Throwable th) {
return b.a(500, "unknown error: " + th.getMessage(), (Object) null);
}
}
}
public interface InterfaceC0701b {
void a();
void a(int i2, int i3, int i4, int i5, a.EnumC0700a enumC0700a, boolean z);
void a(WindAdError windAdError);
void a(String str, Map<String, String> map);
void a(URI uri);
void a(URI uri, int i2, String str);
void a(URI uri, boolean z) throws com.sigmob.sdk.mraid.c;
void a(boolean z);
void a(boolean z, j jVar) throws com.sigmob.sdk.mraid.c;
boolean a(ConsoleMessage consoleMessage);
boolean a(String str, JsResult jsResult);
void b();
void b(String str, Map<String, String> map);
void b(boolean z);
void c();
void d();
void e();
void f();
}
public interface c {
void a(String str, JSONObject jSONObject);
void b(String str, JSONObject jSONObject);
}
public b(BaseAdUnit baseAdUnit, PlacementType placementType) {
this(baseAdUnit, placementType, new h());
}
b(BaseAdUnit baseAdUnit, PlacementType placementType, h hVar) {
this.j = new p() {
@Override
public void onPageFinished(WebView webView, String str) {
b.this.o();
}
@Override
public void onReceivedError(WebView webView, int i2, String str, String str2) {
SigmobLog.e("Error: " + str);
super.onReceivedError(webView, i2, str, str2);
}
@Override
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
b.this.a(renderProcessGoneDetail);
return true;
}
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
if (!TextUtils.isEmpty(b.this.b.getVideoPath()) && str.endsWith(b.this.b.getVideoPath()) && b.this.b.isVideoExist()) {
try {
return new WebResourceResponse(b0.f7425f, "UTF-8", new FileInputStream(b.this.b.getVideoPath()));
} catch (FileNotFoundException e2) {
SigmobLog.e(e2.getMessage());
}
}
return super.shouldInterceptRequest(webView, str);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
return b.this.a(webView, str);
}
};
this.b = baseAdUnit;
this.c = placementType;
this.f11298d = hVar;
}
private int a(int i2, int i3, int i4) throws com.sigmob.sdk.mraid.c {
if (i2 < i3 || i2 > i4) {
throw new com.sigmob.sdk.mraid.c("Integer parameter out of range: " + i2);
}
return i2;
}
private a.EnumC0700a a(String str, a.EnumC0700a enumC0700a) throws com.sigmob.sdk.mraid.c {
if (TextUtils.isEmpty(str)) {
return enumC0700a;
}
if (str.equals("top-left")) {
return a.EnumC0700a.TOP_LEFT;
}
if (str.equals("top-right")) {
return a.EnumC0700a.TOP_RIGHT;
}
if (str.equals(com.google.android.exoplayer2.text.y.d.m0)) {
return a.EnumC0700a.CENTER;
}
if (str.equals("bottom-left")) {
return a.EnumC0700a.BOTTOM_LEFT;
}
if (str.equals("bottom-right")) {
return a.EnumC0700a.BOTTOM_RIGHT;
}
if (str.equals("top-center")) {
return a.EnumC0700a.TOP_CENTER;
}
if (str.equals("bottom-center")) {
return a.EnumC0700a.BOTTOM_CENTER;
}
throw new com.sigmob.sdk.mraid.c("Invalid close position: " + str);
}
public static String a(int i2, String str, Object obj) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("code", i2);
if (!TextUtils.isEmpty(str)) {
jSONObject.put("message", str);
}
if (obj != null) {
jSONObject.put("data", obj);
}
return jSONObject.toString();
} catch (Throwable th) {
return th.getMessage();
}
}
private String a(Rect rect) {
return rect.left + Constants.ACCEPT_TIME_SEPARATOR_SP + rect.top + Constants.ACCEPT_TIME_SEPARATOR_SP + rect.width() + Constants.ACCEPT_TIME_SEPARATOR_SP + rect.height();
}
public static String a(String str) {
if (str == null || str.equalsIgnoreCase("null") || str.equalsIgnoreCase("undefined")) {
return null;
}
return str;
}
private URI a(String str, URI uri) throws com.sigmob.sdk.mraid.c {
return str == null ? uri : i(str);
}
private void a(g gVar) {
c("window.mraidbridge.nativeCallComplete(" + JSONObject.quote(gVar.a()) + ")");
}
public void a(g gVar, String str) {
c("window.mraidbridge.notifyErrorEvent(" + JSONObject.quote(gVar.a()) + ", " + JSONObject.quote(str) + ")");
}
public void a(String str, String str2, JSONObject jSONObject) {
char c2;
int hashCode = str.hashCode();
if (hashCode != 112408642) {
if (hashCode == 1182268276 && str.equals("belowSubview")) {
c2 = 1;
}
c2 = 65535;
} else {
if (str.equals("vpaid")) {
c2 = 0;
}
c2 = 65535;
}
if (c2 == 0) {
this.k.a(str2, jSONObject);
} else if (c2 != 1) {
} else {
this.k.b(str2, jSONObject);
}
}
private boolean a(String str, boolean z) throws com.sigmob.sdk.mraid.c {
return str == null ? z : h(str);
}
private String b(Rect rect) {
return rect.width() + Constants.ACCEPT_TIME_SEPARATOR_SP + rect.height();
}
private URI c(String str, String str2) throws com.sigmob.sdk.mraid.c {
try {
try {
return str == null ? new URI(str2) : new URI(str);
} catch (URISyntaxException unused) {
return new URI(str2);
}
} catch (URISyntaxException unused2) {
throw new com.sigmob.sdk.mraid.c("Invalid URL parameter: " + str);
}
}
private int f(String str) throws com.sigmob.sdk.mraid.c {
try {
return Integer.parseInt(str, 10);
} catch (NumberFormatException unused) {
throw new com.sigmob.sdk.mraid.c("Invalid numeric parameter: " + str);
}
}
private j g(String str) throws com.sigmob.sdk.mraid.c {
if ("portrait".equals(str)) {
return j.PORTRAIT;
}
if ("landscape".equals(str)) {
return j.LANDSCAPE;
}
if ("none".equals(str)) {
return j.NONE;
}
throw new com.sigmob.sdk.mraid.c("Invalid orientation: " + str);
}
private boolean h(String str) throws com.sigmob.sdk.mraid.c {
if ("true".equals(str)) {
return true;
}
if ("false".equals(str)) {
return false;
}
throw new com.sigmob.sdk.mraid.c("Invalid boolean parameter: " + str);
}
private URI i(String str) throws com.sigmob.sdk.mraid.c {
if (str != null) {
try {
return new URI(str);
} catch (URISyntaxException unused) {
throw new com.sigmob.sdk.mraid.c("Invalid URL parameter: " + str);
}
}
throw new com.sigmob.sdk.mraid.c("Parameter cannot be null");
}
public void o() {
if (this.f11303i) {
return;
}
this.f11303i = true;
InterfaceC0701b interfaceC0701b = this.f11300f;
if (interfaceC0701b != null) {
interfaceC0701b.a();
}
}
public String a() {
return this.f11299e;
}
void a(int i2) {
c("sigmob.notifyApkDownloadProcessEvent(" + i2 + ");");
}
@SuppressLint({"JavascriptInterface", "AddJavascriptInterface"})
public void a(Context context, String str) {
o oVar = this.f11301g;
if (oVar == null) {
SigmobLog.e("MRAID bridge called setContentHtml before WebView was attached");
return;
}
oVar.addJavascriptInterface(new a(this), "sigandroid");
this.f11303i = false;
String md5 = Md5Util.md5(str);
File a2 = com.sigmob.sdk.base.utils.b.a(str, md5 + ".html");
if (a2 == null || TextUtils.isEmpty(a2.getAbsolutePath())) {
o oVar2 = this.f11301g;
oVar2.loadDataWithBaseURL(Networking.getBaseUrlScheme() + "://localhost/", str, "text/html", "UTF-8", null);
return;
}
o oVar3 = this.f11301g;
oVar3.loadUrl("file://" + a2.getAbsolutePath());
}
public void a(Location location) {
c("mraidbridge.setLocation(" + location.getLatitude() + Constants.ACCEPT_TIME_SEPARATOR_SP + location.getLongitude() + ",\"" + location.getProvider() + "\");");
}
@TargetApi(26)
void a(RenderProcessGoneDetail renderProcessGoneDetail) {
WindAdError windAdError = (renderProcessGoneDetail == null || !renderProcessGoneDetail.didCrash()) ? WindAdError.RENDER_PROCESS_GONE_UNSPECIFIED : WindAdError.RENDER_PROCESS_GONE_WITH_CRASH;
SigmobLog.e("handleRenderProcessGone " + windAdError.toString());
b();
InterfaceC0701b interfaceC0701b = this.f11300f;
if (interfaceC0701b != null) {
interfaceC0701b.a(windAdError);
}
}
public void a(ValueCallback valueCallback) {
a("mraidbridge.getPlayProgress();", valueCallback);
}
void a(AppInfo appInfo) {
c("sigmob.fireChangeEvent({" + appInfo.toString().replace(ContainerUtils.KEY_VALUE_DELIMITER, Constants.COLON_SEPARATOR) + "});");
}
public void a(CurrentAppOrientation currentAppOrientation) {
c("mraidbridge.fireChangeEvent({" + currentAppOrientation.toString().replace(ContainerUtils.KEY_VALUE_DELIMITER, Constants.COLON_SEPARATOR) + "});");
}
public void a(ExposureChange exposureChange) {
c("mraidbridge.fireChangeEvent({" + exposureChange.toString().replace(ContainerUtils.KEY_VALUE_DELIMITER, Constants.COLON_SEPARATOR) + "});");
}
public void a(MraidEnv mraidEnv) {
String Serialize = JSONSerializer.Serialize(mraidEnv, au.a, true);
c("mraidbridge.fireChangeEvent(" + Serialize + ");");
}
public void a(PlacementType placementType) {
c("mraidbridge.setPlacementType(" + JSONObject.quote(placementType.toJavascriptString()) + ")");
}
public void a(VideoItem videoItem) {
String Serialize = JSONSerializer.Serialize(videoItem, "video", false);
c("sigmob.fireChangeEvent(" + Serialize + ");");
}
public void a(ViewState viewState) {
c("mraidbridge.setState(" + JSONObject.quote(viewState.toJavascriptString()) + ")");
}
public void a(Ad ad) {
String Serialize = JSONSerializer.Serialize(ad, "ad", true);
c("sigmob.fireChangeEvent(" + Serialize + ");");
}
public void a(MaterialMeta materialMeta) {
String Serialize = JSONSerializer.Serialize(materialMeta, ClickCommon.CLICK_AREA_MATERIAL, true);
c("sigmob.fireChangeEvent(" + Serialize + ");");
}
public void a(RvAdSetting rvAdSetting) {
String Serialize = JSONSerializer.Serialize(rvAdSetting, "rvSetting", false);
c("sigmob.fireChangeEvent(" + Serialize + ");");
}
public void a(InterfaceC0701b interfaceC0701b) {
this.f11300f = interfaceC0701b;
}
public void a(c cVar) {
this.k = cVar;
}
void a(final g gVar, Map<String, String> map) throws com.sigmob.sdk.mraid.c {
if (this.f11300f == null) {
throw new com.sigmob.sdk.mraid.c("Invalid state to execute this command");
}
if (this.f11301g == null) {
throw new com.sigmob.sdk.mraid.c("The current WebView is being destroyed");
}
switch (AnonymousClass6.a[gVar.ordinal()]) {
case 1:
this.f11300f.d();
return;
case 2:
this.f11300f.e();
return;
case 3:
this.f11300f.f();
return;
case 4:
this.f11300f.a(a(f(map.get(SocializeProtocolConstants.WIDTH)), 0, com.google.android.exoplayer2.audio.m.f5562f), a(f(map.get(SocializeProtocolConstants.HEIGHT)), 0, com.google.android.exoplayer2.audio.m.f5562f), a(f(map.get("offsetX")), -100000, com.google.android.exoplayer2.audio.m.f5562f), a(f(map.get("offsetY")), -100000, com.google.android.exoplayer2.audio.m.f5562f), a(map.get("customClosePosition"), a.EnumC0700a.TOP_RIGHT), a(map.get("allowOffscreen"), true));
return;
case 5:
this.f11300f.a(a(map.get("url"), (URI) null), a(map.get("shouldUseCustomClose"), false));
return;
case 6:
this.f11300f.b(a(map.get("shouldUseCustomClose"), false));
return;
case 7:
this.f11300f.a(c(map.get("url"), "https://m.sigmob.com"), 1, a(map.get("ext")));
return;
case 8:
this.f11300f.a(h(map.get("allowOrientationChange")), g(map.get("forceOrientation")));
return;
case 9:
this.f11300f.a(i(map.get("uri")));
return;
case 10:
this.f11298d.a(this.f11301g.getContext(), i(map.get("uri")).toString(), new h.a() {
@Override
public void a(com.sigmob.sdk.mraid.c cVar) {
b.this.a(gVar, cVar.getMessage());
}
});
return;
case 11:
this.f11298d.a(this.f11301g.getContext(), map);
return;
case 12:
this.f11300f.a(map.get("event"), map);
return;
case 13:
this.f11300f.b(map.get("event"), map);
return;
case 14:
throw new com.sigmob.sdk.mraid.c("Unspecified MRAID Javascript command");
default:
return;
}
}
public void a(k kVar) {
c("mraidbridge.setScreenSize(" + b(kVar.c()) + ");mraidbridge.setMaxSize(" + b(kVar.e()) + ");mraidbridge.setCurrentPosition(" + a(kVar.g()) + ");mraidbridge.setDefaultPosition(" + a(kVar.i()) + ")");
StringBuilder sb = new StringBuilder();
sb.append("mraidbridge.notifySizeChangeEvent(");
sb.append(b(kVar.g()));
sb.append(")");
c(sb.toString());
}
@SuppressLint({"AddJavascriptInterface"})
public void a(o oVar) {
this.f11301g = oVar;
oVar.getSettings().setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= 17 && this.c == PlacementType.INTERSTITIAL) {
oVar.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
this.f11301g.setScrollContainer(false);
this.f11301g.setVerticalScrollBarEnabled(false);
this.f11301g.setHorizontalScrollBarEnabled(false);
this.f11301g.setBackgroundColor(0);
this.f11301g.setAdUnit(this.b);
this.f11301g.a((k.a) null);
this.f11301g.setWebViewClient(this.j);
this.f11301g.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
return b.this.f11300f != null ? b.this.f11300f.a(consoleMessage) : super.onConsoleMessage(consoleMessage);
}
@Override
public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
return b.this.f11300f != null ? b.this.f11300f.a(str2, jsResult) : super.onJsAlert(webView, str, str2, jsResult);
}
@Override
public boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
return super.onJsPrompt(webView, str, str2, str3, jsPromptResult);
}
@Override
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
super.onShowCustomView(view, customViewCallback);
}
});
this.f11302h = new ag(this.f11301g.getContext(), this.f11301g, this.b);
this.f11301g.setOnTouchListener(new View.OnTouchListener() {
private MotionEvent b;
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
b.this.f11302h.onTouchEvent(motionEvent);
int action = motionEvent.getAction();
if ((action == 0 || action == 1) && !view.hasFocus()) {
view.requestFocus();
}
if (motionEvent.getAction() == 1) {
b.this.f11299e = String.format("%d,%d,%d,%d", Integer.valueOf((int) this.b.getRawX()), Integer.valueOf((int) this.b.getRawY()), Integer.valueOf((int) motionEvent.getRawX()), Integer.valueOf((int) motionEvent.getRawY()));
if (this.b == null) {
this.b = motionEvent;
}
SigMacroCommon macroCommon = b.this.b.getMacroCommon();
if (macroCommon instanceof SigMacroCommon) {
macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, String.valueOf((int) this.b.getRawX()));
macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, String.valueOf((int) this.b.getRawY()));
macroCommon.addMarcoKey(SigMacroCommon._UPX_, String.valueOf((int) motionEvent.getRawX()));
macroCommon.addMarcoKey(SigMacroCommon._UPY_, String.valueOf((int) motionEvent.getRawY()));
}
} else if (motionEvent.getAction() == 0) {
this.b = MotionEvent.obtain(motionEvent);
}
return false;
}
});
this.f11301g.setVisibilityChangedListener(new o.a() {
@Override
public void a(boolean z) {
if (b.this.f11300f != null) {
b.this.f11300f.a(z);
}
}
});
}
public void a(String str, int i2) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("uniqueId", str);
jSONObject.put("currentTime", i2 / 1000.0f);
} catch (JSONException e2) {
e2.printStackTrace();
}
c("mraidbridge.setvdPlayToEnd(" + jSONObject + ")");
}
public void a(String str, int i2, int i3) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("uniqueId", str);
jSONObject.put("currentTime", i2 / 1000.0f);
jSONObject.put("duration", i3 / 1000.0f);
} catch (JSONException e2) {
e2.printStackTrace();
}
c("mraidbridge.setvdPlayCurrentTime(" + jSONObject + ")");
}
public void a(String str, int i2, int i3, int i4) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("uniqueId", str);
jSONObject.put("duration", i2 / 1000.0f);
jSONObject.put(SocializeProtocolConstants.WIDTH, i3);
jSONObject.put(SocializeProtocolConstants.HEIGHT, i4);
} catch (JSONException e2) {
e2.printStackTrace();
}
c("mraidbridge.setvdReadyToPlay(" + jSONObject + ")");
}
void a(String str, ValueCallback valueCallback) {
if (this.f11301g == null) {
SigmobLog.e("Attempted to inject Javascript into MRAID WebView while was not attached:\n\t" + str);
return;
}
SigmobLog.d("Injecting Javascript into MRAID WebView:\n\t" + str);
if (Build.VERSION.SDK_INT >= 19) {
this.f11301g.evaluateJavascript(str, valueCallback);
return;
}
SigmobLog.e("Injecting Javascript into MRAID WebView:\n\t can't support less KITKAT" + str);
}
public void a(String str, String str2) {
this.f11299e = String.format("%s,%s,%s,%s", str, str2, str, str2);
SigMacroCommon macroCommon = this.b.getMacroCommon();
if (macroCommon instanceof SigMacroCommon) {
macroCommon.addMarcoKey(SigMacroCommon._DOWNX_, str);
macroCommon.addMarcoKey(SigMacroCommon._DOWNY_, str2);
macroCommon.addMarcoKey(SigMacroCommon._UPX_, str);
macroCommon.addMarcoKey(SigMacroCommon._UPY_, str2);
}
this.b.getClickCommon().down = new TouchLocation(Integer.parseInt(str), Integer.parseInt(str2));
this.b.getClickCommon().up = new TouchLocation(Integer.parseInt(str), Integer.parseInt(str2));
}
public void a(boolean z) {
c("mraidbridge.setIsViewable(" + z + ")");
}
public void a(boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7) {
c("mraidbridge.setSupports(" + z + Constants.ACCEPT_TIME_SEPARATOR_SP + z2 + Constants.ACCEPT_TIME_SEPARATOR_SP + z3 + Constants.ACCEPT_TIME_SEPARATOR_SP + z4 + Constants.ACCEPT_TIME_SEPARATOR_SP + z5 + Constants.ACCEPT_TIME_SEPARATOR_SP + z6 + Constants.ACCEPT_TIME_SEPARATOR_SP + z7 + ")");
}
boolean a(WebView webView, String str) {
InterfaceC0701b interfaceC0701b;
try {
new URI(str);
Uri parse = Uri.parse(str);
String scheme = parse.getScheme();
String host = parse.getHost();
if ("sigmob".equals(scheme)) {
if ("failLoad".equals(host) && this.c == PlacementType.INLINE && (interfaceC0701b = this.f11300f) != null) {
interfaceC0701b.c();
}
return true;
} else if (!BaseAdActivity.c.equals(scheme)) {
if (!TextUtils.isEmpty(str) && str.startsWith("http")) {
webView.loadUrl(str);
}
return true;
} else {
g a2 = g.a(host);
try {
a(a2, ClientMetadata.getQueryParamMap(parse));
} catch (Throwable th) {
a(a2, th.getMessage());
}
a(a2);
return true;
}
} catch (URISyntaxException unused) {
SigmobLog.e("Invalid MRAID URL: " + str);
a(g.UNSPECIFIED, "Mraid command sent an invalid URL");
return true;
}
}
public void b() {
o oVar = this.f11301g;
if (oVar != null) {
oVar.destroy();
this.f11301g = null;
}
}
public void b(ValueCallback valueCallback) {
a("mraidbridge.getAdDuration();", valueCallback);
}
@SuppressLint({"JavascriptInterface"})
public void b(String str) {
o oVar = this.f11301g;
if (oVar == null) {
SigmobLog.e("MRAID bridge called setContentHtml while WebView was not attached");
return;
}
oVar.addJavascriptInterface(new a(this), "sigandroid");
this.f11303i = false;
this.f11301g.loadUrl(str);
}
public void b(String str, int i2) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("uniqueId", str);
jSONObject.put(com.gaoding.android.sls.e.g.a.r, i2);
} catch (JSONException e2) {
e2.printStackTrace();
}
c("mraidbridge.setvdLoadStateChanged(" + jSONObject + ")");
}
public void b(String str, String str2) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("uniqueId", str);
jSONObject.put("error", str2);
} catch (JSONException e2) {
e2.printStackTrace();
}
c("mraidbridge.setvdPlayError(" + jSONObject + ")");
}
void c() {
c("sigmob.fireChangeEvent({\"osType\":2});");
}
public void c(String str) {
if (this.f11301g == null) {
SigmobLog.e("Attempted to inject Javascript into MRAID WebView while was not attached:\n\t" + str);
return;
}
SigmobLog.d("Injecting Javascript into MRAID WebView:\n\t" + str);
if (Build.VERSION.SDK_INT >= 19) {
this.f11301g.evaluateJavascript(str, null);
return;
}
o oVar = this.f11301g;
oVar.loadUrl("javascript:" + str);
}
public void c(String str, int i2) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("uniqueId", str);
jSONObject.put(com.gaoding.android.sls.e.g.a.r, i2);
} catch (JSONException e2) {
e2.printStackTrace();
}
c("mraidbridge.setvdPlayStateChanged(" + jSONObject + ")");
}
void d() {
c("mraidbridge.fireChangeEvent({\"hostSDKVersion\":4.4.0});");
}
void d(String str) {
c("mraidbridge.fireVideoSrc(\"" + str + "\")");
}
public void e() {
c("mraidbridge.notifyReadyEvent();");
}
void e(String str) {
c("mraidbridge.nativeCallCompleteV2(" + JSONObject.quote(str) + ")");
}
public void f() {
c("sigmob.notifyApkDownloadStartEvent();");
}
public void g() {
c("sigmob.notifyApkDownloadFailEvent();");
}
public void h() {
c("sigmob.notifyApkDownloadEndEvent();");
}
public void i() {
c("sigmob.notifyApkDownloadInstalledEvent();");
}
public void j() {
c("mraidbridge.startAd();");
}
boolean k() {
ag agVar = this.f11302h;
return agVar != null && agVar.c();
}
boolean l() {
o oVar = this.f11301g;
return oVar != null && oVar.i();
}
boolean m() {
return this.f11301g != null;
}
boolean n() {
return this.f11303i;
}
}