导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - d.java 源代码

正在查看: Hopscotch v9.7.2 应用的 d.java JAVA 源代码文件

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


package com.payu.custombrowser;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.h;
import com.payu.custombrowser.bean.CustomBrowserConfig;
import com.payu.custombrowser.c;
import com.payu.custombrowser.cbinterface.CbBottomSheetEventListener;
import com.payu.custombrowser.util.CBConstant;
import com.payu.custombrowser.util.SnoozeConfigMap;
import com.payu.custombrowser.widgets.SnoozeLoaderView;
import com.payu.india.Payu.PayuConstants;
import com.payu.otpparser.OtpCallback;
import com.payu.otpparser.OtpParser;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Timer;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HttpsURLConnection;
import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class d extends com.payu.custombrowser.c implements CbBottomSheetEventListener, View.OnClickListener {
    private static boolean A0 = false;
    public static boolean hasToStart = false;
    public static int snoozeImageDownloadTimeout;
    View Z;
    boolean a0;
    Intent b0;
    boolean c0;
    int d0;
    String f0;
    Timer g0;
    boolean i0;
    String j0;
    boolean m0;
    protected HashMap<String, String> mAnalyticsMap;
    int[] p0;
    SnoozeConfigMap q0;
    protected CountDownTimer slowUserCountDownTimer;
    protected AlertDialog slowUserWarningDialog;
    protected BroadcastReceiver snoozeBroadCastReceiver;
    protected int snoozeUrlLoadingPercentage;
    protected int snoozeUrlLoadingTimeout;
    protected int snoozeVisibleCountBackwdJourney;
    protected int snoozeVisibleCountFwdJourney;
    private RelativeLayout t0;
    private RelativeLayout u0;
    private TextView v0;
    private TextView w0;
    private TextView x0;
    private LinearLayout y0;
    private CountDownTimer z0;
    protected String SNOOZE_GET_WEBVIEW_STATUS_INTENT_ACTION = "webview_status_action";
    protected boolean isSnoozeBroadCastReceiverRegistered = false;
    protected boolean isSnoozeServiceBounded = false;
    protected int snoozeCount = 0;
    protected int snoozeCountBackwardJourney = 0;
    protected boolean isSnoozeEnabled = true;
    protected boolean isRetryNowPressed = false;
    protected boolean isListenerAttached = false;
    boolean e0 = true;
    Boolean h0 = Boolean.FALSE;
    boolean k0 = true;
    boolean l0 = false;
    boolean n0 = false;
    boolean o0 = false;
    int r0 = 0;
    int s0 = 0;
    public boolean isS2SHtmlSupport = false;

    public class a implements Runnable {
        public a() {
        }

        @Override
        public void run() {
            androidx.appcompat.app.h hVar = d.this.j;
            if (hVar == null || !hVar.isShowing()) {
                return;
            }
            d.this.j.cancel();
            d.this.j.dismiss();
            d.this.b.finish();
        }
    }

    public class b implements Runnable {
        final String a;
        final String b;

        public b(d dVar, String str, String str2) {
            this.a = str;
            this.b = str2;
        }

        @Override
        public void run() {
            try {
                HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(URLDecoder.decode(this.a, "UTF-8")).openConnection();
                httpsURLConnection.setRequestMethod("POST");
                httpsURLConnection.setRequestProperty(PayuConstants.PAYU_CONTENT_TYPE, "application/x-www-form-urlencoded");
                httpsURLConnection.setRequestProperty(PayuConstants.PAYU_CONTENT_LENGTH, String.valueOf(this.b.length()));
                httpsURLConnection.setDoOutput(true);
                httpsURLConnection.getOutputStream().write(this.b.getBytes());
            } catch (Exception unused) {
            }
        }
    }

    public class c implements View.OnTouchListener {
        public c() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            com.payu.custombrowser.b bVar = d.this.h;
            if (bVar != null) {
                if (!bVar.isAdded()) {
                    d dVar = d.this;
                    dVar.h.showNow(dVar.getActivity().getSupportFragmentManager(), "CbBottomSheet");
                }
                d dVar2 = d.this;
                dVar2.h.enterManually(dVar2.d);
            }
            d.this.k();
            return false;
        }
    }

    public class CountDownTimerC0069d extends CountDownTimer {
        public CountDownTimerC0069d(long j, long j2) {
            super(j, j2);
        }

        @Override
        public void onFinish() {
            d.this.r();
            if (d.this.isAdded()) {
                try {
                    JSONObject jSONObject = new JSONObject(d.this.W);
                    d dVar = d.this;
                    int i = R.string.cb_regenerate;
                    boolean z = jSONObject.has(dVar.getString(i)) && jSONObject.getBoolean(d.this.getString(i));
                    d dVar2 = d.this;
                    int i2 = R.string.cb_pin;
                    if (jSONObject.has(dVar2.getString(i2))) {
                        jSONObject.getBoolean(d.this.getString(i2));
                    }
                    if (z) {
                        d.this.x0.setVisibility(0);
                    }
                } catch (JSONException e) {
                    com.payu.custombrowser.util.d.a(e.getMessage());
                }
            }
        }

        @Override
        public void onTick(long j) {
            if (d.this.isAdded()) {
                d.this.w0.setText(d.this.getString(R.string.cb_payu_waiting_for_otp) + " " + (j / 1000) + " SEC");
            }
        }
    }

    public class e implements View.OnTouchListener {
        public e() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (com.payu.custombrowser.util.b.g(d.this.b)) {
                d.this.m();
                View view2 = d.this.K;
                if (view2 != null) {
                    view2.setVisibility(8);
                }
                d dVar = d.this;
                if (dVar.w == 2) {
                    dVar.h();
                }
            } else {
                d.this.internetErrorHandler(0, CBConstant.MSG_NO_INTERNET);
            }
            return false;
        }
    }

    public class f implements View.OnKeyListener {

        public class a implements DialogInterface.OnClickListener {
            public a() {
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                d.this.postToPaytxn();
                d.this.addEventAnalytics("user_input", "back_button_ok_Ok");
                dialogInterface.dismiss();
                d.this.onBackApproved();
                HashMap<String, String> e = new com.payu.custombrowser.util.b().e(d.this.customBrowserConfig.getPayuPostData());
                Bank.b1 = e.get("amount");
                Bank.transactionID = e.get("txnid");
                com.payu.custombrowser.util.b.a(d.this.getContext(), "CB Back Button", d.this.customBrowserConfig.getPaymentType(), true, Bank.b1);
                d.this.b.finish();
            }
        }

        public class b implements DialogInterface.OnClickListener {
            public b() {
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                d.this.addEventAnalytics("user_input", "back_button_cancel_Cancel");
                d.this.onBackCancelled();
                dialogInterface.dismiss();
                new com.payu.custombrowser.util.b().e(d.this.customBrowserConfig.getPayuPostData());
                com.payu.custombrowser.util.b.a(d.this.getContext(), "CB Back Button", d.this.customBrowserConfig.getPaymentType(), false, Bank.b1);
            }
        }

        public f() {
        }

        @Override
        public boolean onKey(View view, int i, KeyEvent keyEvent) {
            if (keyEvent.getAction() == 1 && i == 4) {
                if (d.this.getArguments().getBoolean(CBConstant.BACK_BUTTON, true)) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(d.this.b, R.style.cb_dialog);
                    builder.setCancelable(false);
                    builder.setMessage("Do you really want to cancel the transaction ?");
                    builder.setPositiveButton("Ok", new a());
                    builder.setNegativeButton("Cancel", new b());
                    d.this.addEventAnalytics("user_input", "payu_back_button");
                    d.this.onBackPressed(builder);
                    builder.show();
                    return true;
                }
                d.this.addEventAnalytics("user_input", "m_back_button");
                d.this.onBackPressed(null);
                d.this.b.onBackPressed();
            }
            return false;
        }
    }

    public class g implements OtpCallback {
        public g() {
        }

        @Override
        public void onOtpReceived(@NotNull String str) {
            com.payu.custombrowser.b bVar;
            if (str.isEmpty()) {
                return;
            }
            d.this.f0 = str;
            com.payu.custombrowser.util.d.b("onOtpReceived " + d.this.f0);
            d.this.fillOTPOnBankPage();
            d dVar = d.this;
            String str2 = dVar.f0;
            dVar.backupOfOTP = str2;
            dVar.otpTriggered = true;
            dVar.d = str2;
            try {
                dVar.isOTPFilled = false;
                bVar = dVar.h;
            } catch (JSONException e) {
                com.payu.custombrowser.util.d.a(e.getMessage());
            }
            if (bVar != null && bVar.isAdded()) {
                d dVar2 = d.this;
                if (dVar2.isCbBottomSheetExpanded) {
                    dVar2.h.otpFetched(str2);
                    if (d.this.catchAllJSEnabled && !TextUtils.isEmpty(str2)) {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("otp", str2);
                        jSONObject.put("isAutoFillOTP", true);
                        WebView webView = d.this.q;
                        StringBuilder sb = new StringBuilder("javascript:");
                        d dVar3 = d.this;
                        sb.append(dVar3.e.getString(dVar3.getString(R.string.cb_fill_otp)));
                        sb.append("(");
                        sb.append(jSONObject);
                        sb.append(")");
                        webView.loadUrl(sb.toString());
                    }
                    d.this.addEventAnalytics("user_input", CBConstant.CB_OTP_RECEIVED);
                }
            }
            d dVar4 = d.this;
            dVar4.c = 1;
            dVar4.s();
            if (d.this.catchAllJSEnabled) {
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("otp", str2);
                jSONObject2.put("isAutoFillOTP", true);
                WebView webView2 = d.this.q;
                StringBuilder sb2 = new StringBuilder("javascript:");
                d dVar32 = d.this;
                sb2.append(dVar32.e.getString(dVar32.getString(R.string.cb_fill_otp)));
                sb2.append("(");
                sb2.append(jSONObject2);
                sb2.append(")");
                webView2.loadUrl(sb2.toString());
            }
            d.this.addEventAnalytics("user_input", CBConstant.CB_OTP_RECEIVED);
        }

        @Override
        public void onUserDenied() {
            com.payu.custombrowser.util.d.b("onUserDenied permissionGranted " + d.this.k0);
            d.this.addEventAnalytics("user_input", CBConstant.CB_OTP_USERDENIED);
            d dVar = d.this;
            dVar.k0 = false;
            com.payu.custombrowser.b bVar = dVar.h;
            if (bVar != null && bVar.isAdded()) {
                d dVar2 = d.this;
                if (dVar2.isCbBottomSheetExpanded) {
                    dVar2.h.enterManually("");
                    return;
                }
            }
            d dVar3 = d.this;
            dVar3.d = "";
            dVar3.c = 1;
            dVar3.s();
        }
    }

    public class h implements Runnable {

        public class a implements Runnable {
            final String a;

            public a(String str) {
                this.a = str;
            }

            @Override
            public void run() {
                d.this.q.loadUrl("javascript:" + this.a);
            }
        }

        public class b implements Runnable {
            final String a;

            public b(String str) {
                this.a = str;
            }

            @Override
            public void run() {
                d.this.q.loadUrl("javascript:" + this.a);
            }
        }

        public class c implements Runnable {
            public c() {
            }

            @Override
            public void run() {
                d.this.onPageStarted();
            }
        }

        public h() {
        }

        @Override
        public void run() {
            throw new UnsupportedOperationException("Method not decompiled: com.payu.custombrowser.d.h.run():void");
        }
    }

    public class i implements Runnable {
        final Intent a;

        public i(Intent intent) {
            this.a = intent;
        }

        @Override
        public void run() {
            androidx.appcompat.app.h hVar = d.this.j;
            if (hVar != null) {
                hVar.dismiss();
            }
            d dVar = d.this;
            if (dVar.backwardJourneyStarted) {
                dVar.showTransactionStatusDialog(this.a.getStringExtra("value"), false);
                return;
            }
            if (dVar.isRetryNowPressed) {
                dVar.isRetryNowPressed = false;
            } else {
                dVar.snoozeCount++;
            }
            dVar.resumeTransaction(this.a);
        }
    }

    public class j implements DialogInterface.OnDismissListener {
        final String a;

        public j(String str) {
            this.a = str;
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            try {
                com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
                if (bVar.getPayuCustomBrowserCallback() != null) {
                    com.payu.custombrowser.b bVar2 = d.this.h;
                    if (bVar2 != null && bVar2.isAdded()) {
                        d.this.h.finish();
                    }
                    bVar.getPayuCustomBrowserCallback().onPaymentSuccess(this.a, "");
                }
            } catch (Exception unused) {
            }
            d.this.j.dismiss();
            d.this.j.cancel();
            d.this.b.finish();
        }
    }

    public class k implements Runnable {
        public k() {
        }

        @Override
        public void run() {
            androidx.appcompat.app.h hVar = d.this.j;
            if (hVar == null || !hVar.isShowing()) {
                return;
            }
            d.this.j.cancel();
            d.this.j.dismiss();
            d.this.b.finish();
        }
    }

    public class l implements View.OnClickListener {
        public l() {
        }

        @Override
        public void onClick(View view) {
            d.this.addEventAnalytics("snooze_interaction_time", "-1");
            d.this.addEventAnalytics("snooze_window_action", "snooze_cancel_transaction_click");
            d.this.j.dismiss();
            d.this.j.cancel();
            d.this.b.finish();
        }
    }

    public class m implements DialogInterface.OnDismissListener {
        public m() {
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            d.this.j.dismiss();
            d.this.j.cancel();
        }
    }

    public class n extends c.h {
        public n() {
            super();
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            com.payu.custombrowser.util.d.b("Class Name: " + n.class.getCanonicalName() + "onTouch of PayUCBLifeCycleCalled");
            d.this.m();
            return super.onTouch(view, motionEvent);
        }
    }

    public void m() {
        if (this.forwardJourneyForChromeLoaderIsComplete) {
            this.firstTouch = true;
            dismissSlowUserWarningTimer();
        }
    }

    private void n() {
        this.l = CBConstant.errorMessages.PAYMENT_INITIATED;
        addEventAnalytics("user_input", CBConstant.errorMessages.PAYMENT_INITIATED);
        if (this.customBrowserConfig.getPayuPostData() != null) {
            HashMap<String, String> e2 = new com.payu.custombrowser.util.b().e(this.customBrowserConfig.getPayuPostData());
            Bank.b1 = e2.get("amount");
            Bank.transactionID = e2.get("txnid");
            Bank.Z0 = com.payu.custombrowser.util.b.c(e2);
            Bank.a1 = com.payu.custombrowser.util.b.b(e2);
            String str = Bank.Z0;
            if (str == null || !str.equalsIgnoreCase(CBConstant.NETBANKING)) {
                Bank.c1 = "";
            } else {
                Bank.c1 = "L2";
            }
            Bank.d1 = System.currentTimeMillis();
            com.payu.custombrowser.util.b.a(getActivity().getApplicationContext(), "Custom browser Initiated", com.payu.custombrowser.util.b.c(e2), "CB Initiated", Bank.b1, Bank.a1, Bank.Z0, "", String.valueOf(0));
        }
        this.T.execute(new h());
    }

    private void o() {
        String str = this.W;
        if (str == null || str.isEmpty()) {
            return;
        }
        boolean c2 = com.payu.custombrowser.util.b.c(this.W, getString(R.string.cb_regenerate));
        if (getActivity() != null) {
            if (c2) {
                this.x0.setVisibility(0);
            } else {
                this.x0.setVisibility(8);
            }
        }
    }

    private void q() {
        this.q.getSettings().setJavaScriptEnabled(true);
        this.q.addJavascriptInterface(this, "PayU");
        this.q.getSettings().setSupportMultipleWindows(true);
        this.q.setOnTouchListener(new e());
        this.q.getSettings().setDomStorageEnabled(true);
        this.q.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
        this.q.getSettings().setCacheMode(2);
    }

    public void r() {
        addEventAnalytics("user_input", "manual_otp_collpased");
        this.u0.setVisibility(0);
        this.t0.setVisibility(8);
        this.y0.setVisibility(8);
    }

    private void u() {
        CountDownTimerC0069d countDownTimerC0069d = new CountDownTimerC0069d(this.X.longValue(), 1000L);
        this.z0 = countDownTimerC0069d;
        countDownTimerC0069d.start();
    }

    public void approveOtp(String str) {
        this.f0 = null;
        this.l = "approved_otp";
        addEventAnalytics("user_input", "approved_otp");
        addEventAnalytics("Approve_btn_clicked_time", "-1");
        t();
        this.i0 = false;
        this.h0 = Boolean.TRUE;
        onHelpUnavailable();
        g();
        this.w = 1;
        if (str != null && !str.isEmpty()) {
            this.q.loadUrl("javascript:" + this.f.optString(getString(R.string.cb_process_otp)) + "(\"" + str + "\")");
        }
        f();
    }

    public void cbOldFlowOnCreateView() {
        this.q = (WebView) this.b.findViewById(getArguments().getInt(CBConstant.WEBVIEW));
        String str = Bank.Y0;
        if (str == null || !str.equalsIgnoreCase("nb")) {
            CustomBrowserConfig customBrowserConfig = this.customBrowserConfig;
            if (customBrowserConfig != null && customBrowserConfig.getViewPortWideEnable() == 1) {
                this.q.getSettings().setUseWideViewPort(true);
            }
        } else {
            this.q.getSettings().setUseWideViewPort(true);
        }
        this.q.setFocusable(true);
        this.q.setOnKeyListener(new f());
        String str2 = Bank.Y0;
        if ((str2 == null || !str2.equalsIgnoreCase("nb")) && !this.E.getBoolean(CBConstant.VIEWPORTWIDE, false)) {
            return;
        }
        this.q.getSettings().setUseWideViewPort(true);
    }

    public void cbOldOnCreate() {
        Bundle arguments = getArguments();
        this.E = arguments;
        this.autoApprove = arguments.getBoolean(CBConstant.AUTO_APPROVE, false);
        this.autoSelectOtp = this.E.getBoolean(CBConstant.AUTO_SELECT_OTP, false);
        this.z = this.E.getBoolean(CBConstant.MERCHANT_SMS_PERMISSION, false);
        String str = Bank.e1;
        if (str == null || str.equalsIgnoreCase("")) {
            Bank.e1 = getArguments().getString(CBConstant.SDK_DETAILS);
        }
        String str2 = Bank.transactionID;
        if (str2 == null || str2.equalsIgnoreCase("")) {
            Bank.transactionID = getArguments().getString("txnid");
        }
        String str3 = Bank.keyAnalytics;
        if (str3 == null || str3.equalsIgnoreCase("")) {
            Bank.keyAnalytics = getArguments().getString("merchantid");
        }
    }

    public void cbOnCreate() {
        if (getArguments() == null || !getArguments().containsKey("cb_config")) {
            return;
        }
        CustomBrowserConfig customBrowserConfig = (CustomBrowserConfig) getArguments().getParcelable("cb_config");
        this.customBrowserConfig = customBrowserConfig;
        boolean z = false;
        this.z = customBrowserConfig != null && customBrowserConfig.getMerchantSMSPermission() == 1;
        CustomBrowserConfig customBrowserConfig2 = this.customBrowserConfig;
        this.autoApprove = customBrowserConfig2 != null && customBrowserConfig2.getAutoApprove() == 1;
        CustomBrowserConfig customBrowserConfig3 = this.customBrowserConfig;
        if (customBrowserConfig3 != null && customBrowserConfig3.getAutoSelectOTP() == 1) {
            z = true;
        }
        this.autoSelectOtp = z;
        if (this.customBrowserConfig != null) {
            String str = Bank.keyAnalytics;
            if (str == null || str.trim().equals("")) {
                if (this.customBrowserConfig.getMerchantKey() != null) {
                    Bank.keyAnalytics = this.customBrowserConfig.getMerchantKey().trim();
                } else {
                    Bank.keyAnalytics = "";
                }
            }
            String str2 = Bank.transactionID;
            if (str2 == null || str2.trim().equals("")) {
                if (this.customBrowserConfig.getTransactionID() == null || this.customBrowserConfig.getTransactionID().trim().equals("")) {
                    Bank.transactionID = "123";
                } else {
                    Bank.transactionID = this.customBrowserConfig.getTransactionID();
                }
            }
            String str3 = Bank.e1;
            if (str3 == null || str3.trim().equals("")) {
                if (this.customBrowserConfig.getSdkVersionName() != null) {
                    Bank.e1 = this.customBrowserConfig.getSdkVersionName().trim();
                } else {
                    Bank.e1 = "";
                }
            }
            if (TextUtils.isEmpty(this.customBrowserConfig.getSurepayS2Surl()) && TextUtils.isEmpty(this.customBrowserConfig.getHtmlData())) {
                return;
            }
            this.isS2SHtmlSupport = true;
        }
    }

    public void cbOnCreateView() {
        String str = Bank.Y0;
        if (str == null || !str.equalsIgnoreCase("nb")) {
            CustomBrowserConfig customBrowserConfig = this.customBrowserConfig;
            if (customBrowserConfig != null && customBrowserConfig.getViewPortWideEnable() == 1) {
                this.q.getSettings().setUseWideViewPort(true);
                this.q.getSettings().setLoadWithOverviewMode(true);
            }
        } else {
            this.q.getSettings().setUseWideViewPort(true);
            this.q.getSettings().setLoadWithOverviewMode(true);
        }
        Bank bank = (Bank) this;
        this.q.setWebChromeClient(new PayUWebChromeClient(bank));
        if (this.customBrowserConfig.getEnableSurePay() > 0) {
            this.q.setWebViewClient(new PayUSurePayWebViewClient(bank, Bank.keyAnalytics));
        } else {
            this.q.setWebViewClient(new PayUWebViewClient(bank, Bank.keyAnalytics));
        }
        if (!TextUtils.isEmpty(this.customBrowserConfig.getHtmlData())) {
            addEventAnalytics("cb_status", "load_html");
            this.q.loadDataWithBaseURL("https://secure.payu.in/_payment", this.customBrowserConfig.getHtmlData(), "text/html", "UTF-8", null);
        } else if (TextUtils.isEmpty(this.customBrowserConfig.getSurepayS2Surl())) {
            CustomBrowserConfig customBrowserConfig2 = this.customBrowserConfig;
            if (customBrowserConfig2 != null && customBrowserConfig2.getPostURL() != null && this.customBrowserConfig.getPayuPostData() != null) {
                this.q.postUrl(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData().getBytes());
            }
        } else {
            this.q.loadUrl(this.customBrowserConfig.getSurepayS2Surl());
        }
        com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
        if (bVar.getPayuCustomBrowserCallback() != null) {
            bVar.getPayuCustomBrowserCallback().setCBProperties(this.q, bank);
        }
        this.mAnalyticsMap = new HashMap<>();
        String f2 = com.payu.custombrowser.util.b.f(getContext());
        if (f2.length() <= 0 || f2.contentEquals(com.payu.custombrowser.util.b.a(new WebView(getContext())))) {
            return;
        }
        addEventAnalytics("web_view_updated_successfully", com.payu.custombrowser.util.b.a(new WebView(getContext())));
        com.payu.custombrowser.util.b.g(getContext(), "");
    }

    public void dismissSlowUserWarning() {
        AlertDialog alertDialog = this.slowUserWarningDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    public abstract void dismissSlowUserWarningTimer();

    public void fillOTPOnBankPage() {
        try {
            if (this.f == null || TextUtils.isEmpty(this.f0)) {
                return;
            }
            JSONObject jSONObject = this.f;
            int i2 = R.string.cb_fill_otp;
            if (jSONObject.has(getString(i2))) {
                this.q.loadUrl("javascript:" + this.f.getString(getString(i2)) + "(\"" + this.f0 + "\",\"url\")");
                this.f0 = null;
            }
        } catch (JSONException e2) {
            com.payu.custombrowser.util.d.a(e2.getMessage());
        }
    }

    public abstract void internetErrorHandler(int i2, String str);

    public void k() {
        CountDownTimer countDownTimer = this.z0;
        if (countDownTimer != null) {
            countDownTimer.cancel();
            this.z0 = null;
        }
    }

    public void l() {
        k();
        FrameLayout frameLayout = this.H;
        if (frameLayout != null) {
            frameLayout.removeAllViews();
        }
    }

    public void logOnTerminate() {
        try {
            addEventAnalytics("last_url", com.payu.custombrowser.util.b.l(this.L.c(this.b.getApplicationContext(), "last_url")));
        } catch (Exception unused) {
        } finally {
            this.L.a(this.b.getApplicationContext(), "last_url");
        }
        ArrayList<String> arrayList = this.n;
        if (arrayList != null && !arrayList.contains("CUSTOM_BROWSER")) {
            if (this.n.contains("review_order_custom_browser")) {
                this.l = "review_order_custom_browser";
            } else {
                this.l = "NON_CUSTOM_BROWSER";
            }
            addEventAnalytics("cb_status", this.l);
        }
        this.l = "terminate_transaction";
        addEventAnalytics("user_input", "terminate_transaction");
        com.payu.custombrowser.widgets.a aVar = this.u;
        if (aVar != null && !aVar.isShowing()) {
            this.u.dismiss();
        }
        String str = this.listOfTxtFld;
        if (str != null && str.length() > 1 && !this.isOTPFilled) {
            addEventAnalytics("bank_page_otp_fields", this.listOfTxtFld);
            addEventAnalytics("bank_page_host_name", this.hostName);
        }
        this.L.a((Context) this.b);
    }

    public void markPreviousTxnAsUserCanceled(String str) {
        new com.payu.custombrowser.widgets.b(str, com.payu.custombrowser.a.a(this.b.getApplicationContext()).g()).a();
    }

    public void onActivityResult(int i2, int i3, Intent intent) {
        this.g.onActivityResult(i2, i3, intent);
    }

    public void onAttach(Context context) {
        super.onAttach(context);
        this.b = (Activity) context;
        if (OtpParser.getInstance(getActivity()) != null) {
            OtpParser.getInstance(getActivity()).lifeCycleOnDestroy();
        }
        this.g = OtpParser.getInstance(getActivity());
    }

    @Override
    public void onCbBottomSheetCancel() {
        FrameLayout frameLayout = this.G;
        if (frameLayout != null) {
            frameLayout.removeAllViews();
            this.G.setVisibility(8);
        }
        s();
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.resentOtp) {
            try {
                this.l = "regenerate_click_collapsed";
                addEventAnalytics("user_input", "regenerate_click_collapsed");
                this.f0 = null;
                this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_regen_otp)));
                this.isListenerAttached = false;
                this.k0 = true;
                t();
                this.d = "";
                return;
            } catch (JSONException e2) {
                com.payu.custombrowser.util.d.a(e2.getMessage());
                return;
            }
        }
        if (view.getId() == R.id.btnSubmitOtpCollapsed) {
            try {
                e();
                this.f0 = null;
                this.i0 = false;
                this.h0 = Boolean.TRUE;
                t();
                if (this.v0.getText().toString().length() > 5) {
                    com.payu.custombrowser.b bVar = this.h;
                    if (bVar != null) {
                        if (!bVar.isAdded()) {
                            this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.h.loading(getString(R.string.cb_confirming_your_payment));
                    }
                    addEventAnalytics("user_input", "submit_otp_collpased");
                    this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_process_otp)) + "(\"" + this.v0.getText().toString() + "\")");
                }
            } catch (JSONException e3) {
                com.payu.custombrowser.util.d.a(e3.getMessage());
            }
        }
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.surePayS2SPayUId = null;
        this.isSnoozeEnabled = this.L.a(CBConstant.SNOOZE_ENABLED, this.b.getApplicationContext());
        A0 = false;
        SnoozeConfigMap a2 = this.L.a(com.payu.custombrowser.util.f.b(this.b, CBConstant.SNOOZE_SHARED_PREF));
        this.q0 = a2;
        int[] percentageAndTimeout = a2.getPercentageAndTimeout(CBConstant.DEFAULT_PAYMENT_URLS);
        this.p0 = percentageAndTimeout;
        this.snoozeUrlLoadingPercentage = percentageAndTimeout[0];
        this.snoozeUrlLoadingTimeout = percentageAndTimeout[1];
        this.s0 = this.L.a(this.q0, CBConstant.DEFAULT_PAYMENT_URLS);
        snoozeImageDownloadTimeout = com.payu.custombrowser.util.f.b(this.b.getApplicationContext(), "com.payu.custombrowser.payucustombrowser", CBConstant.SNOOZE_IMAGE_DOWNLOAD_TIME_OUT, 0);
        if (this.b.getClass().getSimpleName().equalsIgnoreCase("CBActivity") || this.b.getClass().getSimpleName().equalsIgnoreCase("CheckoutActivity")) {
            cbOnCreate();
        } else {
            this.F = true;
            cbOldOnCreate();
        }
        this.L.a(this.customBrowserConfig);
        initAnalytics(Bank.keyAnalytics);
        this.c0 = false;
        if (this.b != null) {
            this.L.a(this.customBrowserConfig);
            this.surePayS2SPayUId = null;
            this.surePayS2Surl = null;
        }
        if (this.customBrowserConfig != null) {
            addEventAnalytics("snooze_enable_count", "" + this.customBrowserConfig.getEnableSurePay());
            addEventAnalytics("snooze_mode_set_merchant", this.customBrowserConfig.getSurePayMode() == 1 ? "WARN" : "FAIL");
        }
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate;
        View findViewById;
        super.onCreateView(layoutInflater, viewGroup, bundle);
        if (this.F) {
            inflate = layoutInflater.inflate(R.layout.bankold, viewGroup, false);
            inflate.bringToFront();
            cbOldFlowOnCreateView();
            findViewById = inflate;
        } else {
            inflate = layoutInflater.inflate(R.layout.bank, viewGroup, false);
            this.K = inflate.findViewById(R.id.trans_overlay);
            this.q = (WebView) inflate.findViewById(R.id.webview);
            this.Z = inflate.findViewById(R.id.cb_blank_overlay);
            findViewById = inflate.findViewById(R.id.parent);
            cbOnCreateView();
        }
        this.G = (FrameLayout) inflate.findViewById(R.id.help_view);
        this.H = (FrameLayout) inflate.findViewById(R.id.payuBottomSheetCollapsed);
        this.I = (FrameLayout) inflate.findViewById(R.id.flFullScreenLoader);
        View inflate2 = this.b.getLayoutInflater().inflate(R.layout.cb_full_screen_loader, (ViewGroup) null);
        CustomBrowserConfig customBrowserConfig = this.customBrowserConfig;
        if (customBrowserConfig != null && customBrowserConfig.getProgressDialogCustomView() != null) {
            inflate2 = this.customBrowserConfig.getProgressDialogCustomView();
            com.payu.custombrowser.util.b.a((ImageView) inflate2.findViewById(R.id.payu_progress_loader), this.b);
        }
        this.I.addView(inflate2);
        this.J = inflate.findViewById(R.id.view);
        this.v = com.payu.custombrowser.widgets.a.a(this.b, null);
        q();
        n();
        this.mAnalyticsMap = new HashMap<>();
        findViewById.setOnTouchListener(new n());
        return inflate;
    }

    public void onDestroy() {
        super.onDestroy();
        this.L.a(this.timerProgress);
        this.L.a(this.g0);
        this.isListenerAttached = false;
        CountDownTimer countDownTimer = this.slowUserCountDownTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        addEventAnalytics("snooze_count", "" + (this.snoozeVisibleCountBackwdJourney + this.snoozeVisibleCountFwdJourney));
        com.payu.custombrowser.bean.b.SINGLETON.setPayuCustomBrowserCallback(null);
        androidx.appcompat.app.h hVar = this.j;
        if (hVar != null && hVar.isShowing()) {
            this.j.dismiss();
        }
        if (this.snoozeBroadCastReceiver != null && this.isSnoozeBroadCastReceiverRegistered && !A0) {
            androidx.localbroadcastmanager.content.a.b(this.b.getApplicationContext()).e(this.snoozeBroadCastReceiver);
        }
        com.payu.payuanalytics.analytics.model.h hVar2 = this.Y;
        if (hVar2 != null) {
            hVar2.a();
        }
        com.payu.custombrowser.a.a(this.b.getApplicationContext()).a();
        this.L.a(this.g0);
        CountDownTimer countDownTimer2 = this.N;
        if (countDownTimer2 != null) {
            countDownTimer2.cancel();
        }
        logOnTerminate();
        Bank.e1 = null;
        Bank.keyAnalytics = null;
        Bank.transactionID = null;
        Bank.Y0 = null;
        WebView webView = this.q;
        if (webView != null) {
            webView.destroy();
        }
        this.L.b(this.customBrowserConfig);
        this.surePayS2SPayUId = null;
    }

    public void onDestroyView() {
        super.onDestroyView();
        this.L.a(this.timerProgress);
        androidx.appcompat.app.h hVar = this.j;
        if (hVar != null && hVar.isShowing()) {
            this.j.dismiss();
        }
        com.payu.custombrowser.widgets.a aVar = this.u;
        if (aVar != null) {
            aVar.dismiss();
        }
    }

    public abstract void onPageStarted();

    public void onRequestPermissionsResult(int i2, @NonNull String[] strArr, @NonNull int[] iArr) {
        this.m0 = false;
        if (this.o0) {
            try {
                this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_otp)));
            } catch (JSONException e2) {
                com.payu.custombrowser.util.d.a(e2.getMessage());
            }
        }
        if (androidx.core.content.a.a(this.b, "android.permission.RECEIVE_SMS") == 0) {
            this.k0 = true;
            this.f0 = null;
        }
        this.g.onRequestPermissionsResult(i2, strArr, iArr);
        if (this.o0) {
            t();
            com.payu.custombrowser.b bVar = this.h;
            if (bVar != null) {
                if (!bVar.isAdded()) {
                    Bank.d1 = System.currentTimeMillis();
                    com.payu.custombrowser.util.b.a(getActivity().getApplicationContext(), "Custom Browser Loaded", Bank.Z0, "CB Loaded", Bank.b1, Bank.a1, Bank.Z0, Bank.c1, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));
                    this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                }
                this.h.enterOtp(this.j0);
            }
        }
    }

    public void onResume() {
        super.onResume();
        if (this.a0) {
            this.a0 = false;
            cancelTransactionNotification();
            Intent intent = this.b0;
            if (intent == null) {
                addEventAnalytics("internet_not_restored_dialog_recent_app", "-1");
                return;
            }
            if (this.backwardJourneyStarted) {
                try {
                    if (Integer.parseInt(new JSONObject(intent.getStringExtra("value")).optString(getString(R.string.cb_snooze_verify_api_status))) == 1) {
                        addEventAnalytics("transaction_verified_dialog_recent_app", "-1");
                    } else {
                        addEventAnalytics("transaction_not_verified_dialog_recent_app", "-1");
                    }
                } catch (Exception unused) {
                    addEventAnalytics("transaction_not_verified_dialog_recent_app", "-1");
                }
            } else {
                addEventAnalytics("internet_restored_dialog_recent_app", "-1");
            }
            a(this.b0);
        }
    }

    public abstract void p();

    public void postDataToSurl(String str, String str2) {
        new Thread(new b(this, str2, str)).start();
    }

    public abstract void reloadWebView();

    public abstract void reloadWebView(String str);

    public abstract void reloadWebView(String str, String str2);

    public void resumeTransaction(Intent intent) {
        this.customBrowserConfig = (CustomBrowserConfig) intent.getExtras().getParcelable("cb_config");
        if (intent.getStringExtra(CBConstant.CURRENT_URL) == null || intent.getStringExtra(CBConstant.S2S_RETRY_URL) != null) {
            if (intent.getStringExtra(CBConstant.S2S_RETRY_URL) != null) {
                reloadWebView(intent.getStringExtra(CBConstant.S2S_RETRY_URL), null);
                return;
            } else {
                reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
                return;
            }
        }
        if (intent.getStringExtra(CBConstant.CURRENT_URL).equalsIgnoreCase(this.customBrowserConfig.getPostURL())) {
            if (this.customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || this.customBrowserConfig.getPostURL().contentEquals("https://test.payu.in/_payment")) {
                markPreviousTxnAsUserCanceled(com.payu.custombrowser.util.b.a(this.b.getApplicationContext(), "sure_pay_cancelled", this.customBrowserConfig.getTransactionID(), "", Bank.keyAnalytics, this.customBrowserConfig.getTransactionID(), ""));
            }
            reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
            return;
        }
        if (Bank.isUrlWhiteListed(intent.getStringExtra(CBConstant.CURRENT_URL))) {
            reloadWebView(intent.getStringExtra(CBConstant.CURRENT_URL));
            return;
        }
        if (this.customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || this.customBrowserConfig.getPostURL().contentEquals("https://test.payu.in/_payment")) {
            markPreviousTxnAsUserCanceled(com.payu.custombrowser.util.b.a(this.b.getApplicationContext(), "sure_pay_cancelled", this.customBrowserConfig.getTransactionID(), "", Bank.keyAnalytics, this.customBrowserConfig.getTransactionID(), ""));
        }
        reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
    }

    public void s() {
        k();
        FrameLayout frameLayout = this.H;
        if (frameLayout != null) {
            frameLayout.removeAllViews();
        }
        View inflate = this.b.getLayoutInflater().inflate(R.layout.cb_bottom_sheet_collapsed, (ViewGroup) null);
        this.t0 = (RelativeLayout) inflate.findViewById(R.id.rlWaitingForOtpCollapsed);
        this.u0 = (RelativeLayout) inflate.findViewById(R.id.rlManualOtpCollapsed);
        View findViewById = inflate.findViewById(R.id.viewOpenBottomSheet);
        this.v0 = (TextView) inflate.findViewById(R.id.tvCollapsedOtp);
        this.w0 = (TextView) inflate.findViewById(R.id.tvWaitingForOtp);
        this.x0 = (TextView) inflate.findViewById(R.id.resentOtp);
        TextView textView = (TextView) inflate.findViewById(R.id.btnSubmitOtpCollapsed);
        this.y0 = (LinearLayout) inflate.findViewById(R.id.llOtpFetched);
        int i2 = this.c;
        if (i2 == 1 || i2 == 2 || i2 == 5) {
            this.H.setVisibility(0);
            this.H.addView(inflate);
            textView.setOnClickListener(this);
            this.x0.setOnClickListener(this);
            findViewById.setOnTouchListener(new c());
            int i3 = this.c;
            if (i3 != 1 && i3 != 5) {
                if (i3 == 2) {
                    addEventAnalytics("user_input", "waiting_otp_collpased");
                    this.t0.setVisibility(0);
                    this.y0.setVisibility(8);
                    this.u0.setVisibility(8);
                    k();
                    u();
                    return;
                }
                return;
            }
            if (this.d.isEmpty() || this.d.length() < 6 || this.d.length() > 8) {
                o();
                r();
                return;
            }
            addEventAnalytics("user_input", "ready_to_submit_otp_collpased");
            this.v0.setText(this.d);
            this.y0.setVisibility(0);
            this.u0.setVisibility(8);
            this.t0.setVisibility(8);
        }
    }

    public void showCbBlankOverlay(int i2) {
        View view = this.Z;
        if (view != null) {
            view.setVisibility(i2);
        }
    }

    public void showSlowUserWarningNotification() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        new Intent();
    }

    public void showTransactionStatusDialog(java.lang.String r10, boolean r11) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.custombrowser.d.showTransactionStatusDialog(java.lang.String, boolean):void");
    }

    public void t() {
        if (this.isListenerAttached) {
            return;
        }
        this.isListenerAttached = true;
        Bundle bundle = new Bundle();
        bundle.putString(PayuConstants.MERCHANT_KEY, this.customBrowserConfig.getMerchantKey());
        bundle.putString("txnid", this.customBrowserConfig.getTransactionID());
        this.g.startListening(new g(), bundle);
    }

    public void updateHeight(View view) {
        if (this.t == 0) {
            a();
            g();
        }
        a(view);
    }

    public void updateLoaderHeight() {
        if (this.d0 == 0) {
            this.q.measure(-1, -1);
            this.d0 = (int) (this.q.getMeasuredHeight() * 0.35d);
        }
    }

    public void updateSnoozeDialogWithMessage(String str, String str2) {
        androidx.appcompat.app.h hVar = this.j;
        if (hVar != null && hVar.isShowing()) {
            this.j.cancel();
            this.j.dismiss();
        }
        p();
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        View inflate = this.b.getLayoutInflater().inflate(R.layout.cb_layout_snooze, (ViewGroup) null);
        ((TextView) inflate.findViewById(R.id.snooze_header_txt)).setText(str);
        inflate.findViewById(R.id.text_view_cancel_snooze_window).setVisibility(8);
        ((TextView) inflate.findViewById(R.id.text_view_snooze_message)).setText(str2);
        SnoozeLoaderView snoozeLoaderView = (SnoozeLoaderView) inflate.findViewById(R.id.snooze_loader_view);
        snoozeLoaderView.setVisibility(0);
        snoozeLoaderView.c();
        inflate.findViewById(R.id.button_snooze_transaction).setVisibility(8);
        inflate.findViewById(R.id.text_view_retry_message_detail).setVisibility(8);
        inflate.findViewById(R.id.button_retry_transaction).setVisibility(8);
        inflate.findViewById(R.id.button_cancel_transaction).setVisibility(8);
        inflate.findViewById(R.id.t_confirm).setVisibility(8);
        inflate.findViewById(R.id.t_nconfirm).setVisibility(8);
        inflate.findViewById(R.id.button_go_back_snooze).setVisibility(8);
        androidx.appcompat.app.h create = new h.a(this.b).create();
        this.j = create;
        create.a.j(inflate);
        this.j.setCancelable(false);
        this.j.setCanceledOnTouchOutside(false);
        this.j.show();
    }

    private void a(Intent intent) {
        CustomBrowserConfig customBrowserConfig = this.customBrowserConfig;
        int internetRestoredWindowTTL = customBrowserConfig != null ? customBrowserConfig.getInternetRestoredWindowTTL() : 5000;
        int i2 = this.r0;
        if (i2 != 0) {
            internetRestoredWindowTTL = i2;
        }
        if (this.backwardJourneyStarted) {
            try {
                if (this.L.b(intent.getStringExtra("value"), getString(R.string.cb_snooze_verify_api_status)).contentEquals(CBConstant.TRANSACTION_STATUS_SUCCESS)) {
                    Activity activity = this.b;
                    if (activity != null && !activity.isFinishing()) {
                        updateSnoozeDialogWithMessage(this.b.getResources().getString(R.string.cb_transaction_verified), this.b.getResources().getString(R.string.redirect_back_to_merchant));
                    }
                } else {
                    Activity activity2 = this.b;
                    if (activity2 != null && !activity2.isFinishing()) {
                        updateSnoozeDialogWithMessage(this.b.getResources().getString(R.string.cb_transaction_state_unknown), this.b.getResources().getString(R.string.status_unknown_redirect_to_merchant));
                    }
                }
            } catch (Exception unused) {
                Activity activity3 = this.b;
                if (activity3 != null && !activity3.isFinishing()) {
                    updateSnoozeDialogWithMessage(this.b.getResources().getString(R.string.cb_transaction_state_unknown), this.b.getResources().getString(R.string.status_unknown_redirect_to_merchant));
                }
            }
        } else {
            Activity activity4 = this.b;
            if (activity4 != null && !activity4.isFinishing()) {
                updateSnoozeDialogWithMessage(this.b.getResources().getString(R.string.internet_restored), this.b.getResources().getString(R.string.resuming_your_transaction));
            }
        }
        new Handler().postDelayed(new i(intent), internetRestoredWindowTTL);
    }
}