- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
224 lines
8.7 KiB
Java
224 lines
8.7 KiB
Java
package com.mbridge.msdk.video.signal.communication;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import android.util.Base64;
|
|
import com.mbridge.msdk.foundation.controller.c;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.mbsignalcommon.communication.d;
|
|
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
|
|
import com.mbridge.msdk.mbsignalcommon.windvane.g;
|
|
import com.mbridge.msdk.video.signal.factory.IJSFactory;
|
|
import com.unity3d.ads.core.domain.HandleInvocationsFromAdViewer;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class BaseRewardSignalH5 extends a {
|
|
protected IJSFactory a;
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public void initialize(Context context, WindVaneWebView windVaneWebView) {
|
|
if (context instanceof IJSFactory) {
|
|
this.a = (IJSFactory) context;
|
|
}
|
|
}
|
|
|
|
public void initialize(Object obj, WindVaneWebView windVaneWebView) {
|
|
if (obj instanceof IJSFactory) {
|
|
this.a = (IJSFactory) obj;
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void getEndScreenInfo(Object obj, String str) {
|
|
String str2;
|
|
try {
|
|
IJSFactory iJSFactory = this.a;
|
|
if (iJSFactory != null) {
|
|
String a = iJSFactory.getIJSRewardVideoV1().a();
|
|
if (!TextUtils.isEmpty(a)) {
|
|
str2 = Base64.encodeToString(a.getBytes(), 2);
|
|
af.a("JS-Reward-Communication", "getEndScreenInfo success");
|
|
} else {
|
|
str2 = "";
|
|
af.a("JS-Reward-Communication", "getEndScreenInfo failed");
|
|
}
|
|
g.a().a(obj, str2);
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "getEndScreenInfo", th);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void install(Object obj, String str) {
|
|
try {
|
|
if (this.a != null) {
|
|
af.a("JS-Reward-Communication", "install:" + str);
|
|
if (this.a.getJSContainerModule().endCardShowing()) {
|
|
this.a.getJSCommon().click(3, str);
|
|
} else {
|
|
this.a.getJSCommon().click(1, str);
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "install", th);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void openURL(Object obj, String str) {
|
|
WindVaneWebView windVaneWebView;
|
|
af.b("JS-Reward-Communication", "openURL:" + str);
|
|
Context c = c.m().c();
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
if (c == null) {
|
|
try {
|
|
if ((obj instanceof com.mbridge.msdk.mbsignalcommon.windvane.a) && (windVaneWebView = ((com.mbridge.msdk.mbsignalcommon.windvane.a) obj).b) != null) {
|
|
c = windVaneWebView.getContext();
|
|
}
|
|
} catch (Exception e) {
|
|
af.b("JS-Reward-Communication", e.getMessage());
|
|
}
|
|
}
|
|
if (c == null) {
|
|
return;
|
|
}
|
|
try {
|
|
JSONObject jSONObject = new JSONObject(str);
|
|
String optString = jSONObject.optString("url");
|
|
int optInt = jSONObject.optInt("type");
|
|
if (optInt == 1) {
|
|
com.mbridge.msdk.click.c.d(c, optString);
|
|
} else if (optInt == 2) {
|
|
com.mbridge.msdk.click.c.f(c, optString);
|
|
}
|
|
} catch (JSONException e2) {
|
|
af.b("JS-Reward-Communication", e2.getMessage());
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void notifyCloseBtn(Object obj, String str) {
|
|
try {
|
|
if (this.a == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
int optInt = new JSONObject(str).optInt("state");
|
|
af.a("JS-Reward-Communication", "notifyCloseBtn,state:" + str);
|
|
this.a.getIJSRewardVideoV1().notifyCloseBtn(optInt);
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "notifyCloseBtn", th);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void toggleCloseBtn(Object obj, String str) {
|
|
try {
|
|
if (this.a == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
int optInt = new JSONObject(str).optInt("state");
|
|
af.a("JS-Reward-Communication", "toggleCloseBtn,state:" + str);
|
|
this.a.getIJSRewardVideoV1().toggleCloseBtn(optInt);
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "toggleCloseBtn", th);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void triggerCloseBtn(Object obj, String str) {
|
|
try {
|
|
if (this.a == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
g.a().a(obj, a(0));
|
|
this.a.getIJSRewardVideoV1().a(new JSONObject(str).optString("state"));
|
|
af.a("JS-Reward-Communication", "triggerCloseBtn,state:" + str);
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "triggerCloseBtn", th);
|
|
g.a().a(obj, a(-1));
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void setOrientation(Object obj, String str) {
|
|
try {
|
|
if (this.a == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
String optString = new JSONObject(str).optString("state");
|
|
af.a("JS-Reward-Communication", "setOrientation,state:" + str);
|
|
this.a.getIJSRewardVideoV1().b(optString);
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "setOrientation", th);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void handlerPlayableException(Object obj, String str) {
|
|
try {
|
|
if (this.a == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
String optString = new JSONObject(str).optString("msg");
|
|
af.a("JS-Reward-Communication", "handlerPlayableException,msg:" + str);
|
|
this.a.getIJSRewardVideoV1().c(optString);
|
|
} catch (Throwable th) {
|
|
af.b("JS-Reward-Communication", "setOrientation", th);
|
|
}
|
|
}
|
|
|
|
private String a(int i) {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("code", i);
|
|
String jSONObject2 = jSONObject.toString();
|
|
return !TextUtils.isEmpty(jSONObject2) ? Base64.encodeToString(jSONObject2.getBytes(), 2) : "";
|
|
} catch (Throwable unused) {
|
|
af.b("JS-Reward-Communication", "code to string is error");
|
|
return "";
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.signal.communication.BaseIRewardCommunication
|
|
public void cai(Object obj, String str) {
|
|
af.a("JS-Reward-Communication", "cai:" + str);
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
try {
|
|
try {
|
|
String optString = new JSONObject(str).optString(HandleInvocationsFromAdViewer.KEY_PACKAGE_NAME);
|
|
if (TextUtils.isEmpty(optString)) {
|
|
d.a(obj, "packageName is empty");
|
|
}
|
|
int i = ak.c(c.m().c(), optString) ? 1 : 2;
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("code", d.b);
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("result", i);
|
|
jSONObject.put("data", jSONObject2);
|
|
g.a().a(obj, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
|
|
} catch (Exception e) {
|
|
d.a(obj, e.getMessage());
|
|
af.a("JS-Reward-Communication", e.getMessage());
|
|
}
|
|
} catch (Throwable th) {
|
|
d.a(obj, "exception: " + th.getLocalizedMessage());
|
|
af.b("JS-Reward-Communication", "cai", th);
|
|
}
|
|
} catch (JSONException e2) {
|
|
d.a(obj, "exception: " + e2.getLocalizedMessage());
|
|
af.b("JS-Reward-Communication", "cai", e2);
|
|
}
|
|
}
|
|
}
|