正在查看: imToken v3.28.8 应用的 PingppWebView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: imToken v3.28.8 应用的 PingppWebView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.pingplusplus.android;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.pingplusplus.android.WebViewEx;
import com.sensorsdata.analytics.android.sdk.SensorsDataAutoTrackHelper;
import java.util.Arrays;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt;
import org.json.JSONException;
import org.json.JSONObject;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000~\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0011\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\r\b\u0016\u0018\u0000 I2\u00020\u0001:\u0004IJKLB\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u000e\u0010<\u001a\u00020\u00002\u0006\u0010=\u001a\u00020\u0014J\u000e\u0010>\u001a\u00020\u00002\u0006\u0010=\u001a\u00020\u0014J\u0010\u0010?\u001a\u00020@2\u0006\u0010\u0004\u001a\u00020\u0005H\u0014J\b\u0010A\u001a\u00020@H\u0014J\u0006\u0010B\u001a\u00020@J\u001a\u0010B\u001a\u00020@2\b\u0010C\u001a\u0004\u0018\u00010 2\b\u0010D\u001a\u0004\u0018\u00010\"J\b\u0010E\u001a\u00020@H\u0016J\u0012\u0010F\u001a\u00020@2\b\u0010C\u001a\u0004\u0018\u00010 H\u0004J\u0006\u0010G\u001a\u00020@J\b\u0010H\u001a\u00020@H\u0003R\u0014\u0010\u0007\u001a\u00020\bX\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u0014\u0010\u000b\u001a\u00020\bX\u0086D¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\nR\u001a\u0010\r\u001a\u00020\u000eX\u0084.¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u0012\u0010\u0013\u001a\u00020\u00148\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0014X\u0082D¢\u0006\u0002\n\u0000R\u0012\u0010\u0016\u001a\u00020\u00148\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0017\u001a\u00020\u00188\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0019\u001a\u00020\u001aX\u0084.¢\u0006\u000e\n\u0000\u001a\u0004\b\u001b\u0010\u001c\"\u0004\b\u001d\u0010\u001eR\u0014\u0010\u001f\u001a\u0004\u0018\u00010 8\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000R\u0010\u0010!\u001a\u0004\u0018\u00010\"X\u0082\u0004¢\u0006\u0002\n\u0000R\u0012\u0010#\u001a\u00020\u00148\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000R\u000e\u0010$\u001a\u00020\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010%\u001a\u00020&X\u0084.¢\u0006\u000e\n\u0000\u001a\u0004\b'\u0010(\"\u0004\b)\u0010*R\u0010\u0010+\u001a\u0004\u0018\u00010 X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010,\u001a\u0004\u0018\u00010 8\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000R\"\u0010-\u001a\n\u0012\u0004\u0012\u00020/\u0018\u00010.X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b0\u00101\"\u0004\b2\u00103R(\u00104\u001a\u0010\u0012\n\u0012\b\u0012\u0004\u0012\u00020/05\u0018\u00010.X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b6\u00101\"\u0004\b7\u00103R\u0010\u00108\u001a\u0004\u0018\u000109X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010:\u001a\u0004\u0018\u00010;8\u0004@\u0004X\u0085\u000e¢\u0006\u0002\n\u0000¨\u0006M"}, d2 = {"Lcom/pingplusplus/android/PingppWebView;", "", "activity", "Landroid/app/Activity;", "chargeJson", "Lorg/json/JSONObject;", "(Landroid/app/Activity;Lorg/json/JSONObject;)V", "FILECHOOSER_RESULTCODE", "", "getFILECHOOSER_RESULTCODE", "()I", "FILECHOOSER_RESULTCODE_FOR_ANDROID_5", "getFILECHOOSER_RESULTCODE_FOR_ANDROID_5", "flTitle", "Landroid/widget/FrameLayout;", "getFlTitle", "()Landroid/widget/FrameLayout;", "setFlTitle", "(Landroid/widget/FrameLayout;)V", "isCanBack", "", "isFirstLoad", "isSuccess", "mActivity", "Lcom/pingplusplus/android/PaymentActivity;", "mBackIv", "Landroid/widget/ImageView;", "getMBackIv", "()Landroid/widget/ImageView;", "setMBackIv", "(Landroid/widget/ImageView;)V", "mChannel", "", "mData", "", "mIgnoreReturnUrl", "mIgnoreTitleBar", "mProgressBar", "Landroid/widget/ProgressBar;", "getMProgressBar", "()Landroid/widget/ProgressBar;", "setMProgressBar", "(Landroid/widget/ProgressBar;)V", "mReturnUrl", "mURL", "mUploadMessage", "Landroid/webkit/ValueCallback;", "Landroid/net/Uri;", "getMUploadMessage", "()Landroid/webkit/ValueCallback;", "setMUploadMessage", "(Landroid/webkit/ValueCallback;)V", "mUploadMessageForAndroid5", "", "getMUploadMessageForAndroid5", "setMUploadMessageForAndroid5", "mView", "Landroid/view/View;", "mWebView", "Lcom/pingplusplus/android/WebViewEx;", "ignoreReturnUrl", "ignore", "ignoreTitleBar", "initData", "", "initWebView", "loadUrl", "url", "data", "onBack", "setIntentUri", "setTitleColor", "setWebSettings", "Companion", "InJavaScriptLocalObj", "WebAppInterface", "WebViewClientExInner", "pingpp-android_release"}, k = 1, mv = {1, 1, 16})
public class PingppWebView {
protected WebViewEx a;
protected PaymentActivity b;
protected String c;
protected ImageView d;
protected ProgressBar e;
protected FrameLayout f;
private View g;
protected boolean h;
private final boolean i;
protected boolean j;
protected boolean k;
private ValueCallback<Uri> l;
private ValueCallback<Uri[]> m;
private final int n;
private final int o;
static final class a implements View.OnClickListener {
a() {
}
@Override
public final void onClick(View view) {
PingppWebView.this.g();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
}
}
public static final class b {
private b() {
}
public b(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public final class c {
public c() {
}
@JavascriptInterface
public final void showSource(String str) {
Intrinsics.checkParameterIsNotNull(str, "html");
if (StringsKt.contains$default(str, "支付成功", false, 2, (Object) null)) {
PingppWebView pingppWebView = PingppWebView.this;
pingppWebView.j = true;
pingppWebView.b.e = "success";
}
if (StringsKt.contains$default(str, "您已购买成功", false, 2, (Object) null) || StringsKt.contains$default(str, "本次消费已计入您的账单", false, 2, (Object) null)) {
PingppWebView pingppWebView2 = PingppWebView.this;
pingppWebView2.j = true;
pingppWebView2.b.e = "success";
}
}
}
public final class d {
final PingppWebView a;
public d(PingppWebView pingppWebView, Context context) {
Intrinsics.checkParameterIsNotNull(context, "mContext");
this.a = pingppWebView;
}
@JavascriptInterface
public final void paymentResult(String str) {
if (str == null) {
this.a.b.a("fail", "unknown_error");
} else if (Intrinsics.areEqual(str, "success")) {
this.a.b.a("success");
} else {
this.a.b.a("fail", "unknown_error");
}
}
@JavascriptInterface
public final void setResult(String str) {
if (str == null) {
this.a.b.a("fail", "unknown_error");
} else if (Intrinsics.areEqual(str, "success")) {
this.a.b.a("success");
} else {
this.a.b.a("fail", "unknown_error");
}
}
@JavascriptInterface
public final void testmodeResult(String str) {
PaymentActivity paymentActivity;
String str2 = "unknown_error";
if (str == null) {
this.a.b.a("fail", "unknown_error");
return;
}
int hashCode = str.hashCode();
if (hashCode != -1867169789) {
if (hashCode != -1367724422) {
if (hashCode != 3135262) {
if (hashCode == 96784904 && str.equals("error")) {
paymentActivity = this.a.b;
str2 = "testmode_notify_failed";
}
} else if (str.equals("fail")) {
paymentActivity = this.a.b;
str2 = "channel_returns_fail";
}
paymentActivity.a("fail", str2);
}
if (str.equals("cancel")) {
this.a.b.a("cancel", "user_cancelled");
return;
}
} else if (str.equals("success")) {
this.a.b.a("success");
return;
}
paymentActivity = this.a.b;
paymentActivity.a("fail", str2);
}
}
public final class e extends WebViewEx.c {
public e() {
}
@Override
public void onPageFinished(WebView webView, String str) {
Intrinsics.checkParameterIsNotNull(webView, "view");
Intrinsics.checkParameterIsNotNull(str, "url");
super.onPageFinished(webView, str);
PingppWebView.this.c().setVisibility(8);
}
@Override
public void onReceivedError(WebView webView, int i, String str, String str2) {
Intrinsics.checkParameterIsNotNull(webView, "view");
Intrinsics.checkParameterIsNotNull(str, "description");
Intrinsics.checkParameterIsNotNull(str2, "failingUrl");
PingppWebView.this.b.a("fail");
}
}
static {
new b(null);
}
public PingppWebView(Activity activity, JSONObject jSONObject) {
Intrinsics.checkParameterIsNotNull(activity, "activity");
Intrinsics.checkParameterIsNotNull(jSONObject, "chargeJson");
this.h = PingppObject.INSTANCE.a().ignoreResultUrl;
this.i = PingppObject.INSTANCE.a().ignoreTitleBar;
this.k = true;
this.n = 1;
this.o = 2;
this.a = new WebViewEx(activity);
this.b = (PaymentActivity) activity;
View view = null;
try {
view = LayoutInflater.from(activity).inflate(activity.getResources().getIdentifier("activity_pingpp_payment", "layout", activity.getPackageName()), (ViewGroup) null);
} catch (Exception unused) {
Log.e("PING++", "请导入 activity_pingpp_payment.xml 文件");
this.b.a("fail");
}
this.g = view;
if (view != null) {
int identifier = activity.getResources().getIdentifier("pingpp_webView", "id", activity.getPackageName());
View view2 = this.g;
if (view2 == null) {
Intrinsics.throwNpe();
}
View findViewById = view2.findViewById(identifier);
if (findViewById == null) {
throw new TypeCastException("null cannot be cast to non-null type com.pingplusplus.android.WebViewEx");
}
this.a = (WebViewEx) findViewById;
int identifier2 = activity.getResources().getIdentifier("pingpp_progressbar", "id", activity.getPackageName());
View view3 = this.g;
if (view3 == null) {
Intrinsics.throwNpe();
}
View findViewById2 = view3.findViewById(identifier2);
if (findViewById2 == null) {
throw new TypeCastException("null cannot be cast to non-null type android.widget.ProgressBar");
}
this.e = (ProgressBar) findViewById2;
int identifier3 = activity.getResources().getIdentifier("pingpp_title", "id", activity.getPackageName());
View view4 = this.g;
if (view4 == null) {
Intrinsics.throwNpe();
}
View findViewById3 = view4.findViewById(identifier3);
if (findViewById3 == null) {
throw new TypeCastException("null cannot be cast to non-null type android.widget.FrameLayout");
}
this.f = (FrameLayout) findViewById3;
int identifier4 = activity.getResources().getIdentifier("pingpp_back", "id", activity.getPackageName());
View view5 = this.g;
if (view5 == null) {
Intrinsics.throwNpe();
}
View findViewById4 = view5.findViewById(identifier4);
if (findViewById4 == null) {
throw new TypeCastException("null cannot be cast to non-null type android.widget.ImageView");
}
ImageView imageView = (ImageView) findViewById4;
this.d = imageView;
if (imageView == null) {
Intrinsics.throwUninitializedPropertyAccessException("mBackIv");
}
imageView.setOnClickListener(new a());
i();
h();
f();
try {
a(jSONObject);
} catch (JSONException e2) {
this.b.a("fail", "invalid_credential");
e2.printStackTrace();
}
}
}
private final void i() {
WebViewEx webViewEx = this.a;
if (webViewEx == null) {
Intrinsics.throwNpe();
}
WebSettings settings = webViewEx.getSettings();
Intrinsics.checkExpressionValueIsNotNull(settings, "webSettings");
settings.setJavaScriptEnabled(true);
settings.setSupportZoom(false);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setDomStorageEnabled(true);
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%s; %s/%s", Arrays.copyOf(new Object[]{settings.getUserAgentString(), "PingppAndroidSDK", Pingpp.VERSION}, 3));
Intrinsics.checkExpressionValueIsNotNull(format, "java.lang.String.format(format, *args)");
settings.setUserAgentString(format);
WebViewEx webViewEx2 = this.a;
if (webViewEx2 == null) {
Intrinsics.throwNpe();
}
webViewEx2.a(new d(this, this.b), "PingppAndroidSDK");
WebViewEx webViewEx3 = this.a;
if (webViewEx3 == null) {
Intrinsics.throwNpe();
}
webViewEx3.a(new d(this, this.b), "PingppSDK");
WebViewEx webViewEx4 = this.a;
if (webViewEx4 == null) {
Intrinsics.throwNpe();
}
webViewEx4.a(new c(), "local_obj");
WebViewEx webViewEx5 = this.a;
if (webViewEx5 == null) {
Intrinsics.throwNpe();
}
webViewEx5.removeJavascriptInterface("accessibility");
WebViewEx webViewEx6 = this.a;
if (webViewEx6 == null) {
Intrinsics.throwNpe();
}
webViewEx6.removeJavascriptInterface("searchBoxJavaBridge_");
WebViewEx webViewEx7 = this.a;
if (webViewEx7 == null) {
Intrinsics.throwNpe();
}
webViewEx7.removeJavascriptInterface("accessibilityTraversal");
}
public final int getN() {
return this.n;
}
public final PingppWebView a(boolean z) {
ImageView imageView;
int i;
if (z) {
imageView = this.d;
if (imageView == null) {
Intrinsics.throwUninitializedPropertyAccessException("mBackIv");
}
i = 8;
} else {
imageView = this.d;
if (imageView == null) {
Intrinsics.throwUninitializedPropertyAccessException("mBackIv");
}
i = 0;
}
imageView.setVisibility(i);
return this;
}
public final void a(ValueCallback<Uri> valueCallback) {
this.l = valueCallback;
}
public final void a(String str) {
try {
Uri parse = Uri.parse(str);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(parse);
this.b.startActivity(intent);
} catch (Exception e2) {
e2.printStackTrace();
}
}
public final void a(String str, byte[] bArr) {
this.b.setContentView(this.g);
if (bArr == null) {
WebViewEx webViewEx = this.a;
if (webViewEx == null) {
Intrinsics.throwNpe();
}
webViewEx.loadUrl(str);
return;
}
WebViewEx webViewEx2 = this.a;
if (webViewEx2 == null) {
Intrinsics.throwNpe();
}
webViewEx2.postUrl(str, bArr);
}
protected void a(JSONObject jSONObject) {
String format;
Intrinsics.checkParameterIsNotNull(jSONObject, "chargeJson");
String optString = jSONObject.optString("channel");
String optString2 = jSONObject.optString("order_id");
String optString3 = jSONObject.optString("id");
PingppLog.d("模拟支付页面: 支付渠道 " + optString);
if (TextUtils.isEmpty(optString2)) {
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
format = String.format("https://sissi.pingxx.com/mock.php?ch_id=%s&channel=%s", Arrays.copyOf(new Object[]{optString3, optString}, 2));
} else {
StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
format = String.format("https://sissi.pingxx.com/mock.php?ch_id=%s&channel=%s&or_id=%s", Arrays.copyOf(new Object[]{optString3, optString, optString2}, 3));
}
Intrinsics.checkExpressionValueIsNotNull(format, "java.lang.String.format(format, *args)");
PingppLog.a(format);
a(format, null);
}
public final int getO() {
return this.o;
}
public final void b(ValueCallback<Uri[]> valueCallback) {
this.m = valueCallback;
}
public final ProgressBar c() {
ProgressBar progressBar = this.e;
if (progressBar == null) {
Intrinsics.throwUninitializedPropertyAccessException("mProgressBar");
}
return progressBar;
}
public final ValueCallback<Uri> d() {
return this.l;
}
public final ValueCallback<Uri[]> e() {
return this.m;
}
protected void f() {
WebViewEx webViewEx = this.a;
if (webViewEx == null) {
Intrinsics.throwNpe();
}
webViewEx.setWebViewClient(new e());
}
public void g() {
if (this.k) {
WebViewEx webViewEx = this.a;
if (webViewEx != null) {
if (webViewEx == null) {
Intrinsics.throwNpe();
}
if (webViewEx.canGoBack() && !this.j) {
WebViewEx webViewEx2 = this.a;
if (webViewEx2 == null) {
Intrinsics.throwNpe();
}
webViewEx2.goBack();
return;
}
}
PaymentActivity paymentActivity = this.b;
paymentActivity.a(paymentActivity.e);
}
}
public final void h() {
if (this.i) {
FrameLayout frameLayout = this.f;
if (frameLayout == null) {
Intrinsics.throwUninitializedPropertyAccessException("flTitle");
}
frameLayout.setVisibility(8);
}
}
}