导航菜单

页面标题

页面副标题

OLX India v19.42.007 - Bank.java 源代码

正在查看: OLX India v19.42.007 应用的 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.appcompat.app.c;
import com.olxgroup.panamera.domain.seller.posting.entity.PostingDraft;
import com.olxgroup.panamera.domain.users.myaccount.presentation_impl.SettingsPresenter;
import com.payu.commonui.model.listeners.OnUserCancellationFeedbackListener;
import com.payu.commonui.view.customViews.UserCancellationFeedbackBottomSheet;
import com.payu.custombrowser.util.CBConstant;
import com.payu.custombrowser.widgets.SnoozeLoaderView;
import com.payu.ui.model.utils.SdkUiConstants;
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 D2 = null;
    static String E2 = null;
    static String F2 = null;
    static String G2 = null;
    static String H2 = null;
    static long I2 = 0;
    static String J2 = null;
    private static final List K2 = new ArrayList();
    public static String Version = "7.15.2";
    public static String keyAnalytics;
    public static String transactionID;
    private AlertDialog A2;
    private boolean B2;
    private String C2;
    private AlertDialog h2;
    Runnable i2;
    private SnoozeLoaderView m2;
    private boolean q2;
    private boolean r2;
    private CountDownTimer s2;
    public long snoozeClickedTime;
    private CountDownTimer t2;
    private boolean v2;
    private final String g2 = getClass().getSimpleName();
    private CountDownTimer j2 = null;
    private boolean k2 = false;
    private boolean l2 = false;
    private boolean n2 = true;
    private boolean o2 = false;
    private boolean p2 = true;
    private boolean u2 = true;
    private boolean w2 = false;
    private boolean x2 = false;
    private boolean y2 = false;
    private boolean z2 = false;

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

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

        @Override
        public void onGlobalLayout() {
            Activity activity = Bank.this.G0;
            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.N0 == 0) {
                    ((InputMethodManager) bank.G0.getSystemService("input_method")).toggleSoftInput(3, 0);
                    Bank.this.N0 = 1;
                }
            }
        }
    }

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

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

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

    class c implements View.OnClickListener {
        final CheckBox a;

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

        @Override
        public void onClick(View view) {
            Bank.this.p2 = this.a.isChecked();
            if (Bank.this.p2) {
                Bank.this.addEventAnalytics("user_input", com.payu.custombrowser.util.a.d + "y");
                return;
            }
            Bank.this.addEventAnalytics("user_input", com.payu.custombrowser.util.a.d + SettingsPresenter.Origin.NOTIFICATION);
        }
    }

    class d implements View.OnClickListener {
        final Button a;

        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.V0;
                StringBuilder sb = new StringBuilder();
                sb.append("javascript:");
                Bank bank = Bank.this;
                sb.append(bank.K0.getString(bank.getString(i0.cb_btn_action)));
                webView.loadUrl(sb.toString());
            } catch (Exception e) {
                if (e.getMessage() != null) {
                    Bank.this.addEventAnalytics("cb_exception", "nb_cb_btn_click_" + e.getMessage());
                }
            }
        }
    }

    class e implements View.OnClickListener {
        final CheckBox a;

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

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

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

        @Override
        public void onClick(View view) {
            try {
                WebView webView = Bank.this.V0;
                StringBuilder sb = new StringBuilder();
                sb.append("javascript:");
                Bank bank = Bank.this;
                sb.append(bank.K0.getString(bank.getString(i0.cb_btn_action)));
                webView.loadUrl(sb.toString());
            } catch (Exception e) {
                if (e.getMessage() != null) {
                    Bank.this.addEventAnalytics("cb_exception", "nb_cb_pwd_btn_click_" + e.getMessage());
                }
            }
        }
    }

    class g implements Runnable {
        g() {
        }

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

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

        @Override
        public void onFinish() {
            Bank.this.k2 = false;
            int progress = Bank.this.V0.getProgress();
            Bank bank = Bank.this;
            if (progress < bank.snoozeUrlLoadingPercentage && !bank.R0 && bank.u2 && !Bank.this.getTransactionStatusReceived()) {
                Bank.this.launchSnoozeWindow();
            }
            Bank.this.t6();
        }

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

    public Bank(Activity activity) {
        this.G0 = activity;
        this.M0 = new com.payu.custombrowser.b(this, this);
        this.r2 = false;
        this.v1 = new HashSet();
        this.q1 = new com.payu.custombrowser.util.b();
        this.y1 = Executors.newCachedThreadPool();
        this.w1 = new HashSet();
        this.x1 = new HashSet();
    }

    public boolean A6(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 D6(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();
        }
    }

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

    public void G6(String str, String str2) {
        try {
            Timer timer = this.L1;
            if (timer != null && this.i2 != null) {
                this.q1.I(timer);
            }
            if (str.equals(getString(i0.cb_error))) {
                com.payu.custombrowser.b bVar = this.M0;
                if (bVar != null && bVar.isAdded()) {
                    this.M0.onBankError(str);
                }
                onBankError();
            } else if (str.equals("parse error")) {
                com.payu.custombrowser.b bVar2 = this.M0;
                if (bVar2 != null && bVar2.isAdded()) {
                    this.M0.onBankError(str);
                }
                onBankError();
            } else if (str.contentEquals(CBConstant.LOADING) && !this.H1 && this.N1) {
                onHelpAvailable();
                View view = this.p1;
                if (view != null) {
                    view.setVisibility(0);
                }
            } else if (str.equals(getString(i0.cb_choose))) {
                T6();
                this.b1 = 2;
                this.N1 = true;
                View view2 = this.p1;
                if (view2 != null) {
                    view2.setVisibility(0);
                }
                com.payu.custombrowser.b bVar3 = this.M0;
                if (bVar3 != null && !bVar3.isAdded()) {
                    this.M0.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                    this.M0.chooseFasterAction(str2);
                }
            } else if (str.equals(getString(i0.cb_incorrect_OTP_2))) {
                this.pageType = str;
                T6();
                this.N1 = true;
                if (this.isCbBottomSheetExpanded) {
                    com.payu.custombrowser.b bVar4 = this.M0;
                    if (bVar4 != null) {
                        if (!bVar4.isAdded()) {
                            this.M0.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.M0.incorrectOtp(str2);
                    }
                } else {
                    this.H0 = 1;
                    E5();
                    this.C1 = 0L;
                }
            } else if (str.equals(getString(i0.cb_retry_otp))) {
                this.N1 = true;
                if (this.isCbBottomSheetExpanded) {
                    com.payu.custombrowser.b bVar5 = this.M0;
                    if (bVar5 != null) {
                        if (!bVar5.isAdded()) {
                            this.M0.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.M0.retryOtp(str2);
                        Context applicationContext = getActivity().getApplicationContext();
                        String str3 = E2;
                        com.payu.custombrowser.util.b.x(applicationContext, "Custom Browser Resend", str3, "CB Resend", G2, F2, str3, "", String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - I2)));
                    }
                } else {
                    this.H0 = 1;
                    E5();
                    this.C1 = 0L;
                }
            } else if (str.equals(getString(i0.cb_enter_pin))) {
                this.pageType = "PIN Page";
                T6();
                View view3 = this.o1;
                if (view3 != null) {
                    view3.setVisibility(8);
                }
                this.H1 = true;
                this.M1 = Boolean.TRUE;
                dismissCb();
            } else if (str.equals(getString(i0.cb_enter_otp))) {
                this.pageType = str;
                this.N1 = true;
                this.O1 = str2;
                if (!this.R1) {
                    T6();
                    F5();
                    com.payu.custombrowser.b bVar6 = this.M0;
                    if (bVar6 != null) {
                        if (!bVar6.isAdded()) {
                            Context applicationContext2 = getActivity().getApplicationContext();
                            String str4 = E2;
                            com.payu.custombrowser.util.b.x(applicationContext2, "Custom Browser Loaded", str4, "CB Loaded", G2, F2, str4, H2, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())));
                            this.M0.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                        }
                        this.M0.enterOtp(str2);
                    }
                }
            } else if (str.equals(getString(i0.cb_incorrect_pin))) {
                this.pageType = "Choose Screen";
                T6();
                try {
                    JSONObject jSONObject = new JSONObject(str2);
                    if (jSONObject.has(getString(i0.cb_otp)) && jSONObject.getBoolean(getString(i0.cb_otp))) {
                        this.N1 = true;
                        com.payu.custombrowser.b bVar7 = this.M0;
                        if (bVar7 != null && !bVar7.isAdded()) {
                            this.M0.showNow(getActivity().getSupportFragmentManager(), "CbBottomSheet");
                            this.M0.chooseFasterAction(str2);
                        }
                    }
                } catch (Exception e2) {
                    if (e2.getMessage() != null) {
                        addEventAnalytics("cb_exception", "cb_incorrect_pin_" + e2.getMessage());
                    }
                }
            } else if (!str.equals(getString(i0.cb_register_option))) {
                addEventAnalytics("arrival", PostingDraft.NO_AD_ID);
            }
        } catch (Exception e3) {
            if (e3.getMessage() != null) {
                addEventAnalytics("cb_exception", "convertToNative_" + e3.getMessage());
            }
        }
        String str5 = this.pageType;
        if (str5 == null || str5.equalsIgnoreCase("")) {
            return;
        }
        addEventAnalytics("arrival", PostingDraft.NO_AD_ID);
    }

    public void H6(boolean z) {
        this.isOTPFilled = z;
        if (z) {
            this.otp = null;
            if (this.otpTriggered) {
                this.otpTriggered = false;
                String optString = this.J0.optString(getString(i0.cb_catchAll_success_msg));
                if (this.B2) {
                    this.C2 = optString;
                } else {
                    if (optString == null || optString.isEmpty()) {
                        return;
                    }
                    Toast.makeText(this.G0.getApplicationContext(), optString, 0).show();
                }
            }
        }
    }

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

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

    public void L6(boolean z) {
        if (z) {
            return;
        }
        l5();
        this.b1 = 1;
        try {
            View view = this.o1;
            if (view != null) {
                view.setVisibility(8);
            }
            onHelpUnavailable();
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "showCustomBrowser_" + e2.getMessage());
            }
        }
    }

    public void O6(View view) {
        d();
        dismissCb();
        S6(view);
    }

    public void P6(String str) {
        p6();
        if (str.isEmpty()) {
            return;
        }
        Activity activity = this.G0;
        String str2 = E2;
        com.payu.custombrowser.util.b.y(activity, "PayUCustomBrowser", str2, SdkUiConstants.CP_BACK_BUTTON, G2, F2, str2, H2, String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis())), str);
    }

    private void Q6(boolean z) {
        this.z2 = z;
    }

    public void R6(View view) {
        d();
        dismissCb();
        S6(view);
    }

    private void S6(View view) {
        NotificationManager notificationManager;
        if (view.getId() == g0.button_retry_transaction) {
            this.snoozeCount++;
            addEventAnalytics("snooze_interaction_time", PostingDraft.NO_AD_ID);
            addEventAnalytics("snooze_window_action", "snooze_retry_click");
        } else if (view.getId() == g0.button_retry_anyway) {
            this.snoozeCount++;
            addEventAnalytics("snooze_txn_paused_user_interaction_time", PostingDraft.NO_AD_ID);
            addEventAnalytics("snooze_txn_paused_window_action", "retry_anyway_click");
        }
        setTransactionStatusReceived(false);
        if (!com.payu.custombrowser.util.b.o0(this.G0.getApplicationContext())) {
            Toast.makeText(this.G0.getApplicationContext(), CBConstant.MSG_NO_INTERNET, 0).show();
            return;
        }
        if (this.V0.getUrl() == null || this.V0.getUrl().contentEquals("https://secure.payu.in/_payment") || this.V0.getUrl().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS) || !isUrlWhiteListed(this.V0.getUrl())) {
            this.q1.C(this.customBrowserConfig);
            if ((this.customBrowserConfig.getPostURL() != null && (this.customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || this.customBrowserConfig.getPostURL().contentEquals(CBConstant.TEST_PAYMENT_URL))) || (this.isS2SHtmlSupport && !TextUtils.isEmpty(this.surePayS2Surl) && !TextUtils.isEmpty(this.surePayS2SPayUId))) {
                markPreviousTxnAsUserCanceled(com.payu.custombrowser.util.b.k(this.G0.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() != g0.button_retry_anyway || (notificationManager = (NotificationManager) this.G0.getSystemService("notification")) == null) {
            return;
        }
        notificationManager.cancel(CBConstant.SNOOZE_NOTIFICATION_ID);
    }

    private void U6() {
        if (this.Q1 || Build.VERSION.SDK_INT < 23 || !this.e1) {
            onHelpAvailable();
            if (this.T1) {
                try {
                    this.V0.loadUrl("javascript:" + this.K0.getString(getString(i0.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) {
                        addEventAnalytics("cb_exception", "checkPermission_m_" + e3.getMessage());
                        return;
                    }
                    return;
                }
            }
            return;
        }
        this.Q1 = true;
        if (androidx.core.content.b.checkSelfPermission(this.G0, "android.permission.RECEIVE_SMS") != 0) {
            this.R1 = true;
            return;
        }
        this.P1 = true;
        if (this.T1) {
            try {
                this.V0.loadUrl("javascript:" + this.K0.getString(getString(i0.cb_otp)));
            } catch (JSONException e4) {
                if (e4.getMessage() != null) {
                    addEventAnalytics("cb_exception", "checkPermission_je_" + e4.getMessage());
                }
            } catch (Exception e5) {
                if (e5.getMessage() != null) {
                    addEventAnalytics("cb_exception", "checkPermission_" + e5.getMessage());
                }
            }
        }
    }

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

    private void W6() {
        if (com.payu.custombrowser.bean.b.SINGLETON.getPayuCustomBrowserCallback() == null || this.customBrowserConfig == null || !this.q1.K(CBConstant.SNOOZE_ENABLED, this.G0.getApplicationContext()) || this.customBrowserConfig.getEnableSurePay() <= this.snoozeCount) {
            return;
        }
        if (this.k2) {
            t6();
        }
        s6();
    }

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

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

    public void c(String str, String str2) {
        int i;
        try {
            if (this.R0) {
                dismissSnoozeWindow();
                addEventAnalytics("snooze_window_action", "snooze_window_dismissed_by_cb");
                addEventAnalytics("snooze_window_automatically_disappear_time", PostingDraft.NO_AD_ID);
            }
            this.pageType = "NBLogin Page";
            addEventAnalytics("arrival", PostingDraft.NO_AD_ID);
            onHelpAvailable();
            addEventAnalytics("cb_status", com.payu.custombrowser.util.a.b);
            if (str == null || this.G0 == null) {
                return;
            }
            dismissSnoozeWindow();
            View inflate = this.G0.getLayoutInflater().inflate(h0.cb_nb_layout, (ViewGroup) null);
            Button button = (Button) inflate.findViewById(g0.b_continue);
            CheckBox checkBox = (CheckBox) inflate.findViewById(g0.checkbox);
            JSONObject jSONObject = new JSONObject(str2);
            String string = getString(i0.cb_btn_text);
            if (!jSONObject.has(string) || jSONObject.getString(string) == null || jSONObject.getString(string).equalsIgnoreCase("")) {
                onHelpUnavailable();
                this.l1.removeAllViews();
                return;
            }
            if (!str.equals(getString(i0.cb_button))) {
                if (str.equals(getString(i0.cb_pwd_btn))) {
                    button.setText(jSONObject.getString(string));
                    if (this.r2) {
                        checkBox.setChecked(true);
                    } else {
                        checkBox.setChecked(false);
                    }
                    if (checkBox.isChecked()) {
                        try {
                            this.V0.loadUrl("javascript:" + this.K0.getString(getString(i0.cb_toggle_field)) + "(\"true\")");
                        } catch (Exception e2) {
                            if (e2.getMessage() != null) {
                                addEventAnalytics("cb_exception", "nb_cb_pwd_btn_click_" + e2.getMessage());
                            }
                        }
                    }
                    checkBox.setText(getString(i0.cb_show_password));
                    checkBox.setVisibility(0);
                    checkBox.setOnClickListener(new e(checkBox));
                    button.setOnClickListener(new f());
                    this.T0 = true;
                    this.l1.removeAllViews();
                    this.l1.addView(inflate);
                    return;
                }
                return;
            }
            if (!jSONObject.has(getString(i0.cb_checkbox))) {
                checkBox.setVisibility(8);
            } else if (jSONObject.getBoolean(getString(i0.cb_checkbox))) {
                if (this.p2) {
                    addEventAnalytics(com.payu.custombrowser.util.a.e, "y");
                    Context applicationContext = getActivity().getApplicationContext();
                    String str3 = E2;
                    com.payu.custombrowser.util.b.x(applicationContext, "Custom Browser Loaded", str3, "CB Loaded", G2, F2, str3, "L1", String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - I2)));
                    checkBox = checkBox;
                    checkBox.setChecked(true);
                    i = 0;
                } else {
                    addEventAnalytics(com.payu.custombrowser.util.a.e, SettingsPresenter.Origin.NOTIFICATION);
                    Context applicationContext2 = getActivity().getApplicationContext();
                    String str4 = E2;
                    com.payu.custombrowser.util.b.x(applicationContext2, "Custom Browser Loaded", str4, "CB Loaded", G2, F2, str4, "L1", String.valueOf(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - I2)));
                    i = 0;
                    checkBox.setChecked(false);
                }
                checkBox.setOnClickListener(new c(checkBox));
                checkBox.setVisibility(i);
            } else {
                checkBox.setVisibility(8);
            }
            button.setText(jSONObject.getString(string));
            button.setTransformationMethod(null);
            button.setOnClickListener(new d(button));
            this.l1.removeAllViews();
            this.l1.addView(inflate);
            this.T0 = true;
        } catch (Exception e3) {
            if (e3.getMessage() != null) {
                addEventAnalytics("cb_exception", "nativeHelperForNB_" + e3.getMessage());
            }
        }
    }

    public void i6() {
        a();
    }

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

    public void k6() {
        try {
            if (this.q1.V(this.G0.getApplicationContext(), this.f1) == null || this.q1.V(this.G0.getApplicationContext(), this.f1).equals("")) {
                return;
            }
            this.V0.loadUrl("javascript:" + this.K0.getString(getString(i0.cb_populate_user_id)) + "(\"" + this.q1.V(this.G0.getApplicationContext(), this.f1) + "\")");
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "getUserId_" + e2.getMessage());
            }
        }
    }

    public void m6() {
        boolean z;
        if (this.l2 || this.w2 || !(z = this.R0) || this.backwardJourneyStarted) {
            return;
        }
        if (z) {
            addEventAnalytics("snooze_window_automatically_disappear_time", PostingDraft.NO_AD_ID);
        }
        dismissSnoozeWindow();
    }

    public void n6() {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded() || this.a1 == null || !isVisible()) {
            return;
        }
        this.a1.dismiss();
    }

    private void p6() {
        postToPaytxn();
        androidx.appcompat.app.c cVar = this.O0;
        if (cVar != null && cVar.isShowing()) {
            this.O0.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.G0;
        if (activity == null || !(activity instanceof CBActivity)) {
            return;
        }
        activity.finish();
    }

    private void q6() {
        setIsPageStoppedForcefully(true);
        if (this.V1 != null) {
            t6();
            this.X1 = this.q1.b(this.V1, this.d1);
            launchSnoozeWindow(2);
        }
    }

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

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

    public void t6() {
        CountDownTimer countDownTimer = this.j2;
        if (countDownTimer != null) {
            this.k2 = false;
            countDownTimer.cancel();
            this.j2 = null;
        }
    }

    public void u6(int i, String str, DialogInterface dialogInterface, int i2) {
        if (i2 != -1) {
            dialogInterface.dismiss();
            this.h2 = null;
            retryCancellationHandler();
        } else if (!com.payu.custombrowser.util.b.o0(this.G0)) {
            dialogInterface.dismiss();
            this.h2 = null;
            internetErrorHandler(i, str);
        } else {
            dialogInterface.dismiss();
            this.h2 = null;
            if (i != 0) {
                reloadWebViewUrl();
            }
        }
    }

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

    public void w6(DialogInterface dialogInterface, int i) {
        if (!isAdded() || isRemoving() || isDetached()) {
            return;
        }
        String str = E2;
        if (str == null || !str.equals(CBConstant.NETBANKING)) {
            p6();
            return;
        }
        UserCancellationFeedbackBottomSheet.Builder builder = new UserCancellationFeedbackBottomSheet.Builder(getContext(), getChildFragmentManager(), this.g2);
        builder.setDefaultFeedbacksList(null, true);
        builder.setFeedbackListener(new OnUserCancellationFeedbackListener() {
            @Override
            public final void onUserCancellationFeedbackReceived(String str2) {
                Bank.this.P6(str2);
            }
        });
        builder.setPrimaryColor(this.customBrowserConfig.getPrimaryColor());
        builder.setBaseTextColor(this.customBrowserConfig.getBaseTextColor());
        builder.build().show();
    }

    public void y6(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(CBConstant.errorCodes.SSL_ERROR, str);
        }
    }

    public void z6(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.L1;
        if (timer != null) {
            timer.cancel();
            this.L1.purge();
        }
        this.snoozeCountBackwardJourney++;
        this.O0.setCanceledOnTouchOutside(false);
        textView.setText(this.G0.getResources().getString(i0.cb_confirm_transaction));
        textView2.setText(this.G0.getString(i0.cb_transaction_status));
        this.m2.setVisibility(0);
        this.m2.h();
        button.setVisibility(8);
        textView3.setVisibility(8);
        textView4.setVisibility(8);
        textView5.setVisibility(8);
    }

    @Override
    void B5() {
        AlertDialog alertDialog = this.A2;
        if (alertDialog != null) {
            alertDialog.dismiss();
            this.A2 = null;
        }
    }

    void T6() {
        if (this.S0.contains("CUSTOM_BROWSER")) {
            return;
        }
        this.Q0 = "CUSTOM_BROWSER";
        this.S0.add("CUSTOM_BROWSER");
        addEventAnalytics("cb_status", this.Q0);
    }

    @JavascriptInterface
    public void bankFound(final String str) {
        if (!this.q2) {
            checkStatusFromJS(str);
            this.q2 = true;
        }
        a(str);
        Activity activity = this.G0;
        if (activity != null && !activity.isFinishing()) {
            this.G0.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Bank.this.i6();
                }
            });
        }
        this.f1 = str;
        if (!this.S1) {
            try {
                if (!this.l2) {
                    if (this.r1 == null) {
                        convertToNative(CBConstant.LOADING, "{}");
                    } else {
                        Activity activity2 = this.G0;
                        if (activity2 != null) {
                            if (this.r1 != ((ViewGroup) activity2.findViewById(g0.help_view)).getChildAt(0)) {
                                convertToNative(CBConstant.LOADING, "{}");
                            }
                        }
                    }
                }
            } catch (Exception e2) {
                if (e2.getMessage() != null) {
                    addEventAnalytics("cb_exception", "bankFound_loading_" + e2.getMessage());
                }
            }
        }
        if (this.o2 || this.K0 != null) {
            return;
        }
        this.y1.execute(new Runnable() {
            @Override
            public final void run() {
                Bank.this.F6(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) {
                addEventAnalytics("cb_exception", "cacheAnalytics_" + e2.getMessage());
            }
        }
    }

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

    @JavascriptInterface
    public void convertToNative(final String str, final String str2) {
        if (this.R0) {
            dismissSnoozeWindow();
            cancelTransactionNotification();
            addEventAnalytics("snooze_window_action", "snooze_window_dismissed_by_cb");
            addEventAnalytics("snooze_window_automatically_disappear_time", PostingDraft.NO_AD_ID);
        }
        Activity activity = this.G0;
        if (activity != null && !activity.isFinishing()) {
            this.G0.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Bank.this.j6();
                }
            });
        }
        String str3 = this.pageType;
        if (str3 != null && !str3.equalsIgnoreCase("")) {
            addEventAnalytics("departure", PostingDraft.NO_AD_ID);
            this.pageType = "";
        }
        Activity activity2 = this.G0;
        if (activity2 == null || !this.J1 || activity2.isFinishing()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.G6(str, str2);
            }
        });
    }

    public void dismissCb() {
        V6();
        x5();
    }

    @JavascriptInterface
    public void l6() {
        com.payu.custombrowser.widgets.a aVar;
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing() || (aVar = this.Z0) == null) {
            return;
        }
        aVar.dismiss();
        this.Z0.cancel();
        if (this.x2) {
            return;
        }
        this.forwardJourneyForChromeLoaderIsComplete = true;
        com.payu.custombrowser.util.d.c("Setting forwardJourneyForChromeLoaderIsComplete = true");
        startSlowUserWarningTimer();
    }

    @JavascriptInterface
    public void dismissReviewOrder() {
    }

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

    public void dismissSnoozeWindow() {
        this.R0 = false;
        androidx.appcompat.app.c cVar = this.O0;
        if (cVar != null) {
            cVar.dismiss();
            this.O0.cancel();
            showCbBlankOverlay(8);
        }
    }

    @JavascriptInterface
    public void enableCatchAllJS(final boolean z) {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.a(z);
            }
        });
    }

    @JavascriptInterface
    public void fillOTPCallback(final boolean z) {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.H6(z);
            }
        });
    }

    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.V0.loadUrl("javascript:" + this.J0.getString(getString(i0.cb_fill_otp)) + "(" + jSONObject + ")");
        } catch (JSONException e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "fillOTPOnBankPage_" + e2.getMessage());
            }
        }
    }

    public String getBankName() {
        String str = this.f1;
        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.m2;
    }

    @JavascriptInterface
    public void getUserId() {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.k6();
            }
        });
    }

    @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.u6(i, str, dialogInterface, i2);
            }
        };
        if (this.h2 == null) {
            AlertDialog create = com.payu.custombrowser.util.b.d(this.G0, onClickListener, getString(i0.cb_retry_transaction), getString(i0.cb_dialog_cancel), null, getString(i0.payu_cb_no_internet_connection)).create();
            this.h2 = create;
            create.setCancelable(false);
            this.h2.setCanceledOnTouchOutside(false);
            this.h2.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 = E2;
        com.payu.custombrowser.util.b.x(context, str, str4, str2, G2, F2, 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(final String str, final String str2) {
        Activity activity = this.G0;
        if (activity != null && !activity.isFinishing() && !isRemoving() && isAdded()) {
            this.G0.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    Bank.this.c(str, str2);
                }
            });
        }
        Activity activity2 = this.G0;
        if (activity2 == null || activity2.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.l6();
            }
        });
    }

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

    @JavascriptInterface
    public void onFailure(String str) {
        this.h1 = str;
        n5();
    }

    public void onLoadResourse(WebView webView, String str) {
        Activity activity = this.G0;
        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.a = str;
        com.payu.custombrowser.util.b.b = "Loaded";
        this.w2 = false;
        Activity activity = this.G0;
        if (activity != null && !activity.isFinishing() && !isRemoving() && isAdded()) {
            if (this.z2) {
                addEventAnalytics("snooze_resume_url", str);
                Q6(false);
            }
            this.q1.d0(this.G0.getApplicationContext(), "last_url", "f:" + str);
            r6();
            if (this.n2 && getArguments() != null && getArguments().getInt(CBConstant.MAIN_LAYOUT, -1) != -1) {
                try {
                    View findViewById = this.G0.findViewById(getArguments().getInt(CBConstant.MAIN_LAYOUT));
                    findViewById.getViewTreeObserver().addOnGlobalLayoutListener(new a(findViewById));
                    this.n2 = false;
                } catch (Exception e2) {
                    if (e2.getMessage() != null) {
                        addEventAnalytics("cb_exception", "onPageFinishWebclient_" + e2.getMessage());
                    }
                }
            }
        }
        if (!this.l2) {
            t6();
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                Bank.this.m6();
            }
        }, 1000L);
    }

    public void o6() {
        if (!isAdded() || isRemoving() || this.G0 == null) {
            return;
        }
        this.S1 = true;
        if (this.M1.booleanValue()) {
            onHelpUnavailable();
            this.M1 = Boolean.FALSE;
        }
        View view = this.r1;
        if (view != null && view.isShown()) {
            this.b1 = 1;
            l5();
            onHelpUnavailable();
        }
        this.G0.getWindow().setSoftInputMode(3);
        if (this.K0 != null && this.J1 && !this.l2) {
            try {
                this.V0.loadUrl("javascript:" + this.K0.getString(getString(i0.cb_init)));
            } catch (JSONException e2) {
                if (e2.getMessage() != null) {
                    addEventAnalytics("cb_exception", "onPageFinished_" + e2.getMessage());
                }
            }
        }
        if (this.J0 != null) {
            if (!this.y2) {
                checkStatusFromJS("", 3);
                this.y2 = true;
            }
            View view2 = this.p1;
            if (view2 != null) {
                view2.setVisibility(8);
            }
        }
        fillOTPOnBankPage(true);
    }

    @Override
    public void onPageStarted() {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        if (this.T0) {
            onHelpUnavailable();
            this.T0 = false;
        }
        if (isAdded() && !isRemoving() && isVisible()) {
            this.S1 = false;
            if (this.J0 != null) {
                try {
                    if (this.J1) {
                        this.V0.loadUrl("javascript:" + this.J0.getString(getString(i0.cb_detect_bank)));
                    }
                } catch (JSONException e2) {
                    if (e2.getMessage() != null) {
                        addEventAnalytics("cb_exception", "onPageStarted_" + e2.getMessage());
                    }
                }
            }
            View view = this.p1;
            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.B2 = true;
    }

    @JavascriptInterface
    public void onPayuFailure(String str) {
        if (this.G0 != null) {
            this.Q0 = "failure_transaction";
            addEventAnalytics("trxn_status", "failure_transaction");
            this.i1 = Boolean.FALSE;
            this.g1 = str;
        }
        cancelTransactionNotification();
        b();
    }

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

    public void onProgressChanged(int i) {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded() || this.a1 == null || !isVisible()) {
            return;
        }
        this.a1.show();
        if (i == 100) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    Bank.this.n6();
                }
            }, 100L);
        } else {
            g5(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.V0.getUrl() != null ? this.V0.getUrl() : "");
        String sb2 = sb.toString();
        a("ERROR_RECEIVED", sb2);
        Log.d("Bank", "communicationError onReceivedErrorWebClient " + sb2);
        c();
        com.payu.custombrowser.widgets.a aVar = this.a1;
        if (aVar != null) {
            aVar.dismiss();
        }
        this.x2 = 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) {
                    q6();
                } else if (z && this.isTxnNBType && this.snoozeCountBackwardJourney < this.customBrowserConfig.getEnableSurePay()) {
                    dismissSnoozeWindow();
                    q6();
                }
                onHelpUnavailable();
                this.l1.removeAllViews();
                if (this.Y0 != 0) {
                    l5();
                    this.b1 = 1;
                }
                d();
                dismissCb();
                if (this.k1) {
                    return;
                }
                bVar.getPayuCustomBrowserCallback().onCBErrorReceived(i, str);
            }
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "onReceivedErrorWebClient_" + e2.getMessage());
            }
        }
    }

    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.B2 = false;
        String str = this.C2;
        if (str != null) {
            Toast.makeText(this.G0, str, 0).show();
            this.C2 = null;
        }
    }

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

    public void otpClicked() {
        this.T1 = true;
        U6();
        this.Q0 = "otp_click";
        addEventAnalytics("user_input", "otp_click");
        if (Build.VERSION.SDK_INT < 23) {
            this.K1 = null;
            F5();
        }
    }

    @JavascriptInterface
    public void reInit() {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.o6();
            }
        });
    }

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

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

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

    @Override
    public void reloadWebView(String str, String str2) {
        this.forwardJourneyForChromeLoaderIsComplete = false;
        this.isWebviewReloading = true;
        this.backwardJourneyStarted = false;
        if (this.R0) {
            dismissSnoozeWindow();
        }
        com.payu.custombrowser.widgets.a aVar = this.Z0;
        if (aVar != null) {
            aVar.dismiss();
        }
        if (isAdded() && this.n1 != null) {
            this.Z0 = null;
        }
        Q6(true);
        resetAutoSelectOTP();
        this.q1.S(this.customBrowserConfig);
        this.surePayS2SPayUId = null;
        if (str != null && str2 != null) {
            this.V0.postUrl(str, str2.getBytes());
        } else if (str != null) {
            this.V0.loadUrl(str);
        }
    }

    public void reloadWebViewUrl() {
        if (!com.payu.custombrowser.util.b.o0(this.G0.getApplicationContext())) {
            addEventAnalytics("no_internet_found", "reloadWebViewUrl : Internet not available");
        } else {
            if (this.V0.getUrl() == null || this.V0.getUrl().contentEquals("https://secure.payu.in/_payment") || this.V0.getUrl().contentEquals(CBConstant.PRODUCTION_PAYMENT_URL_SEAMLESS) || !isUrlWhiteListed(this.V0.getUrl())) {
                return;
            }
            reloadWebView();
        }
    }

    @JavascriptInterface
    public void removeJSData(String str, boolean z) {
        if (z) {
            this.q1.h0(this.G0, str);
        } else {
            this.q1.l0(this.G0, str);
        }
    }

    public boolean retryCancellationHandler() {
        postToPaytxn();
        addEventAnalytics("user_input", "user_cancel_retry_dialog");
        onBackApproved();
        HashMap g0 = new com.payu.custombrowser.util.b().g0(this.customBrowserConfig.getPayuPostData());
        G2 = (String) g0.get("amount");
        transactionID = (String) g0.get("txnid");
        if (!this.customBrowserConfig.isActionBarPresent()) {
            return true;
        }
        this.G0.finish();
        return true;
    }

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

    @JavascriptInterface
    public void setJSData(String str, String str2, boolean z) {
        if (z) {
            this.q1.Z(this.G0, str, str2);
        } else {
            this.q1.R(this.G0, str, str2);
        }
    }

    @JavascriptInterface
    public void setSnoozeConfig(String str) {
        this.V1 = this.q1.p0(this.G0.getApplicationContext(), str);
    }

    @JavascriptInterface
    public void setSnoozeEnabled(boolean z) {
        if (!z) {
            this.customBrowserConfig.setEnableSurePay(0);
        }
        this.q1.H(CBConstant.SNOOZE_ENABLED, z, this.G0.getApplicationContext());
    }

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

    @JavascriptInterface
    public void setUserId(String str) {
        if (!this.p2) {
            if (this.q1.V(this.G0.getApplicationContext(), this.f1).equals("")) {
                return;
            }
            this.q1.h0(this.G0.getApplicationContext(), this.f1);
        } else {
            Activity activity = this.G0;
            if (activity == null || activity.isFinishing()) {
                return;
            }
            this.q1.i0(this.G0.getApplicationContext(), this.f1, str);
        }
    }

    public void showBackButtonDialog() {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this.G0, j0.cb_dialog);
        builder.setCancelable(false);
        builder.setMessage(this.G0.getString(i0.payu_cancel_transaction_confirmation));
        builder.setPositiveButton(this.G0.getString(i0.payu_ok), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                Bank.this.w6(dialogInterface, i);
            }
        });
        builder.setNegativeButton(this.G0.getString(i0.cb_b_cancel), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                Bank.this.D6(dialogInterface, i);
            }
        });
        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.A2 = create;
        create.getWindow().getAttributes().type = 2003;
        this.A2 = builder.show();
    }

    @JavascriptInterface
    public void showCustomBrowser(final boolean z) {
        this.J1 = z;
        if (getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.L6(z);
            }
        });
    }

    @JavascriptInterface
    public void showJSRequestedToast(String str) {
        if (this.B2) {
            this.C2 = str;
        } else {
            Toast.makeText(this.G0.getApplicationContext(), str, 0).show();
        }
    }

    @JavascriptInterface
    public void spResumedWindowTTL(String str) {
        try {
            this.W1 = Integer.parseInt(str);
        } catch (Exception e2) {
            if (e2.getMessage() != null) {
                addEventAnalytics("cb_exception", "spResumedWindowTTL_" + e2.getMessage());
            }
        }
    }

    protected void startSlowUserWarningTimer() {
        com.payu.custombrowser.util.d.c("Attempting to start slowUserCountDownTimer");
        if (this.slowUserCountDownTimer == null) {
            com.payu.custombrowser.util.d.c("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(CBConstant.MERCHANTKEY) && jSONObject.has(CBConstant.TXNID)) {
                this.surePayS2Surl = jSONObject.getString(CBConstant.S2SREPLAYURL);
                this.merchantKey = jSONObject.getString(CBConstant.MERCHANTKEY);
                this.txnId = jSONObject.getString(CBConstant.TXNID);
                String string = jSONObject.getString(CBConstant.TXN_TYPE);
                this.txnType = string;
                this.isTxnNBType = string.equalsIgnoreCase(SdkUiConstants.CP_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());
            }
        }
    }

    void x6(final SslErrorHandler sslErrorHandler, final String str) {
        DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                Bank.this.y6(sslErrorHandler, str, dialogInterface, i);
            }
        };
        if (isAdded()) {
            com.payu.custombrowser.util.b.d(getActivity(), onClickListener, getString(i0.cb_dialog_continue), getString(i0.cb_dialog_cancel), null, str + " " + getString(i0.cb_dialog_would_you_like_to_continue)).create().show();
        }
    }

    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) {
                    addEventAnalytics("cb_exception", "addErrorData_" + e2.getMessage());
                    return;
                }
                return;
            }
        }
    }

    @JavascriptInterface
    public String getJSData(String str, boolean z) {
        return this.q1.l(this.G0, str, z);
    }

    public void launchSnoozeWindow(int i) {
        int i2 = this.X1;
        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.G0;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        dismissSlowUserWarning();
        a(8, "");
        this.R0 = true;
        addEventAnalytics("snooze_window_status", "snooze_visible");
        addEventAnalytics("snooze_appear_url", this.d1);
        addEventAnalytics("snooze_window_launch_mode", i == 1 ? CBConstant.STR_SNOOZE_MODE_WARN : CBConstant.STR_SNOOZE_MODE_FAIL);
        addEventAnalytics("snooze_window_appear_time", PostingDraft.NO_AD_ID);
        View inflate = this.G0.getLayoutInflater().inflate(h0.cb_layout_snooze, (ViewGroup) null);
        final TextView textView = (TextView) inflate.findViewById(g0.text_view_snooze_message);
        final TextView textView2 = (TextView) inflate.findViewById(g0.text_view_transaction_snoozed_message1);
        TextView textView3 = (TextView) inflate.findViewById(g0.button_cancel_transaction);
        final Button button = (Button) inflate.findViewById(g0.button_snooze_transaction);
        Button button2 = (Button) inflate.findViewById(g0.button_retry_transaction);
        TextView textView4 = (TextView) inflate.findViewById(g0.text_view_cancel_snooze_window);
        final TextView textView5 = (TextView) inflate.findViewById(g0.t_confirm);
        final TextView textView6 = (TextView) inflate.findViewById(g0.t_nconfirm);
        final TextView textView7 = (TextView) inflate.findViewById(g0.snooze_header_txt);
        TextView textView8 = (TextView) inflate.findViewById(g0.text_view_retry_message_detail);
        Button button3 = (Button) inflate.findViewById(g0.button_retry_anyway);
        SnoozeLoaderView snoozeLoaderView = (SnoozeLoaderView) inflate.findViewById(g0.snooze_loader_view);
        this.m2 = 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.G0.getString(i0.cb_slownetwork_status));
        textView7.setText(this.G0.getString(i0.cb_try_later));
        textView8.setText(this.G0.getString(i0.cb_retry_restart));
        if (this.backwardJourneyStarted && this.u1) {
            textView.setText(this.G0.getResources().getString(i0.cb_slow_internet_confirmation));
            textView2.setText(this.G0.getResources().getString(i0.cb_receive_sms));
            textView7.setText(this.G0.getResources().getString(i0.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", "Y");
        } else {
            this.snoozeVisibleCountFwdJourney++;
        }
        textView5.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                Bank.this.z6(textView7, textView, button, textView2, textView5, textView6, view);
            }
        });
        textView6.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                Bank.this.b(view);
            }
        });
        textView4.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                Bank.this.J6(view);
            }
        });
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                Bank.this.O6(view);
            }
        });
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                Bank.this.R6(view);
            }
        });
        androidx.appcompat.app.c cVar = this.O0;
        if (cVar == null || !cVar.isShowing()) {
            androidx.appcompat.app.c create = new c.a(this.G0).create();
            this.O0 = create;
            create.h(inflate);
            this.O0.setCanceledOnTouchOutside(false);
            this.O0.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public final void onDismiss(DialogInterface dialogInterface) {
                    Bank.this.v6(dialogInterface);
                }
            });
            this.O0.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public final boolean onKey(DialogInterface dialogInterface, int i3, KeyEvent keyEvent) {
                    boolean A6;
                    A6 = Bank.this.A6(dialogInterface, i3, keyEvent);
                    return A6;
                }
            });
        }
        this.O0.show();
    }

    @JavascriptInterface
    public void onCancel(final String str) {
        Activity activity = this.G0;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.G0.runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                Bank.this.K6(str);
            }
        });
    }

    @JavascriptInterface
    public void onSuccess(String str) {
        this.i1 = Boolean.TRUE;
        this.h1 = str;
        n5();
    }

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

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

    @Override
    public void reloadWebView() {
        if (this.R0) {
            dismissSnoozeWindow();
        }
        this.isWebviewReloading = true;
        if (this.isSnoozeEnabled) {
            W6();
        }
        if (this.V0.getUrl() != null) {
            Q6(true);
            reloadWVNative();
        }
    }

    @Override
    public void reloadWebView(String str) {
        if (this.R0) {
            dismissSnoozeWindow();
        }
        this.isWebviewReloading = true;
        if (this.isSnoozeEnabled) {
            W6();
        }
        if (this.V0.getUrl() != null) {
            Q6(true);
            reloadWVUsingJS();
        } else {
            reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
        }
    }
}