Files
rr3-apk/decompiled-community/sources/com/tapjoy/d.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- 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
2026-02-18 15:48:36 -08:00

208 lines
8.5 KiB
Java

package com.tapjoy;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.URLUtil;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.gms.drive.DriveFile;
import com.tapjoy.TapjoyErrorMessage;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
/* loaded from: classes4.dex */
public final class d extends WebViewClient {
public final /* synthetic */ TJAdUnit a;
public d(TJAdUnit tJAdUnit) {
this.a = tJAdUnit;
}
public final boolean a(String str) {
NetworkInfo activeNetworkInfo;
TJAdUnit tJAdUnit = this.a;
tJAdUnit.getClass();
try {
if (tJAdUnit.e.getContext() != null && (activeNetworkInfo = ((ConnectivityManager) tJAdUnit.e.getContext().getSystemService("connectivity")).getActiveNetworkInfo()) != null && activeNetworkInfo.isAvailable()) {
if (activeNetworkInfo.isConnected() && URLUtil.isValidUrl(str)) {
this.a.getClass();
try {
String host = new URL(TapjoyConnectCore.getInstance().getHostURL()).getHost();
if ((host != null && str.contains(host)) || str.contains(TapjoyConnectCore.getInstance().getRedirectDomain()) || str.contains(TapjoyUtil.getRedirectDomain(TapjoyConnectCore.getInstance().getPlacementURL()))) {
return false;
}
} catch (MalformedURLException unused) {
}
if (this.a.c.allowRedirect) {
Uri parse = Uri.parse(str);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(parse);
intent.addFlags(DriveFile.MODE_READ_ONLY);
if (this.a.e.getContext() != null) {
try {
this.a.e.getContext().startActivity(intent);
return true;
} catch (Exception e) {
TapjoyLog.e("TJAdUnit", "Exception in loading URL. " + e.getMessage());
}
}
} else if (str.startsWith("javascript:")) {
try {
this.a.e.evaluateJavascript(str.replaceFirst("javascript:", ""), null);
return true;
} catch (Exception e2) {
TapjoyLog.e("TJAdUnit", "Exception in evaluateJavascript. Device not supported. " + e2.toString());
}
}
return false;
}
}
} catch (Exception e3) {
TapjoyLog.d("TJAdUnit", "Exception getting NetworkInfo: " + e3.getLocalizedMessage());
}
TJAdUnitActivity tJAdUnitActivity = this.a.b;
if (tJAdUnitActivity != null) {
tJAdUnitActivity.showErrorDialog();
}
return true;
}
@Override // android.webkit.WebViewClient
public final void onLoadResource(WebView webView, String str) {
}
@Override // android.webkit.WebViewClient
public final void onPageFinished(WebView webView, String str) {
TJAdUnitJSBridge tJAdUnitJSBridge;
TapjoyLog.d("TJAdUnit", "onPageFinished: " + str);
TJAdUnit tJAdUnit = this.a;
if (tJAdUnit.j) {
return;
}
TJAdUnitActivity tJAdUnitActivity = tJAdUnit.b;
if (tJAdUnitActivity != null) {
tJAdUnitActivity.setProgressSpinnerVisibility(false);
}
TJAdUnit tJAdUnit2 = this.a;
tJAdUnit2.j = true;
if (tJAdUnit2.f && (tJAdUnitJSBridge = tJAdUnit2.c) != null) {
tJAdUnitJSBridge.display();
}
TJAdUnitJSBridge tJAdUnitJSBridge2 = this.a.c;
if (tJAdUnitJSBridge2 != null) {
tJAdUnitJSBridge2.flushMessageQueue();
}
}
@Override // android.webkit.WebViewClient
public final void onPageStarted(WebView webView, String str, Bitmap bitmap) {
TapjoyLog.d("TJAdUnit", "onPageStarted: " + str);
TJAdUnitJSBridge tJAdUnitJSBridge = this.a.c;
if (tJAdUnitJSBridge != null) {
tJAdUnitJSBridge.allowRedirect = true;
tJAdUnitJSBridge.customClose = false;
tJAdUnitJSBridge.closeRequested = false;
}
}
@Override // android.webkit.WebViewClient
public final void onReceivedError(WebView webView, int i, String str, String str2) {
TapjoyLog.d("TJAdUnit", "error:" + str);
TJAdUnitActivity tJAdUnitActivity = this.a.b;
if (tJAdUnitActivity != null) {
tJAdUnitActivity.showErrorDialog();
}
if (this.a.getSdkBeacon() != null) {
com.tapjoy.internal.z0 sdkBeacon = this.a.getSdkBeacon();
if (!TextUtils.isEmpty(sdkBeacon.d)) {
HashMap hashMap = new HashMap(sdkBeacon.b);
hashMap.put("error", "loadFailure");
new com.tapjoy.internal.y0(sdkBeacon, hashMap).start();
}
}
super.onReceivedError(webView, i, str, str2);
}
@Override // android.webkit.WebViewClient
public final boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
TapjoyLog.e("TJAdUnit", new TapjoyErrorMessage(TapjoyErrorMessage.ErrorType.SDK_ERROR, "WebView rendering process exited while instantiating a WebViewClient unexpectedly"));
if (this.a.getSdkBeacon() != null) {
com.tapjoy.internal.z0 sdkBeacon = this.a.getSdkBeacon();
if (!TextUtils.isEmpty(sdkBeacon.d)) {
HashMap hashMap = new HashMap(sdkBeacon.b);
hashMap.put("error", "terminated");
new com.tapjoy.internal.y0(sdkBeacon, hashMap).start();
}
}
View view = this.a.d;
if (view != null) {
ViewGroup viewGroup = (ViewGroup) view.getParent();
if (viewGroup != null) {
viewGroup.removeView(this.a.d);
}
this.a.d = null;
}
TJWebView tJWebView = this.a.e;
if (tJWebView != null) {
ViewGroup viewGroup2 = (ViewGroup) tJWebView.getParent();
if (viewGroup2 != null) {
viewGroup2.removeView(this.a.e);
}
this.a.e.removeAllViews();
this.a.e.destroy();
this.a.e = null;
}
TJAdUnitJSBridge tJAdUnitJSBridge = this.a.c;
if (tJAdUnitJSBridge != null) {
tJAdUnitJSBridge.cleanUpJSBridge();
this.a.c = null;
}
TJAdUnitActivity tJAdUnitActivity = this.a.b;
if (tJAdUnitActivity == null) {
return true;
}
tJAdUnitActivity.finish();
return true;
}
@Override // android.webkit.WebViewClient
public final WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
TapjoyCachedAssetData cachedDataForURL;
WebResourceResponse webResourceResponse;
if (TapjoyCache.getInstance() != null && (cachedDataForURL = TapjoyCache.getInstance().getCachedDataForURL(str)) != null) {
try {
webResourceResponse = new WebResourceResponse(cachedDataForURL.getMimeType(), "UTF-8", new FileInputStream(cachedDataForURL.getLocalFilePath()));
} catch (Exception unused) {
webResourceResponse = null;
}
if (webResourceResponse != null) {
TapjoyLog.d("TJAdUnit", "Reading request for " + str + " from cache -- localPath: " + cachedDataForURL.getLocalFilePath());
return webResourceResponse;
}
}
return super.shouldInterceptRequest(webView, str);
}
@Override // android.webkit.WebViewClient
public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
return a(str);
}
@Override // android.webkit.WebViewClient
public final boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
return a(webResourceRequest.getUrl().toString());
}
}