导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - Bank.java 源代码

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

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


package com.payu.custombrowser;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Rect;
import android.net.http.SslError;
import android.os.Build;
import android.os.CountDownTimer;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.o;
import androidx.activity.p;
import androidx.appcompat.app.h;
import androidx.appcompat.widget.c1;
import androidx.media3.exoplayer.t;
import com.google.android.gms.ads.internal.client.z0;
import com.payu.commonui.view.customViews.c;
import com.payu.custombrowser.util.CBConstant;
import com.payu.custombrowser.widgets.SnoozeLoaderView;
import com.payu.paymentparamhelper.PayuConstants;
import in.hopscotch.android.api.response.CheckIsDomesticPayUResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;

public class Bank extends com.payu.custombrowser.d {
    static String Y0;
    static String Z0;
    static String a1;
    static String b1;
    static String c1;
    static long d1;
    static String e1;
    public static String keyAnalytics;
    public static String transactionID;
    private AlertDialog C0;
    Runnable D0;
    private SnoozeLoaderView H0;
    private boolean L0;
    private boolean M0;
    private CountDownTimer N0;
    private CountDownTimer O0;
    private boolean Q0;
    private AlertDialog V0;
    private boolean W0;
    private String X0;
    public long snoozeClickedTime;
    private static final List<String> f1 = new ArrayList();
    public static String Version = "7.13.3";
    private final String B0 = getClass().getSimpleName();
    private CountDownTimer E0 = null;
    private boolean F0 = false;
    private boolean G0 = false;
    private boolean I0 = true;
    private boolean J0 = false;
    private boolean K0 = true;
    private boolean P0 = true;
    private boolean R0 = false;
    private boolean S0 = false;
    private boolean T0 = false;
    private boolean U0 = false;

    public class a implements ViewTreeObserver.OnGlobalLayoutListener {
        private final int a = 48 + 100;
        private final Rect b = new Rect();
        final View c;

        public a(View view) {
            this.c = view;
        }

        @Override
        public void onGlobalLayout() {
            Activity activity = Bank.this.b;
            if (activity == null || activity.isFinishing() || Bank.this.isRemoving() || !Bank.this.isAdded()) {
                return;
            }
            int applyDimension = (int) TypedValue.applyDimension(1, this.a, this.c.getResources().getDisplayMetrics());
            this.c.getWindowVisibleDisplayFrame(this.b);
            int height = this.c.getRootView().getHeight();
            Rect rect = this.b;
            if (height - (rect.bottom - rect.top) >= applyDimension) {
                Bank bank = Bank.this;
                if (bank.i == 0) {
                    ((InputMethodManager) bank.b.getSystemService("input_method")).toggleSoftInput(3, 0);
                    Bank.this.i = 1;
                }
            }
        }
    }

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

        @Override
        public void onFinish() {
            Bank.this.C();
        }

        @Override
        public void onTick(long j) {
        }
    }

    public class c implements View.OnClickListener {
        final CheckBox a;

        public c(CheckBox checkBox) {
            this.a = checkBox;
        }

        @Override
        public void onClick(View view) {
            Bank.this.K0 = this.a.isChecked();
            if (Bank.this.K0) {
                Bank.this.addEventAnalytics("user_input", com.payu.custombrowser.util.a.d + PayuConstants.THREEDS2_SDK_EMPHEM_KEY_Y);
                return;
            }
            Bank.this.addEventAnalytics("user_input", com.payu.custombrowser.util.a.d + "n");
        }
    }

    public class d implements View.OnClickListener {
        final Button a;

        public d(Button button) {
            this.a = button;
        }

        @Override
        public void onClick(View view) {
            try {
                Bank.this.addEventAnalytics("user_input", com.payu.custombrowser.util.a.c + ((Object) this.a.getText()));
                WebView webView = Bank.this.q;
                StringBuilder sb = new StringBuilder("javascript:");
                Bank bank = Bank.this;
                sb.append(bank.f.getString(bank.getString(R.string.cb_btn_action)));
                webView.loadUrl(sb.toString());
            } catch (Exception e) {
                if (e.getMessage() != null) {
                    z0.k(e, new StringBuilder("nb_cb_btn_click_"), Bank.this, "cb_exception");
                }
            }
        }
    }

    public class e implements View.OnClickListener {
        final CheckBox a;

        public e(CheckBox checkBox) {
            this.a = checkBox;
        }

        @Override
        public void onClick(View view) {
            Bank.this.M0 = this.a.isChecked();
            if (this.a.isChecked()) {
                try {
                    WebView webView = Bank.this.q;
                    StringBuilder sb = new StringBuilder("javascript:");
                    Bank bank = Bank.this;
                    sb.append(bank.f.getString(bank.getString(R.string.cb_toggle_field)));
                    sb.append("(\"true\")");
                    webView.loadUrl(sb.toString());
                    return;
                } catch (Exception e) {
                    if (e.getMessage() != null) {
                        z0.k(e, new StringBuilder("nb_checkbox_unchecked_"), Bank.this, "cb_exception");
                        return;
                    }
                    return;
                }
            }
            try {
                WebView webView2 = Bank.this.q;
                StringBuilder sb2 = new StringBuilder("javascript:");
                Bank bank2 = Bank.this;
                sb2.append(bank2.f.getString(bank2.getString(R.string.cb_toggle_field)));
                sb2.append("(\"false\")");
                webView2.loadUrl(sb2.toString());
            } catch (Exception e2) {
                if (e2.getMessage() != null) {
                    z0.k(e2, new StringBuilder("nb_checkbox_checked_"), Bank.this, "cb_exception");
                }
            }
        }
    }

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

        @Override
        public void onClick(View view) {
            try {
                WebView webView = Bank.this.q;
                StringBuilder sb = new StringBuilder("javascript:");
                Bank bank = Bank.this;
                sb.append(bank.f.getString(bank.getString(R.string.cb_btn_action)));
                webView.loadUrl(sb.toString());
            } catch (Exception e) {
                if (e.getMessage() != null) {
                    z0.k(e, new StringBuilder("nb_cb_pwd_btn_click_"), Bank.this, "cb_exception");
                }
            }
        }
    }

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

        @Override
        public void run() {
            Bank.this.F();
        }
    }

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

        @Override
        public void onFinish() {
            Bank.this.F0 = false;
            int progress = Bank.this.q.getProgress();
            Bank bank = Bank.this;
            if (progress < bank.snoozeUrlLoadingPercentage && !bank.m && bank.P0 && !Bank.this.getTransactionStatusReceived()) {
                Bank.this.launchSnoozeWindow();
            }
            Bank.this.K();
        }

        @Override
        public void onTick(long j) {
            Bank.this.F0 = true;
        }
    }

    public Bank(Activity activity) {
        this.b = activity;
        this.h = new com.payu.custombrowser.b(this, this);
        this.M0 = false;
        this.Q = new HashSet();
        this.L = new com.payu.custombrowser.util.b();
        this.T = Executors.newCachedThreadPool();
        this.R = new HashSet();
        this.S = new HashSet();
    }

    private void H() {
        setIsPageStoppedForcefully(true);
        if (this.q0 != null) {
            K();
            this.s0 = this.L.a(this.q0, this.y);
            launchSnoozeWindow(2);
        }
    }

    private void I() {
        CountDownTimer countDownTimer = this.N0;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        CountDownTimer countDownTimer2 = this.O0;
        if (countDownTimer2 != null) {
            countDownTimer2.cancel();
        }
        this.N0 = new b(2000L, 1000L).start();
    }

    public void d(View view) {
        d();
        dismissCb();
        f(view);
    }

    public void e(View view) {
        d();
        dismissCb();
        f(view);
    }

    private void f(View view) {
        NotificationManager notificationManager;
        if (view.getId() == R.id.button_retry_transaction) {
            this.snoozeCount++;
            addEventAnalytics("snooze_interaction_time", "-1");
            addEventAnalytics("snooze_window_action", "snooze_retry_click");
        } else if (view.getId() == R.id.button_retry_anyway) {
            this.snoozeCount++;
            addEventAnalytics("snooze_txn_paused_user_interaction_time", "-1");
            addEventAnalytics("snooze_txn_paused_window_action", "retry_anyway_click");
        }
        setTransactionStatusReceived(false);
        if (!com.payu.custombrowser.util.b.g(this.b.getApplicationContext())) {
            Toast.makeText(this.b.getApplicationContext(), CBConstant.MSG_NO_INTERNET, 0).show();
            return;
        }
        if (this.q.getUrl() == null || this.q.getUrl().contentEquals("https://secure.payu.in/_payment") || this.q.getUrl().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS) || !isUrlWhiteListed(this.q.getUrl())) {
            this.L.a(this.customBrowserConfig);
            if ((this.customBrowserConfig.getPostURL() != null && (this.customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || this.customBrowserConfig.getPostURL().contentEquals("https://test.payu.in/_payment"))) || (this.isS2SHtmlSupport && !TextUtils.isEmpty(this.surePayS2Surl) && !TextUtils.isEmpty(this.surePayS2SPayUId))) {
                markPreviousTxnAsUserCanceled(com.payu.custombrowser.util.b.a(this.b.getApplicationContext(), "sure_pay_cancelled", this.customBrowserConfig.getTransactionID(), "", keyAnalytics, this.customBrowserConfig.getTransactionID(), ""));
            }
            if (this.customBrowserConfig.getPostURL() == null || this.customBrowserConfig.getPayuPostData() == null || this.surePayS2Surl != null) {
                String str = this.surePayS2Surl;
                if (str != null) {
                    reloadWebView(str, null);
                }
            } else {
                reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
            }
        } else {
            reloadWebView();
        }
        dismissSnoozeWindow();
        this.slowUserCountDownTimer = null;
        if (view.getId() != R.id.button_retry_anyway || (notificationManager = (NotificationManager) this.b.getSystemService("notification")) == null) {
            return;
        }
        notificationManager.cancel(CBConstant.SNOOZE_NOTIFICATION_ID);
    }

    public static boolean isUrlWhiteListed(String str) {
        if ((str.contains("https://secure.payu.in") || str.contains(CBConstant.PAYU_DOMAIN_TEST)) && str.contains(CBConstant.RESPONSE_BACKWARD)) {
            return true;
        }
        Iterator<String> it = f1.iterator();
        while (it.hasNext()) {
            if (str.contains(it.next())) {
                return true;
            }
        }
        return false;
    }

    private void w() {
        if (this.l0 || Build.VERSION.SDK_INT < 23 || !this.z) {
            onHelpAvailable();
            if (this.o0) {
                try {
                    this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_otp)));
                    return;
                } catch (JSONException e2) {
                    if (e2.getMessage() != null) {
                        addEventAnalytics("cb_exception", "checkPermission_m_je_" + e2.getMessage());
                        return;
                    }
                    return;
                } catch (Exception e3) {
                    if (e3.getMessage() != null) {
                        z0.k(e3, new StringBuilder("checkPermission_m_"), this, "cb_exception");
                        return;
                    }
                    return;
                }
            }
            return;
        }
        this.l0 = true;
        if (androidx.core.content.a.a(this.b, "android.permission.RECEIVE_SMS") != 0) {
            this.m0 = true;
            return;
        }
        this.k0 = true;
        if (this.o0) {
            try {
                this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_otp)));
            } catch (JSONException e4) {
                if (e4.getMessage() != null) {
                    addEventAnalytics("cb_exception", "checkPermission_je_" + e4.getMessage());
                }
            } catch (Exception e5) {
                if (e5.getMessage() != null) {
                    z0.k(e5, new StringBuilder("checkPermission_"), this, "cb_exception");
                }
            }
        }
    }

    private void x() {
        com.payu.custombrowser.b bVar = this.h;
        if (bVar == null || !bVar.isAdded()) {
            return;
        }
        this.h.finish();
    }

    private void y() {
        if (com.payu.custombrowser.bean.b.SINGLETON.getPayuCustomBrowserCallback() == null || this.customBrowserConfig == null || !this.L.a(CBConstant.SNOOZE_ENABLED, this.b.getApplicationContext()) || this.customBrowserConfig.getEnableSurePay() <= this.snoozeCount) {
            return;
        }
        if (this.F0) {
            K();
        }
        J();
    }

    public void z() {
        a();
    }

    @JavascriptInterface
    public void bankFound(String str) {
        if (!this.L0) {
            checkStatusFromJS(str);
            this.L0 = true;
        }
        a(str);
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing()) {
            this.b.runOnUiThread(new l(this, 0));
        }
        this.A = str;
        if (!this.n0) {
            try {
                if (!this.G0) {
                    if (this.M == null) {
                        convertToNative(CBConstant.LOADING, "{}");
                    } else {
                        Activity activity2 = this.b;
                        if (activity2 != null) {
                            if (this.M != ((ViewGroup) activity2.findViewById(R.id.help_view)).getChildAt(0)) {
                                convertToNative(CBConstant.LOADING, "{}");
                            }
                        }
                    }
                }
            } catch (Exception e2) {
                if (e2.getMessage() != null) {
                    z0.k(e2, new StringBuilder("bankFound_loading_"), this, "cb_exception");
                }
            }
        }
        if (this.J0 || this.f != null) {
            return;
        }
        this.T.execute(new o(11, this, str));
    }

    @JavascriptInterface
    public void cacheAnalytics(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            String obj = jSONObject.get("inputFields").toString();
            if (this.listOfTxtFld == null) {
                this.listOfTxtFld = obj;
            } else {
                this.listOfTxtFld += obj;
            }
            this.hostName = jSONObject.get("hostName").toString();
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                z0.k(e2, new StringBuilder("cacheAnalytics_"), this, "cb_exception");
            }
        }
    }

    @JavascriptInterface
    public void closeCbUi() {
        dismissCb();
    }

    @JavascriptInterface
    public void convertToNative(String str, String str2) {
        if (this.m) {
            dismissSnoozeWindow();
            cancelTransactionNotification();
            addEventAnalytics("snooze_window_action", "snooze_window_dismissed_by_cb");
            addEventAnalytics("snooze_window_automatically_disappear_time", "-1");
        }
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing()) {
            this.b.runOnUiThread(new k(this, 0));
        }
        String str3 = this.pageType;
        if (str3 != null && !str3.equalsIgnoreCase("")) {
            addEventAnalytics("departure", "-1");
            this.pageType = "";
        }
        Activity activity2 = this.b;
        if (activity2 == null || !this.e0 || activity2.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new androidx.fragment.app.g(this, str, str2, 6));
    }

    public void dismissCb() {
        x();
        l();
    }

    @JavascriptInterface
    public void C() {
        com.payu.custombrowser.widgets.a aVar;
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || (aVar = this.u) == null) {
            return;
        }
        aVar.dismiss();
        this.u.cancel();
        if (this.S0) {
            return;
        }
        this.forwardJourneyForChromeLoaderIsComplete = true;
        com.payu.custombrowser.util.d.b("Setting forwardJourneyForChromeLoaderIsComplete = true");
        startSlowUserWarningTimer();
    }

    @JavascriptInterface
    public void dismissReviewOrder() {
    }

    @Override
    public void dismissSlowUserWarningTimer() {
        if (this.slowUserCountDownTimer != null) {
            com.payu.custombrowser.util.d.b("Shutting down slowUserCountDownTimer");
            this.slowUserCountDownTimer.cancel();
        }
    }

    public void dismissSnoozeWindow() {
        this.m = false;
        androidx.appcompat.app.h hVar = this.j;
        if (hVar != null) {
            hVar.dismiss();
            this.j.cancel();
            showCbBlankOverlay(8);
        }
    }

    @JavascriptInterface
    public void enableCatchAllJS(boolean z) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new androidx.media3.exoplayer.audio.g(1, z, this));
    }

    @JavascriptInterface
    public void fillOTPCallback(boolean z) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new j(this, z, 0));
    }

    public void fillOTPOnBankPage(boolean z) {
        if (TextUtils.isEmpty(this.otp) || !this.catchAllJSEnabled || this.backwardJourneyStarted || this.isOTPFilled) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("otp", this.otp);
            jSONObject.put("isAutoFillOTP", z);
            this.q.loadUrl("javascript:" + this.e.getString(getString(R.string.cb_fill_otp)) + "(" + jSONObject + ")");
        } catch (JSONException e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "fillOTPOnBankPage_" + e2.getMessage());
            }
        }
    }

    public String getBankName() {
        String str = this.A;
        return str == null ? "" : str;
    }

    @JavascriptInterface
    public String getJSData(String str) {
        return getJSData(str, false);
    }

    public String getPageType() {
        return this.pageType;
    }

    public SnoozeLoaderView getSnoozeLoaderView() {
        return this.H0;
    }

    @JavascriptInterface
    public void getUserId() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        this.b.runOnUiThread(new k(this, 1));
    }

    @Override
    public void internetErrorHandler(final int i, final String str) {
        addEventAnalytics("no_internet_found", i + ":" + str);
        DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i2) {
                Bank.this.a(i, str, dialogInterface, i2);
            }
        };
        if (this.C0 == null) {
            AlertDialog create = com.payu.custombrowser.util.b.a(this.b, onClickListener, getString(R.string.cb_retry_transaction), getString(R.string.cb_dialog_cancel), null, getString(R.string.payu_cb_no_internet_connection)).create();
            this.C0 = create;
            create.setCancelable(false);
            this.C0.setCanceledOnTouchOutside(false);
            this.C0.show();
        }
    }

    public boolean isInBackWardJourney(java.lang.String r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.custombrowser.Bank.isInBackWardJourney(java.lang.String):boolean");
    }

    @JavascriptInterface
    public void isOTPKeyboardNumeric(boolean z) {
    }

    public void launchSnoozeWindow() {
        launchSnoozeWindow(1);
    }

    public void logCBAnalytics(Context context, String str, String str2, String str3) {
        String str4 = Z0;
        com.payu.custombrowser.util.b.a(context, str, str4, str2, b1, a1, str4, "", str3);
    }

    @JavascriptInterface
    public void logPayUAnalytics(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                if (this.mAnalyticsMap.get(next) != null && this.mAnalyticsMap.get(next).contentEquals(jSONObject.get(next).toString())) {
                }
                this.mAnalyticsMap.put(next, jSONObject.get(next).toString());
                addEventAnalytics(next, jSONObject.get(next).toString());
            }
        } catch (JSONException e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "logPayUAnalytics_" + e2.getMessage());
            }
        }
    }

    @JavascriptInterface
    public void nativeHelperForNB(String str, String str2) {
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing() && !isRemoving() && isAdded()) {
            this.b.runOnUiThread(new androidx.fragment.app.c(this, str, str2, 7));
        }
        Activity activity2 = this.b;
        if (activity2 == null || activity2.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        this.b.runOnUiThread(new p(this, 16));
    }

    @JavascriptInterface
    public void onCancel() {
        onCancel("");
    }

    @JavascriptInterface
    public void onFailure(String str) {
        this.C = str;
        i();
    }

    public void onLoadResourse(WebView webView, String str) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded() || str.equalsIgnoreCase(CBConstant.rupeeURL) || str.contains(CBConstant.rupeeURL1)) {
            return;
        }
        str.contains(CBConstant.rupeeURL2);
    }

    public void onOverrideURL(String str) {
    }

    public void onPageFinishWebclient(String str) {
        com.payu.custombrowser.util.b.b = str;
        com.payu.custombrowser.util.b.c = "Loaded";
        this.R0 = false;
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing() && !isRemoving() && isAdded()) {
            if (this.U0) {
                addEventAnalytics("snooze_resume_url", str);
                d(false);
            }
            this.L.d(this.b.getApplicationContext(), "last_url", "f:" + str);
            I();
            if (this.I0 && getArguments() != null && getArguments().getInt(CBConstant.MAIN_LAYOUT, -1) != -1) {
                try {
                    View findViewById = this.b.findViewById(getArguments().getInt(CBConstant.MAIN_LAYOUT));
                    findViewById.getViewTreeObserver().addOnGlobalLayoutListener(new a(findViewById));
                    this.I0 = false;
                } catch (Exception e2) {
                    if (e2.getMessage() != null) {
                        z0.k(e2, new StringBuilder("onPageFinishWebclient_"), this, "cb_exception");
                    }
                }
            }
        }
        if (!this.G0) {
            K();
        }
        new Handler().postDelayed(new androidx.activity.d(this, 23), 1000L);
    }

    public void F() {
        if (!isAdded() || isRemoving() || this.b == null) {
            return;
        }
        this.n0 = true;
        if (this.h0.booleanValue()) {
            onHelpUnavailable();
            this.h0 = Boolean.FALSE;
        }
        View view = this.M;
        if (view != null && view.isShown()) {
            this.w = 1;
            g();
            onHelpUnavailable();
        }
        this.b.getWindow().setSoftInputMode(3);
        if (this.f != null && this.e0 && !this.G0) {
            try {
                this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_init)));
            } catch (JSONException e2) {
                if (e2.getMessage() != null) {
                    addEventAnalytics("cb_exception", "onPageFinished_" + e2.getMessage());
                }
            }
        }
        if (this.e != null) {
            if (!this.T0) {
                checkStatusFromJS("", 3);
                this.T0 = true;
            }
            View view2 = this.K;
            if (view2 != null) {
                view2.setVisibility(8);
            }
        }
        fillOTPOnBankPage(true);
    }

    @Override
    public void onPageStarted() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        if (this.o) {
            onHelpUnavailable();
            this.o = false;
        }
        if (!isAdded() || isRemoving()) {
            return;
        }
        this.n0 = false;
        if (this.e != null) {
            try {
                if (this.e0) {
                    this.q.loadUrl("javascript:" + this.e.getString(getString(R.string.cb_detect_bank)));
                }
            } catch (JSONException e2) {
                if (e2.getMessage() != null) {
                    addEventAnalytics("cb_exception", "onPageStarted_" + e2.getMessage());
                }
            }
        }
        View view = this.K;
        if (view != null) {
            view.setVisibility(8);
        }
    }

    public void onPageStartedWebclient(java.lang.String r11) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.custombrowser.Bank.onPageStartedWebclient(java.lang.String):void");
    }

    public void onPause() {
        super.onPause();
        this.W0 = true;
    }

    @JavascriptInterface
    public void onPayuFailure(String str) {
        if (this.b != null) {
            this.l = "failure_transaction";
            addEventAnalytics("trxn_status", "failure_transaction");
            this.D = Boolean.FALSE;
            this.B = str;
        }
        cancelTransactionNotification();
        b();
    }

    @JavascriptInterface
    public void onPayuSuccess(String str) {
        this.D = Boolean.TRUE;
        this.l = "success_transaction";
        addEventAnalytics("trxn_status", "success_transaction");
        this.B = str;
        cancelTransactionNotification();
        b();
    }

    public void onProgressChanged(int i) {
        com.payu.custombrowser.widgets.a aVar;
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded() || (aVar = this.v) == null) {
            return;
        }
        aVar.show();
        if (i == 100) {
            new Handler().postDelayed(new c1(this, 20), 100L);
        } else {
            a(i);
        }
    }

    public void onReceivedErrorWebClient(int i, String str) {
        StringBuilder sb = new StringBuilder();
        sb.append(i);
        sb.append("|");
        sb.append(str == null ? "" : str);
        sb.append("|");
        sb.append(this.q.getUrl() != null ? this.q.getUrl() : "");
        String sb2 = sb.toString();
        a("ERROR_RECEIVED", sb2);
        Log.d("Bank", "communicationError onReceivedErrorWebClient " + sb2);
        c();
        com.payu.custombrowser.widgets.a aVar = this.v;
        if (aVar != null) {
            aVar.dismiss();
        }
        this.S0 = true;
        try {
            if (getActivity() == null || getActivity().isFinishing()) {
                return;
            }
            com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
            if (bVar.getPayuCustomBrowserCallback() != null) {
                boolean z = this.backwardJourneyStarted;
                if (!z) {
                    H();
                } else if (z && this.isTxnNBType && this.snoozeCountBackwardJourney < this.customBrowserConfig.getEnableSurePay()) {
                    dismissSnoozeWindow();
                    H();
                }
                onHelpUnavailable();
                this.G.removeAllViews();
                if (this.t != 0) {
                    g();
                    this.w = 1;
                }
                d();
                dismissCb();
                if (this.F) {
                    return;
                }
                bVar.getPayuCustomBrowserCallback().onCBErrorReceived(i, str);
            }
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                z0.k(e2, new StringBuilder("onReceivedErrorWebClient_"), this, "cb_exception");
            }
        }
    }

    public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
        StringBuilder sb = new StringBuilder();
        Object obj = sslError;
        if (sslError == null) {
            obj = "";
        }
        sb.append(obj);
        sb.append("|");
        sb.append(webView.getUrl() != null ? webView.getUrl() : "");
        String sb2 = sb.toString();
        a("SSL_ERROR", sb2);
        Log.d("Bank", "communicationError onReceivedSslError" + sb2);
        c();
    }

    public void onStart() {
        super.onStart();
        this.W0 = false;
        String str = this.X0;
        if (str != null) {
            Toast.makeText(this.b, str, 0).show();
            this.X0 = null;
        }
    }

    @JavascriptInterface
    public void onSuccess() {
        onSuccess("");
    }

    public void otpClicked() {
        this.o0 = true;
        w();
        this.l = "otp_click";
        addEventAnalytics("user_input", "otp_click");
        if (Build.VERSION.SDK_INT < 23) {
            this.f0 = null;
            t();
        }
    }

    @Override
    public void p() {
        AlertDialog alertDialog = this.V0;
        if (alertDialog != null) {
            alertDialog.dismiss();
            this.V0 = null;
        }
    }

    @JavascriptInterface
    public void reInit() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new l(this, 1));
    }

    public void reloadWVNative() {
        this.q.reload();
    }

    public void reloadWVUsingJS() {
        this.q.loadUrl("javascript:window.location.reload(true)");
    }

    public void reloadWVUsingJSFromCache() {
        this.q.loadUrl("javascript:window.location.reload()");
    }

    @Override
    public void reloadWebView(String str, String str2) {
        this.forwardJourneyForChromeLoaderIsComplete = false;
        this.isWebviewReloading = true;
        this.backwardJourneyStarted = false;
        if (this.m) {
            dismissSnoozeWindow();
        }
        com.payu.custombrowser.widgets.a aVar = this.u;
        if (aVar != null) {
            aVar.dismiss();
        }
        if (isAdded() && this.I != null) {
            this.u = null;
        }
        d(true);
        resetAutoSelectOTP();
        this.L.b(this.customBrowserConfig);
        this.surePayS2SPayUId = null;
        if (str != null && str2 != null) {
            this.q.postUrl(str, str2.getBytes());
        } else if (str != null) {
            this.q.loadUrl(str);
        }
    }

    public void reloadWebViewUrl() {
        if (com.payu.custombrowser.util.b.g(this.b.getApplicationContext())) {
            if (this.q.getUrl() != null && !this.q.getUrl().contentEquals("https://secure.payu.in/_payment") && !this.q.getUrl().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS) && isUrlWhiteListed(this.q.getUrl())) {
                reloadWebView();
            } else {
                if (this.customBrowserConfig.getPostURL() == null || this.customBrowserConfig.getPayuPostData() == null || this.surePayS2Surl != null) {
                    return;
                }
                reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
            }
        }
    }

    @JavascriptInterface
    public void removeJSData(String str, boolean z) {
        if (z) {
            this.L.e(this.b, str);
        } else {
            this.L.f(this.b, str);
        }
    }

    public boolean retryCancellationHandler() {
        postToPaytxn();
        addEventAnalytics("user_input", "user_cancel_retry_dialog");
        onBackApproved();
        HashMap<String, String> e2 = new com.payu.custombrowser.util.b().e(this.customBrowserConfig.getPayuPostData());
        b1 = e2.get("amount");
        transactionID = e2.get("txnid");
        this.b.finish();
        return true;
    }

    public void setIsPageStoppedForcefully(boolean z) {
        this.G0 = z;
    }

    @JavascriptInterface
    public void setJSData(String str, String str2, boolean z) {
        if (z) {
            this.L.c(this.b, str, str2);
        } else {
            this.L.b(this.b, str, str2);
        }
    }

    @JavascriptInterface
    public void setSnoozeConfig(String str) {
        this.q0 = this.L.h(this.b.getApplicationContext(), str);
    }

    @JavascriptInterface
    public void setSnoozeEnabled(boolean z) {
        if (!z) {
            this.customBrowserConfig.setEnableSurePay(0);
        }
        this.L.a(CBConstant.SNOOZE_ENABLED, z, this.b.getApplicationContext());
    }

    public void setSnoozeLoaderView(SnoozeLoaderView snoozeLoaderView) {
        this.H0 = snoozeLoaderView;
    }

    @JavascriptInterface
    public void setUserId(String str) {
        if (!this.K0) {
            if (this.L.c(this.b.getApplicationContext(), this.A).equals("")) {
                return;
            }
            this.L.e(this.b.getApplicationContext(), this.A);
        } else {
            Activity activity = this.b;
            if (activity == null || activity.isFinishing()) {
                return;
            }
            this.L.e(this.b.getApplicationContext(), this.A, str);
        }
    }

    public void showBackButtonDialog() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this.b, R.style.cb_dialog);
        builder.setCancelable(false);
        builder.setMessage(this.b.getString(R.string.payu_cancel_transaction_confirmation));
        builder.setPositiveButton(this.b.getString(R.string.payu_ok), new com.payu.custombrowser.e(this, 0));
        builder.setNegativeButton((CharSequence) this.b.getString(R.string.cb_b_cancel), (DialogInterface.OnClickListener) new com.facebook.login.b(this, 1));
        com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
        if (bVar.getPayuCustomBrowserCallback() != null) {
            bVar.getPayuCustomBrowserCallback().onBackButton(builder);
        }
        AlertDialog create = builder.create();
        this.V0 = create;
        create.getWindow().getAttributes().type = 2003;
        this.V0 = builder.show();
    }

    @JavascriptInterface
    public void showCustomBrowser(boolean z) {
        this.e0 = z;
        if (getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        getActivity().runOnUiThread(new j(this, z, 1));
    }

    @JavascriptInterface
    public void showJSRequestedToast(String str) {
        if (this.W0) {
            this.X0 = str;
        } else {
            Toast.makeText(this.b.getApplicationContext(), str, 0).show();
        }
    }

    @JavascriptInterface
    public void spResumedWindowTTL(String str) {
        try {
            this.r0 = Integer.parseInt(str);
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                z0.k(e2, new StringBuilder("spResumedWindowTTL_"), this, "cb_exception");
            }
        }
    }

    public void startSlowUserWarningTimer() {
        com.payu.custombrowser.util.d.b("Attempting to start slowUserCountDownTimer");
        if (this.slowUserCountDownTimer == null) {
            com.payu.custombrowser.util.d.b("Starting slowUserCountDownTimer");
        }
    }

    @JavascriptInterface
    public void surePayData(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            if (jSONObject.has(CBConstant.S2SPAYUID)) {
                this.surePayS2SPayUId = jSONObject.getString(CBConstant.S2SPAYUID);
            }
            if (jSONObject.has(CBConstant.S2SREPLAYURL) && jSONObject.has(CBConstant.SNOOZE_COUNT) && jSONObject.has(CBConstant.TXN_TYPE) && jSONObject.has("merchantKey") && jSONObject.has(CBConstant.TXNID)) {
                this.surePayS2Surl = jSONObject.getString(CBConstant.S2SREPLAYURL);
                this.merchantKey = jSONObject.getString("merchantKey");
                this.txnId = jSONObject.getString(CBConstant.TXNID);
                String string = jSONObject.getString(CBConstant.TXN_TYPE);
                this.txnType = string;
                this.isTxnNBType = string.equalsIgnoreCase(PayuConstants.NB);
                this.customBrowserConfig.setEnableSurePay(Integer.parseInt(jSONObject.getString(CBConstant.SNOOZE_COUNT)));
                this.isSurePayValueLoaded = true;
            }
        } catch (JSONException e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "surePayData_" + e2.getMessage());
            }
        }
    }

    public void v() {
        if (this.n.contains("CUSTOM_BROWSER")) {
            return;
        }
        this.l = "CUSTOM_BROWSER";
        this.n.add("CUSTOM_BROWSER");
        addEventAnalytics("cb_status", this.l);
    }

    public void B() {
        try {
            if (this.L.c(this.b.getApplicationContext(), this.A) == null || this.L.c(this.b.getApplicationContext(), this.A).equals("")) {
                return;
            }
            this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_populate_user_id)) + "(\"" + this.L.c(this.b.getApplicationContext(), this.A) + "\")");
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                z0.k(e2, new StringBuilder("getUserId_"), this, "cb_exception");
            }
        }
    }

    public void D() {
        boolean z;
        if (this.G0 || this.R0 || !(z = this.m) || this.backwardJourneyStarted) {
            return;
        }
        if (z) {
            addEventAnalytics("snooze_window_automatically_disappear_time", "-1");
        }
        dismissSnoozeWindow();
    }

    public void E() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        this.v.dismiss();
    }

    private void G() {
        postToPaytxn();
        androidx.appcompat.app.h hVar = this.j;
        if (hVar != null && hVar.isShowing()) {
            this.j.cancel();
        }
        cancelTransactionNotification();
        addEventAnalytics("user_input", "back_button_ok");
        dismissSnoozeWindow();
        com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
        if (bVar.getPayuCustomBrowserCallback() != null) {
            bVar.getPayuCustomBrowserCallback().onBackApprove();
        }
        Activity activity = this.b;
        if (activity != null) {
            activity.finish();
        }
    }

    private void J() {
        h hVar = new h(this.snoozeUrlLoadingTimeout, 500L);
        this.E0 = hVar;
        hVar.start();
    }

    public void K() {
        CountDownTimer countDownTimer = this.E0;
        if (countDownTimer != null) {
            this.F0 = false;
            countDownTimer.cancel();
            this.E0 = null;
        }
    }

    @JavascriptInterface
    public String getJSData(String str, boolean z) {
        return this.L.a(this.b, str, z);
    }

    public void launchSnoozeWindow(int i) {
        int i2 = this.s0;
        if (i2 == 3) {
            return;
        }
        if (i == 2 && i2 == 2) {
            return;
        }
        if (i == 1 && i2 == 1) {
            return;
        }
        showCbBlankOverlay(8);
        if (this.backwardJourneyStarted) {
            if (this.snoozeCountBackwardJourney >= this.customBrowserConfig.getEnableSurePay()) {
                return;
            }
            if (this.isS2SHtmlSupport && (TextUtils.isEmpty(this.surePayS2SPayUId) || TextUtils.isEmpty(this.surePayS2Surl))) {
                return;
            }
        } else {
            if (this.snoozeCount >= this.customBrowserConfig.getEnableSurePay()) {
                return;
            }
            if (this.isS2SHtmlSupport && TextUtils.isEmpty(this.surePayS2Surl)) {
                return;
            }
        }
        this.snoozeMode = i;
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        dismissSlowUserWarning();
        a(8, "");
        this.m = true;
        addEventAnalytics("snooze_window_status", "snooze_visible");
        addEventAnalytics("snooze_appear_url", this.y);
        addEventAnalytics("snooze_window_launch_mode", i == 1 ? CBConstant.STR_SNOOZE_MODE_WARN : CBConstant.STR_SNOOZE_MODE_FAIL);
        addEventAnalytics("snooze_window_appear_time", "-1");
        View inflate = this.b.getLayoutInflater().inflate(R.layout.cb_layout_snooze, (ViewGroup) null);
        final TextView textView = (TextView) inflate.findViewById(R.id.text_view_snooze_message);
        final TextView textView2 = (TextView) inflate.findViewById(R.id.text_view_transaction_snoozed_message1);
        TextView textView3 = (TextView) inflate.findViewById(R.id.button_cancel_transaction);
        final Button button = (Button) inflate.findViewById(R.id.button_snooze_transaction);
        Button button2 = (Button) inflate.findViewById(R.id.button_retry_transaction);
        TextView textView4 = (TextView) inflate.findViewById(R.id.text_view_cancel_snooze_window);
        final TextView textView5 = (TextView) inflate.findViewById(R.id.t_confirm);
        final TextView textView6 = (TextView) inflate.findViewById(R.id.t_nconfirm);
        final TextView textView7 = (TextView) inflate.findViewById(R.id.snooze_header_txt);
        TextView textView8 = (TextView) inflate.findViewById(R.id.text_view_retry_message_detail);
        Button button3 = (Button) inflate.findViewById(R.id.button_retry_anyway);
        SnoozeLoaderView snoozeLoaderView = (SnoozeLoaderView) inflate.findViewById(R.id.snooze_loader_view);
        this.H0 = snoozeLoaderView;
        snoozeLoaderView.setVisibility(8);
        textView4.setVisibility(0);
        textView3.setVisibility(0);
        button.setVisibility(0);
        button2.setVisibility(0);
        textView.setVisibility(0);
        textView2.setVisibility(8);
        textView8.setVisibility(0);
        textView5.setVisibility(8);
        textView6.setVisibility(8);
        button3.setVisibility(8);
        textView.setText(this.b.getString(R.string.cb_slownetwork_status));
        textView7.setText(this.b.getString(R.string.cb_try_later));
        textView8.setText(this.b.getString(R.string.cb_retry_restart));
        if (this.backwardJourneyStarted && this.P) {
            textView.setText(this.b.getResources().getString(R.string.cb_slow_internet_confirmation));
            textView2.setText(this.b.getResources().getString(R.string.cb_receive_sms));
            textView7.setText(this.b.getResources().getString(R.string.cb_confirm_transaction));
            button.setVisibility(8);
            textView8.setVisibility(8);
            button2.setVisibility(8);
            textView3.setVisibility(8);
            textView.setVisibility(0);
            textView2.setVisibility(0);
            textView5.setVisibility(0);
            textView6.setVisibility(0);
            button3.setVisibility(8);
            this.snoozeVisibleCountBackwdJourney++;
            addEventAnalytics("snooze_backward_visible", CheckIsDomesticPayUResponse.IS_DOMESTIC);
        } else {
            this.snoozeVisibleCountFwdJourney++;
        }
        textView5.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                Bank.this.a(textView7, textView, button, textView2, textView5, textView6, view);
            }
        });
        textView6.setOnClickListener(new com.google.android.material.datepicker.m(this, 1));
        textView4.setOnClickListener(new androidx.media3.ui.l(this, 5));
        final int i3 = 1;
        button2.setOnClickListener(new View.OnClickListener(this) {
            public final Bank b;

            {
                this.b = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i3) {
                    case 0:
                        this.b.e(view);
                        break;
                    default:
                        this.b.d(view);
                        break;
                }
            }
        });
        final int i4 = 0;
        button3.setOnClickListener(new View.OnClickListener(this) {
            public final Bank b;

            {
                this.b = this;
            }

            @Override
            public final void onClick(View view) {
                switch (i4) {
                    case 0:
                        this.b.e(view);
                        break;
                    default:
                        this.b.d(view);
                        break;
                }
            }
        });
        androidx.appcompat.app.h hVar = this.j;
        if (hVar == null || !hVar.isShowing()) {
            androidx.appcompat.app.h create = new h.a(this.b).create();
            this.j = create;
            create.a.j(inflate);
            this.j.setCanceledOnTouchOutside(false);
            int i5 = 0;
            this.j.setOnDismissListener(new com.payu.custombrowser.g(this, i5));
            this.j.setOnKeyListener(new com.payu.custombrowser.h(this, i5));
        }
        this.j.show();
    }

    @JavascriptInterface
    public void onCancel(String str) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new androidx.core.content.res.h(19, this, str));
    }

    @JavascriptInterface
    public void onSuccess(String str) {
        this.D = Boolean.TRUE;
        this.C = str;
        i();
    }

    public void b(java.lang.String r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.custombrowser.Bank.b(java.lang.String):void");
    }

    public void c(boolean z) {
        if (z) {
            return;
        }
        g();
        this.w = 1;
        try {
            View view = this.J;
            if (view != null) {
                view.setVisibility(8);
            }
            onHelpUnavailable();
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                z0.k(e2, new StringBuilder("showCustomBrowser_"), this, "cb_exception");
            }
        }
    }

    public void a(final SslErrorHandler sslErrorHandler, final String str) {
        DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                Bank.this.a(sslErrorHandler, str, dialogInterface, i);
            }
        };
        if (isAdded()) {
            androidx.fragment.app.n activity = getActivity();
            String string = getString(R.string.cb_dialog_continue);
            String string2 = getString(R.string.cb_dialog_cancel);
            StringBuilder j = android.support.v4.media.d.j(str, " ");
            j.append(getString(R.string.cb_dialog_would_you_like_to_continue));
            com.payu.custombrowser.util.b.a(activity, onClickListener, string, string2, null, j.toString()).create().show();
        }
    }

    @JavascriptInterface
    public void removeJSData(String str) {
        removeJSData(str, false);
    }

    @JavascriptInterface
    public void setJSData(String str, String str2) {
        setJSData(str, str2, false);
    }

    public void d(String str) {
        G();
        if (str.isEmpty()) {
            return;
        }
        Activity activity = this.b;
        String str2 = Z0;
        com.payu.custombrowser.util.b.a(activity, "PayUCustomBrowser", str2, "Back button", b1, a1, str2, c1, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())), str);
    }

    private void d(boolean z) {
        this.U0 = z;
    }

    public void a(SslErrorHandler sslErrorHandler, String str, DialogInterface dialogInterface, int i) {
        if (i == -1) {
            addEventAnalytics("user_input", "user_confirm_ssl_dialog");
            sslErrorHandler.proceed();
        } else if (i == -2) {
            addEventAnalytics("user_input", "user_cancel_ssl_dialog");
            dialogInterface.dismiss();
            com.payu.custombrowser.bean.b.SINGLETON.getPayuCustomBrowserCallback().onCBErrorReceived(5002, str);
        }
    }

    public void c(String str, String str2) {
        try {
            if (this.m) {
                dismissSnoozeWindow();
                addEventAnalytics("snooze_window_action", "snooze_window_dismissed_by_cb");
                addEventAnalytics("snooze_window_automatically_disappear_time", "-1");
            }
            this.pageType = "NBLogin Page";
            addEventAnalytics("arrival", "-1");
            onHelpAvailable();
            addEventAnalytics("cb_status", com.payu.custombrowser.util.a.b);
            if (str == null || this.b == null) {
                return;
            }
            dismissSnoozeWindow();
            View inflate = this.b.getLayoutInflater().inflate(R.layout.cb_nb_layout, (ViewGroup) null);
            Button button = (Button) inflate.findViewById(R.id.b_continue);
            CheckBox checkBox = (CheckBox) inflate.findViewById(R.id.checkbox);
            JSONObject jSONObject = new JSONObject(str2);
            String string = getString(R.string.cb_btn_text);
            if (jSONObject.has(string) && jSONObject.getString(string) != null && !jSONObject.getString(string).equalsIgnoreCase("")) {
                if (str.equals(getString(R.string.cb_button))) {
                    int i = R.string.cb_checkbox;
                    if (jSONObject.has(getString(i))) {
                        if (jSONObject.getBoolean(getString(i))) {
                            if (this.K0) {
                                addEventAnalytics(com.payu.custombrowser.util.a.e, PayuConstants.THREEDS2_SDK_EMPHEM_KEY_Y);
                                Context applicationContext = getActivity().getApplicationContext();
                                String str3 = Z0;
                                com.payu.custombrowser.util.b.a(applicationContext, "Custom Browser Loaded", str3, "CB Loaded", b1, a1, str3, "L1", String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - d1)));
                                checkBox.setChecked(true);
                            } else {
                                addEventAnalytics(com.payu.custombrowser.util.a.e, "n");
                                Context applicationContext2 = getActivity().getApplicationContext();
                                String str4 = Z0;
                                com.payu.custombrowser.util.b.a(applicationContext2, "Custom Browser Loaded", str4, "CB Loaded", b1, a1, str4, "L1", String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - d1)));
                                checkBox.setChecked(false);
                            }
                            checkBox.setOnClickListener(new c(checkBox));
                            checkBox.setVisibility(0);
                        } else {
                            checkBox.setVisibility(8);
                        }
                    } else {
                        checkBox.setVisibility(8);
                    }
                    button.setText(jSONObject.getString(string));
                    button.setTransformationMethod(null);
                    button.setOnClickListener(new d(button));
                    this.G.removeAllViews();
                    this.G.addView(inflate);
                    this.o = true;
                    return;
                }
                if (str.equals(getString(R.string.cb_pwd_btn))) {
                    button.setText(jSONObject.getString(string));
                    if (this.M0) {
                        checkBox.setChecked(true);
                    } else {
                        checkBox.setChecked(false);
                    }
                    if (checkBox.isChecked()) {
                        try {
                            this.q.loadUrl("javascript:" + this.f.getString(getString(R.string.cb_toggle_field)) + "(\"true\")");
                        } catch (Exception e2) {
                            if (e2.getMessage() != null) {
                                addEventAnalytics("cb_exception", "nb_cb_pwd_btn_click_" + e2.getMessage());
                            }
                        }
                    }
                    checkBox.setText(getString(R.string.cb_show_password));
                    checkBox.setVisibility(0);
                    checkBox.setOnClickListener(new e(checkBox));
                    button.setOnClickListener(new f());
                    this.o = true;
                    this.G.removeAllViews();
                    this.G.addView(inflate);
                    return;
                }
                return;
            }
            onHelpUnavailable();
            this.G.removeAllViews();
        } catch (Exception e3) {
            if (e3.getMessage() != null) {
                z0.k(e3, new StringBuilder("nativeHelperForNB_"), this, "cb_exception");
            }
        }
    }

    @Override
    public void reloadWebView() {
        if (this.m) {
            dismissSnoozeWindow();
        }
        this.isWebviewReloading = true;
        if (this.isSnoozeEnabled) {
            y();
        }
        if (this.q.getUrl() != null) {
            d(true);
            reloadWVNative();
        }
    }

    public void a(int i, String str, DialogInterface dialogInterface, int i2) {
        if (i2 == -1) {
            if (com.payu.custombrowser.util.b.g(this.b)) {
                dialogInterface.dismiss();
                this.C0 = null;
                if (i != 0) {
                    reloadWebViewUrl();
                    return;
                }
                return;
            }
            dialogInterface.dismiss();
            this.C0 = null;
            internetErrorHandler(i, str);
            return;
        }
        dialogInterface.dismiss();
        this.C0 = null;
        retryCancellationHandler();
    }

    @Override
    public void reloadWebView(String str) {
        if (this.m) {
            dismissSnoozeWindow();
        }
        this.isWebviewReloading = true;
        if (this.isSnoozeEnabled) {
            y();
        }
        if (this.q.getUrl() != null) {
            d(true);
            reloadWVUsingJS();
        } else {
            reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
        }
    }

    public void a(boolean z) {
        this.catchAllJSEnabled = z;
        fillOTPOnBankPage(true);
    }

    public void a(TextView textView, TextView textView2, Button button, TextView textView3, TextView textView4, TextView textView5, View view) {
        addEventAnalytics(com.payu.custombrowser.util.a.a, "confirm_deduction_y");
        Timer timer = this.g0;
        if (timer != null) {
            timer.cancel();
            this.g0.purge();
        }
        this.snoozeCountBackwardJourney++;
        this.j.setCanceledOnTouchOutside(false);
        textView.setText(this.b.getResources().getString(R.string.cb_confirm_transaction));
        textView2.setText(this.b.getString(R.string.cb_transaction_status));
        this.H0.setVisibility(0);
        this.H0.c();
        button.setVisibility(8);
        textView3.setVisibility(8);
        textView4.setVisibility(8);
        textView5.setVisibility(8);
    }

    public void a(DialogInterface dialogInterface) {
        showCbBlankOverlay(8);
    }

    public boolean a(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
        if (i != 4 || keyEvent.getAction() != 0) {
            return true;
        }
        addEventAnalytics("user_input", "payu_back_button".toLowerCase());
        showBackButtonDialog();
        return true;
    }

    public void a(DialogInterface dialogInterface, int i) {
        String str = Z0;
        if (str != null && str.equals(CBConstant.NETBANKING)) {
            c.a aVar = new c.a(getContext(), getChildFragmentManager(), this.B0);
            aVar.g();
            aVar.h(new t(this, 18));
            aVar.i(this.customBrowserConfig.getPrimaryColor());
            aVar.f(this.customBrowserConfig.getBaseTextColor());
            aVar.e().a();
            return;
        }
        G();
    }

    private void a(String str, String str2) {
        String str3;
        int i = 0;
        while (str2.length() > 0) {
            try {
                i++;
                if (str2.length() > 128) {
                    String substring = str2.substring(0, 128);
                    str3 = str2.substring(128);
                    str2 = substring;
                } else {
                    str3 = "";
                }
                addEventAnalytics(str + "_" + i, str2);
                str2 = str3;
            } catch (Exception e2) {
                if (e2.getMessage() != null) {
                    z0.k(e2, new StringBuilder("addErrorData_"), this, "cb_exception");
                    return;
                }
                return;
            }
        }
    }

    public void c(String str) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || !isAdded()) {
            return;
        }
        Intent intent = new Intent();
        intent.putExtra(getString(R.string.cb_result), str);
        this.b.setResult(0, intent);
        this.b.finish();
    }

    public void b(boolean z) {
        this.isOTPFilled = z;
        if (z) {
            this.otp = null;
            if (this.otpTriggered) {
                this.otpTriggered = false;
                String optString = this.e.optString(getString(R.string.cb_catchAll_success_msg));
                if (this.W0) {
                    this.X0 = optString;
                } else {
                    if (optString == null || optString.isEmpty()) {
                        return;
                    }
                    Toast.makeText(this.b.getApplicationContext(), optString, 0).show();
                }
            }
        }
    }

    public void c(View view) {
        if (this.backwardJourneyStarted) {
            this.snoozeCountBackwardJourney++;
        } else {
            this.snoozeCount++;
        }
        addEventAnalytics("snooze_interaction_time", "-1");
        if (!this.backwardJourneyStarted) {
            addEventAnalytics("snooze_window_action", "snooze_cancel_window_click");
        }
        dismissSnoozeWindow();
    }

    public void b(String str, String str2) {
        try {
            Timer timer = this.g0;
            if (timer != null && this.D0 != null) {
                this.L.a(timer);
            }
            if (str.equals(getString(R.string.cb_error))) {
                com.payu.custombrowser.b bVar = this.h;
                if (bVar != null && bVar.isAdded()) {
                    this.h.onBankError(str);
                }
                onBankError();
            } else if (str.equals("parse error")) {
                com.payu.custombrowser.b bVar2 = this.h;
                if (bVar2 != null && bVar2.isAdded()) {
                    this.h.onBankError(str);
                }
                onBankError();
            } else if (str.contentEquals(CBConstant.LOADING) && !this.c0 && this.i0) {
                onHelpAvailable();
                View view = this.K;
                if (view != null) {
                    view.setVisibility(0);
                }
            } else if (str.equals(getString(R.string.cb_choose))) {
                v();
                this.w = 2;
                this.i0 = true;
                View view2 = this.K;
                if (view2 != null) {
                    view2.setVisibility(0);
                }
                com.payu.custombrowser.b bVar3 = this.h;
                if (bVar3 != null && !bVar3.isAdded()) {
                    this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                    this.h.chooseFasterAction(str2);
                }
            } else if (str.equals(getString(R.string.cb_incorrect_OTP_2))) {
                this.pageType = str;
                v();
                this.i0 = true;
                if (this.isCbBottomSheetExpanded) {
                    com.payu.custombrowser.b bVar4 = this.h;
                    if (bVar4 != null) {
                        if (!bVar4.isAdded()) {
                            this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.h.incorrectOtp(str2);
                    }
                } else {
                    this.c = 1;
                    s();
                    this.X = 0L;
                }
            } else if (str.equals(getString(R.string.cb_retry_otp))) {
                this.i0 = true;
                if (this.isCbBottomSheetExpanded) {
                    com.payu.custombrowser.b bVar5 = this.h;
                    if (bVar5 != null) {
                        if (!bVar5.isAdded()) {
                            this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.h.retryOtp(str2);
                        Context applicationContext = getActivity().getApplicationContext();
                        String str3 = Z0;
                        com.payu.custombrowser.util.b.a(applicationContext, "Custom Browser Resend", str3, "CB Resend", b1, a1, str3, "", String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - d1)));
                    }
                } else {
                    this.c = 1;
                    s();
                    this.X = 0L;
                }
            } else if (str.equals(getString(R.string.cb_enter_pin))) {
                this.pageType = "PIN Page";
                v();
                View view3 = this.J;
                if (view3 != null) {
                    view3.setVisibility(8);
                }
                this.c0 = true;
                this.h0 = Boolean.TRUE;
                dismissCb();
            } else if (str.equals(getString(R.string.cb_enter_otp))) {
                this.pageType = str;
                this.i0 = true;
                this.j0 = str2;
                if (!this.m0) {
                    v();
                    t();
                    com.payu.custombrowser.b bVar6 = this.h;
                    if (bVar6 != null) {
                        if (!bVar6.isAdded()) {
                            Context applicationContext2 = getActivity().getApplicationContext();
                            String str4 = Z0;
                            com.payu.custombrowser.util.b.a(applicationContext2, "Custom Browser Loaded", str4, "CB Loaded", b1, a1, str4, c1, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));
                            this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.h.enterOtp(str2);
                    }
                }
            } else if (str.equals(getString(R.string.cb_incorrect_pin))) {
                this.pageType = "Choose Screen";
                v();
                try {
                    JSONObject jSONObject = new JSONObject(str2);
                    int i = R.string.cb_otp;
                    if (jSONObject.has(getString(i)) && jSONObject.getBoolean(getString(i))) {
                        this.i0 = true;
                        com.payu.custombrowser.b bVar7 = this.h;
                        if (bVar7 != null && !bVar7.isAdded()) {
                            this.h.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                            this.h.chooseFasterAction(str2);
                        }
                    }
                } catch (Exception e2) {
                    if (e2.getMessage() != null) {
                        addEventAnalytics("cb_exception", "cb_incorrect_pin_" + e2.getMessage());
                    }
                }
            } else if (!str.equals(getString(R.string.cb_register_option))) {
                addEventAnalytics("arrival", "-1");
            }
        } catch (Exception e3) {
            if (e3.getMessage() != null) {
                z0.k(e3, new StringBuilder("convertToNative_"), this, "cb_exception");
            }
        }
        String str5 = this.pageType;
        if (str5 == null || str5.equalsIgnoreCase("")) {
            return;
        }
        addEventAnalytics("arrival", "-1");
    }

    public void b(View view) {
        this.snoozeCountBackwardJourney++;
        dismissSnoozeWindow();
        addEventAnalytics(com.payu.custombrowser.util.a.a, "confirm_deduction_n");
    }

    public void b(DialogInterface dialogInterface, int i) {
        addEventAnalytics("user_input", "back_button_cancel");
        dialogInterface.dismiss();
        com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
        if (bVar.getPayuCustomBrowserCallback() != null) {
            bVar.getPayuCustomBrowserCallback().onBackDismiss();
        }
    }
}