导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - Bank.java 源代码

正在查看: Clash Legends v0.0.1 应用的 Bank.java JAVA 源代码文件

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


package com.payu.custombrowser;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.http.SslError;
import android.os.CountDownTimer;
import android.os.Handler;
import android.text.Editable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.StyleSpan;
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.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.onesignal.core.internal.database.impl.OneSignalDbContract;
import com.onesignal.notifications.internal.bundle.impl.NotificationBundleProcessor;
import com.payu.custombrowser.bean.CustomBrowserConfig;
import com.payu.custombrowser.services.SnoozeService;
import com.payu.custombrowser.widgets.SnoozeLoaderView;
import com.payu.india.Payu.PayuConstants;
import in.juspay.godel.core.Constants;
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import javax.net.ssl.HttpsURLConnection;
import kotlinx.coroutines.scheduling.WorkQueueKt;
import org.json.JSONException;
import org.json.JSONObject;

public class Bank extends com.payu.custombrowser.b {
    static String T0 = null;
    static String U0 = null;
    static String V0 = null;
    public static String keyAnalytics;
    private boolean E0;
    private CountDownTimer G0;
    private CountDownTimer H0;
    private boolean J0;
    private AlertDialog O0;
    private boolean R0;
    private String S0;
    public long snoozeClickedTime;
    Runnable v0;
    private SnoozeLoaderView z0;
    private static List<String> W0 = new ArrayList();
    public static String Version = "7.8.0";
    private CountDownTimer w0 = null;
    private boolean x0 = false;
    private boolean y0 = false;
    private boolean A0 = true;
    private boolean B0 = false;
    private boolean D0 = true;
    private boolean I0 = true;
    private boolean K0 = false;
    private boolean L0 = false;
    private boolean M0 = false;
    private boolean N0 = false;
    private boolean P0 = true;
    private boolean Q0 = false;
    private i0 C0 = new i0();
    private boolean F0 = false;

    class a implements Runnable {
        a() {
        }

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

    class a0 implements DialogInterface.OnClickListener {
        a0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            Bank.this.postToPaytxn();
            androidx.appcompat.app.AlertDialog alertDialog = Bank.this.g;
            if (alertDialog != null && alertDialog.isShowing()) {
                Bank.this.g.cancel();
            }
            Bank.this.killSnoozeService();
            Bank.this.cancelTransactionNotification();
            Bank.this.a("user_input", "back_button_ok");
            Bank.this.dismissSnoozeWindow();
            com.payu.custombrowser.bean.b bVar = com.payu.custombrowser.bean.b.SINGLETON;
            if (bVar.getPayuCustomBrowserCallback() != null) {
                bVar.getPayuCustomBrowserCallback().onBackApprove();
            }
            Bank.this.b.finish();
        }
    }

    class b implements Runnable {
        b() {
        }

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

    class b0 implements DialogInterface.OnClickListener {
        b0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            Bank.this.a("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();
            }
        }
    }

    class c implements Runnable {
        c() {
        }

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

    class c0 implements Runnable {
        c0() {
        }

        @Override
        public void run() {
            Bank bank = Bank.this;
            if (bank.D) {
                return;
            }
            bank.hideReviewOrderHorizontalBar();
            Bank.this.hideReviewOrderDetails();
        }
    }

    class d implements Runnable {
        d() {
        }

        @Override
        public void run() {
            Bank bank = Bank.this;
            View view = bank.I;
            if (view != null) {
                bank.o0.b(view.findViewById(R.id.progress));
            }
        }
    }

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

        d0(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.f == 0) {
                    ((InputMethodManager) bank.b.getSystemService("input_method")).toggleSoftInput(3, 0);
                    Bank.this.f = 1;
                }
            }
        }
    }

    class e implements Runnable {
        final String a;

        class a implements Runnable {
            a() {
            }

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

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

        @Override
        public void run() {
            Bank bank;
            Bank bank2;
            Bank.this.B0 = true;
            try {
                try {
                    Bank bank3 = Bank.this;
                    if (bank3.b != null) {
                        String string = bank3.c.getString(this.a);
                        if (!new File(Bank.this.b.getFilesDir(), string).exists()) {
                            HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(Bank.this.a + string + ".js").openConnection();
                            httpsURLConnection.setRequestMethod(PayuConstants.REQUEST_METHOD_GET);
                            httpsURLConnection.setSSLSocketFactory(new com.payu.custombrowser.util.h());
                            httpsURLConnection.setRequestProperty("Accept-Charset", "UTF-8");
                            if (httpsURLConnection.getResponseCode() == 200) {
                                Bank.this.H.a(httpsURLConnection.getInputStream(), Bank.this.b, string, 0);
                            }
                        }
                    }
                    bank2 = Bank.this;
                } catch (Exception e) {
                    Bank bank4 = Bank.this;
                    if (bank4.b == null) {
                        return;
                    }
                    Bank.this.d = new JSONObject(com.payu.custombrowser.util.c.a(Bank.this.b.openFileInput(bank4.c.getString(this.a))));
                    Activity activity = Bank.this.b;
                    if (activity != null && !activity.isFinishing()) {
                        Bank.this.b.runOnUiThread(new a());
                    }
                    bank = Bank.this;
                } catch (Throwable th) {
                    try {
                        Bank bank5 = Bank.this;
                        if (bank5.b != null) {
                            Bank.this.d = new JSONObject(com.payu.custombrowser.util.c.a(Bank.this.b.openFileInput(bank5.c.getString(this.a))));
                            Activity activity2 = Bank.this.b;
                            if (activity2 != null && !activity2.isFinishing()) {
                                Bank.this.b.runOnUiThread(new a());
                            }
                            Bank.this.B0 = false;
                        }
                    } catch (FileNotFoundException e2) {
                    } catch (JSONException e3) {
                    } catch (Exception e4) {
                    }
                    throw th;
                }
                if (bank2.b != null) {
                    Bank.this.d = new JSONObject(com.payu.custombrowser.util.c.a(Bank.this.b.openFileInput(bank2.c.getString(this.a))));
                    Activity activity3 = Bank.this.b;
                    if (activity3 != null && !activity3.isFinishing()) {
                        Bank.this.b.runOnUiThread(new a());
                    }
                    bank = Bank.this;
                    bank.B0 = false;
                }
            } catch (FileNotFoundException e5) {
            } catch (JSONException e6) {
            } catch (Exception e7) {
            }
        }
    }

    class e0 implements Runnable {
        e0() {
        }

        @Override
        public void run() {
            Bank bank;
            boolean z;
            if (Bank.this.y0 || Bank.this.K0 || !(z = (bank = Bank.this).j) || bank.backwardJourneyStarted) {
                return;
            }
            if (z) {
                bank.a("snooze_window_automatically_disappear_time", "-1");
            }
            Bank.this.dismissSnoozeWindow();
        }
    }

    class f implements Runnable {
        final boolean a;

        f(boolean z) {
            this.a = z;
        }

        @Override
        public void run() {
            Bank bank = Bank.this;
            boolean z = this.a;
            bank.isOTPFilled = z;
            if (z) {
                bank.otp = null;
                if (bank.otpTriggered) {
                    bank.otpTriggered = false;
                    String optString = bank.c.optString(bank.getString(R.string.cb_catchAll_success_msg));
                    if (Bank.this.R0) {
                        Bank.this.S0 = optString;
                    } else {
                        if (optString == null || optString.isEmpty()) {
                            return;
                        }
                        Toast.makeText(Bank.this.b.getApplicationContext(), optString, 0).show();
                    }
                }
            }
        }
    }

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

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

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

    class g implements Runnable {
        final boolean a;

        g(boolean z) {
            this.a = z;
        }

        @Override
        public void run() {
            Bank bank = Bank.this;
            bank.catchAllJSEnabled = this.a;
            bank.fillOTPOnBankPage(true);
        }
    }

    class g0 implements Runnable {
        g0() {
        }

        @Override
        public void run() {
            try {
                Bank bank = Bank.this;
                if (bank.H.c(bank.b.getApplicationContext(), Bank.this.y) != null) {
                    Bank bank2 = Bank.this;
                    if (bank2.H.c(bank2.b.getApplicationContext(), Bank.this.y).equals("")) {
                        return;
                    }
                    WebView webView = Bank.this.n;
                    StringBuilder append = new StringBuilder().append("javascript:");
                    Bank bank3 = Bank.this;
                    StringBuilder append2 = append.append(bank3.d.getString(bank3.getString(R.string.cb_populate_user_id))).append("(\"");
                    Bank bank4 = Bank.this;
                    webView.loadUrl(append2.append(bank4.H.c(bank4.b.getApplicationContext(), Bank.this.y)).append("\")").toString());
                }
            } catch (Exception e) {
            }
        }
    }

    class h implements Runnable {
        h() {
        }

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

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

        class a implements View.OnClickListener {
            final CheckBox a;

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

            @Override
            public void onClick(View view) {
                Bank.this.D0 = this.a.isChecked();
                if (Bank.this.D0) {
                    Bank.this.a("user_input", com.payu.custombrowser.util.a.d + "y");
                } else {
                    Bank.this.a("user_input", com.payu.custombrowser.util.a.d + NotificationBundleProcessor.PUSH_MINIFIED_BUTTON_TEXT);
                }
            }
        }

        class b implements View.OnClickListener {
            final Button a;

            b(Button button) {
                this.a = button;
            }

            @Override
            public void onClick(View view) {
                try {
                    Bank.this.a("user_input", com.payu.custombrowser.util.a.c + ((Object) this.a.getText()));
                    WebView webView = Bank.this.n;
                    StringBuilder append = new StringBuilder().append("javascript:");
                    Bank bank = Bank.this;
                    webView.loadUrl(append.append(bank.d.getString(bank.getString(R.string.cb_btn_action))).toString());
                } catch (Exception e) {
                }
            }
        }

        class c implements View.OnClickListener {
            final CheckBox a;

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

            @Override
            public void onClick(View view) {
                Bank.this.F0 = this.a.isChecked();
                try {
                    if (this.a.isChecked()) {
                        WebView webView = Bank.this.n;
                        StringBuilder append = new StringBuilder().append("javascript:");
                        Bank bank = Bank.this;
                        webView.loadUrl(append.append(bank.d.getString(bank.getString(R.string.cb_toggle_field))).append("(\"").append(true).append("\")").toString());
                    } else {
                        WebView webView2 = Bank.this.n;
                        StringBuilder append2 = new StringBuilder().append("javascript:");
                        Bank bank2 = Bank.this;
                        webView2.loadUrl(append2.append(bank2.d.getString(bank2.getString(R.string.cb_toggle_field))).append("(\"").append(false).append("\")").toString());
                    }
                } catch (Exception e) {
                }
            }
        }

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

            @Override
            public void onClick(View view) {
                try {
                    WebView webView = Bank.this.n;
                    StringBuilder append = new StringBuilder().append("javascript:");
                    Bank bank = Bank.this;
                    webView.loadUrl(append.append(bank.d.getString(bank.getString(R.string.cb_btn_action))).toString());
                } catch (Exception e) {
                }
            }
        }

        h0(String str, String str2) {
            this.a = str;
            this.b = str2;
        }

        @Override
        public void run() {
            try {
                Bank.this.dismissReviewOrder();
                Bank bank = Bank.this;
                if (bank.j) {
                    bank.dismissSnoozeWindow();
                    Bank.this.a("snooze_window_action", "snooze_window_dismissed_by_cb");
                    Bank.this.a("snooze_window_automatically_disappear_time", "-1");
                }
                Bank bank2 = Bank.this;
                bank2.pageType = "NBLogin Page";
                bank2.a("arrival", "-1");
                Bank.this.onHelpAvailable();
                Bank.this.a("cb_status", com.payu.custombrowser.util.a.b);
                if (this.a != null) {
                    Bank bank3 = Bank.this;
                    if (bank3.b != null) {
                        bank3.dismissSnoozeWindow();
                        View inflate = Bank.this.b.getLayoutInflater().inflate(R.layout.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(this.b);
                        String string = Bank.this.getString(R.string.cb_btn_text);
                        if (!jSONObject.has(string) || jSONObject.getString(string) == null || jSONObject.getString(string).equalsIgnoreCase("")) {
                            Bank.this.onHelpUnavailable();
                            Bank.this.E.removeAllViews();
                            return;
                        }
                        if (this.a.equals(Bank.this.getString(R.string.cb_button))) {
                            if (!jSONObject.has(Bank.this.getString(R.string.cb_checkbox))) {
                                checkBox.setVisibility(8);
                            } else if (jSONObject.getBoolean(Bank.this.getString(R.string.cb_checkbox))) {
                                if (Bank.this.D0) {
                                    Bank.this.a(com.payu.custombrowser.util.a.e, "y");
                                    checkBox.setChecked(true);
                                } else {
                                    Bank.this.a(com.payu.custombrowser.util.a.e, NotificationBundleProcessor.PUSH_MINIFIED_BUTTON_TEXT);
                                    checkBox.setChecked(false);
                                }
                                checkBox.setOnClickListener(new a(checkBox));
                                checkBox.setVisibility(0);
                            } else {
                                checkBox.setVisibility(8);
                            }
                            button.setText(jSONObject.getString(string));
                            button.setTransformationMethod(null);
                            button.setOnClickListener(new b(button));
                            Bank.this.E.removeAllViews();
                            Bank.this.E.addView(inflate);
                            Bank.this.l = true;
                            return;
                        }
                        if (this.a.equals(Bank.this.getString(R.string.cb_pwd_btn))) {
                            button.setText(jSONObject.getString(string));
                            if (Bank.this.F0) {
                                checkBox.setChecked(true);
                            } else {
                                checkBox.setChecked(false);
                            }
                            if (checkBox.isChecked()) {
                                try {
                                    WebView webView = Bank.this.n;
                                    StringBuilder append = new StringBuilder().append("javascript:");
                                    Bank bank4 = Bank.this;
                                    webView.loadUrl(append.append(bank4.d.getString(bank4.getString(R.string.cb_toggle_field))).append("(\"").append(true).append("\")").toString());
                                } catch (Exception e) {
                                }
                            }
                            checkBox.setText(Bank.this.getString(R.string.cb_show_password));
                            checkBox.setVisibility(0);
                            checkBox.setOnClickListener(new c(checkBox));
                            button.setOnClickListener(new d());
                            Bank bank5 = Bank.this;
                            bank5.l = true;
                            bank5.E.removeAllViews();
                            Bank.this.E.addView(inflate);
                        }
                    }
                }
            } catch (Exception e2) {
            }
        }
    }

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

        class a implements View.OnClickListener {
            final JSONObject a;

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

                @Override
                public void onClick(View view) {
                    try {
                        Bank bank = Bank.this;
                        bank.i = "password_click";
                        bank.a("user_input", "password_click");
                        WebView webView = Bank.this.n;
                        StringBuilder append = new StringBuilder().append("javascript:");
                        Bank bank2 = Bank.this;
                        webView.loadUrl(append.append(bank2.d.getString(bank2.getString(R.string.cb_pin))).toString());
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            }

            a(JSONObject jSONObject) {
                this.a = jSONObject;
            }

            @Override
            public void onClick(View view) {
                Bank bank = Bank.this;
                bank.b0 = true;
                bank.g0 = Boolean.TRUE;
                bank.g();
                Bank bank2 = Bank.this;
                bank2.u = 1;
                View view2 = bank2.G;
                if (view2 != null) {
                    view2.setVisibility(8);
                }
                try {
                    if (this.a.has(Bank.this.getString(R.string.cb_register)) && this.a.getBoolean(Bank.this.getString(R.string.cb_register))) {
                        view = Bank.this.b.getLayoutInflater().inflate(R.layout.register_pin, (ViewGroup) null);
                        Bank.this.E.removeAllViews();
                        Bank.this.E.addView(view);
                        if (Bank.this.E.isShown()) {
                            Bank.this.u = 2;
                        }
                        view.findViewById(R.id.pin).setOnClickListener(new ViewOnClickListenerC0007a());
                        if (this.a.has(Bank.this.getString(R.string.cb_otp)) && !this.a.getBoolean(Bank.this.getString(R.string.cb_otp))) {
                            view.findViewById(R.id.otp).setVisibility(8);
                        }
                        view.findViewById(R.id.otp).setOnClickListener(Bank.this.C0);
                    } else {
                        Bank bank3 = Bank.this;
                        bank3.i = "password_click";
                        bank3.a("user_input", "password_click");
                        Bank.this.onHelpUnavailable();
                        WebView webView = Bank.this.n;
                        StringBuilder append = new StringBuilder().append("javascript:");
                        Bank bank4 = Bank.this;
                        webView.loadUrl(append.append(bank4.d.getString(bank4.getString(R.string.cb_pin))).toString());
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                Bank.this.updateHeight(view);
            }
        }

        i(String str, String str2) {
            this.a = str;
            this.b = str2;
        }

        @Override
        public void run() {
            Bank bank = Bank.this;
            View view = bank.I;
            if (view != null) {
                bank.o0.b(view.findViewById(R.id.progress));
            }
            Bank bank2 = Bank.this;
            View view2 = bank2.J;
            if (view2 != null) {
                bank2.o0.b(view2.findViewById(R.id.progress));
            }
            try {
                Bank bank3 = Bank.this;
                Timer timer = bank3.f0;
                if (timer != null && bank3.v0 != null) {
                    bank3.H.a(timer);
                }
                if (this.a.equals(Bank.this.getString(R.string.cb_error))) {
                    Bank.this.onBankError();
                } else if (this.a.equals("parse error")) {
                    Bank.this.onBankError();
                } else {
                    if (this.a.contentEquals(com.payu.custombrowser.util.b.LOADING)) {
                        Bank bank4 = Bank.this;
                        if (!bank4.b0 && bank4.h0) {
                            bank4.onHelpAvailable();
                            View view3 = Bank.this.G;
                            if (view3 != null) {
                                view3.setVisibility(0);
                            }
                            Bank bank5 = Bank.this;
                            if (bank5.I == null) {
                                bank5.I = bank5.b.getLayoutInflater().inflate(R.layout.cb_loading, (ViewGroup) null);
                            }
                            ImageView imageView = (ImageView) Bank.this.I.findViewById(R.id.bank_logo);
                            imageView.setOnClickListener(Bank.this.viewOnClickListener);
                            Drawable drawable = Bank.this.m;
                            if (drawable != null) {
                                imageView.setImageDrawable(drawable);
                            }
                            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, Bank.this.c0);
                            View findViewById = Bank.this.I.findViewById(R.id.loading);
                            findViewById.setLayoutParams(layoutParams);
                            findViewById.requestLayout();
                            findViewById.invalidate();
                            Bank bank6 = Bank.this;
                            bank6.o0.c(bank6.I.findViewById(R.id.progress));
                            Bank.this.E.removeAllViews();
                            Bank bank7 = Bank.this;
                            bank7.E.addView(bank7.I);
                            if (Bank.this.E.isShown()) {
                                Bank.this.u = 2;
                            } else {
                                Bank.this.g();
                            }
                            Bank bank8 = Bank.this;
                            bank8.updateHeight(bank8.I);
                            Bank bank9 = Bank.this;
                            bank9.addReviewOrder(bank9.I);
                        }
                    }
                    boolean z = true;
                    if (this.a.equals(Bank.this.getString(R.string.cb_choose))) {
                        Bank.this.q();
                        Bank bank10 = Bank.this;
                        bank10.u = 2;
                        bank10.h0 = true;
                        View view4 = bank10.G;
                        if (view4 != null) {
                            view4.setVisibility(0);
                        }
                        View inflate = Bank.this.b.getLayoutInflater().inflate(R.layout.choose_action, (ViewGroup) null);
                        Bank.this.addReviewOrder(inflate);
                        Bank bank11 = Bank.this;
                        if (bank11.q == 0) {
                            bank11.a();
                            Bank.this.g();
                        }
                        Bank.this.E.setVisibility(0);
                        View view5 = Bank.this.F;
                        if (view5 != null) {
                            view5.setVisibility(8);
                        }
                        Bank.this.a(inflate);
                        Bank.this.onHelpAvailable();
                        inflate.measure(-2, -2);
                        Bank.this.c0 = inflate.getMeasuredHeight();
                        ImageView imageView2 = (ImageView) inflate.findViewById(R.id.bank_logo);
                        imageView2.setOnClickListener(Bank.this.viewOnClickListener);
                        Drawable drawable2 = Bank.this.m;
                        if (drawable2 != null) {
                            imageView2.setImageDrawable(drawable2);
                        }
                        Bank.this.E.removeAllViews();
                        Bank.this.E.addView(inflate);
                        if (Bank.this.E.isShown()) {
                            Bank.this.u = 2;
                        }
                        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder("Select an option for Faster payment");
                        spannableStringBuilder.setSpan(new StyleSpan(1), 21, 27, 33);
                        ((TextView) inflate.findViewById(R.id.choose_text)).setText(spannableStringBuilder);
                        try {
                            JSONObject jSONObject = new JSONObject(this.b);
                            if ((jSONObject.has(Bank.this.getString(R.string.cb_otp)) && jSONObject.getBoolean(Bank.this.getString(R.string.cb_otp))) || (jSONObject.has(Bank.this.getString(R.string.cb_pin)) && jSONObject.getBoolean(Bank.this.getString(R.string.cb_pin)))) {
                                Bank.this.pageType = "Choose Screen";
                            } else {
                                Bank.this.pageType = "";
                            }
                            if (!jSONObject.has(Bank.this.getString(R.string.cb_otp)) || jSONObject.getBoolean(Bank.this.getString(R.string.cb_otp))) {
                                inflate.findViewById(R.id.otp).setOnClickListener(Bank.this.C0);
                                Bank bank12 = Bank.this;
                                if (bank12.autoSelectOtp) {
                                    bank12.i = "auto_otp_select";
                                    bank12.a("user_input", "auto_otp_select");
                                    inflate.findViewById(R.id.otp).performClick();
                                    Bank.this.autoSelectOtp = false;
                                }
                            } else {
                                inflate.findViewById(R.id.otp).setVisibility(8);
                                inflate.findViewById(R.id.view).setVisibility(8);
                            }
                            inflate.findViewById(R.id.otp).setOnClickListener(Bank.this.C0);
                            if (!jSONObject.has(Bank.this.getString(R.string.cb_pin)) || jSONObject.getBoolean(Bank.this.getString(R.string.cb_pin))) {
                                inflate.findViewById(R.id.pin).setOnClickListener(new a(jSONObject));
                            } else {
                                inflate.findViewById(R.id.pin).setVisibility(8);
                                inflate.findViewById(R.id.view).setVisibility(8);
                            }
                            if (jSONObject.has(Bank.this.getString(R.string.cb_error))) {
                                inflate.findViewById(R.id.error_message).setVisibility(0);
                                ((TextView) inflate.findViewById(R.id.error_message)).setText(jSONObject.getString("error"));
                            }
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    } else if (this.a.equals(Bank.this.getString(R.string.cb_incorrect_OTP_2))) {
                        Bank bank13 = Bank.this;
                        bank13.pageType = this.a;
                        bank13.q();
                        Bank bank14 = Bank.this;
                        bank14.h0 = true;
                        bank14.onHelpAvailable();
                        View inflate2 = Bank.this.b.getLayoutInflater().inflate(R.layout.retry_otp, (ViewGroup) null);
                        Bank.this.addReviewOrder(inflate2);
                        ImageView imageView3 = (ImageView) inflate2.findViewById(R.id.bank_logo);
                        imageView3.setOnClickListener(Bank.this.viewOnClickListener);
                        Drawable drawable3 = Bank.this.m;
                        if (drawable3 != null) {
                            imageView3.setImageDrawable(drawable3);
                        }
                        Bank.this.E.removeAllViews();
                        Bank.this.E.addView(inflate2);
                        if (Bank.this.E.isShown()) {
                            Bank.this.u = 2;
                        } else {
                            View view6 = Bank.this.F;
                            if (view6 != null) {
                                view6.setVisibility(0);
                            }
                            Bank.this.g();
                        }
                        if (Bank.this.e0 == null) {
                            inflate2.findViewById(R.id.regenerate_layout).setVisibility(0);
                            inflate2.findViewById(R.id.Regenerate_layout_gone).setVisibility(8);
                            try {
                                JSONObject jSONObject2 = new JSONObject(this.b);
                                if (!jSONObject2.has(Bank.this.getString(R.string.cb_pin)) || !jSONObject2.getBoolean(Bank.this.getString(R.string.cb_pin))) {
                                    z = false;
                                }
                                inflate2.findViewById(R.id.enter_manually).setOnClickListener(Bank.this.C0);
                                if (z) {
                                    inflate2.findViewById(R.id.pin_layout_gone).setVisibility(0);
                                } else {
                                    inflate2.findViewById(R.id.pin_layout_gone).setVisibility(8);
                                }
                                inflate2.findViewById(R.id.pin).setOnClickListener(Bank.this.C0);
                            } catch (Exception e2) {
                            }
                        }
                        Bank.this.updateHeight(inflate2);
                    } else if (this.a.equals(Bank.this.getString(R.string.cb_retry_otp))) {
                        Bank bank15 = Bank.this;
                        bank15.pageType = this.a;
                        bank15.q();
                        Bank bank16 = Bank.this;
                        bank16.h0 = true;
                        bank16.onHelpAvailable();
                        Bank.this.f();
                        View view7 = Bank.this.G;
                        if (view7 != null) {
                            view7.setVisibility(0);
                        }
                        View inflate3 = Bank.this.b.getLayoutInflater().inflate(R.layout.retry_otp, (ViewGroup) null);
                        Bank.this.addReviewOrder(inflate3);
                        ImageView imageView4 = (ImageView) inflate3.findViewById(R.id.bank_logo);
                        imageView4.setOnClickListener(Bank.this.viewOnClickListener);
                        Drawable drawable4 = Bank.this.m;
                        if (drawable4 != null) {
                            imageView4.setImageDrawable(drawable4);
                        }
                        Bank.this.E.removeAllViews();
                        Bank.this.E.addView(inflate3);
                        if (Bank.this.E.isShown()) {
                            Bank.this.u = 2;
                        } else {
                            View view8 = Bank.this.F;
                            if (view8 != null) {
                                view8.setVisibility(0);
                            }
                            Bank.this.g();
                        }
                        try {
                            if (Bank.this.e0 == null) {
                                JSONObject jSONObject3 = new JSONObject(this.b);
                                boolean z2 = jSONObject3.has(Bank.this.getString(R.string.cb_regenerate)) && jSONObject3.getBoolean(Bank.this.getString(R.string.cb_regenerate));
                                if (!jSONObject3.has(Bank.this.getString(R.string.cb_pin)) || !jSONObject3.getBoolean(Bank.this.getString(R.string.cb_pin))) {
                                    z = false;
                                }
                                inflate3.findViewById(R.id.regenerate_layout).setVisibility(0);
                                if (z2) {
                                    inflate3.findViewById(R.id.Regenerate_layout_gone).setVisibility(0);
                                    if (z) {
                                        inflate3.findViewById(R.id.Enter_manually_gone).setVisibility(8);
                                        inflate3.findViewById(R.id.pin_layout_gone).setVisibility(0);
                                    } else {
                                        inflate3.findViewById(R.id.Enter_manually_gone).setVisibility(0);
                                        inflate3.findViewById(R.id.pin_layout_gone).setVisibility(8);
                                    }
                                } else {
                                    if (z) {
                                        inflate3.findViewById(R.id.pin_layout_gone).setVisibility(0);
                                    } else {
                                        inflate3.findViewById(R.id.pin_layout_gone).setVisibility(8);
                                    }
                                    inflate3.findViewById(R.id.Regenerate_layout_gone).setVisibility(8);
                                    inflate3.findViewById(R.id.Enter_manually_gone).setVisibility(0);
                                }
                            }
                            inflate3.findViewById(R.id.pin).setOnClickListener(Bank.this.C0);
                            inflate3.findViewById(R.id.enter_manually).setOnClickListener(Bank.this.C0);
                            inflate3.findViewById(R.id.retry).setOnClickListener(Bank.this.C0);
                            Bank.this.C0.a(inflate3);
                            inflate3.findViewById(R.id.approve).setOnClickListener(Bank.this.C0);
                        } catch (Exception e3) {
                        }
                        Bank.this.updateHeight(inflate3);
                    } else if (this.a.equals(Bank.this.getString(R.string.cb_enter_pin))) {
                        Bank bank17 = Bank.this;
                        bank17.pageType = "PIN Page";
                        bank17.q();
                        View view9 = Bank.this.F;
                        if (view9 != null) {
                            view9.setVisibility(8);
                        }
                        Bank.this.onHelpUnavailable();
                        Bank bank18 = Bank.this;
                        bank18.b0 = true;
                        bank18.g0 = Boolean.TRUE;
                        bank18.g();
                        Bank bank19 = Bank.this;
                        bank19.u = 1;
                        View view10 = bank19.G;
                        if (view10 != null) {
                            view10.setVisibility(8);
                        }
                        Bank.this.g();
                        Bank.this.E.removeAllViews();
                    } else if (this.a.equals(Bank.this.getString(R.string.cb_enter_otp))) {
                        Bank bank20 = Bank.this;
                        bank20.pageType = this.a;
                        bank20.i0 = this.b;
                        if (!bank20.l0) {
                            bank20.q();
                            Bank.this.b(this.b);
                        }
                    } else if (this.a.equals(Bank.this.getString(R.string.cb_incorrect_pin))) {
                        Bank bank21 = Bank.this;
                        bank21.pageType = "Choose Screen";
                        bank21.q();
                        JSONObject jSONObject4 = new JSONObject(this.b);
                        if (jSONObject4.has(Bank.this.getString(R.string.cb_otp)) && jSONObject4.getBoolean(Bank.this.getString(R.string.cb_otp))) {
                            Bank bank22 = Bank.this;
                            bank22.h0 = true;
                            bank22.onHelpAvailable();
                            View inflate4 = Bank.this.b.getLayoutInflater().inflate(R.layout.choose_action, (ViewGroup) null);
                            Bank.this.addReviewOrder(inflate4);
                            ImageView imageView5 = (ImageView) inflate4.findViewById(R.id.bank_logo);
                            imageView5.setOnClickListener(Bank.this.viewOnClickListener);
                            Drawable drawable5 = Bank.this.m;
                            if (drawable5 != null) {
                                imageView5.setImageDrawable(drawable5);
                            }
                            TextView textView = (TextView) inflate4.findViewById(R.id.error_message);
                            textView.setVisibility(0);
                            textView.setText(Bank.this.b.getResources().getString(R.string.cb_incorrect_password));
                            TextView textView2 = (TextView) inflate4.findViewById(R.id.choose_text);
                            textView2.setVisibility(0);
                            textView2.setText(Bank.this.b.getResources().getString(R.string.cb_retry));
                            Bank.this.E.removeAllViews();
                            Bank.this.E.addView(inflate4);
                            inflate4.findViewById(R.id.otp).setOnClickListener(Bank.this.C0);
                            inflate4.findViewById(R.id.pin).setOnClickListener(Bank.this.C0);
                            Bank.this.updateHeight(inflate4);
                            if (Bank.this.E.isShown()) {
                                Bank.this.u = 2;
                            } else {
                                Bank.this.g();
                            }
                        }
                    } else if (this.a.equals(Bank.this.getString(R.string.cb_register_option))) {
                        Bank bank23 = Bank.this;
                        bank23.pageType = "Register Page";
                        bank23.q();
                        Bank.this.onHelpAvailable();
                        View inflate5 = Bank.this.b.getLayoutInflater().inflate(R.layout.register, (ViewGroup) null);
                        Bank.this.addReviewOrder(inflate5);
                        Bank.this.E.removeAllViews();
                        Bank.this.E.addView(inflate5);
                        ImageView imageView6 = (ImageView) inflate5.findViewById(R.id.bank_logo);
                        imageView6.setOnClickListener(Bank.this.viewOnClickListener);
                        Drawable drawable6 = Bank.this.m;
                        if (drawable6 != null) {
                            imageView6.setImageDrawable(drawable6);
                        }
                        Bank.this.updateHeight(inflate5);
                        if (Bank.this.E.isShown()) {
                            Bank.this.u = 2;
                        } else {
                            Bank.this.g();
                        }
                    } else {
                        Bank.this.g();
                        Bank bank24 = Bank.this;
                        bank24.u = 1;
                        View view11 = bank24.F;
                        if (view11 != null) {
                            view11.setVisibility(8);
                        }
                        Bank.this.onHelpUnavailable();
                    }
                }
            } catch (Exception e4) {
            }
            String str = Bank.this.pageType;
            if (str == null || str.equalsIgnoreCase("")) {
                return;
            }
            Bank.this.a("arrival", "-1");
        }
    }

    public class i0 implements View.OnClickListener {
        private View a;

        class a implements TextWatcher {
            final View a;
            final Button b;

            a(View view, Button button) {
                this.a = view;
                this.b = button;
            }

            @Override
            public void afterTextChanged(Editable editable) {
            }

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                if (((EditText) this.a.findViewById(R.id.otp_sms)).getText().toString().length() <= 5) {
                    this.b.setClickable(false);
                    com.payu.custombrowser.util.c.a(0.3f, this.b);
                    this.b.setOnClickListener(null);
                } else {
                    Bank.this.C0.a(this.a);
                    this.b.setOnClickListener(Bank.this.C0);
                    this.b.setClickable(true);
                    com.payu.custombrowser.util.c.a(1.0f, this.b);
                }
            }
        }

        public i0() {
        }

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

        @Override
        public void onClick(View view) {
            boolean z = view instanceof Button;
            switch (Bank.this.c((z ? ((Button) view).getText().toString() : view instanceof TextView ? ((TextView) view).getText().toString() : "").toLowerCase())) {
                case 0:
                    if (com.payu.custombrowser.a.DEBUG) {
                        Toast.makeText(Bank.this.b, "button text not matching any click listener option", 0).show();
                        break;
                    }
                    break;
                case 1:
                case 3:
                    Bank bank = Bank.this;
                    bank.b0 = true;
                    bank.g0 = Boolean.TRUE;
                    bank.g();
                    Bank bank2 = Bank.this;
                    bank2.u = 1;
                    bank2.onHelpUnavailable();
                    View view2 = Bank.this.F;
                    if (view2 != null) {
                        view2.setVisibility(8);
                    }
                    View view3 = Bank.this.G;
                    if (view3 != null) {
                        view3.setVisibility(8);
                    }
                    try {
                        WebView webView = Bank.this.n;
                        StringBuilder append = new StringBuilder().append("javascript:");
                        Bank bank3 = Bank.this;
                        webView.loadUrl(append.append(bank3.d.getString(bank3.getString(R.string.cb_pin))).toString());
                        Bank bank4 = Bank.this;
                        bank4.i = "password_click";
                        bank4.a("user_input", "password_click");
                        break;
                    } catch (JSONException e) {
                        e.printStackTrace();
                        return;
                    }
                case 2:
                    try {
                        Bank bank5 = Bank.this;
                        bank5.i = "regenerate_click";
                        bank5.a("user_input", "regenerate_click");
                        Bank bank6 = Bank.this;
                        bank6.e0 = null;
                        WebView webView2 = bank6.n;
                        StringBuilder append2 = new StringBuilder().append("javascript:");
                        Bank bank7 = Bank.this;
                        webView2.loadUrl(append2.append(bank7.d.getString(bank7.getString(R.string.cb_regen_otp))).toString());
                        Bank bank8 = Bank.this;
                        bank8.isListenerAttached = false;
                        bank8.j0 = true;
                        bank8.o();
                        break;
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                        return;
                    }
                case 4:
                    View inflate = Bank.this.b.getLayoutInflater().inflate(R.layout.wait_for_otp, (ViewGroup) null);
                    if (z) {
                        Bank.this.i = "enter_manually_click";
                    } else {
                        Bank.this.i = "enter_manually_ontimer_click";
                    }
                    Bank bank9 = Bank.this;
                    bank9.a("user_input", bank9.i);
                    if (Bank.this.c0 == 0) {
                        inflate.measure(-2, -2);
                        Bank.this.c0 = inflate.getMeasuredHeight();
                    }
                    Bank.this.E.removeAllViews();
                    Bank.this.E.addView(inflate);
                    if (Bank.this.E.isShown()) {
                        Bank.this.u = 2;
                    } else {
                        Bank.this.g();
                    }
                    ImageView imageView = (ImageView) inflate.findViewById(R.id.bank_logo);
                    imageView.setOnClickListener(Bank.this.viewOnClickListener);
                    Drawable drawable = Bank.this.m;
                    if (drawable != null) {
                        imageView.setImageDrawable(drawable);
                    }
                    inflate.findViewById(R.id.waiting).setVisibility(8);
                    Button button = (Button) inflate.findViewById(R.id.approve);
                    button.setClickable(false);
                    EditText editText = (EditText) inflate.findViewById(R.id.otp_sms);
                    if (Bank.this.P0) {
                        editText.setInputType(2);
                    } else {
                        editText.setInputType(1);
                    }
                    Bank.this.b(editText);
                    com.payu.custombrowser.util.c.a(0.3f, button);
                    button.setVisibility(0);
                    editText.setVisibility(0);
                    inflate.findViewById(R.id.regenerate_layout).setVisibility(8);
                    inflate.findViewById(R.id.progress).setVisibility(4);
                    Bank.this.b(editText);
                    editText.addTextChangedListener(new a(inflate, button));
                    Bank.this.updateHeight(inflate);
                    Bank.this.addReviewOrder(inflate);
                    break;
                case 5:
                    try {
                        Bank.this.e();
                        Bank bank10 = Bank.this;
                        bank10.e0 = null;
                        bank10.h0 = false;
                        bank10.g0 = Boolean.TRUE;
                        bank10.onHelpUnavailable();
                        Bank.this.g();
                        Bank bank11 = Bank.this;
                        bank11.u = 1;
                        bank11.o();
                        if (((EditText) this.a.findViewById(R.id.otp_sms)).getText().toString().length() > 5) {
                            Bank bank12 = Bank.this;
                            bank12.i = "approved_otp";
                            bank12.a("user_input", "approved_otp");
                            Bank.this.a("Approve_btn_clicked_time", "-1");
                            WebView webView3 = Bank.this.n;
                            StringBuilder append3 = new StringBuilder().append("javascript:");
                            Bank bank13 = Bank.this;
                            webView3.loadUrl(append3.append(bank13.d.getString(bank13.getString(R.string.cb_process_otp))).append("(\"").append(((TextView) this.a.findViewById(R.id.otp_sms)).getText().toString()).append("\")").toString());
                            ((EditText) this.a.findViewById(R.id.otp_sms)).setText("");
                            break;
                        }
                    } catch (JSONException e3) {
                        e3.printStackTrace();
                        return;
                    }
                    break;
                case 6:
                case 7:
                    Bank bank14 = Bank.this;
                    bank14.n0 = true;
                    bank14.r();
                    Bank bank15 = Bank.this;
                    bank15.i = "otp_click";
                    bank15.a("user_input", "otp_click");
                    break;
            }
        }
    }

    class j implements Runnable {
        final String a;

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

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

    class k implements Runnable {
        final boolean a;

        k(boolean z) {
            this.a = z;
        }

        @Override
        public void run() {
            if (this.a) {
                return;
            }
            Bank.this.g();
            Bank bank = Bank.this;
            bank.u = 1;
            try {
                View view = bank.F;
                if (view != null) {
                    view.setVisibility(8);
                }
                Bank.this.onHelpUnavailable();
            } catch (Exception e) {
            }
        }
    }

    class l implements TextWatcher {
        final EditText a;
        final Button b;

        l(EditText editText, Button button) {
            this.a = editText;
            this.b = button;
        }

        @Override
        public void afterTextChanged(Editable editable) {
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (this.a.getText().toString().length() <= 5) {
                this.b.setClickable(false);
                com.payu.custombrowser.util.c.a(1.0f, this.b);
                this.b.setOnClickListener(null);
            } else {
                Bank.this.C0.a(Bank.this.J);
                this.b.setOnClickListener(Bank.this.C0);
                this.b.setClickable(true);
                com.payu.custombrowser.util.c.a(1.0f, this.b);
            }
        }
    }

    class m extends TimerTask {
        m() {
        }

        @Override
        public synchronized void run() {
            Activity activity = Bank.this.b;
            if (activity != null && !activity.isFinishing()) {
                Bank bank = Bank.this;
                bank.b.runOnUiThread(bank.v0);
            }
        }
    }

    class n implements TextWatcher {
        final EditText a;
        final Button b;

        n(EditText editText, Button button) {
            this.a = editText;
            this.b = button;
        }

        @Override
        public void afterTextChanged(Editable editable) {
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            if (this.a.getText().toString().length() <= 5) {
                this.b.setClickable(false);
                com.payu.custombrowser.util.c.a(0.3f, this.b);
                this.b.setOnClickListener(null);
            } else {
                Bank.this.C0.a(Bank.this.J);
                this.b.setOnClickListener(Bank.this.C0);
                this.b.setClickable(true);
                com.payu.custombrowser.util.c.a(1.0f, this.b);
            }
        }
    }

    class o implements Runnable {
        int a;
        final int b;
        final TextView c;
        final String d;
        final View e;
        final View f;
        final View g;
        final View h;
        final View i;
        final View j;
        final View k;
        final View l;
        final Button m;
        final View n;
        final EditText o;
        final View p;
        final View q;

        o(int i, TextView textView, String str, View view, View view2, View view3, View view4, View view5, View view6, View view7, View view8, Button button, View view9, EditText editText, View view10, View view11) {
            this.b = i;
            this.c = textView;
            this.d = str;
            this.e = view;
            this.f = view2;
            this.g = view3;
            this.h = view4;
            this.i = view5;
            this.j = view6;
            this.k = view7;
            this.l = view8;
            this.m = button;
            this.n = view9;
            this.o = editText;
            this.p = view10;
            this.q = view11;
            this.a = i;
        }

        @Override
        public void run() {
            String str;
            boolean z = true;
            try {
                if (this.a != 0) {
                    if (this.o.hasFocus() || !this.o.getText().toString().matches("")) {
                        return;
                    }
                    Bank.this.Q0 = false;
                    JSONObject jSONObject = new JSONObject(this.d);
                    boolean z2 = jSONObject.has(Bank.this.getString(R.string.cb_regenerate)) && jSONObject.getBoolean(Bank.this.getString(R.string.cb_regenerate));
                    if (jSONObject.has(Bank.this.getString(R.string.cb_pin))) {
                        jSONObject.getBoolean(Bank.this.getString(R.string.cb_pin));
                    }
                    if (this.a == this.b && z2) {
                        this.c.setVisibility(0);
                    }
                    if (Bank.this.j0) {
                        this.c.setVisibility(0);
                        str = this.a + "";
                    } else {
                        str = this.a != 1 ? this.a + "  secs remaining to regenerate OTP\n" : this.a + " sec remaining to regenerate OTP\n";
                    }
                    this.c.setText(str);
                    this.a--;
                    return;
                }
                if (Bank.this.Q0) {
                    return;
                }
                Bank bank = Bank.this;
                if (bank.b == null || !bank.J.isShown() || Bank.this.b.findViewById(R.id.otp_sms) == null) {
                    return;
                }
                Bank.this.Q0 = true;
                this.c.setVisibility(8);
                JSONObject jSONObject2 = new JSONObject(this.d);
                boolean z3 = jSONObject2.has(Bank.this.getString(R.string.cb_regenerate)) && jSONObject2.getBoolean(Bank.this.getString(R.string.cb_regenerate));
                if (!jSONObject2.has(Bank.this.getString(R.string.cb_pin)) || !jSONObject2.getBoolean(Bank.this.getString(R.string.cb_pin))) {
                    z = false;
                }
                this.e.setVisibility(8);
                if (z3) {
                    this.f.setVisibility(0);
                    this.g.setVisibility(8);
                    this.h.setVisibility(0);
                } else {
                    if (z) {
                        this.g.setVisibility(0);
                    } else {
                        this.g.setVisibility(8);
                    }
                    this.f.setVisibility(8);
                    this.h.setVisibility(0);
                }
                this.i.setVisibility(8);
                this.j.setVisibility(0);
                this.k.setVisibility(0);
                this.l.setVisibility(0);
                this.m.setVisibility(8);
                this.n.setVisibility(8);
                this.o.setVisibility(8);
                this.p.setOnClickListener(Bank.this.C0);
                this.q.setOnClickListener(Bank.this.C0);
                this.j.setOnClickListener(Bank.this.C0);
                Bank bank2 = Bank.this;
                bank2.updateHeight(bank2.J);
            } catch (Exception e) {
            }
        }
    }

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

        @Override
        public void onFinish() {
            Bank.this.x0 = false;
            int progress = Bank.this.n.getProgress();
            Bank bank = Bank.this;
            if (progress < bank.snoozeUrlLoadingPercentage && !bank.j && bank.I0 && !Bank.this.getTransactionStatusReceived()) {
                Bank.this.launchSnoozeWindow();
            }
            Bank.this.w();
        }

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

    class q implements View.OnClickListener {
        final TextView a;
        final TextView b;
        final Button c;
        final TextView d;
        final TextView e;
        final TextView f;

        q(TextView textView, TextView textView2, Button button, TextView textView3, TextView textView4, TextView textView5) {
            this.a = textView;
            this.b = textView2;
            this.c = button;
            this.d = textView3;
            this.e = textView4;
            this.f = textView5;
        }

        @Override
        public void onClick(View view) {
            Bank.this.a(com.payu.custombrowser.util.a.a, "confirm_deduction_y");
            Timer timer = Bank.this.f0;
            if (timer != null) {
                timer.cancel();
                Bank.this.f0.purge();
            }
            Bank bank = Bank.this;
            bank.snoozeCountBackwardJourney++;
            bank.g.setCanceledOnTouchOutside(false);
            this.a.setText(Bank.this.b.getResources().getString(R.string.cb_confirm_transaction));
            this.b.setText(Bank.this.b.getString(R.string.cb_transaction_status));
            Bank.this.z0.setVisibility(0);
            Bank.this.z0.c();
            this.c.setVisibility(8);
            this.d.setVisibility(8);
            this.e.setVisibility(8);
            this.f.setVisibility(8);
            Bank bank2 = Bank.this;
            if (bank2.M) {
                bank2.startSnoozeServiceVerifyPayment(bank2.b.getResources().getString(R.string.cb_verify_message_received));
            } else {
                bank2.startSnoozeServiceVerifyPayment(bank2.b.getResources().getString(R.string.cb_user_input_confirm_transaction));
            }
        }
    }

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

        @Override
        public void onClick(View view) {
            Bank bank = Bank.this;
            bank.snoozeCountBackwardJourney++;
            bank.dismissSnoozeWindow();
            Bank.this.a(com.payu.custombrowser.util.a.a, "confirm_deduction_n");
        }
    }

    class s implements View.OnClickListener {
        final int a;

        s(int i) {
            this.a = i;
        }

        @Override
        public void onClick(View view) {
            Bank bank = Bank.this;
            if (bank.backwardJourneyStarted) {
                bank.snoozeCountBackwardJourney++;
            } else {
                bank.snoozeCount++;
            }
            bank.a("snooze_interaction_time", "-1");
            Bank bank2 = Bank.this;
            if (!bank2.backwardJourneyStarted) {
                bank2.a("snooze_window_action", "snooze_cancel_window_click");
            }
            if (this.a == 2) {
                Bank.this.killSnoozeService();
            }
            Bank.this.dismissSnoozeWindow();
        }
    }

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

        @Override
        public void onClick(View view) {
            Bank.this.d();
            Bank.this.c(view);
        }
    }

    class u implements View.OnClickListener {
        final TextView a;
        final TextView b;
        final Button c;
        final Button d;
        final TextView e;
        final TextView f;
        final TextView g;
        final TextView h;
        final Button i;

        u(TextView textView, TextView textView2, Button button, Button button2, TextView textView3, TextView textView4, TextView textView5, TextView textView6, Button button3) {
            this.a = textView;
            this.b = textView2;
            this.c = button;
            this.d = button2;
            this.e = textView3;
            this.f = textView4;
            this.g = textView5;
            this.h = textView6;
            this.i = button3;
        }

        @Override
        public void onClick(View view) {
            Bank bank = Bank.this;
            bank.isRetryNowPressed = true;
            bank.snoozeCount++;
            bank.a("snooze_interaction_time", "-1");
            Bank.this.g();
            Bank bank2 = Bank.this;
            bank2.u = 1;
            View view2 = bank2.F;
            if (view2 != null) {
                view2.setVisibility(8);
            }
            Bank.this.onHelpUnavailable();
            Bank.this.snoozeClickedTime = System.currentTimeMillis();
            Bank bank3 = Bank.this;
            bank3.isSnoozeBroadCastReceiverRegistered = true;
            bank3.y0 = true;
            Bank.this.n.stopLoading();
            if (com.payu.custombrowser.bean.b.SINGLETON.getPayuCustomBrowserCallback() != null) {
                com.payu.custombrowser.b.hasToStart = true;
                Bank.this.bindService();
            }
            Bank.this.e0 = null;
            this.a.setVisibility(8);
            this.b.setVisibility(8);
            this.c.setVisibility(8);
            this.d.setVisibility(8);
            this.e.setText("We have paused your transaction because the network was unable to process it now. We will notify you when the network improves.");
            this.f.setVisibility(8);
            this.g.setText(Bank.this.b.getResources().getString(R.string.cb_transaction_paused));
            this.h.setVisibility(0);
            this.i.setVisibility(0);
            Bank.this.a(8, "");
            Bank.this.a("snooze_window_action", "snooze_click");
            Bank bank4 = Bank.this;
            bank4.a("snooze_load_url", bank4.n.getUrl() == null ? Bank.this.w : Bank.this.n.getUrl());
            Bank bank5 = Bank.this;
            bank5.slowUserCountDownTimer = null;
            bank5.showCbBlankOverlay(0);
        }
    }

    class v implements Runnable {
        v() {
        }

        @Override
        public void run() {
            Activity activity = Bank.this.b;
            if (activity == null || activity.isFinishing() || Bank.this.isRemoving() || !Bank.this.isAdded()) {
                return;
            }
            Bank.this.t.setVisibility(8);
            Bank.this.s = 0;
        }
    }

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

        @Override
        public void onClick(View view) {
            Bank bank = Bank.this;
            if (bank.backwardJourneyStarted) {
                bank.snoozeCountBackwardJourney++;
            } else {
                bank.snoozeCount++;
            }
            bank.a("snooze_interaction_time", "-1");
            Bank.this.a("snooze_window_action", "snooze_cancel_transaction_click");
            Bank.this.showBackButtonDialog();
        }
    }

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

        @Override
        public void onClick(View view) {
            Bank.this.d();
            Bank.this.c(view);
        }
    }

    class y implements DialogInterface.OnDismissListener {
        y() {
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            Bank.this.showCbBlankOverlay(8);
        }
    }

    class z implements DialogInterface.OnKeyListener {
        z() {
        }

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

    public Bank() {
        this.o0 = new com.payu.custombrowser.custombar.a();
        this.O = new HashSet();
        this.H = new com.payu.custombrowser.util.c();
        this.Q = Executors.newCachedThreadPool();
        this.P = new HashSet();
    }

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

    public void r() {
        try {
            if (this.k0 || !this.x) {
                onHelpAvailable();
                if (!this.n0) {
                    return;
                }
                try {
                    this.n.loadUrl("javascript:" + this.d.getString(getString(R.string.cb_otp)));
                } catch (JSONException e2) {
                    e2.printStackTrace();
                }
            } else {
                this.k0 = true;
                if (ContextCompat.checkSelfPermission(this.b, "android.permission.RECEIVE_SMS") != 0) {
                    this.l0 = true;
                    return;
                }
                this.j0 = true;
                if (!this.n0) {
                    return;
                }
                try {
                    this.n.loadUrl("javascript:" + this.d.getString(getString(R.string.cb_otp)));
                } catch (JSONException e3) {
                    e3.printStackTrace();
                }
            }
        } catch (Exception e4) {
        }
    }

    private void s() {
        if (com.payu.custombrowser.bean.b.SINGLETON.getPayuCustomBrowserCallback() == null || this.customBrowserConfig == null || !this.H.a(com.payu.custombrowser.util.b.SNOOZE_ENABLED, this.b.getApplicationContext()) || this.customBrowserConfig.getEnableSurePay() <= this.snoozeCount) {
            return;
        }
        if (this.x0) {
            w();
        }
        v();
    }

    private void t() {
        setIsPageStoppedForcefully(true);
        if (this.q0 != null) {
            w();
            this.t0 = this.H.a(this.q0, this.w);
            launchSnoozeWindow(2);
        }
    }

    private void u() {
        CountDownTimer countDownTimer = this.G0;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
        CountDownTimer countDownTimer2 = this.H0;
        if (countDownTimer2 != null) {
            countDownTimer2.cancel();
        }
        this.G0 = new f0(2000L, 1000L).start();
    }

    private void v() {
        p pVar = new p(this.snoozeUrlLoadingTimeout, 500L);
        this.w0 = pVar;
        pVar.start();
    }

    public void w() {
        CountDownTimer countDownTimer = this.w0;
        if (countDownTimer != null) {
            this.x0 = false;
            countDownTimer.cancel();
            this.w0 = null;
        }
    }

    public void addReviewOrder(View view) {
        setReviewOrderButtonProperty((TextView) view.findViewById(R.id.t_payu_review_option));
    }

    @JavascriptInterface
    public void bankFound(String str) {
        if (!this.E0) {
            checkStatusFromJS(str);
            this.E0 = true;
        }
        a(str);
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing()) {
            this.b.runOnUiThread(new c());
        }
        this.y = str;
        if (!this.m0) {
            try {
                Activity activity2 = this.b;
                if (activity2 != null && !activity2.isFinishing()) {
                    this.b.runOnUiThread(new d());
                }
                if (!this.y0) {
                    if (this.I == null) {
                        convertToNative(com.payu.custombrowser.util.b.LOADING, "{}");
                    } else {
                        Activity activity3 = this.b;
                        if (activity3 != null) {
                            if (this.I != ((ViewGroup) activity3.findViewById(R.id.help_view)).getChildAt(0)) {
                                convertToNative(com.payu.custombrowser.util.b.LOADING, "{}");
                            }
                        }
                    }
                }
            } catch (Exception e2) {
            }
        }
        if (this.B0 || this.d != null) {
            return;
        }
        this.Q.execute(new e(str));
    }

    public void bindService() {
        LocalBroadcastManager.getInstance(this.b).unregisterReceiver(this.snoozeBroadCastReceiver);
        LocalBroadcastManager.getInstance(this.b.getApplicationContext()).registerReceiver(this.snoozeBroadCastReceiver, new IntentFilter(this.SNOOZE_GET_WEBVIEW_STATUS_INTENT_ACTION));
        Intent intent = new Intent(this.b, (Class<?>) SnoozeService.class);
        intent.putExtra("cb_config", this.customBrowserConfig);
        intent.putExtra(com.payu.custombrowser.util.b.CURRENT_URL, this.w);
        intent.putExtra(com.payu.custombrowser.util.b.MERCHANT_CHECKOUT_ACTIVITY, this.customBrowserConfig.getMerchantCheckoutActivityPath());
        if (!TextUtils.isEmpty(this.surePayS2Surl)) {
            intent.putExtra(com.payu.custombrowser.util.b.S2S_RETRY_URL, this.surePayS2Surl);
        }
        this.isSnoozeServiceBounded = true;
        this.b.bindService(intent, this.snoozeServiceConnection, 1);
        this.b.startService(intent);
    }

    @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) {
        }
    }

    @JavascriptInterface
    public void convertToNative(String str, String str2) {
        if (this.j) {
            dismissSnoozeWindow();
            killSnoozeService();
            cancelTransactionNotification();
            a("snooze_window_action", "snooze_window_dismissed_by_cb");
            a("snooze_window_automatically_disappear_time", "-1");
        }
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing()) {
            this.b.runOnUiThread(new h());
        }
        String str3 = this.pageType;
        if (str3 != null && !str3.equalsIgnoreCase("")) {
            a("departure", "-1");
            this.pageType = "";
        }
        Activity activity2 = this.b;
        if (activity2 == null || !this.d0 || activity2.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new i(str, str2));
    }

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

    @JavascriptInterface
    public void dismissReviewOrder() {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new c0());
    }

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

    public void dismissSnoozeWindow() {
        this.j = false;
        showReviewOrderHorizontalBar();
        androidx.appcompat.app.AlertDialog alertDialog = this.g;
        if (alertDialog != null) {
            alertDialog.dismiss();
            this.g.cancel();
            showCbBlankOverlay(8);
        }
    }

    @JavascriptInterface
    public void enableCatchAllJS(boolean z2) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new g(z2));
    }

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

    public void fillOTPOnBankPage(boolean z2) {
        if (TextUtils.isEmpty(this.otp) || !this.catchAllJSEnabled || this.backwardJourneyStarted || this.isOTPFilled) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(Constants.OTP, this.otp);
            jSONObject.put("isAutoFillOTP", z2);
            this.n.loadUrl("javascript:" + this.c.getString(getString(R.string.cb_fill_otp)) + "(" + jSONObject + ")");
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

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

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

    public boolean isInBackWardJourney(String str) {
        try {
            if (!this.backwardJourneyStarted) {
                if ((str.startsWith("https://secure.payu.in") || str.startsWith(com.payu.custombrowser.util.b.PAYU_DOMAIN_TEST)) && str.contains(com.payu.custombrowser.util.b.RESPONSE_BACKWARD)) {
                    return true;
                }
                Set<String> set = this.O;
                if (set != null) {
                    Iterator<String> it = set.iterator();
                    while (it.hasNext()) {
                        if (str.contains(it.next())) {
                            return true;
                        }
                    }
                    return false;
                }
            }
            return this.backwardJourneyStarted;
        } catch (Exception e2) {
            return this.backwardJourneyStarted;
        }
    }

    @JavascriptInterface
    public void isOTPKeyboardNumeric(boolean z2) {
        this.P0 = z2;
    }

    public void killSnoozeService() {
        SnoozeService snoozeService = this.snoozeService;
        if (snoozeService != null) {
            snoozeService.d();
        }
    }

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

    @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());
                    a(next, jSONObject.get(next).toString());
                }
            }
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

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

    @JavascriptInterface
    public void nativeHelperForNB(String str, String str2) {
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing() && !isRemoving() && isAdded()) {
            this.b.runOnUiThread(new h0(str, str2));
        }
        Activity activity2 = this.b;
        if (activity2 == null || activity2.isFinishing() || isRemoving() || !isAdded()) {
            return;
        }
        this.b.runOnUiThread(new a());
    }

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

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

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

    public void onOverrideURL(String str) {
        ProgressBar progressBar = this.t;
        if (progressBar != null) {
            progressBar.setProgress(10);
        }
    }

    public void onPageFinishWebclient(String str) {
        this.K0 = false;
        Activity activity = this.b;
        if (activity != null && !activity.isFinishing() && !isRemoving() && isAdded()) {
            if (this.N0) {
                a("snooze_resume_url", str);
                a(false);
            }
            this.H.d(this.b.getApplicationContext(), "last_url", "f:" + str);
            u();
            if (this.A0 && getArguments() != null && getArguments().getInt(com.payu.custombrowser.util.b.MAIN_LAYOUT, -1) != -1) {
                try {
                    View findViewById = this.b.findViewById(getArguments().getInt(com.payu.custombrowser.util.b.MAIN_LAYOUT));
                    findViewById.getViewTreeObserver().addOnGlobalLayoutListener(new d0(findViewById));
                    this.A0 = false;
                } catch (Exception e2) {
                }
            }
        }
        if (!this.y0) {
            w();
        }
        new Handler().postDelayed(new e0(), 1000L);
    }

    public void onPageFinished() {
        if (!isAdded() || isRemoving() || this.b == null) {
            return;
        }
        this.m0 = true;
        if (this.g0.booleanValue()) {
            onHelpUnavailable();
            this.g0 = Boolean.FALSE;
        }
        View view = this.I;
        if (view != null && view.isShown()) {
            this.u = 1;
            g();
            onHelpUnavailable();
        }
        this.b.getWindow().setSoftInputMode(3);
        if (this.d != null && this.d0 && !this.y0) {
            try {
                this.n.loadUrl("javascript:" + this.d.getString(getString(R.string.cb_init)));
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
        if (this.c != null) {
            if (!this.M0) {
                checkStatusFromJS("", 3);
                this.M0 = true;
            }
            View view2 = this.G;
            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.l) {
            onHelpUnavailable();
            this.l = false;
        }
        if (!isAdded() || isRemoving()) {
            return;
        }
        this.m0 = false;
        if (this.c != null) {
            try {
                if (this.d0) {
                    this.n.loadUrl("javascript:" + this.c.getString(getString(R.string.cb_detect_bank)));
                }
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
        View view = this.G;
        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.R0 = true;
    }

    @JavascriptInterface
    public void onPayuFailure(String str) {
        SnoozeService snoozeService = this.snoozeService;
        if (snoozeService != null) {
            snoozeService.d();
        }
        if (this.b != null) {
            this.i = "failure_transaction";
            a("trxn_status", "failure_transaction");
            this.B = Boolean.FALSE;
            this.z = str;
        }
        cancelTransactionNotification();
        b();
    }

    @JavascriptInterface
    public void onPayuSuccess(String str) {
        SnoozeService snoozeService = this.snoozeService;
        if (snoozeService != null) {
            snoozeService.d();
        }
        this.B = Boolean.TRUE;
        this.i = "success_transaction";
        a("trxn_status", "success_transaction");
        this.z = str;
        cancelTransactionNotification();
        b();
    }

    public void onProgressChanged(int i2) {
        ProgressBar progressBar;
        Activity activity = this.b;
        if (activity == null || activity.isFinishing() || isRemoving() || !isAdded() || (progressBar = this.t) == null) {
            return;
        }
        progressBar.setVisibility(0);
        if (i2 != 100) {
            a(i2);
            return;
        }
        ProgressBar progressBar2 = this.t;
        if (progressBar2 != null) {
            progressBar2.setProgress(100);
            new Handler().postDelayed(new v(), 100L);
        }
    }

    public void onReceivedErrorWebClient(int i2, String str) {
        b("ERROR_RECEIVED", i2 + "|" + (str == null ? "" : str) + "|" + (this.n.getUrl() != null ? this.n.getUrl() : ""));
        c();
        ProgressBar progressBar = this.t;
        if (progressBar != null) {
            progressBar.setVisibility(8);
        }
        this.L0 = 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 z2 = this.backwardJourneyStarted;
                if (!z2) {
                    t();
                } else if (z2 && this.isTxnNBType && this.snoozeCountBackwardJourney < this.customBrowserConfig.getEnableSurePay()) {
                    dismissSnoozeWindow();
                    t();
                }
                onHelpUnavailable();
                this.E.removeAllViews();
                if (this.q != 0) {
                    g();
                    this.u = 1;
                }
                d();
                if (this.D) {
                    return;
                }
                bVar.getPayuCustomBrowserCallback().onCBErrorReceived(i2, str);
            }
        } catch (Exception e2) {
        }
    }

    public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
        StringBuilder sb = new StringBuilder();
        Object obj = sslError;
        if (sslError == null) {
            obj = "";
        }
        b("SSL_ERROR", sb.append(obj).append("|").append(webView.getUrl() != null ? webView.getUrl() : "").toString());
        c();
    }

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

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

    void q() {
        if (this.k.contains("CUSTOM_BROWSER")) {
            return;
        }
        this.i = "CUSTOM_BROWSER";
        this.k.add("CUSTOM_BROWSER");
        a("cb_status", this.i);
    }

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

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

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

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

    @Override
    public void reloadWebView(String str, String str2) {
        this.forwardJourneyForChromeLoaderIsComplete = false;
        this.backwardJourneyStarted = false;
        this.isWebviewReloading = true;
        this.backwardJourneyStarted = false;
        SnoozeService snoozeService = this.snoozeService;
        if (snoozeService != null) {
            snoozeService.d();
        }
        if (this.j) {
            dismissSnoozeWindow();
        }
        com.payu.custombrowser.widgets.a aVar = this.r;
        if (aVar != null) {
            aVar.dismiss();
        }
        this.r = null;
        a(true);
        resetAutoSelectOTP();
        this.H.b(this.customBrowserConfig);
        this.surePayS2SPayUId = null;
        if (str != null && str2 != null) {
            this.n.postUrl(str, str2.getBytes());
        } else if (str != null) {
            this.n.loadUrl(str);
        }
    }

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

    public void setIsPageStoppedForcefully(boolean z2) {
        this.y0 = z2;
    }

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

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

    @JavascriptInterface
    public void setSnoozeEnabled(boolean z2) {
        if (!z2) {
            this.customBrowserConfig.setEnableSurePay(0);
        }
        this.H.a(com.payu.custombrowser.util.b.SNOOZE_ENABLED, z2, this.b.getApplicationContext());
    }

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

    @JavascriptInterface
    public void setUserId(String str) {
        if (!this.D0) {
            if (this.H.c(this.b.getApplicationContext(), this.y).equals("")) {
                return;
            }
            this.H.e(this.b.getApplicationContext(), this.y);
        } else {
            Activity activity = this.b;
            if (activity == null || activity.isFinishing()) {
                return;
            }
            this.H.e(this.b.getApplicationContext(), this.y, 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("Do you really want to cancel the transaction ?");
        builder.setPositiveButton("Ok", new a0());
        builder.setNegativeButton("Cancel", new b0());
        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.O0 = create;
        create.getWindow().getAttributes().type = 2003;
        this.O0 = builder.show();
    }

    @JavascriptInterface
    public void showCustomBrowser(boolean z2) {
        this.d0 = z2;
        if (getActivity() == null || getActivity().isFinishing()) {
            return;
        }
        getActivity().runOnUiThread(new k(z2));
    }

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

    @JavascriptInterface
    public void showReviewOrder(boolean z2) {
        if (this.D) {
            return;
        }
        int enableReviewOrder = this.customBrowserConfig.getEnableReviewOrder();
        CustomBrowserConfig customBrowserConfig = this.customBrowserConfig;
        if (enableReviewOrder != 0 || z2) {
            return;
        }
        customBrowserConfig.setEnableReviewOrder(-1);
        this.V.setVisibility(8);
        dismissReviewOrder();
    }

    @JavascriptInterface
    public void spResumedWindowTTL(String str) {
        try {
            this.s0 = Integer.parseInt(str);
        } catch (Exception e2) {
        }
    }

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

    public void startSnoozeServiceVerifyPayment(String str) {
        LocalBroadcastManager.getInstance(this.b).unregisterReceiver(this.snoozeBroadCastReceiver);
        LocalBroadcastManager.getInstance(this.b.getApplicationContext()).registerReceiver(this.snoozeBroadCastReceiver, new IntentFilter(this.SNOOZE_GET_WEBVIEW_STATUS_INTENT_ACTION));
        Intent intent = new Intent(this.b, (Class<?>) SnoozeService.class);
        intent.putExtra("cb_config", this.customBrowserConfig);
        intent.putExtra(com.payu.custombrowser.util.b.VERIFICATION_MSG_RECEIVED, true);
        intent.putExtra(com.payu.custombrowser.util.b.MERCHANT_CHECKOUT_ACTIVITY, this.customBrowserConfig.getMerchantCheckoutActivityPath());
        intent.putExtra(com.payu.custombrowser.util.b.VERIFY_ADDON_PARAMS, str);
        if (!TextUtils.isEmpty(this.surePayS2SPayUId)) {
            intent.putExtra(com.payu.custombrowser.util.b.PAYUID, this.surePayS2SPayUId);
        }
        if (!TextUtils.isEmpty(this.merchantKey)) {
            intent.putExtra(com.payu.custombrowser.util.b.MERCHANTKEY, this.merchantKey);
        }
        if (!TextUtils.isEmpty(this.txnId)) {
            intent.putExtra("txnid", this.txnId);
        }
        this.isSnoozeServiceBounded = true;
        this.b.bindService(intent, this.snoozeServiceConnection, 1);
        this.isSnoozeBroadCastReceiverRegistered = true;
        this.b.startService(intent);
    }

    @JavascriptInterface
    public void surePayData(String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            if (jSONObject.has(com.payu.custombrowser.util.b.S2SPAYUID)) {
                this.surePayS2SPayUId = jSONObject.getString(com.payu.custombrowser.util.b.S2SPAYUID);
            }
            if (jSONObject.has(com.payu.custombrowser.util.b.S2SREPLAYURL) && jSONObject.has(com.payu.custombrowser.util.b.SNOOZE_COUNT) && jSONObject.has(com.payu.custombrowser.util.b.TXN_TYPE) && jSONObject.has(com.payu.custombrowser.util.b.MERCHANTKEY) && jSONObject.has(com.payu.custombrowser.util.b.TXNID)) {
                this.surePayS2Surl = jSONObject.getString(com.payu.custombrowser.util.b.S2SREPLAYURL);
                this.merchantKey = jSONObject.getString(com.payu.custombrowser.util.b.MERCHANTKEY);
                this.txnId = jSONObject.getString(com.payu.custombrowser.util.b.TXNID);
                String string = jSONObject.getString(com.payu.custombrowser.util.b.TXN_TYPE);
                this.txnType = string;
                this.isTxnNBType = string.equalsIgnoreCase(com.payu.paymentparamhelper.PayuConstants.NB);
                this.customBrowserConfig.setEnableSurePay(Integer.parseInt(jSONObject.getString(com.payu.custombrowser.util.b.SNOOZE_COUNT)));
                this.isSurePayValueLoaded = true;
            }
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

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

    public void launchSnoozeWindow(int i2) {
        boolean z2;
        int i3 = this.t0;
        if (i3 == 3) {
            return;
        }
        if (i2 == 2 && i3 == 2) {
            return;
        }
        if (i2 == 1 && i3 == 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 = i2;
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        dismissSlowUserWarning();
        a(8, "");
        this.j = true;
        a("snooze_window_status", "snooze_visible");
        a("snooze_appear_url", this.w);
        a("snooze_window_launch_mode", i2 == 1 ? com.payu.custombrowser.util.b.STR_SNOOZE_MODE_WARN : com.payu.custombrowser.util.b.STR_SNOOZE_MODE_FAIL);
        a("snooze_window_appear_time", "-1");
        View inflate = this.b.getLayoutInflater().inflate(R.layout.cb_layout_snooze, (ViewGroup) null);
        TextView textView = (TextView) inflate.findViewById(R.id.text_view_snooze_message);
        TextView textView2 = (TextView) inflate.findViewById(R.id.text_view_transaction_snoozed_message1);
        TextView textView3 = (TextView) inflate.findViewById(R.id.button_cancel_transaction);
        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);
        TextView textView5 = (TextView) inflate.findViewById(R.id.t_confirm);
        TextView textView6 = (TextView) inflate.findViewById(R.id.t_nconfirm);
        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.z0 = 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.N) {
            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++;
            a("snooze_backward_visible", "Y");
        } else {
            this.snoozeVisibleCountFwdJourney++;
        }
        textView5.setOnClickListener(new q(textView7, textView, button, textView2, textView5, textView6));
        textView6.setOnClickListener(new r());
        textView4.setOnClickListener(new s(i2));
        button2.setOnClickListener(new t());
        button.setOnClickListener(new u(textView4, textView3, button, button2, textView, textView8, textView7, textView2, button3));
        textView3.setOnClickListener(new w());
        button3.setOnClickListener(new x());
        androidx.appcompat.app.AlertDialog alertDialog = this.g;
        if (alertDialog == null || !alertDialog.isShowing()) {
            androidx.appcompat.app.AlertDialog create = new AlertDialog.Builder(this.b).create();
            this.g = create;
            create.setView(inflate);
            z2 = false;
            this.g.setCanceledOnTouchOutside(false);
            this.g.setOnDismissListener(new y());
            this.g.setOnKeyListener(new z());
        } else {
            z2 = false;
        }
        dismissReviewOrder();
        this.g.show();
        if (i2 != 2 || this.backwardJourneyStarted) {
            return;
        }
        com.payu.custombrowser.b.hasToStart = z2;
        bindService();
    }

    @JavascriptInterface
    public void onCancel(String str) {
        Activity activity = this.b;
        if (activity == null || activity.isFinishing()) {
            return;
        }
        this.b.runOnUiThread(new j(str));
    }

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

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

    int c(String str) {
        if (str.equalsIgnoreCase(getString(R.string.cb_pin))) {
            return 3;
        }
        if (str.equalsIgnoreCase(getString(R.string.cb_password))) {
            return 1;
        }
        if (str.equalsIgnoreCase(getString(R.string.cb_enter_manually))) {
            return 4;
        }
        if (str.equalsIgnoreCase(getString(R.string.cb_approve_otp))) {
            return 5;
        }
        if (str.equalsIgnoreCase(getString(R.string.cb_otp)) || str.equalsIgnoreCase(getString(R.string.cb_use_sms_otp))) {
            return 6;
        }
        if (str.equalsIgnoreCase(getString(R.string.cb_sms_otp))) {
            return 7;
        }
        return str.equalsIgnoreCase(getString(R.string.cb_regenerate_otp)) ? 2 : 0;
    }

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

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

    private void a(boolean z2) {
        this.N0 = z2;
    }

    public void c(View view) {
        if (view.getId() == R.id.button_retry_transaction) {
            this.snoozeCount++;
            a("snooze_interaction_time", "-1");
            a("snooze_window_action", "snooze_retry_click");
        } else if (view.getId() == R.id.button_retry_anyway) {
            this.snoozeCount++;
            a("snooze_txn_paused_user_interaction_time", "-1");
            a("snooze_txn_paused_window_action", "retry_anyway_click");
        }
        setTransactionStatusReceived(false);
        if (!com.payu.custombrowser.util.c.g(this.b.getApplicationContext())) {
            Toast.makeText(this.b.getApplicationContext(), com.payu.custombrowser.util.b.MSG_NO_INTERNET, 0).show();
            return;
        }
        if (this.n.getUrl() != null && !this.n.getUrl().contentEquals("https://secure.payu.in/_payment") && !this.n.getUrl().contentEquals(com.payu.custombrowser.util.b.PRODUCTION_PAYMENT_URL_SEAMLESS) && isUrlWhiteListed(this.n.getUrl())) {
            reloadWebView();
        } else {
            this.H.a(this.customBrowserConfig);
            if ((this.customBrowserConfig.getPostURL() != null && (this.customBrowserConfig.getPostURL().contentEquals("https://secure.payu.in/_payment") || this.customBrowserConfig.getPostURL().contentEquals("https://mobiletest.payu.in/_payment"))) || (this.isS2SHtmlSupport && !TextUtils.isEmpty(this.surePayS2Surl) && !TextUtils.isEmpty(this.surePayS2SPayUId))) {
                markPreviousTxnAsUserCanceled(com.payu.custombrowser.util.c.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) {
                reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
            } else {
                String str = this.surePayS2Surl;
                if (str != null) {
                    reloadWebView(str, null);
                }
            }
        }
        dismissSnoozeWindow();
        this.slowUserCountDownTimer = null;
        if (view.getId() == R.id.button_retry_anyway) {
            killSnoozeService();
            NotificationManager notificationManager = (NotificationManager) this.b.getSystemService(OneSignalDbContract.NotificationTable.TABLE_NAME);
            if (notificationManager != null) {
                notificationManager.cancel(com.payu.custombrowser.util.b.SNOOZE_NOTIFICATION_ID);
            }
        }
    }

    @Override
    public void reloadWebView() {
        SnoozeService snoozeService = this.snoozeService;
        if (snoozeService != null) {
            snoozeService.d();
        }
        if (this.j) {
            dismissSnoozeWindow();
        }
        this.isWebviewReloading = true;
        if (this.isSnoozeEnabled) {
            s();
        }
        if (this.n.getUrl() != null) {
            a(true);
            reloadWVNative();
        }
    }

    @Override
    public void reloadWebView(String str) {
        SnoozeService snoozeService = this.snoozeService;
        if (snoozeService != null) {
            snoozeService.d();
        }
        if (this.j) {
            dismissSnoozeWindow();
        }
        this.isWebviewReloading = true;
        if (this.isSnoozeEnabled) {
            s();
        }
        if (this.n.getUrl() != null) {
            a(true);
            reloadWVUsingJS();
        } else {
            reloadWebView(this.customBrowserConfig.getPostURL(), this.customBrowserConfig.getPayuPostData());
        }
    }

    private void b(String str, String str2) {
        String str3;
        int i2 = 0;
        while (str2.length() > 0) {
            try {
                i2++;
                if (str2.length() > 128) {
                    String substring = str2.substring(0, WorkQueueKt.BUFFER_CAPACITY);
                    str3 = str2.substring(WorkQueueKt.BUFFER_CAPACITY, str2.length());
                    str2 = substring;
                } else {
                    str3 = "";
                }
                a(str + "_" + i2, str2);
                str2 = str3;
            } catch (Exception e2) {
                return;
            }
        }
    }
}