- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
504 lines
20 KiB
Java
504 lines
20 KiB
Java
package com.mbridge.msdk.newreward.player.presenter;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import android.util.Base64;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import com.facebook.appevents.internal.ViewHierarchyConstants;
|
|
import com.mbridge.msdk.foundation.d.a;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.newreward.a.b.b;
|
|
import com.mbridge.msdk.newreward.function.command.c;
|
|
import com.mbridge.msdk.newreward.function.command.f;
|
|
import com.mbridge.msdk.newreward.function.command.receiver.d;
|
|
import com.mbridge.msdk.newreward.function.g.e;
|
|
import com.mbridge.msdk.newreward.player.imodel.IECModel;
|
|
import com.mbridge.msdk.newreward.player.iview.IBaseWebView;
|
|
import com.mbridge.msdk.newreward.player.model.WebViewECModel;
|
|
import com.mbridge.msdk.newreward.player.view.hybrid.util.MBCommunicatorUtil;
|
|
import com.mbridge.msdk.out.RewardInfo;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
|
|
import java.lang.reflect.Proxy;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class ECWebPresenter extends AbsPresenter implements b {
|
|
final int END_CARD_BUILD_TYPE;
|
|
private final String TAG;
|
|
IECModel ecTempleModel;
|
|
a feedbackDialogEventListener;
|
|
boolean isLoadResourceError;
|
|
boolean isShown;
|
|
boolean isWebContentLoadFinish;
|
|
Handler mHandler;
|
|
float mTouchX;
|
|
float mTouchY;
|
|
IBaseWebView mWebContentView;
|
|
int muteState;
|
|
public Runnable nativeCloseBtnVisibleRunnable;
|
|
int webCloseViewStatus;
|
|
|
|
public void onAttachedToWindow() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void releaseSource() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqFailed(com.mbridge.msdk.foundation.c.b bVar) {
|
|
}
|
|
|
|
public ECWebPresenter(IBaseWebView iBaseWebView) {
|
|
super(iBaseWebView);
|
|
this.TAG = "ECWebPresenter";
|
|
this.webCloseViewStatus = -1;
|
|
this.muteState = -1;
|
|
this.isLoadResourceError = false;
|
|
this.isShown = false;
|
|
this.isWebContentLoadFinish = false;
|
|
this.END_CARD_BUILD_TYPE = 2;
|
|
this.mHandler = new Handler(Looper.getMainLooper());
|
|
this.nativeCloseBtnVisibleRunnable = new Runnable() { // from class: com.mbridge.msdk.newreward.player.presenter.ECWebPresenter.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
CampaignEx campaignEx;
|
|
ECWebPresenter eCWebPresenter = ECWebPresenter.this;
|
|
if (eCWebPresenter.webCloseViewStatus == -1 || (campaignEx = eCWebPresenter.campaignEx) == null || campaignEx.getVideo_end_type() == 4) {
|
|
ECWebPresenter.this.mWebContentView.setNativeCloseButtonVisibility(0);
|
|
}
|
|
}
|
|
};
|
|
this.feedbackDialogEventListener = new a() { // from class: com.mbridge.msdk.newreward.player.presenter.ECWebPresenter.2
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void showed() {
|
|
ECWebPresenter.this.firePrivacyFeedbackEvent(1);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void close() {
|
|
ECWebPresenter.this.firePrivacyFeedbackEvent(2);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void summit(String str) {
|
|
ECWebPresenter.this.firePrivacyFeedbackEvent(2);
|
|
}
|
|
};
|
|
this.mWebContentView = (IBaseWebView) Proxy.newProxyInstance(iBaseWebView.getClass().getClassLoader(), new Class[]{IBaseWebView.class}, new e(iBaseWebView, this.adapterModel, this.commandManager));
|
|
this.TEMPLATE_MARK_TYPE = 3;
|
|
}
|
|
|
|
public void addECModel() {
|
|
WebViewECModel webViewECModel = new WebViewECModel(this.commandManager, this.adapterModel);
|
|
webViewECModel.setCallbackListener(this);
|
|
webViewECModel.setRenderType(this.TEMPLATE_MARK_TYPE);
|
|
this.mWebContentView.getWebView().setHybridCommunicator(webViewECModel);
|
|
this.mWebContentView.getWebView().setWebViewEventListener(webViewECModel);
|
|
this.ecTempleModel = (IECModel) Proxy.newProxyInstance(WebViewECModel.class.getClassLoader(), new Class[]{IECModel.class}, new e(webViewECModel, this.adapterModel, this.commandManager));
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void click(View view) {
|
|
this.mWebContentView.removeTempleFromSuperView(this.data.getRootViewGroup());
|
|
if (isIVRewardEnable()) {
|
|
this.ecTempleModel.onAdCloseWithIVReward(this.mBridgeIds, this.adapterModel.ab(), this.adapterModel.w());
|
|
}
|
|
adClosed();
|
|
if (!this.isIV && this.adapterModel.ab()) {
|
|
this.ecTempleModel.eventAddReward(this.redirectModel);
|
|
}
|
|
finish(true);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void getView() {
|
|
initDataForView(null);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void initDataForView(com.mbridge.msdk.video.dynview.a aVar) {
|
|
this.mWebContentView.initViews(false);
|
|
ak.a(2, this.mWebContentView.getPrivacyButton(), this.adapterModel.U(), this.context, false, this.feedbackDialogEventListener);
|
|
}
|
|
|
|
public void onDetachedFromWindow() {
|
|
this.mHandler.removeCallbacks(this.nativeCloseBtnVisibleRunnable);
|
|
}
|
|
|
|
public void onActivityLifeCycleCallback(String str) {
|
|
String str2;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
str.hashCode();
|
|
switch (str) {
|
|
case "onDestroy":
|
|
adClosed();
|
|
finish(false);
|
|
str2 = "onSystemDestory";
|
|
break;
|
|
case "onPause":
|
|
str2 = "onSystemPause";
|
|
break;
|
|
case "onBackPressed":
|
|
str2 = "onSystemBackPressed";
|
|
break;
|
|
case "onResume":
|
|
str2 = "onSystemResume";
|
|
break;
|
|
default:
|
|
str2 = "";
|
|
break;
|
|
}
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
MBCommunicatorUtil.fireEvent(this.mWebContentView.getWebView(), str2, "");
|
|
}
|
|
if (str.equals("onBackPressed") && this.isShown) {
|
|
click(null);
|
|
}
|
|
}
|
|
|
|
public void onShown() {
|
|
adShowSuccess();
|
|
if (this.ecTempleModel == null || this.adapterModel.Z()) {
|
|
return;
|
|
}
|
|
int i = this.videoEndType;
|
|
if (i != 4 && i != 5) {
|
|
this.ecTempleModel.onEndCardShow(this.mBridgeIds, 2);
|
|
this.ecTempleModel.eventTrackingForEndCardShow(this.redirectModel, 2);
|
|
}
|
|
this.isShown = true;
|
|
if (this.isWebContentLoadFinish) {
|
|
this.mWebContentView.onWebViewShow(this.TEMPLATE_MARK_TYPE);
|
|
}
|
|
this.adapterModel.k(true);
|
|
changeNativeCloseButton();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void adShowSuccess() {
|
|
if (this.adapterModel.Y()) {
|
|
return;
|
|
}
|
|
this.adapterModel.j(true);
|
|
super.adShowSuccess();
|
|
this.ecTempleModel.onAdShow(this.mBridgeIds);
|
|
this.ecTempleModel.eventImpression(this.redirectModel);
|
|
this.ecTempleModel.eventOnlyImpression(this.redirectModel);
|
|
this.ecTempleModel.eventPvUrls(this.redirectModel);
|
|
this.ecTempleModel.eventTrackingForImpression(this.redirectModel);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void adClosed() {
|
|
if (this.adapterModel.aa()) {
|
|
return;
|
|
}
|
|
this.adapterModel.l(true);
|
|
if (this.reward != null) {
|
|
this.ecTempleModel.onAdClose(this.mBridgeIds, new RewardInfo(this.adapterModel.ab(), this.reward.a(), String.valueOf(this.reward.b())), 2);
|
|
}
|
|
}
|
|
|
|
public void changeNativeCloseButton() {
|
|
int cbd = this.adapterModel.U().getCbd();
|
|
if (cbd < 0) {
|
|
cbd = this.adapterModel.x().b().p();
|
|
}
|
|
this.mHandler.postDelayed(this.nativeCloseBtnVisibleRunnable, cbd * 1000);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void finish(boolean z) {
|
|
this.mWebContentView.onDestroyWebContent(this.TEMPLATE_MARK_TYPE);
|
|
d.a().d(f.SHOW_OR_PRELOAD_WEB_EC);
|
|
Context context = this.context;
|
|
if (context instanceof Activity) {
|
|
((Activity) context).finish();
|
|
}
|
|
}
|
|
|
|
public void onWebContentError() {
|
|
if (this.isLoadResourceError) {
|
|
return;
|
|
}
|
|
this.isLoadResourceError = true;
|
|
this.mWebContentView.onDestroyWebContent(this.TEMPLATE_MARK_TYPE);
|
|
if (this.isShown) {
|
|
CampaignEx campaignEx = this.campaignEx;
|
|
long ecTemplateId = campaignEx != null ? campaignEx.getEcTemplateId() : 404L;
|
|
c cVar = this.commandManager;
|
|
cVar.g(cVar.a("add_temple", Long.valueOf(ecTemplateId), "template_type", 18, "adapter_model", this.adapterModel, "parent_temple", this.data.getRootViewGroup()), f.SHOW_ADD_TEMPLE);
|
|
d.a().d(f.SHOW_OR_PRELOAD_WEB_EC);
|
|
} else {
|
|
this.ecTempleModel.setRenderStatus(1);
|
|
}
|
|
this.mWebContentView.removeTempleFromSuperView(this.data.getRootViewGroup());
|
|
}
|
|
|
|
public int getRenderStatus() {
|
|
return this.ecTempleModel.getRenderStatus();
|
|
}
|
|
|
|
public void setRenderError() {
|
|
IECModel iECModel = this.ecTempleModel;
|
|
if (iECModel != null) {
|
|
iECModel.setRenderStatus(1);
|
|
}
|
|
}
|
|
|
|
public void setNotchData(String str) {
|
|
MBCommunicatorUtil.notifyNotchData(this.mWebContentView.getWebView(), str);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqSuccessful(Object obj) {
|
|
char c;
|
|
int i;
|
|
try {
|
|
} catch (Throwable th) {
|
|
af.b("ECWebPresenter", th.getMessage());
|
|
}
|
|
if (obj instanceof JSONObject) {
|
|
JSONObject jSONObject = (JSONObject) obj;
|
|
if (jSONObject.length() > 0) {
|
|
String string = jSONObject.getString("action");
|
|
int i2 = 8;
|
|
switch (string.hashCode()) {
|
|
case -1765453640:
|
|
if (string.equals("toggleCloseBtn")) {
|
|
c = 3;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -1488920312:
|
|
if (string.equals("onReceivedError")) {
|
|
c = 7;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -1289167206:
|
|
if (string.equals("expand")) {
|
|
c = '\t';
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -1258199123:
|
|
if (string.equals("notifyCloseBtn")) {
|
|
c = 4;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -920773881:
|
|
if (string.equals("ivRewardAdsWithoutVideo")) {
|
|
c = 6;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -505277536:
|
|
if (string.equals("onPageFinished")) {
|
|
c = 2;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 94750088:
|
|
if (string.equals("click")) {
|
|
c = '\b';
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 94756344:
|
|
if (string.equals("close")) {
|
|
c = 5;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 96046965:
|
|
if (string.equals("readyStatus")) {
|
|
c = 0;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 1639551484:
|
|
if (string.equals("loadingResourceStatus")) {
|
|
c = 1;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 1843897919:
|
|
if (string.equals("feedbackOperate")) {
|
|
c = '\n';
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
default:
|
|
c = 65535;
|
|
break;
|
|
}
|
|
switch (c) {
|
|
case 0:
|
|
case 1:
|
|
if (jSONObject.optInt("status", 1) == 1) {
|
|
this.isWebContentLoadFinish = true;
|
|
break;
|
|
}
|
|
break;
|
|
case 2:
|
|
this.isWebContentLoadFinish = true;
|
|
if (this.isShown) {
|
|
this.mWebContentView.onWebViewShow(this.TEMPLATE_MARK_TYPE);
|
|
break;
|
|
}
|
|
break;
|
|
case 3:
|
|
int optInt = jSONObject.optInt("status", 1);
|
|
this.webCloseViewStatus = optInt;
|
|
this.mHandler.removeCallbacks(this.nativeCloseBtnVisibleRunnable);
|
|
this.mWebContentView.setNativeCloseButtonVisibility(optInt == 1 ? 0 : 4);
|
|
break;
|
|
case 4:
|
|
int optInt2 = jSONObject.optInt("status", -1);
|
|
if (optInt2 == 0 || optInt2 == 1) {
|
|
this.webCloseViewStatus = optInt2;
|
|
break;
|
|
}
|
|
case 5:
|
|
this.mWebContentView.onCloseViewClick(2);
|
|
break;
|
|
case 6:
|
|
int optInt3 = jSONObject.optInt("type");
|
|
int optInt4 = jSONObject.optInt(CampaignEx.JSON_NATIVE_VIDEO_COMPLETE);
|
|
if (optInt3 == 2) {
|
|
i = com.mbridge.msdk.foundation.same.a.D;
|
|
} else if (optInt3 == 3) {
|
|
i = com.mbridge.msdk.foundation.same.a.E;
|
|
} else {
|
|
i = com.mbridge.msdk.foundation.same.a.F;
|
|
}
|
|
this.adapterModel.b(i);
|
|
this.adapterModel.m(optInt4 == 1);
|
|
this.mWebContentView.onCloseViewClick(2);
|
|
break;
|
|
case 7:
|
|
onWebContentError();
|
|
break;
|
|
case '\b':
|
|
CampaignEx campaignEx = this.campaignEx;
|
|
if (campaignEx != null) {
|
|
campaignEx.setClickTempSource(com.mbridge.msdk.foundation.same.report.d.a.h);
|
|
}
|
|
this.ecTempleModel.eventTrackingForClick(this.redirectModel);
|
|
this.ecTempleModel.onAdClick(this.mBridgeIds);
|
|
break;
|
|
case '\t':
|
|
String optString = jSONObject.optString("url", "");
|
|
int optInt5 = jSONObject.optInt("shouldUseCustomClose", 1);
|
|
if (!TextUtils.isEmpty(optString)) {
|
|
this.mWebContentView.showMRAIDExpandView(optString, optInt5);
|
|
break;
|
|
}
|
|
break;
|
|
case '\n':
|
|
String optString2 = jSONObject.optString("type", "");
|
|
String optString3 = jSONObject.optString("status", "");
|
|
if (!TextUtils.isEmpty(optString2)) {
|
|
JSONObject jSONObject2 = new JSONObject(optString3);
|
|
if (optString2.equals("popup")) {
|
|
com.mbridge.msdk.foundation.d.b.a().a(jSONObject2.optString("key", ""), jSONObject2.optInt("view_visible", 1), this.feedbackDialogEventListener);
|
|
}
|
|
if (optString2.equals(ViewHierarchyConstants.DIMENSION_VISIBILITY_KEY)) {
|
|
int optInt6 = jSONObject2.optInt("view_visible", 1);
|
|
String optString4 = jSONObject2.optString("key", "");
|
|
com.mbridge.msdk.foundation.d.b a = com.mbridge.msdk.foundation.d.b.a();
|
|
if (optInt6 != 1) {
|
|
i2 = 0;
|
|
}
|
|
a.a(optString4, i2, this.mWebContentView.getWebView());
|
|
}
|
|
if (optString2.equals(TtmlNode.TAG_LAYOUT)) {
|
|
com.mbridge.msdk.foundation.d.b.a().a(jSONObject2.optString("key", ""), jSONObject2.optInt("width", -1), jSONObject2.optInt("height", -1), jSONObject2.optInt("radius", 20), jSONObject2.optInt("left", -1), jSONObject2.optInt("top", -1), (float) jSONObject2.optDouble("opacity", 1.0d), jSONObject2.optString("fontColor", ""), jSONObject2.optString("bgColor", ""), (float) jSONObject2.optDouble(TtmlNode.ATTR_TTS_FONT_SIZE, -1.0d), jSONObject2.optJSONArray("padding"));
|
|
break;
|
|
}
|
|
} else {
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public String getWebViewShowExtraData() {
|
|
if (this.reward == null) {
|
|
return "";
|
|
}
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("name", this.reward.a());
|
|
jSONObject2.put("amount", this.reward.b());
|
|
jSONObject2.put("id", "");
|
|
jSONObject.put("userId", "");
|
|
jSONObject.put("reward", jSONObject2);
|
|
jSONObject.put("playVideoMute", this.muteState);
|
|
jSONObject.put("extra", this.adapterModel.W());
|
|
return jSONObject.toString();
|
|
} catch (JSONException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
public int getCampaignOrientation() {
|
|
try {
|
|
if (this.adapterModel.U() != null) {
|
|
return this.adapterModel.U().getRewardTemplateMode().b();
|
|
}
|
|
return 0;
|
|
} catch (Throwable th) {
|
|
af.b("ECWebPresenter", th.getMessage());
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void firePrivacyFeedbackEvent(int i) {
|
|
String str;
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
if (com.mbridge.msdk.foundation.controller.c.m().c() != null) {
|
|
jSONObject.put("status", i);
|
|
}
|
|
str = Base64.encodeToString(jSONObject.toString().getBytes(), 2);
|
|
} catch (Throwable th) {
|
|
af.b("ECWebPresenter", th.getMessage(), th);
|
|
str = "";
|
|
}
|
|
MBCommunicatorUtil.fireEvent(this.mWebContentView.getWebView(), "onFeedbackAlertStatusNotify", str);
|
|
}
|
|
|
|
public void handleInterceptTouchEvent(MotionEvent motionEvent) {
|
|
this.mTouchX = motionEvent.getRawX();
|
|
this.mTouchY = motionEvent.getRawY();
|
|
}
|
|
}
|