正在查看: TruCred v1.1.3 应用的 CommonWebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: TruCred v1.1.3 应用的 CommonWebViewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.veloz.app.ui.web;
import a3d2025071099291226074.oo00oOO;
import a3d2025071099291226074.ooO00O0O0Oo;
import aai.liveness.activity.LivenessActivity;
import ai.advance.sdk.GuardianSDK;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Address;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Environment;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.Observer;
import com.adjust.sdk.webbridge.AdjustBridge;
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.DeviceUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.ImageUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.blankj.utilcode.util.PhoneUtils;
import com.blankj.utilcode.util.SDCardUtils;
import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.google.android.gms.auth.api.credentials.Credential;
import com.google.android.gms.auth.api.credentials.Credentials;
import com.google.android.gms.auth.api.credentials.CredentialsOptions;
import com.google.android.gms.auth.api.credentials.HintRequest;
import com.google.gson.JsonObject;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.jeremyliao.liveeventbus.LiveEventBus;
import com.lzy.okgo.model.Progress;
import com.veloz.app.R$layout;
import com.veloz.app.VelozApplication;
import com.veloz.app.base.AutoArg;
import com.veloz.app.base.BaseActivity;
import com.veloz.app.cache.LocationCache;
import com.veloz.app.cache.LoginInfoCache;
import com.veloz.app.constant.Constant;
import com.veloz.app.databinding.CommonWebViewActivityBinding;
import com.veloz.app.entity.CreateWebViewParamsEntity;
import com.veloz.app.entity.IDAuthParamEntity;
import com.veloz.app.entity.LiveIdentifyInfo;
import com.veloz.app.entity.LiveIdentifyNotifyInfo;
import com.veloz.app.entity.LocationEntity;
import com.veloz.app.entity.SetAppHeadBarParamsEntity;
import com.veloz.app.entity.UploadCompleteEntity;
import com.veloz.app.helper.PointHelper;
import com.veloz.app.my.MyActivity;
import com.veloz.app.service.CdufIntentService;
import com.veloz.app.service.UploadFileIntentService;
import com.veloz.app.ui.home.fragment.FacturaFragment;
import com.veloz.app.ui.login.LoginActivity;
import com.veloz.app.utils.AndroidWindowUtils;
import com.veloz.app.utils.Base64Coder;
import com.veloz.app.utils.Constants;
import com.veloz.app.utils.CpuInfoUtil;
import com.veloz.app.utils.GeoCoderHelper;
import com.veloz.app.utils.MyDeviceInfoUtils;
import com.veloz.app.utils.PhotoUtils;
import com.veloz.app.utils.StaticC;
import com.veloz.app.utils.ViewUtils;
import com.veloz.app.utils.WebviewUtils;
import com.veloz.app.utils.WifiInfoUtil;
import com.veloz.app.utils.XToastUtils;
import com.wildma.idcardcamera.camera.IDCardCamera;
import com.youth.banner.config.BannerConfig;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.functions.Consumer;
import io.reactivex.rxjava3.schedulers.Schedulers;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import org.json.JSONException;
import org.json.JSONObject;
public class CommonWebViewActivity extends MyActivity<CommonWebViewActivityBinding, CommonWebViewActivityViewModel> {
public static final int REQUEST_CODE_LIVENESS = 10000;
public static final int REQUEST_EMAIL = 1;
@AutoArg
String callbackName;
public WifiInfoUtil e;
public LiveIdentifyInfo f;
public final String g = "customPermissionTipDialog";
public boolean i = false;
public String f899j;
public String f900k;
public String f901l;
public ValueCallback f902m;
public CustomWebChromeClient f903n;
@AutoArg
boolean needToken;
public String f904o;
public String f905p;
public String f906q;
public boolean f907r;
public boolean f908s;
@AutoArg
String url;
private void f0(String str) {
try {
if (str.startsWith("{")) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("appUrl")) {
try {
str = jSONObject.getString("appUrl");
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
if (StringUtils.isEmpty(str)) {
return;
}
}
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
intent.addFlags(268435456);
startActivity(intent);
} catch (Exception unused) {
startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=com.example.app")));
}
}
public final void M(String str) {
if (StringUtils.isEmpty(this.f904o)) {
return;
}
JsonObject jsonObject = new JsonObject();
JsonObject jsonObject2 = new JsonObject();
if (StringUtils.isEmpty(str)) {
jsonObject.addProperty(Progress.STATUS, (Number) 0);
jsonObject.add("data", jsonObject2);
} else {
jsonObject2.addProperty("email", str);
jsonObject.addProperty(Progress.STATUS, (Number) 1);
jsonObject.add("data", jsonObject2);
}
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f904o + "('" + jsonObject + "')");
this.f904o = "";
}
public final File N(Context context) {
String format = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
return new File(context.getExternalFilesDir(Environment.DIRECTORY_DCIM), "/" + format + ".jpg");
}
public final void O(Cursor cursor, boolean z2) {
if (StringUtils.isEmpty(this.f899j)) {
return;
}
JsonObject jsonObject = new JsonObject();
JsonObject jsonObject2 = new JsonObject();
if (z2) {
jsonObject2.addProperty("name", cursor.getString(1));
jsonObject2.addProperty("mobile", cursor.getString(0));
jsonObject.addProperty(Progress.STATUS, (Number) 1);
jsonObject.add("data", jsonObject2);
} else {
jsonObject.addProperty(Progress.STATUS, (Number) 0);
jsonObject.add("data", jsonObject2);
}
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f899j + "('" + jsonObject + "')");
this.f899j = "";
}
public final Single P() {
return Single.fromCallable(new Callable() {
@Override
public final Object call() {
String T;
T = CommonWebViewActivity.this.T();
return T;
}
});
}
public final Single Q() {
return Single.fromCallable(new Callable() {
@Override
public final Object call() {
String U;
U = CommonWebViewActivity.this.U();
return U;
}
});
}
public final String R(int i, Map map) {
HashMap hashMap = new HashMap();
hashMap.put(Progress.STATUS, Integer.valueOf(i));
hashMap.put("data", map);
return GsonUtils.toJson(hashMap);
}
public final void S(String str) {
String str2;
LogUtils.e(new Object[]{"handleJsInterface url=" + str});
String[] split = str.split("callback=");
String str3 = "";
if (split.length > 1) {
if (split[1].split("¶ms=").length > 0) {
this.f906q = split[1].split("¶ms=")[0];
}
if (split[1].split("¶ms=").length > 1) {
this.f905p = split[1].split("¶ms=")[1];
}
} else {
this.f906q = "";
this.f905p = "";
}
LogUtils.e(new Object[]{"callbackMethod=" + this.f906q});
LogUtils.e(new Object[]{"callbackParams=" + this.f905p});
this.f904o = this.f906q;
if (str.contains("closeWebView")) {
String R = R(1, null);
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f906q + "('" + R + "')");
finish();
return;
}
if (str.contains("getDeviceInfo")) {
P().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
@Override
public final void accept(Object obj) {
CommonWebViewActivity.this.V((String) obj);
}
}, new k0.f());
return;
}
if (str.contains("goLogin")) {
startActivity(LoginActivity.class).go();
return;
}
if (str.contains("createWebView")) {
CreateWebViewParamsEntity createWebViewParamsEntity = (CreateWebViewParamsEntity) GsonUtils.fromJson(this.f905p, CreateWebViewParamsEntity.class);
if (createWebViewParamsEntity == null) {
XToastUtils.a("createWebView params is null");
return;
} else {
this.f908s = createWebViewParamsEntity.isRefreshOnResume();
startActivity(CommonWebViewActivity.class).with(Progress.URL, createWebViewParamsEntity.getUrl()).with("needToken", Boolean.valueOf(createWebViewParamsEntity.isNeedToken())).with("callbackName", createWebViewParamsEntity.getCallbackName()).go();
return;
}
}
if (str.contains("getLongitudeLatitude")) {
Q().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
@Override
public final void accept(Object obj) {
CommonWebViewActivity.this.W((String) obj);
}
}, new k0.f());
return;
}
if (str.contains("setAppHeadBar")) {
SetAppHeadBarParamsEntity setAppHeadBarParamsEntity = (SetAppHeadBarParamsEntity) GsonUtils.fromJson(this.f905p, SetAppHeadBarParamsEntity.class);
if (setAppHeadBarParamsEntity != null) {
if (!StringUtils.isTrimEmpty(setAppHeadBarParamsEntity.getTitle())) {
((CommonWebViewActivityBinding) this.bind).b.j(setAppHeadBarParamsEntity.getTitle());
}
if (setAppHeadBarParamsEntity.isHasTitleBar()) {
((CommonWebViewActivityBinding) this.bind).b.getCenterText().setVisibility(0);
} else {
((CommonWebViewActivityBinding) this.bind).b.getCenterText().setVisibility(8);
}
((CommonWebViewActivityBinding) this.bind).b.i(setAppHeadBarParamsEntity.isBackEnable());
((CommonWebViewActivityBinding) this.bind).b.setVisibility(setAppHeadBarParamsEntity.isHideBar() ? 8 : 0);
}
((CommonWebViewActivityBinding) this.bind).b.h(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CommonWebViewActivity.this.X(view);
}
});
String R2 = R(1, null);
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f906q + "('" + R2 + "')");
return;
}
if (str.contains("getStatusBarHeight")) {
int px2dp = ConvertUtils.px2dp(BarUtils.getStatusBarHeight());
HashMap hashMap = new HashMap();
hashMap.put("statusBarHeight", Integer.valueOf(px2dp));
String R3 = R(1, hashMap);
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f906q + "('" + R3 + "')");
return;
}
if (str.contains("toGooglePlay")) {
f0(this.f905p);
String R4 = R(1, null);
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f906q + "('" + R4 + "')");
return;
}
if (str.contains("getAddressBookInfo")) {
d0();
this.f899j = this.f906q;
e0();
return;
}
if (str.contains("goActionLiveness")) {
if (this.i) {
return;
}
this.i = true;
showLoading();
if (!XXPermissions.isGranted((Context) this, Permission.CAMERA)) {
final String str4 = this.f906q;
final String str5 = this.f905p;
XXPermissions.with((Context) this).permission(Permission.CAMERA).request(new OnPermissionCallback() {
@Override
public void onDenied(List list, boolean z2) {
CommonWebViewActivity.this.i = false;
CommonWebViewActivity.this.dismissLoading();
HashMap hashMap2 = new HashMap();
hashMap2.put("authResult", 0);
hashMap2.put("getResult", 0);
String R5 = CommonWebViewActivity.this.R(0, hashMap2);
((CommonWebViewActivityBinding) ((BaseActivity) CommonWebViewActivity.this).bind).c.loadUrl("javascript:" + str4 + "('" + R5 + "')");
}
@Override
public void onGranted(List list, boolean z2) {
if (z2) {
CommonWebViewActivity.this.g0(str5);
}
}
});
return;
} else if (ContextCompat.checkSelfPermission(this, Permission.CAMERA) != 0) {
dismissLoading();
return;
} else {
this.f900k = this.f906q;
g0(this.f905p);
return;
}
}
if (str.contains("getAuthAndDataCollection")) {
return;
}
if (str.contains("dataCollection")) {
try {
String replace = new JSONObject(this.f905p).getString("queryStr").replace('-', '+').replace('_', '/');
str3 = replace + k0.a.a("=", (4 - (replace.length() % 4)) % 4);
str2 = Base64Coder.c(str3);
} catch (Throwable th) {
th.printStackTrace();
str2 = str3;
}
CdufIntentService.startCollectData(this, str2);
return;
}
if (str.contains("getEmail")) {
try {
startIntentSenderForResult(Credentials.b(VelozApplication.getInstance(), new CredentialsOptions.Builder().c().b()).d(new HintRequest.Builder().b(true).a()).getIntentSender(), 1, (Intent) null, 0, 0, 0);
return;
} catch (IntentSender.SendIntentException e) {
e.printStackTrace();
return;
}
}
if (str.contains("getPhotoImg")) {
this.f901l = this.f906q;
PhotoUtils.a(this, 19);
return;
}
if (str.contains("queryPushPermission")) {
final HashMap hashMap2 = new HashMap();
hashMap2.put("code", 1);
if (!XXPermissions.isGranted((Context) this, Permission.POST_NOTIFICATIONS)) {
XXPermissions.with((Context) this).permission(Permission.POST_NOTIFICATIONS).request(new OnPermissionCallback() {
@Override
public void onDenied(List list, boolean z2) {
CommonWebViewActivity.this.f907r = true;
hashMap2.put("code", 0);
super.onDenied(list, z2);
XXPermissions.startPermissionActivity((Activity) CommonWebViewActivity.this, Permission.POST_NOTIFICATIONS);
String R5 = CommonWebViewActivity.this.R(1, hashMap2);
((CommonWebViewActivityBinding) ((BaseActivity) CommonWebViewActivity.this).bind).c.loadUrl("javascript:" + CommonWebViewActivity.this.f906q + "('" + R5 + "')");
}
@Override
public void onGranted(List list, boolean z2) {
String R5;
if (z2) {
R5 = CommonWebViewActivity.this.R(1, hashMap2);
} else {
CommonWebViewActivity.this.f907r = true;
hashMap2.put("code", 0);
R5 = CommonWebViewActivity.this.R(1, hashMap2);
XXPermissions.startPermissionActivity((Activity) CommonWebViewActivity.this, Permission.POST_NOTIFICATIONS);
}
((CommonWebViewActivityBinding) ((BaseActivity) CommonWebViewActivity.this).bind).c.loadUrl("javascript:" + CommonWebViewActivity.this.f906q + "('" + R5 + "')");
}
});
return;
}
String R5 = R(1, hashMap2);
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f906q + "('" + R5 + "')");
return;
}
if (str.contains("goAuthCerWithCamera")) {
if (!XXPermissions.isGranted((Context) this, Permission.CAMERA)) {
final String str6 = this.f906q;
XXPermissions.with((Context) this).permission(Permission.CAMERA).request(new OnPermissionCallback() {
@Override
public void onDenied(List list, boolean z2) {
HashMap hashMap3 = new HashMap();
hashMap3.put("authResult", 0);
hashMap3.put("getResult", 0);
String R6 = CommonWebViewActivity.this.R(0, hashMap3);
((CommonWebViewActivityBinding) ((BaseActivity) CommonWebViewActivity.this).bind).c.loadUrl("javascript:" + str6 + "('" + R6 + "')");
}
@Override
public void onGranted(List list, boolean z2) {
if (z2) {
IDCardCamera.a(CommonWebViewActivity.this).c(1);
}
}
});
return;
} else {
if (ContextCompat.checkSelfPermission(this, Permission.CAMERA) != 0) {
return;
}
IDAuthParamEntity iDAuthParamEntity = (IDAuthParamEntity) GsonUtils.fromJson(this.f905p, IDAuthParamEntity.class);
this.f901l = this.f906q;
if (iDAuthParamEntity.getIsPositive() == 1) {
IDCardCamera.a(this).c(1);
return;
} else {
if (iDAuthParamEntity.getIsPositive() == 0) {
IDCardCamera.a(this).c(2);
return;
}
return;
}
}
}
if (str.contains("openMineEditor")) {
LiveEventBus.get("openMineEditor").post(null);
finish();
return;
}
PointHelper.h().a(str, "h52AppError");
String R6 = R(1, null);
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f906q + "('" + R6 + "')");
}
public final String T() {
try {
LocationEntity a = LocationCache.a();
HashMap hashMap = new HashMap();
hashMap.put("TO-GO-LANG", Constants.f912m);
hashMap.put("TO-GO-LNG-LAT", a.getLongitude() + "," + a.getLatitude());
hashMap.put("TO-GO-TIMEZONE", Constants.f913n);
hashMap.put("TO-GO-ACCESS-TOKEN", LoginInfoCache.e());
hashMap.put("TO-GO-VER", AppUtils.getAppVersionName() + "/" + AppUtils.getAppVersionCode());
hashMap.put("deviceld", DeviceUtils.getUniqueDeviceId());
hashMap.put("gaid", VelozApplication.getInstance().getGaid());
if (LoginInfoCache.c() != null) {
hashMap.put("appUserNo", LoginInfoCache.c().appUserNo);
}
if (LoginInfoCache.d() != null) {
hashMap.put("customerNo", LoginInfoCache.d().customerNo);
hashMap.put("dcCustomerNo", LoginInfoCache.d().dcCustomerNo);
hashMap.put("productMode", Integer.valueOf(LoginInfoCache.d().productMode));
}
hashMap.put("accessIp", NetworkUtils.getIPAddress(true));
hashMap.put("appCode", Constants.a);
hashMap.put("appName", AppUtils.getAppName());
hashMap.put("appVersion", AppUtils.getAppVersionName());
hashMap.put("versionCode", Integer.valueOf(AppUtils.getAppVersionCode()));
hashMap.put("appMac", MyDeviceInfoUtils.b());
hashMap.put("authentication", LoginInfoCache.e());
hashMap.put("channelPackageSource", "release");
String str = Build.BRAND;
hashMap.put("deviceBrand", str);
hashMap.put("deviceCpuArchitecture", CpuInfoUtil.a());
hashMap.put("deviceModel", DeviceUtils.getModel());
hashMap.put("deviceNo", DeviceUtils.getUniqueDeviceId());
hashMap.put("deviceOs", "android");
hashMap.put("deviceOsImage", StaticC.c + "*" + StaticC.d);
hashMap.put("deviceProvidersName", PhoneUtils.getSimOperatorName());
hashMap.put("deviceStorageSpace", Long.valueOf(SDCardUtils.getExternalTotalSize()));
hashMap.put("deviceSystemLanguage", "es");
hashMap.put("deviceWifiSsid", this.e.a());
hashMap.put("mobileOsVersion", DeviceUtils.getSDKVersionName());
hashMap.put("mobilePhoneBrand", str);
hashMap.put("loginPlatform", "Android");
hashMap.put("adid", Constant.c);
Address b = GeoCoderHelper.b();
if (b != null) {
hashMap.put("gpsAddressCity", b.getLocality());
hashMap.put("gpsAddressProvince", b.getAdminArea());
hashMap.put("gpsAddressStreet", b.getSubAdminArea());
hashMap.put("gpsLatitude", Double.valueOf(a.getLatitude()));
hashMap.put("lbsAddressCity", b.getLocality());
hashMap.put("lbsAddressProvince", b.getAdminArea());
hashMap.put("lbsAddressStreet", b.getSubAdminArea());
hashMap.put("lbsLatitude", Double.valueOf(a.getLatitude()));
hashMap.put("lbsLongitude", Double.valueOf(a.getLongitude()));
} else {
hashMap.put("gpsAddressCity", "");
hashMap.put("gpsAddressProvince", "");
hashMap.put("gpsAddressStreet", "");
hashMap.put("gpsLatitude", "");
hashMap.put("lbsAddressCity", "");
hashMap.put("lbsAddressProvince", "");
hashMap.put("lbsAddressStreet", "");
hashMap.put("lbsLatitude", "");
hashMap.put("lbsLongitude", "");
}
return R(1, hashMap);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public final String U() {
HashMap hashMap;
String str = ",";
try {
LocationEntity a = LocationCache.a();
hashMap = new HashMap();
Address a2 = GeoCoderHelper.a(this, Double.valueOf(a.getLatitude()), Double.valueOf(a.getLongitude()));
hashMap.put("longitude", Double.valueOf(a.getLongitude()));
hashMap.put("latitude", Double.valueOf(a.getLatitude()));
hashMap.put("create_time", Long.valueOf(System.currentTimeMillis()));
try {
if (a2 != null) {
try {
hashMap.put("gps_address_country", a2.getCountryName());
hashMap.put("gps_address_country_code", a2.getCountryCode());
hashMap.put("gps_address_province", a2.getAdminArea());
hashMap.put("gps_address_city", a2.getLocality());
hashMap.put("gps_address_street", a2.getThoroughfare());
hashMap.put("gps_address_sub_locality", a2.getSubLocality());
hashMap.put("gps_address_sub_admin_area", a2.getSubAdminArea());
hashMap.put("lbs_address_province", a2.getAdminArea());
hashMap.put("lbs_address_city", a2.getLocality());
hashMap.put("lbs_address_street", a2.getThoroughfare());
hashMap.put("lbs_address_country_code", a2.getCountryCode());
hashMap.put("lbs_address_country", a2.getCountryName());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < a2.getMaxAddressLineIndex(); i++) {
try {
sb.append(a2.getAddressLine(i));
sb.append("\n");
} catch (Exception e) {
e = e;
str = "";
e.printStackTrace();
return str;
}
}
sb.append(a2.getFeatureName());
sb.append(",");
sb.append(a2.getThoroughfare());
sb.append(",");
sb.append(a2.getSubLocality());
sb.append(",");
sb.append(a2.getSubAdminArea());
sb.append(",");
sb.append(a2.getLocality());
sb.append(",");
sb.append(a2.getPostalCode());
sb.append(" ");
sb.append(a2.getAdminArea());
sb.append(",");
sb.append(a2.getCountryCode());
sb.append(" ");
sb.append(a2.getCountryName());
str = "";
sb.append(str);
hashMap.put("provider", sb.toString());
} catch (Exception e2) {
e = e2;
str = "";
e.printStackTrace();
return str;
}
} else {
str = "";
hashMap.put("gps_address_country", str);
hashMap.put("gps_address_country_code", str);
hashMap.put("gps_address_province", str);
hashMap.put("gps_address_city", str);
hashMap.put("gps_address_street", str);
hashMap.put("gps_address_sub_locality", str);
hashMap.put("gps_address_sub_admin_area", str);
hashMap.put("lbs_address_province", str);
hashMap.put("lbs_address_city", str);
hashMap.put("lbs_address_street", str);
hashMap.put("lbs_address_country_code", str);
hashMap.put("lbs_address_country", str);
hashMap.put("provider", str);
}
} catch (Exception e3) {
e = e3;
}
} catch (Exception e4) {
e = e4;
str = "";
}
try {
return R(1, hashMap);
} catch (Exception e5) {
e = e5;
e.printStackTrace();
return str;
}
}
public final void V(String str) {
((CommonWebViewActivityBinding) this.bind).c.evaluateJavascript("javascript:" + this.f906q + "('" + str + "')", null);
}
public final void W(String str) {
((CommonWebViewActivityBinding) this.bind).c.evaluateJavascript("javascript:" + this.f906q + "('" + str + "')", null);
}
public final void X(View view) {
finish();
}
public final void Y(LiveIdentifyNotifyInfo liveIdentifyNotifyInfo) {
if (liveIdentifyNotifyInfo == null) {
HashMap hashMap = new HashMap();
hashMap.put("authResult", 0);
hashMap.put("getResult", 0);
String R = R(0, hashMap);
dismissLoading();
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f900k + "('" + R + "')");
return;
}
HashMap hashMap2 = new HashMap();
hashMap2.put("nextIndex", Integer.valueOf(liveIdentifyNotifyInfo.nextIndex));
hashMap2.put("passFlag", Integer.valueOf(liveIdentifyNotifyInfo.passFlag));
hashMap2.put("netInStatus", Integer.valueOf(liveIdentifyNotifyInfo.netInStatus));
String R2 = R(1, hashMap2);
dismissLoading();
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f900k + "('" + R2 + "')");
}
public final void Z(UploadCompleteEntity uploadCompleteEntity) {
if (uploadCompleteEntity == null) {
String R = R(0, null);
LogUtils.e(new Object[]{"LiveEventBus>>UploadCompleteEntity failed"});
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f901l + "('" + R + "')");
return;
}
HashMap hashMap = new HashMap();
hashMap.put(Progress.FILE_NAME, uploadCompleteEntity.fileName);
hashMap.put("tempUrl", uploadCompleteEntity.tempUrl);
hashMap.put("tempUrlBase64", uploadCompleteEntity.tempUrlBase64);
hashMap.put("fileSize", Long.valueOf(uploadCompleteEntity.fileSize));
String R2 = R(uploadCompleteEntity.status, hashMap);
LogUtils.e(new Object[]{"LiveEventBus>>UploadCompleteEntity success"});
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:" + this.f901l + "('" + R2 + "')");
}
public final void a0(Object obj) {
((CommonWebViewActivityBinding) this.bind).c.postDelayed(new Runnable() {
@Override
public void run() {
CommonWebViewActivity.this.b0();
}
}, 200L);
}
public final void b0() {
LogUtils.d(new Object[]{"url=" + this.url});
WebviewUtils.g(((CommonWebViewActivityBinding) this.bind).c);
((CommonWebViewActivityBinding) this.bind).c.loadUrl(getTokenUrl(this.url));
}
@Override
public void o(CommonWebViewActivityBinding commonWebViewActivityBinding, CommonWebViewActivityViewModel commonWebViewActivityViewModel) {
super.o(commonWebViewActivityBinding, commonWebViewActivityViewModel);
ViewUtils.a(commonWebViewActivityBinding.a);
AndroidWindowUtils.d(this);
WebSettings settings = commonWebViewActivityBinding.c.getSettings();
settings.setDefaultTextEncodingName("UTF-8");
settings.setUserAgentString(settings.getUserAgentString() + Constants.a + "/" + AppUtils.getAppVersionName());
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setCacheMode(2);
settings.setDomStorageEnabled(true);
settings.setDatabaseEnabled(true);
settings.setAllowFileAccess(true);
settings.setAllowContentAccess(true);
settings.setAllowFileAccessFromFileURLs(false);
settings.setAllowUniversalAccessFromFileURLs(false);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
CustomWebChromeClient customWebChromeClient = new CustomWebChromeClient(this);
this.f903n = customWebChromeClient;
commonWebViewActivityBinding.c.setWebChromeClient(customWebChromeClient);
commonWebViewActivityBinding.c.setWebViewClient(new MyWebViewClient());
AdjustBridge.registerAndGetInstance(VelozApplication.getInstance(), commonWebViewActivityBinding.c);
b0();
commonWebViewActivityBinding.a(commonWebViewActivityViewModel);
}
public final void d0() {
((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(((CommonWebViewActivityBinding) this.bind).a.getWindowToken(), 0);
}
public final void e0() {
Intent intent = new Intent("android.intent.action.PICK", ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivityForResult(intent, FacturaFragment.PICK_CONTACT);
}
}
public final void g0(String str) {
String str2;
try {
LiveIdentifyInfo liveIdentifyInfo = (LiveIdentifyInfo) GsonUtils.fromJson(str, LiveIdentifyInfo.class);
this.f = liveIdentifyInfo;
str2 = new String(Base64.decode(liveIdentifyInfo.getSdkLicense(), 0), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} catch (Exception e2) {
e2.printStackTrace();
XToastUtils.a(e2.getMessage());
str2 = "";
}
if (StringUtils.isEmpty(str2)) {
XToastUtils.a("license is null");
return;
}
String licenseAndCheck = oo00oOO.setLicenseAndCheck(str2);
if ("SUCCESS".equals(licenseAndCheck)) {
oo00oOO.letSDKHandleCameraPermission();
oo00oOO.setRecordVideoSwitch(true);
oo00oOO.isDetectOcclusion(false);
oo00oOO.setResultPictureSize(BannerConfig.SCROLL_TIME);
GuardianSDK.bindUser(LoginInfoCache.e());
h0();
return;
}
PointHelper.h().a("init:" + licenseAndCheck, "advanceError");
XToastUtils.a("Licencia incorrecta, caducidad / formato incorrecto / appid no está dentro del alcance de la autorización");
}
public String getTokenUrl(String str) {
if (str.contains("token=") || StringUtils.isTrimEmpty(LoginInfoCache.e())) {
return str;
}
if (str.contains("?")) {
return str + "&token=" + LoginInfoCache.e();
}
return str + "?token=" + LoginInfoCache.e();
}
public final void h0() {
startActivityForResult(new Intent((Context) this, (Class<?>) LivenessActivity.class), 10000);
}
@Override
public void initData() {
this.e = new WifiInfoUtil(this);
}
@Override
public void m() {
LiveEventBus.get("LiveIdentifyNotifyInfo", LiveIdentifyNotifyInfo.class).observe(this, new Observer() {
public final void onChanged(Object obj) {
CommonWebViewActivity.this.Y((LiveIdentifyNotifyInfo) obj);
}
});
LiveEventBus.get("UploadCompleteEntity", UploadCompleteEntity.class).observe(this, new Observer() {
public final void onChanged(Object obj) {
CommonWebViewActivity.this.Z((UploadCompleteEntity) obj);
}
});
LiveEventBus.get("turnOnNotificationSuccessed").observe(this, new Observer() {
public final void onChanged(Object obj) {
CommonWebViewActivity.this.a0(obj);
}
});
}
@Override
public int myView() {
return R$layout.common_web_view_activity;
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
Credential parcelableExtra;
String dataString;
super.onActivityResult(i, i2, intent);
if (i == 10000) {
dismissLoading();
this.i = false;
ooO00O0O0Oo.getEventId();
ooO00O0O0Oo.getVideoFile(this);
if (!ooO00O0O0Oo.isSuccess()) {
String errorCode = ooO00O0O0Oo.getErrorCode();
String errorMsg = ooO00O0O0Oo.getErrorMsg();
PointHelper.h().a(errorCode + errorMsg, "advanceError");
dismissLoading();
return;
}
String livenessId = ooO00O0O0Oo.getLivenessId();
long uploadPictureCostMillSeconds = ooO00O0O0Oo.getUploadPictureCostMillSeconds();
ooO00O0O0Oo.isPay();
ooO00O0O0Oo.getLivenessBitmap();
Bitmap nearBitmap = ooO00O0O0Oo.getNearBitmap();
ooO00O0O0Oo.getAuditImageList();
File filesDir = getApplicationContext().getFilesDir();
StringBuilder sb = new StringBuilder();
sb.append(filesDir.getAbsolutePath());
String str = File.separator;
sb.append(str);
sb.append("liveness");
sb.append(str);
sb.append(FileUtils.getFileName(TimeUtils.date2String(new Date(), "yyyyMMddHHmmss") + ".jpg"));
String sb2 = sb.toString();
ImageUtils.save(nearBitmap, sb2, Bitmap.CompressFormat.JPEG);
this.f.setSupplierNo(livenessId);
this.f.setFilePath(sb2);
this.f.setTimeCost(uploadPictureCostMillSeconds);
UploadFileIntentService.startUploadLiveImage(this, this.f);
return;
}
if (i == 10001 && i2 == -1) {
Cursor query = getContentResolver().query(intent.getData(), new String[]{"data1", "display_name"}, null, null, null);
if (query == null) {
O(null, false);
return;
}
try {
if (query.getCount() == 0) {
O(query, false);
return;
} else {
query.moveToNext();
O(query, true);
return;
}
} finally {
query.close();
}
}
if (i == 10002) {
Uri[] uriArr = (i2 != -1 || intent == null || (dataString = intent.getDataString()) == null) ? null : new Uri[]{Uri.parse(dataString)};
ValueCallback valueCallback = this.f902m;
if (valueCallback != null) {
valueCallback.onReceiveValue(uriArr);
this.f902m = null;
return;
}
return;
}
if (i == 100 || i == 101) {
CustomWebChromeClient customWebChromeClient = this.f903n;
if (customWebChromeClient != null) {
customWebChromeClient.k(i, i2, intent);
return;
}
return;
}
if (i2 != 17) {
if (i == 19) {
if (intent == null || intent.getData() == null) {
return;
}
File N = N(this);
PhotoUtils.c(PhotoUtils.b(this, intent.getData()), N);
UploadFileIntentService.startUploadIDImage(this, N.getAbsolutePath());
return;
}
if (i == 1 && i2 == -1) {
String id = (intent == null || (parcelableExtra = intent.getParcelableExtra("com.google.android.gms.credentials.Credential")) == null) ? "" : parcelableExtra.getId();
LogUtils.d(new Object[]{"email=" + id});
M(id);
return;
}
return;
}
String b = IDCardCamera.b(intent);
if (TextUtils.isEmpty(b)) {
return;
}
Bitmap decodeFile = BitmapFactory.decodeFile(b);
File filesDir2 = getApplicationContext().getFilesDir();
StringBuilder sb3 = new StringBuilder();
sb3.append(filesDir2.getAbsolutePath());
String str2 = File.separator;
sb3.append(str2);
sb3.append("idcard");
sb3.append(str2);
sb3.append(FileUtils.getFileName(TimeUtils.date2String(new Date(), "yyyyMMddHHmmss") + ".jpg"));
String sb4 = sb3.toString();
ImageUtils.save(decodeFile, sb4, Bitmap.CompressFormat.JPEG);
UploadFileIntentService.startUploadIDImage(this, sb4);
}
@Override
public void onDestroy() {
AdjustBridge.unregister();
super.onDestroy();
}
@Override
public void onResume() {
super.onResume();
if (this.f908s) {
((CommonWebViewActivityBinding) this.bind).c.loadUrl("javascript:location.reload()");
this.f908s = false;
}
if (this.f907r && XXPermissions.isGranted((Context) this, Permission.POST_NOTIFICATIONS)) {
this.f907r = false;
LiveEventBus.get("postPermissionGranted").post(null);
}
}
@Override
public void p() {
}
public class MyWebViewClient extends WebViewClient {
public MyWebViewClient() {
}
public final boolean a(String str) {
String str2 = str;
String[] strArr = {".txt", ".doc", ".docx", ".pdf", ".rtf", ".odt", ".xls", ".xlsx", ".csv", ".ods", ".zip", ".mp4", ".mp3", ".apk", ".ppt", ".pptx"};
int indexOf = str2.indexOf(63);
if (indexOf != -1) {
str2 = str2.substring(0, indexOf);
}
int lastIndexOf = str2.lastIndexOf(46);
if (lastIndexOf != -1 && lastIndexOf < str2.length() - 1) {
String lowerCase = str2.substring(lastIndexOf).toLowerCase();
for (int i = 0; i < 16; i++) {
if (lowerCase.equals(strArr[i])) {
return true;
}
}
}
return false;
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
WebviewUtils.c(webView);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
WebviewUtils.c(webView);
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
sslErrorHandler.cancel();
Toast.makeText(webView.getContext(), "SSL Certificate error.", 1).show();
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
String uri = webResourceRequest.getUrl().toString();
LogUtils.e(new Object[]{"shouldOverrideUrlLoading url=" + uri});
try {
String decode = URLDecoder.decode(uri, "UTF-8");
LogUtils.e(new Object[]{"shouldOverrideUrlLoading decode url=" + decode});
if (decode.contains("callfunction://")) {
CommonWebViewActivity.this.S(decode);
return true;
}
if (a(decode)) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(decode));
intent.setFlags(268435456);
try {
CommonWebViewActivity.this.startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
return super.shouldOverrideUrlLoading(webView, webResourceRequest);
} catch (UnsupportedEncodingException e2) {
throw new RuntimeException(e2);
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
try {
LogUtils.e(new Object[]{"shouldOverrideUrlLoading url=" + str});
String decode = URLDecoder.decode(str, "UTF-8");
LogUtils.e(new Object[]{"shouldOverrideUrlLoading decode url=" + decode});
if (decode.contains("callfunction://")) {
CommonWebViewActivity.this.S(decode);
return true;
}
return super.shouldOverrideUrlLoading(webView, decode);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
}
}