导航菜单

页面标题

页面副标题

TruCred v1.1.3 - FacturaFragment.java 源代码

正在查看: TruCred v1.1.3 应用的 FacturaFragment.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.veloz.app.ui.home.fragment;

import a3d2025071099291226074.oo00oOO;
import a3d2025071099291226074.ooO00O0O0Oo;
import aai.liveness.activity.LivenessActivity;
import ai.advance.sdk.GuardianSDK;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Address;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.provider.ContactsContract;
import android.text.TextUtils;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
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.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$id;
import com.veloz.app.R$layout;
import com.veloz.app.R$style;
import com.veloz.app.VelozApplication;
import com.veloz.app.base.BaseFragment;
import com.veloz.app.cache.LocationCache;
import com.veloz.app.cache.LoginInfoCache;
import com.veloz.app.constant.Constant;
import com.veloz.app.databinding.FragmentFacturaBinding;
import com.veloz.app.dialog.CustomPermissionTipDialog;
import com.veloz.app.dialog.MyBottomSheetDialog;
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.UploadCompleteEntity;
import com.veloz.app.my.MyFragment;
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.ui.web.CommonWebViewActivity;
import com.veloz.app.ui.web.CustomWebChromeClient;
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.SensorsHelper;
import com.veloz.app.utils.StaticC;
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.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Callable;
import k0.f;
import org.json.JSONObject;

public class FacturaFragment extends MyFragment<FragmentFacturaBinding, FacturaViewModel> {
    public static final int PICK_CONTACT = 10001;
    public static final int REQUEST_CODE_LIVENESS = 10000;
    private static FacturaFragment fragment;
    private CustomPermissionTipDialog customPermissionTipDialog;
    private CustomWebChromeClient customWebChromeClient;
    private String getContactCallbackMethod;
    private String idDataCallbackMethod;
    private LiveIdentifyInfo liveData;
    private Observer liveIdentifyNotifyInfoObserver;
    private String livenessCallbackMethod;
    private MyBottomSheetDialog mBottomProgressDialog;
    private Observer uploadCompleteEntityObserver;
    private WifiInfoUtil wifiInfoUtil;
    private boolean isLivenessing = false;
    private boolean isFirst = true;
    private final String PERMISSION_TIP_DIALOG_TAG = "customPermissionTipDialog";
    private boolean hasAddEventListener = false;

    public class AnonymousClass4 extends TimerTask {
        public int a = 0;
        public int b = 0;
        public final ProgressBar c;
        public final RadioButton d;
        public final RadioButton e;
        public final RadioButton f;
        public final RadioButton g;

        public AnonymousClass4(ProgressBar progressBar, RadioButton radioButton, RadioButton radioButton2, RadioButton radioButton3, RadioButton radioButton4) {
            this.c = progressBar;
            this.d = radioButton;
            this.e = radioButton2;
            this.f = radioButton3;
            this.g = radioButton4;
        }

        public final void b(ProgressBar progressBar, RadioButton radioButton, RadioButton radioButton2, RadioButton radioButton3, RadioButton radioButton4) {
            progressBar.setProgress(this.a);
            if (this.b == 1) {
                radioButton.setChecked(true);
            }
            if (this.b == 2) {
                radioButton2.setChecked(true);
            }
            if (this.b == 3) {
                radioButton3.setChecked(true);
            }
            if (this.b == 4) {
                radioButton4.setChecked(true);
            }
        }

        @Override
        public void run() {
            int i = this.a + 10;
            this.a = i;
            if (i > 100) {
                this.a = 0;
                this.b++;
            }
            FragmentActivity activity = FacturaFragment.this.getActivity();
            final ProgressBar progressBar = this.c;
            final RadioButton radioButton = this.d;
            final RadioButton radioButton2 = this.e;
            final RadioButton radioButton3 = this.f;
            final RadioButton radioButton4 = this.g;
            activity.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    FacturaFragment.AnonymousClass4.this.b(progressBar, radioButton, radioButton2, radioButton3, radioButton4);
                }
            });
        }
    }

    private void addLiveEventListener() {
        if (this.hasAddEventListener) {
            return;
        }
        this.hasAddEventListener = true;
        LogUtils.e(new Object[]{"FacturaFragment addLiveEventListener"});
        LiveEventBus.get("LiveIdentifyNotifyInfo", LiveIdentifyNotifyInfo.class).observeForever(this.liveIdentifyNotifyInfoObserver);
        LiveEventBus.get("UploadCompleteEntity", UploadCompleteEntity.class).observeForever(this.uploadCompleteEntityObserver);
    }

    private void getAddressBookSF(Cursor cursor, boolean z2) {
        if (StringUtils.isEmpty(this.getContactCallbackMethod)) {
            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);
        }
        ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + this.getContactCallbackMethod + "('" + jsonObject + "')");
        this.getContactCallbackMethod = "";
    }

    private Single<String> getDeviceInfo() {
        return Single.fromCallable(new Callable() {
            @Override
            public final Object call() {
                String lambda$getDeviceInfo$5;
                lambda$getDeviceInfo$5 = FacturaFragment.this.lambda$getDeviceInfo$5();
                return lambda$getDeviceInfo$5;
            }
        });
    }

    public static FacturaFragment getInstance() {
        if (fragment == null) {
            fragment = new FacturaFragment();
        }
        return fragment;
    }

    private Single<String> getLongitudeLatitude() {
        return Single.fromCallable(new Callable() {
            @Override
            public final Object call() {
                String lambda$getLongitudeLatitude$6;
                lambda$getLongitudeLatitude$6 = FacturaFragment.this.lambda$getLongitudeLatitude$6();
                return lambda$getLongitudeLatitude$6;
            }
        });
    }

    public String getResultJson(int i, Map<String, Object> map) {
        HashMap hashMap = new HashMap();
        hashMap.put(Progress.STATUS, Integer.valueOf(i));
        hashMap.put("data", map);
        return GsonUtils.toJson(hashMap);
    }

    public void handleJsInterface(String str) {
        if (StringUtils.isTrimEmpty(LoginInfoCache.e())) {
            return;
        }
        LogUtils.e(new Object[]{"url=" + str});
        String[] split = str.split("callback=");
        final String str2 = split[1].split("&params=")[0];
        final String str3 = split[1].split("&params=")[1];
        LogUtils.e(new Object[]{"callbackMethod=" + str2});
        LogUtils.e(new Object[]{"callbackParams=" + str3});
        if (str.contains("closeWebView")) {
            String resultJson = getResultJson(1, null);
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + str2 + "('" + resultJson + "')");
            getActivity().finish();
            return;
        }
        if (str.contains("getDeviceInfo")) {
            getDeviceInfo().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
                @Override
                public final void accept(Object obj) {
                    FacturaFragment.this.lambda$handleJsInterface$3(str2, (String) obj);
                }
            }, new f());
            return;
        }
        if (str.contains("goLogin")) {
            getActivity().startActivity(LoginActivity.class).go();
            return;
        }
        if (str.contains("createWebView")) {
            CreateWebViewParamsEntity createWebViewParamsEntity = (CreateWebViewParamsEntity) GsonUtils.fromJson(str3, CreateWebViewParamsEntity.class);
            if (createWebViewParamsEntity == null) {
                XToastUtils.a("createWebView params is null");
                return;
            } else {
                getActivity().startActivity(CommonWebViewActivity.class).with(Progress.URL, createWebViewParamsEntity.getUrl()).with("needToken", Boolean.valueOf(createWebViewParamsEntity.isNeedToken())).with("callbackName", createWebViewParamsEntity.getCallbackName()).go();
                return;
            }
        }
        if (str.contains("getLongitudeLatitude")) {
            getLongitudeLatitude().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
                @Override
                public final void accept(Object obj) {
                    FacturaFragment.this.lambda$handleJsInterface$4(str2, (String) obj);
                }
            }, new f());
            return;
        }
        if (str.contains("setAppHeadBar")) {
            String resultJson2 = getResultJson(1, null);
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + str2 + "('" + resultJson2 + "')");
            ((FragmentFacturaBinding) this.bind).a.setVisibility(0);
            this.isFirst = false;
            dismissLoading();
            return;
        }
        if (str.contains("getStatusBarHeight")) {
            int px2dp = ConvertUtils.px2dp(BarUtils.getStatusBarHeight());
            HashMap hashMap = new HashMap();
            hashMap.put("statusBarHeight", Integer.valueOf(px2dp));
            String resultJson3 = getResultJson(1, hashMap);
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + str2 + "('" + resultJson3 + "')");
            return;
        }
        if (str.contains("toGooglePlay")) {
            openGooglePlay(str3);
            String resultJson4 = getResultJson(1, null);
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + str2 + "('" + resultJson4 + "')");
            return;
        }
        if (str.contains("getAddressBookInfo")) {
            this.getContactCallbackMethod = str2;
            openContacts();
            return;
        }
        if (str.contains("goActionLiveness")) {
            if (this.isLivenessing) {
                return;
            }
            this.isLivenessing = true;
            if (!XXPermissions.isGranted((Context) getActivity(), Permission.CAMERA)) {
                XXPermissions.with((Context) getActivity()).permission(Permission.CAMERA).request(new OnPermissionCallback() {
                    @Override
                    public void onDenied(List list, boolean z2) {
                        FacturaFragment.this.isLivenessing = false;
                        HashMap hashMap2 = new HashMap();
                        hashMap2.put("authResult", 0);
                        hashMap2.put("getResult", 0);
                        String resultJson5 = FacturaFragment.this.getResultJson(0, hashMap2);
                        ((FragmentFacturaBinding) ((BaseFragment) FacturaFragment.this).bind).a.loadUrl("javascript:" + str2 + "('" + resultJson5 + "')");
                    }

                    @Override
                    public void onGranted(List list, boolean z2) {
                        if (!z2) {
                            LogUtils.e(new Object[]{"a"});
                        } else {
                            LogUtils.e(new Object[]{"a"});
                            FacturaFragment.this.startGoLiveness(str3);
                        }
                    }
                });
                return;
            } else {
                if (ContextCompat.checkSelfPermission(getActivity(), Permission.CAMERA) != 0) {
                    return;
                }
                this.livenessCallbackMethod = str2;
                startGoLiveness(str3);
                return;
            }
        }
        if (str.contains("getAuthAndDataCollection")) {
            return;
        }
        if (str.contains("dataCollection")) {
            String str4 = "";
            try {
                String replace = new JSONObject(str3).getString("queryStr").replace('-', '+').replace('_', '/');
                str4 = Base64Coder.c(replace + k0.a.a("=", (4 - (replace.length() % 4)) % 4));
            } catch (Throwable th) {
                th.printStackTrace();
            }
            CdufIntentService.startCollectData(getContext(), str4);
            return;
        }
        if (str.contains("goAuthCerWithCamera")) {
            if (!XXPermissions.isGranted((Context) getActivity(), Permission.CAMERA)) {
                XXPermissions.with((Context) getActivity()).permission(Permission.CAMERA).request(new OnPermissionCallback() {
                    @Override
                    public void onDenied(List list, boolean z2) {
                        HashMap hashMap2 = new HashMap();
                        hashMap2.put("authResult", 0);
                        hashMap2.put("getResult", 0);
                        String resultJson5 = FacturaFragment.this.getResultJson(0, hashMap2);
                        ((FragmentFacturaBinding) ((BaseFragment) FacturaFragment.this).bind).a.loadUrl("javascript:" + str2 + "('" + resultJson5 + "')");
                    }

                    @Override
                    public void onGranted(List list, boolean z2) {
                        if (!z2) {
                            LogUtils.e(new Object[]{"a"});
                        } else {
                            LogUtils.e(new Object[]{"a"});
                            IDCardCamera.a(FacturaFragment.this.getActivity()).c(1);
                        }
                    }
                });
                return;
            }
            if (ContextCompat.checkSelfPermission(getActivity(), Permission.CAMERA) != 0) {
                return;
            }
            IDAuthParamEntity iDAuthParamEntity = (IDAuthParamEntity) GsonUtils.fromJson(str3, IDAuthParamEntity.class);
            this.idDataCallbackMethod = str2;
            if (iDAuthParamEntity.getIsPositive() == 1) {
                IDCardCamera.a(getActivity()).c(1);
            } else if (iDAuthParamEntity.getIsPositive() == 0) {
                IDCardCamera.a(getActivity()).c(2);
            }
        }
    }

    private void initObserver() {
        this.liveIdentifyNotifyInfoObserver = new Observer() {
            public final void onChanged(Object obj) {
                FacturaFragment.this.lambda$initObserver$1((LiveIdentifyNotifyInfo) obj);
            }
        };
        this.uploadCompleteEntityObserver = new Observer() {
            public final void onChanged(Object obj) {
                FacturaFragment.this.lambda$initObserver$2((UploadCompleteEntity) obj);
            }
        };
    }

    public String lambda$getDeviceInfo$5() {
        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.wifiInfoUtil.a());
            hashMap.put("mobileOsVersion", DeviceUtils.getSDKVersionName());
            hashMap.put("mobilePhoneBrand", str);
            hashMap.put("loginPlatform", "Android");
            hashMap.put("adid", Constant.c);
            if (getActivity() != null) {
                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 getResultJson(1, hashMap);
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }

    public String lambda$getLongitudeLatitude$6() {
        Map<String, Object> hashMap;
        String str = ",";
        try {
            LocationEntity a = LocationCache.a();
            hashMap = new HashMap<>();
            if (getActivity() != null) {
                Address a2 = GeoCoderHelper.a(getActivity(), 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;
                }
            } else {
                str = "";
            }
        } catch (Exception e4) {
            e = e4;
            str = "";
        }
        try {
            return getResultJson(1, hashMap);
        } catch (Exception e5) {
            e = e5;
            e.printStackTrace();
            return str;
        }
    }

    public void lambda$handleJsInterface$3(String str, String str2) {
        ((FragmentFacturaBinding) this.bind).a.evaluateJavascript("javascript:" + str + "('" + str2 + "')", null);
    }

    public void lambda$handleJsInterface$4(String str, String str2) {
        ((FragmentFacturaBinding) this.bind).a.evaluateJavascript("javascript:" + str + "('" + str2 + "')", null);
    }

    public void lambda$initObserver$1(LiveIdentifyNotifyInfo liveIdentifyNotifyInfo) {
        if (liveIdentifyNotifyInfo == null) {
            HashMap hashMap = new HashMap();
            hashMap.put("authResult", 0);
            hashMap.put("getResult", 0);
            String resultJson = getResultJson(0, hashMap);
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + this.livenessCallbackMethod + "('" + resultJson + "')");
            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 resultJson2 = getResultJson(1, hashMap2);
        ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + this.livenessCallbackMethod + "('" + resultJson2 + "')");
    }

    public void lambda$initObserver$2(UploadCompleteEntity uploadCompleteEntity) {
        if (uploadCompleteEntity == null) {
            String resultJson = getResultJson(0, null);
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + this.idDataCallbackMethod + "('" + resultJson + "')");
            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 resultJson2 = getResultJson(uploadCompleteEntity.status, hashMap);
        ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:" + this.idDataCallbackMethod + "('" + resultJson2 + "')");
    }

    public void lambda$myCreate$0(LiveIdentifyInfo liveIdentifyInfo) {
        this.liveData = liveIdentifyInfo;
    }

    private void openContacts() {
        Intent intent = new Intent("android.intent.action.PICK", ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
        if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
            getActivity().startActivityForResult(intent, PICK_CONTACT);
        }
    }

    private void openGooglePlay(String str) {
        try {
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
            intent.addFlags(268435456);
            getActivity().startActivity(intent);
        } catch (ActivityNotFoundException unused) {
            getActivity().startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=com.example.app")));
        }
    }

    private void removeEventListener() {
        if (this.hasAddEventListener) {
            this.hasAddEventListener = false;
            LogUtils.e(new Object[]{"FacturaFragment removeEventListener"});
            LiveEventBus.get("LiveIdentifyNotifyInfo", LiveIdentifyNotifyInfo.class).removeObserver(this.liveIdentifyNotifyInfoObserver);
            LiveEventBus.get("UploadCompleteEntity", UploadCompleteEntity.class).removeObserver(this.uploadCompleteEntityObserver);
        }
    }

    private void showBottomProgressDialog() {
        SensorsHelper.b("collect");
        if (this.mBottomProgressDialog == null) {
            this.mBottomProgressDialog = new MyBottomSheetDialog(getActivity(), R$style.BottomSheetDialogStyle);
        }
        RelativeLayout relativeLayout = (RelativeLayout) LayoutInflater.from(getActivity()).inflate(R$layout.layout_bottom_progress_dialog, (ViewGroup) null);
        new Timer().schedule(new AnonymousClass4((ProgressBar) relativeLayout.findViewById(R$id.progress), (RadioButton) relativeLayout.findViewById(R$id.rbtn_one), (RadioButton) relativeLayout.findViewById(R$id.rbtn_two), (RadioButton) relativeLayout.findViewById(R$id.rbtn_three), (RadioButton) relativeLayout.findViewById(R$id.rbtn_four)), 0L, 250L);
        this.mBottomProgressDialog.setContentView(relativeLayout);
        this.mBottomProgressDialog.setCancelable(false);
        this.mBottomProgressDialog.setCanceledOnTouchOutside(false);
        this.mBottomProgressDialog.show();
    }

    private void showCustomPermissionTipDialog(String str) {
        if (this.customPermissionTipDialog == null) {
            this.customPermissionTipDialog = new CustomPermissionTipDialog();
        }
        this.customPermissionTipDialog.setPermissionList(str);
        this.customPermissionTipDialog.setOnClickListener(new CustomPermissionTipDialog.OnClickListener() {
            @Override
            public void a() {
                FacturaFragment.this.customPermissionTipDialog.dismiss();
            }

            @Override
            public void b() {
            }
        });
        CustomPermissionTipDialog customPermissionTipDialog = this.customPermissionTipDialog;
        if (customPermissionTipDialog != null) {
            if (customPermissionTipDialog.isAdded() && this.customPermissionTipDialog.isVisible() && this.customPermissionTipDialog.getDialog() != null && this.customPermissionTipDialog.getDialog().isShowing()) {
                return;
            }
            getActivity().showDialog(this.customPermissionTipDialog, "customPermissionTipDialog");
        }
    }

    public void startGoLiveness(String str) {
        LiveIdentifyInfo liveIdentifyInfo = (LiveIdentifyInfo) GsonUtils.fromJson(str, LiveIdentifyInfo.class);
        this.liveData = liveIdentifyInfo;
        if (!"SUCCESS".equals(oo00oOO.setLicenseAndCheck(new String(Base64.decode(liveIdentifyInfo.getSdkLicense(), 0), StandardCharsets.UTF_8)))) {
            XToastUtils.a("Licencia incorrecta, caducidad / formato incorrecto / appid no está dentro del alcance de la autorización");
            LogUtils.e(new Object[]{"license a, a/a/appId a"});
            return;
        }
        LogUtils.e(new Object[]{"license a"});
        oo00oOO.letSDKHandleCameraPermission();
        oo00oOO.setRecordVideoSwitch(true);
        oo00oOO.isDetectOcclusion(false);
        oo00oOO.setResultPictureSize(BannerConfig.SCROLL_TIME);
        GuardianSDK.bindUser(Constants.a);
        startLivenessActivity();
    }

    private void startLivenessActivity() {
        getActivity().startActivityForResult(new Intent((Context) getActivity(), (Class<?>) LivenessActivity.class), 10000);
    }

    @Override
    public void lazyLoad() {
        super.lazyLoad();
        addLiveEventListener();
        if (!LoginInfoCache.a) {
            ((FragmentFacturaBinding) this.bind).a.loadUrl("javascript:location.reload()");
            return;
        }
        if (StringUtils.isTrimEmpty(LoginInfoCache.e())) {
            return;
        }
        String str = Constants.e + "repay/order?token=" + LoginInfoCache.e();
        if (!this.isFirst) {
            showLoading();
        }
        ((FragmentFacturaBinding) this.bind).a.clearView();
        ((FragmentFacturaBinding) this.bind).a.setVisibility(4);
        LogUtils.e(new Object[]{"url=" + str});
        WebviewUtils.g(((FragmentFacturaBinding) this.bind).a);
        ((FragmentFacturaBinding) this.bind).a.loadUrl(str);
        new Handler() {
            @Override
            public void handleMessage(Message message) {
                if (message.what != 1) {
                    return;
                }
                ((FragmentFacturaBinding) ((BaseFragment) FacturaFragment.this).bind).a.reload();
            }
        }.sendEmptyMessageDelayed(1, 600L);
        LoginInfoCache.a = false;
    }

    @Override
    public int myView() {
        return R$layout.fragment_factura;
    }

    public void onChooseFile(int i, int i2, Intent intent) {
        CustomWebChromeClient customWebChromeClient = this.customWebChromeClient;
        if (customWebChromeClient != null) {
            customWebChromeClient.k(i, i2, intent);
        }
    }

    public void onDestroyView() {
        LogUtils.e(new Object[]{"onDestroyView"});
        AdjustBridge.unregister();
        super.onDestroyView();
    }

    public void onIDTakeResult(Intent intent) {
        String b = IDCardCamera.b(intent);
        if (TextUtils.isEmpty(b)) {
            return;
        }
        Bitmap decodeFile = BitmapFactory.decodeFile(b);
        File filesDir = getActivity().getApplicationContext().getFilesDir();
        StringBuilder sb = new StringBuilder();
        sb.append(filesDir.getAbsolutePath());
        String str = File.separator;
        sb.append(str);
        sb.append("idcard");
        sb.append(str);
        sb.append(FileUtils.getFileName(TimeUtils.date2String(new Date(), "yyyyMMddHHmmss") + ".jpg"));
        String sb2 = sb.toString();
        ImageUtils.save(decodeFile, sb2, Bitmap.CompressFormat.JPEG);
        UploadFileIntentService.startUploadIDImage(getActivity(), sb2);
    }

    @Override
    public void onInvisible() {
        super.onInvisible();
        removeEventListener();
    }

    public void onLivenessResult(Intent intent) {
        this.isLivenessing = false;
        ooO00O0O0Oo.getEventId();
        ooO00O0O0Oo.getVideoFile(getActivity());
        if (!ooO00O0O0Oo.isSuccess()) {
            ooO00O0O0Oo.getErrorCode();
            ooO00O0O0Oo.getErrorMsg();
            return;
        }
        String livenessId = ooO00O0O0Oo.getLivenessId();
        long uploadPictureCostMillSeconds = ooO00O0O0Oo.getUploadPictureCostMillSeconds();
        ooO00O0O0Oo.isPay();
        ooO00O0O0Oo.getLivenessBitmap();
        Bitmap nearBitmap = ooO00O0O0Oo.getNearBitmap();
        ooO00O0O0Oo.getAuditImageList();
        File filesDir = getActivity().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.liveData.setSupplierNo(livenessId);
        this.liveData.setFilePath(sb2);
        this.liveData.setTimeCost(uploadPictureCostMillSeconds);
        UploadFileIntentService.startUploadLiveImage(getActivity(), this.liveData);
    }

    public void onPickContactResult(Intent intent) {
        Cursor query = getActivity().getContentResolver().query(intent.getData(), new String[]{"data1", "display_name"}, null, null, null);
        if (query == null) {
            getAddressBookSF(null, false);
            return;
        }
        try {
            if (query.getCount() == 0) {
                getAddressBookSF(query, false);
            } else {
                query.moveToNext();
                getAddressBookSF(query, true);
            }
        } finally {
            query.close();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void myCreate(FragmentFacturaBinding fragmentFacturaBinding, FacturaViewModel facturaViewModel) {
        this.wifiInfoUtil = new WifiInfoUtil(getActivity());
        WebSettings settings = fragmentFacturaBinding.a.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(getActivity());
        this.customWebChromeClient = customWebChromeClient;
        fragmentFacturaBinding.a.setWebChromeClient(customWebChromeClient);
        fragmentFacturaBinding.a.setWebViewClient(new MyWebViewClient());
        AdjustBridge.registerAndGetInstance(VelozApplication.getInstance(), fragmentFacturaBinding.a);
        facturaViewModel.c.observe(this, new Observer() {
            public final void onChanged(Object obj) {
                FacturaFragment.this.lambda$myCreate$0((LiveIdentifyInfo) obj);
            }
        });
        initObserver();
        fragmentFacturaBinding.a(facturaViewModel);
        lazyLoad();
    }

    public class MyWebViewClient extends WebViewClient {
        public MyWebViewClient() {
        }

        @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 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://")) {
                    return super.shouldOverrideUrlLoading(webView, webResourceRequest);
                }
                FacturaFragment.this.handleJsInterface(decode);
                return true;
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }

        @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://")) {
                    FacturaFragment.this.handleJsInterface(decode);
                    return true;
                }
                return super.shouldOverrideUrlLoading(webView, decode);
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }
        }
    }
}