正在查看: Easycash v3.75.13 应用的 EasyCashWebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Easycash v3.75.13 应用的 EasyCashWebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.lingyue.easycash.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.fintopia.livenessdetection.LivenessDetectionManager;
import com.fintopia.livenessdetection.facev5.models.LiveDetectionArgs;
import com.github.lzyzsd.jsbridge.BridgeWebView;
import com.github.lzyzsd.jsbridge.CallBackFunction;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.credentials.Credential;
import com.google.android.gms.auth.api.credentials.HintRequest;
import com.google.android.gms.common.api.GoogleApiClient;
import com.lingyue.easycash.ECServerApiConfig;
import com.lingyue.easycash.R;
import com.lingyue.easycash.account.ECLoginAndRegisterV2Activity;
import com.lingyue.easycash.activity.EasyCashWebViewActivity;
import com.lingyue.easycash.authentication.activity.ECLiveCheckPreviewActivity;
import com.lingyue.easycash.authentication.activity.ECLiveRecognitionResultActivity;
import com.lingyue.easycash.business.faceliveness.AuthFaceLiveNessHelper;
import com.lingyue.easycash.business.nsrender.IWebViewInstance;
import com.lingyue.easycash.business.nsrender.WebViewCore;
import com.lingyue.easycash.business.screenshotprotect.ScreenShotProtect;
import com.lingyue.easycash.commom.BaseWebViewActivity;
import com.lingyue.easycash.models.BluePayEvent;
import com.lingyue.easycash.models.ChoosePicResult;
import com.lingyue.easycash.models.EventLoginOrRegisterEnd;
import com.lingyue.easycash.models.SetPasswordSuccess;
import com.lingyue.easycash.utils.EasycashUmengEvent;
import com.lingyue.easycash.utils.H5GetKtpHelper;
import com.lingyue.easycash.utils.SensorTrackEvent;
import com.lingyue.easycash.utils.YqdUtils;
import com.lingyue.easycash.widght.webViewPart.EasyCashJsBridgeHandler;
import com.lingyue.easycash.widght.webViewPart.FaceLiveNessDetectResult;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.IdnBaseResult;
import com.lingyue.idnbaselib.model.events.DeleteUserReasonEvent;
import com.lingyue.idnbaselib.model.live.FaceIdCard;
import com.lingyue.idnbaselib.model.live.LiveDetectionEvent;
import com.lingyue.idnbaselib.utils.DevUtil;
import com.lingyue.idnbaselib.utils.EcUriUtil;
import com.lingyue.idnbaselib.utils.FieldRuleUtils;
import com.lingyue.idnbaselib.utils.GsonUtil;
import com.lingyue.idnbaselib.utils.JsonParamsBuilder;
import com.lingyue.idnbaselib.utils.TechSensorTrackEvent;
import com.lingyue.idnbaselib.utils.ThirdPartEventUtils;
import com.lingyue.supertoolkit.screen.IScreenShotProtectPage;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.veda.android.networklib.domain.WebDomainManager;
import cz.msebera.android.httpclient.cookie.ClientCookie;
import io.reactivex.disposables.Disposable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
public class EasyCashWebViewActivity extends BaseWebViewActivity implements IScreenShotProtectPage {
public static final String INTENT_KEY_ACTION_URL = "actionUrl";
public static final String INTENT_KEY_SCREEN_SHOT_PROTECT = "screenShotProtect";
public static final String INTENT_KEY_SHOW_LOADING = "showLoading";
public static final int REQUEST_CODE_CHOOSE_FROM_ALBUM = 2001;
protected boolean L;
private long M;
private long N;
private boolean O;
@BindView(R.id.ll_error_content)
LinearLayout llErrorContent;
private final long K = System.currentTimeMillis();
private List<Runnable> P = new ArrayList();
class AnonymousClass1 implements LivenessDetectionManager.LivenessDetectionManagerListener {
AnonymousClass1() {
}
public void e(String str, String str2, String str3) {
if (((BaseWebViewActivity) EasyCashWebViewActivity.this).E == null) {
return;
}
FaceLiveNessDetectResult a = new FaceLiveNessDetectResult.Builder().b(AuthFaceLiveNessHelper.h + "").g("FACEPP").e(str + "").c(str2 + "").d(str3 + "").a();
((BaseWebViewActivity) EasyCashWebViewActivity.this).E.getWebView().callHandler("faceLivenessUploadResult", GsonUtil.b().t(a) + "");
}
public void f(FaceIdCard faceIdCard) {
if (((BaseWebViewActivity) EasyCashWebViewActivity.this).E == null) {
return;
}
HashMap hashMap = new HashMap();
hashMap.put("code", "1");
hashMap.put("faceIdCard", faceIdCard.toMap());
((BaseWebViewActivity) EasyCashWebViewActivity.this).E.getWebView().callHandler("faceLivenessResult", GsonUtil.b().t(hashMap));
}
public void a(final String str, final String str2, final String str3) {
EasyCashWebViewActivity.this.B0(new Runnable() {
@Override
public final void run() {
EasyCashWebViewActivity.AnonymousClass1.this.e(str, str2, str3);
}
});
}
public void b(@NonNull final FaceIdCard faceIdCard) {
EasyCashWebViewActivity.this.B0(new Runnable() {
@Override
public final void run() {
EasyCashWebViewActivity.AnonymousClass1.this.f(faceIdCard);
}
});
ECLiveRecognitionResultActivity.startRecognitionResultActivityForResult(EasyCashWebViewActivity.this, faceIdCard, new LiveDetectionArgs(0, EasyCashWebViewActivity.this.userSession.b().mobileNumber, (Bundle) null));
}
}
private void A0(String str) {
CallBackFunction callBackFunction = D0().N0().get("getHintMobile");
if (callBackFunction != null) {
callBackFunction.onCallBack(str);
}
}
private java.lang.String C0(android.content.Intent r9) {
throw new UnsupportedOperationException("Method not decompiled: com.lingyue.easycash.activity.EasyCashWebViewActivity.C0(android.content.Intent):java.lang.String");
}
private void E0(DeleteUserReasonEvent deleteUserReasonEvent) {
Uri parse = Uri.parse(this.D);
boolean parseBoolean = Boolean.parseBoolean(parse.getQueryParameter("hasIdentity"));
if (!Boolean.parseBoolean(parse.getQueryParameter("hasLivingInfo"))) {
DeleteAccountActivity.startDeleteAccountActivity(this, parseBoolean, deleteUserReasonEvent.a, this.userSession.b().mobileNumber);
return;
}
Bundle bundle = new Bundle();
bundle.putBoolean("hasIdentity", parseBoolean);
bundle.putString("reason", deleteUserReasonEvent.a);
ECLiveCheckPreviewActivity.startECLiveCheckPreviewActivity(this, new LiveDetectionArgs(40000108, this.userSession.b().mobileNumber, bundle));
}
public void G0() {
IWebViewInstance iWebViewInstance = this.E;
if (iWebViewInstance == null) {
return;
}
iWebViewInstance.getWebView().callHandler("faceLivenessUploadResult", AuthFaceLiveNessHelper.g + "");
}
public void H0() {
IWebViewInstance iWebViewInstance = this.E;
if (iWebViewInstance == null) {
return;
}
iWebViewInstance.getWebView().callHandler("faceLivenessUploadResult", "-1");
}
public void I0() {
IWebViewInstance iWebViewInstance = this.E;
if (iWebViewInstance == null) {
return;
}
iWebViewInstance.getWebView().callHandler("faceLivenessUploadResult", AuthFaceLiveNessHelper.h + "");
}
public void J0(Intent intent) {
if (this.E == null) {
return;
}
onLiveDetectionFinish((LiveDetectionEvent) intent.getSerializableExtra(ECLiveCheckPreviewActivity.KEY_LIVE_DETECTION_RESULT));
}
public static void K0(CallBackFunction callBackFunction, ChoosePicResult choosePicResult) {
callBackFunction.onCallBack(choosePicResult.getCode());
}
private void N0(long j) {
ThirdPartEventUtils.D(this, EasycashUmengEvent.x3, new JsonParamsBuilder().d("url").a(this.D).d("span").a(String.valueOf(j)).c());
}
public static Intent args(Context context, @NonNull String str, boolean z2, boolean z3) {
WebViewCore.h().t(str);
Intent intent = new Intent(context, (Class<?>) EasyCashWebViewActivity.class);
intent.putExtra("actionUrl", str);
intent.putExtra(INTENT_KEY_SHOW_LOADING, z2);
intent.putExtra(INTENT_KEY_SCREEN_SHOT_PROTECT, z3);
return intent;
}
public static void startECWebViewActivity(Context context, String str, boolean z2, boolean z3) {
if (TextUtils.isEmpty(str)) {
return;
}
context.startActivity(args(context, str, z2, z3));
}
@Override
protected void B(@NonNull Bundle bundle) {
super.B(bundle);
this.D = WebDomainManager.c(YqdUtils.t(YqdUtils.g(bundle.getString("actionUrl"), this.K)));
this.L = bundle.getBoolean(INTENT_KEY_SHOW_LOADING);
this.O = bundle.getBoolean(INTENT_KEY_SCREEN_SHOT_PROTECT);
if (getWebView() != null) {
getWebView().restoreState(bundle);
}
ThirdPartEventUtils.Q(this, TechSensorTrackEvent.ENTER_WEB_PAGE_ENTER, new JsonParamsBuilder().d("url").a(this.D + "").d(ClientCookie.PATH_ATTR).a(BaseUtils.j(this.D) + "").d("screenProtect").a(this.O + "").b());
}
protected void B0(Runnable runnable) {
if (((LifecycleEvent) this.j.D0()).ordinal() <= LifecycleEvent.CREATED.ordinal()) {
this.P.add(runnable);
} else {
runnable.run();
}
}
@Override
protected void D() {
super.D();
if (this.C == null) {
q0(0);
} else {
q0(8);
}
}
@NonNull
protected EasyCashJsBridgeHandler D0() {
IWebViewInstance webViewInstance = getWebViewInstance();
if (webViewInstance != null && webViewInstance.getEasycashJsBridgeHandler() != null) {
return webViewInstance.getEasycashJsBridgeHandler();
}
DevUtil.a(new IllegalStateException("webViewInstance is Null or without init!"));
return new EasyCashJsBridgeHandler();
}
protected boolean F0(int i) {
BridgeWebView bridgeWebView;
L0(i);
if (i != 4 || (bridgeWebView = this.C) == null || !bridgeWebView.canGoBack()) {
return false;
}
this.C.goBack();
return true;
}
protected void L0(int i) {
if (i == 4) {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("url", TextUtils.isEmpty(this.D) ? "" : this.D);
hashMap.put("webview_is_null", this.C != null ? "false" : "true");
logSensorEventWithParams(SensorTrackEvent.EC_WEB_BACK_CLICK, hashMap);
}
}
protected void M0() {
if (this.C == null) {
DevUtil.a(new IllegalStateException("wvWebView is null!"));
return;
}
IWebViewInstance iWebViewInstance = this.E;
if (iWebViewInstance != null) {
iWebViewInstance.d();
}
refreshWeb();
q0(8);
this.B = false;
}
@Override
protected void N(@NonNull Bundle bundle) {
super.N(bundle);
bundle.putString("actionUrl", this.D);
bundle.putBoolean(INTENT_KEY_SHOW_LOADING, this.L);
bundle.putBoolean(INTENT_KEY_SCREEN_SHOT_PROTECT, this.O);
if (getWebView() != null) {
getWebView().saveState(bundle);
}
}
@Override
protected void a0() {
q0(0);
}
@Override
public int getLayoutID() {
return R.layout.easycash_activity_webview_nsr;
}
public void getPicFromAlbum() {
Intent intent = new Intent("android.intent.action.PICK");
intent.setType("image/*");
startActivityForResult(intent, REQUEST_CODE_CHOOSE_FROM_ALBUM);
}
@Override
public String getTrackUrl() {
return TextUtils.isEmpty(this.D) ? getClass().getName() : this.D;
}
@Override
public BridgeWebView getWebView() {
return this.C;
}
@Override
protected void init() {
super.init();
}
@Override
public boolean isNeedProcessScreenShot() {
if (this.O) {
return true;
}
if (TextUtils.isEmpty(this.D)) {
return false;
}
return ScreenShotProtect.f().h(this.D);
}
@Override
protected void m0(String str) {
ThirdPartEventUtils.Q(this, TechSensorTrackEvent.WEB_URL_LOAD, new JsonParamsBuilder().d("url").a(str + "").d(ClientCookie.PATH_ATTR).a(BaseUtils.j(str) + "").b());
super.m0(str);
}
@Override
protected void onActivityResult(int i, int i2, final Intent intent) {
final CallBackFunction callBackFunction;
super.onActivityResult(i, i2, intent);
LivenessDetectionManager.a(this, i, i2, intent, new AnonymousClass1());
EasyCashJsBridgeHandler D0 = D0();
if (i == 1004) {
if (i2 == -1 && intent != null) {
B0(new Runnable() {
@Override
public final void run() {
EasyCashWebViewActivity.this.G0();
}
});
setResult(-1, intent);
finish();
return;
} else if (i2 == 10) {
B0(new Runnable() {
@Override
public final void run() {
EasyCashWebViewActivity.this.H0();
}
});
return;
} else {
B0(new Runnable() {
@Override
public final void run() {
EasyCashWebViewActivity.this.I0();
}
});
return;
}
}
if (i == 1003) {
if (i2 == -1) {
B0(new Runnable() {
@Override
public final void run() {
EasyCashWebViewActivity.this.J0(intent);
}
});
return;
}
return;
}
if (1001 == i) {
CallBackFunction callBackFunction2 = D0.N0().get("chooseContact");
if (i2 != -1) {
if (callBackFunction2 != null) {
callBackFunction2.onCallBack("");
return;
}
return;
} else {
if (callBackFunction2 != null) {
callBackFunction2.onCallBack(this.gson.t(C0(intent)));
D0.N0().remove("chooseContact");
return;
}
return;
}
}
if (i == 10086) {
if (i2 != -1) {
A0("");
return;
}
Credential parcelableExtra = intent.getParcelableExtra("com.google.android.gms.credentials.Credential");
if (parcelableExtra != null) {
String i3 = FieldRuleUtils.i(parcelableExtra.getId());
if (TextUtils.isEmpty(i3)) {
A0("");
return;
} else {
A0(i3);
ThirdPartEventUtils.z(this, EasycashUmengEvent.e3, "ture");
return;
}
}
return;
}
if (i != 2001 || (callBackFunction = D0.N0().get("chooseKtpFromAlbum")) == null) {
return;
}
if (i2 != -1) {
callBackFunction.onCallBack(ChoosePicResult.CANCEL.getCode());
return;
}
if (intent == null || intent.getData() == null) {
callBackFunction.onCallBack(ChoosePicResult.INNER_ERROR.getCode());
return;
}
Uri data = intent.getData();
if (data == null) {
callBackFunction.onCallBack(ChoosePicResult.INNER_ERROR.getCode());
} else {
addCompositeDisposable(new H5GetKtpHelper(this, data, new H5GetKtpHelper.InnerCallBack() {
@Override
public final void a(ChoosePicResult choosePicResult) {
EasyCashWebViewActivity.K0(callBackFunction, choosePicResult);
}
}).g());
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onBluePayResult(BluePayEvent bluePayEvent) {
CallBackFunction callBackFunction = D0().N0().get("openBindCardPage");
if (callBackFunction == null) {
return;
}
callBackFunction.onCallBack("");
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onChooseDeleteUserReason(DeleteUserReasonEvent deleteUserReasonEvent) {
if (deleteUserReasonEvent != null) {
E0(deleteUserReasonEvent);
}
finish();
}
@Override
protected void onDestroy() {
super.onDestroy();
N0(this.N / 1000);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventLoginOrRegister(EventLoginOrRegisterEnd eventLoginOrRegisterEnd) {
f0();
CallBackFunction callBackFunction = D0().N0().get("showLoginFlow");
if (callBackFunction != null) {
callBackFunction.onCallBack("");
}
}
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (F0(i)) {
return true;
}
return super.onKeyDown(i, keyEvent);
}
public void onLiveDetectionFinish(LiveDetectionEvent liveDetectionEvent) {
IdnBaseResult.Status status;
EasyCashJsBridgeHandler D0 = D0();
if (D0 == null || TextUtils.isEmpty(liveDetectionEvent.faceImageToWeb)) {
return;
}
CallBackFunction callBackFunction = D0.N0().get("openLiveDetection");
if (callBackFunction != null) {
callBackFunction.onCallBack(liveDetectionEvent.faceImageToWeb);
return;
}
IdnBaseResult idnBaseResult = (IdnBaseResult) GsonUtil.e(liveDetectionEvent.faceImageToWeb, IdnBaseResult.class);
if (idnBaseResult == null || (status = idnBaseResult.status) == null || status.code != 0) {
return;
}
finish();
}
@Override
@CallSuper
public void onPageReady(String str, boolean z2) {
super.onPageReady(str, z2);
for (Runnable runnable : this.P) {
if (runnable != null) {
runnable.run();
}
}
removeExtraParams("openKTPTakePhoto");
this.P.clear();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onSetPasswordSuccess(SetPasswordSuccess setPasswordSuccess) {
f0();
CallBackFunction callBackFunction = D0().N0().get("goSetPassword");
if (callBackFunction != null) {
callBackFunction.onCallBack("");
}
}
@Override
protected void onStart() {
super.onStart();
this.M = System.currentTimeMillis();
}
@Override
protected void onStop() {
super.onStop();
this.N += System.currentTimeMillis() - this.M;
}
@OnClick({R.id.btn_retry})
public void onViewClicked(View view) {
if (view.getId() != 2131362020) {
return;
}
if (this.C != null) {
M0();
return;
}
D();
IWebViewInstance iWebViewInstance = this.E;
if (iWebViewInstance != null) {
iWebViewInstance.d();
}
refreshWeb();
}
@Override
public void onWebReceivedError(int i, String str) {
boolean z2;
try {
z2 = ECServerApiConfig.e().a().getHost().equalsIgnoreCase(new URL(str).getHost());
} catch (MalformedURLException e) {
e.printStackTrace();
z2 = true;
}
if (z2) {
super.onWebReceivedError(i, str);
} else {
dismissLoadingDialog();
}
setTitle("");
}
@Override
protected void q0(int i) {
this.llErrorContent.setVisibility(i);
}
public void refreshWeb() {
if (this.L) {
showLoadingDialog();
}
Uri parse = Uri.parse(this.D);
if (EcUriUtil.g(parse)) {
getWindow().addFlags(67108864);
this.f.setVisibility(8);
parse = EcUriUtil.k(parse);
}
m0(parse.toString());
}
public void requestHintMobile() {
try {
HintRequest build = new HintRequest.Builder().setPhoneNumberIdentifierSupported(true).build();
startIntentSenderForResult(Auth.CredentialsApi.getHintPickerIntent(new GoogleApiClient.Builder(this).addApi(Auth.CREDENTIALS_API).build(), build).getIntentSender(), ECLoginAndRegisterV2Activity.REQUEST_CODE_RESOLVE_HINT, (Intent) null, 0, 0, 0);
} catch (Exception e) {
ThirdPartEventUtils.z(this, EasycashUmengEvent.d3, e.getMessage());
A0("");
}
}
@Override
public Disposable runOnActiveEvent(Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.a(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnCreated(@NonNull Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.b(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnDestroy(@NonNull Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.c(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.d(this, lifecycleEvent, runnable);
}
@Override
public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
return com.lingyue.idnbaselib.framework.lifecycle.m.e(this, lifecycleEventArr, runnable);
}
@Override
protected void z() {
if (this.C != null) {
refreshWeb();
}
}
}