导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - AuthOtpActivity.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 AuthOtpActivity.java JAVA 源代码文件

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


package com.bm.sc.bebasbayar.ui.activity.auth;

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.res.ResourcesCompat;
import com.bm.sc.auth.ui.cs.LiveChatActivity;
import com.bm.sc.bebasbayar.R;
import com.bm.sc.bebasbayar.adapter.entity.ScOtpTypeEntity;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.helper.AuthHelper;
import com.bm.sc.bebasbayar.helper.EventHelper;
import com.bm.sc.bebasbayar.helper.FirebaseHelper;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.iface.NotificationListener;
import com.bm.sc.bebasbayar.message.mp.LoginMessage;
import com.bm.sc.bebasbayar.service.BBFourDigitReceiver;
import com.bm.sc.bebasbayar.service.BBSmsReceiver;
import com.bm.sc.bebasbayar.setting.ApiConfig;
import com.bm.sc.bebasbayar.setting.session.AppSession;
import com.bm.sc.bebasbayar.ui.activity.auth.AuthOtpActivity;
import com.bm.sc.util.android.Compat;
import com.bm.sc.util.android.Device;
import com.bm.sc.util.common.Var;
import com.bm.sc.util.format.DateTime;
import com.google.android.gms.auth.api.phone.SmsRetriever;
import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.textfield.TextInputEditText;
import com.orhanobut.dialogplus.DialogPlus;
import in.aabhasjindal.otptextview.OTPListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import org.json.JSONException;
import org.json.JSONObject;

public class AuthOtpActivity extends AuthActivity implements View.OnClickListener, NotificationListener, OTPListener {
    public static final int STATE_CHANGE_PIN = 3;
    public static final int STATE_LOGIN = 2;
    public static final int STATE_LOGIN_FINGER = 4;
    public static final int STATE_LOGIN_PIN = 6;
    public static final int STATE_LOGIN_SMS = 7;
    public static final int STATE_LOGIN_WA = 5;
    public static final int STATE_REGISTER = 1;
    public static final int STATE_RESET = 0;
    public final String d = getClass().getSimpleName();
    public int e;
    public CountDownTimer f;
    public TextInputEditText g;
    public TextView h;
    public View i;
    public AppCompatButton j;
    public AppCompatButton k;
    public AppCompatButton l;
    public DialogPlus m;
    public View n;
    public String o;
    public String p;
    public String q;
    public String r;
    public int s;
    public BBSmsReceiver t;
    public BBFourDigitReceiver u;
    public IntentFilter v;
    public ScOtpTypeEntity w;

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

        public void c(Editable editable, View view) {
            AuthOtpActivity authOtpActivity = AuthOtpActivity.this;
            authOtpActivity.S0(authOtpActivity.s, editable.toString());
        }

        public void d(final Editable editable) {
            AuthOtpActivity.this.j.setBackgroundDrawable(ResourcesCompat.getDrawable(AuthOtpActivity.this.getResources(), R.drawable.bb_background_gradient_round_25, (Resources.Theme) null));
            AuthOtpActivity.this.j.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    AuthOtpActivity.a.this.c(editable, view);
                }
            });
            AuthOtpActivity.this.g.performClick();
            AuthOtpActivity authOtpActivity = AuthOtpActivity.this;
            authOtpActivity.showKeyboard(authOtpActivity.g);
            AuthOtpActivity authOtpActivity2 = AuthOtpActivity.this;
            authOtpActivity2.S0(authOtpActivity2.s, editable.toString());
        }

        @Override
        public void afterTextChanged(final Editable editable) {
            if (editable.length() == 4) {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        AuthOtpActivity.a.this.d(editable);
                    }
                }, 500L);
            }
        }

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

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

    public class b implements BBSmsReceiver.SmsReceiverListener {
        public b() {
        }

        @Override
        public void onError(String str) {
            String unused = AuthOtpActivity.this.d;
            AuthOtpActivity.this.R0();
        }

        @Override
        public void onSuccess(String str) {
            String unused = AuthOtpActivity.this.d;
            StringBuilder sb = new StringBuilder();
            sb.append("Receive OTP:");
            sb.append(str);
            AuthOtpActivity.this.g.setText(str);
        }
    }

    public class c implements BBFourDigitReceiver.FourDigitReceiverListener {
        public c() {
        }

        @Override
        public void onError(String str) {
            String unused = AuthOtpActivity.this.d;
            AuthOtpActivity.this.R0();
        }

        @Override
        public void onSuccess(String str) {
            String unused = AuthOtpActivity.this.d;
            StringBuilder sb = new StringBuilder();
            sb.append("Receive OTP:");
            sb.append(str);
            AuthOtpActivity.this.g.setText(str);
        }
    }

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

        @Override
        public void onFinish() {
            AuthOtpActivity.this.R0();
        }

        @Override
        public void onTick(long j) {
            TimeUnit timeUnit = TimeUnit.MILLISECONDS;
            long minutes = timeUnit.toMinutes(j);
            AuthOtpActivity.this.h.setText(AuthOtpActivity.this.getString(R.string.bonjour_otp_cooldown_tick, String.format(Locale.getDefault(), "%02d:%02d", Long.valueOf(minutes), Long.valueOf(timeUnit.toSeconds(j) - TimeUnit.MINUTES.toSeconds(minutes)))));
        }
    }

    public void A0(final String str, int i, AuthHelper.OTPResponse oTPResponse) {
        if (oTPResponse.getRc().equals("00")) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.z0(str);
                }
            }, 1000L);
        } else {
            Affinity.info(this, false, oTPResponse.getMessage());
            R0();
        }
    }

    public void B0(String str) {
        Affinity.purge(this, RegisterActivity.class, RegisterActivity.getBundle(this, this.o, str, this.p));
    }

    public void C0(Bundle bundle, int i, Boolean bool) {
        Affinity.purge(this, BonjourActivity.class, bundle);
    }

    public void D0(final String str, int i, AuthHelper.OTPResponse oTPResponse) {
        if (oTPResponse.getRc().equals("00")) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.B0(str);
                }
            }, 1000L);
            return;
        }
        if (!oTPResponse.getRc().equals(LoginMessage.RC_OTP_INVALID)) {
            Affinity.info(this, false, oTPResponse.getMessage());
            R0();
        } else {
            final Bundle bundle = new Bundle();
            bundle.putByte(BonjourActivity.NAV_TO_BONJOUR, (byte) 3);
            Affinity.info(this, -1, "Informasi", oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.C0(bundle, i2, (Boolean) obj);
                }
            });
            R0();
        }
    }

    public static boolean W(Context context) {
        return NotificationManagerCompat.getEnabledListenerPackages(context).contains(context.getPackageName());
    }

    public void X(int i, AuthHelper.LoginMessageNew loginMessageNew) {
        if (loginMessageNew.getRc().equals("00")) {
            this.f.cancel();
        } else {
            Affinity.info(this, false, loginMessageNew.getMessage());
        }
    }

    public void Y() {
        G0(this.s, this.p);
    }

    public void Z(View view) {
        onBackPressed();
    }

    public static void a0(int i, Boolean bool) {
    }

    public void b0(int i, String str) {
        try {
            JSONObject jSONObject = new JSONObject(str);
            ScOtpTypeEntity scOtpTypeEntity = new ScOtpTypeEntity();
            this.w = scOtpTypeEntity;
            scOtpTypeEntity.setType(jSONObject.getString("type"));
            if (jSONObject.isNull("is_otp_initiate")) {
                this.w.setIs_otp_initiate(false);
            } else {
                this.w.setIs_otp_initiate(jSONObject.getBoolean("is_otp_initiate"));
            }
            this.w.setInitial(jSONObject.getString("initial"));
            this.w.setPhoneToMessage(jSONObject.getString("phone_to_message"));
            this.w.setHashSmsRetrieve(Var.toString(jSONObject.getString("hash_sms_retrieve"), ""));
            K0();
            J0();
        } catch (JSONException e) {
            this.w = null;
            O0();
            Objects.requireNonNull(e.getMessage());
            Affinity.info(this, -1, getString(R.string.title_warning), getString(R.string.error_json_parse), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.a0(i2, (Boolean) obj);
                }
            });
        }
    }

    public static ScOtpTypeEntity buildScOtpTypeEntity(String str) {
        ScOtpTypeEntity scOtpTypeEntity = new ScOtpTypeEntity();
        try {
            JSONObject jSONObject = new JSONObject(str);
            scOtpTypeEntity.setType(jSONObject.getString("type"));
            if (jSONObject.isNull("is_otp_initiate")) {
                scOtpTypeEntity.setIs_otp_initiate(false);
            } else {
                scOtpTypeEntity.setIs_otp_initiate(jSONObject.getBoolean("klik_otp_link"));
            }
            scOtpTypeEntity.setInitial(jSONObject.getString("initial"));
            scOtpTypeEntity.setPhoneToMessage(jSONObject.getString("phone_to_message"));
            scOtpTypeEntity.setHashSmsRetrieve(Var.toString(jSONObject.getString("hash_sms_retrieve"), ""));
            return scOtpTypeEntity;
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void c0() {
        this.g.performClick();
        this.g.setFocusable(true);
        showKeyboard(this.g);
    }

    public void d0(AuthHelper.OTPResponse oTPResponse, int i, Boolean bool) {
        V(oTPResponse.getDate());
    }

    public static void e0(int i, Boolean bool) {
    }

    public void f0(int i, final AuthHelper.OTPResponse oTPResponse) {
        if (oTPResponse.getRc().equals("00")) {
            V(oTPResponse.getDate());
        } else if (oTPResponse.getRc().equals("01")) {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.d0(oTPResponse, i2, (Boolean) obj);
                }
            });
        } else {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.e0(i2, (Boolean) obj);
                }
            });
        }
    }

    public void g0(AuthHelper.OTPResponse oTPResponse, int i, Boolean bool) {
        V(oTPResponse.getDate());
    }

    public static Bundle getBundle(AuthActivity authActivity, String str, int i, int i2) {
        Bundle bundle = new Bundle();
        bundle.putAll(authActivity.getGPSBundle());
        bundle.putString("phone", str);
        bundle.putInt("state", i);
        bundle.putInt("is_wa", i2);
        return bundle;
    }

    public static void h0(int i, Boolean bool) {
    }

    public void i0(int i, final AuthHelper.OTPResponse oTPResponse) {
        if (oTPResponse.getRc().equals("00")) {
            V(oTPResponse.getDate());
        } else if (oTPResponse.getRc().equals("01")) {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.g0(oTPResponse, i2, (Boolean) obj);
                }
            });
        } else {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.h0(i2, (Boolean) obj);
                }
            });
        }
    }

    public void j0(AuthHelper.OTPResponse oTPResponse, int i, Boolean bool) {
        V(oTPResponse.getDate());
    }

    public static void k0(int i, Boolean bool) {
    }

    public void l0(int i, final AuthHelper.OTPResponse oTPResponse) {
        if (oTPResponse.getRc().equals("00")) {
            V(oTPResponse.getDate());
        } else if (oTPResponse.getRc().equals("01")) {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.j0(oTPResponse, i2, (Boolean) obj);
                }
            });
        } else {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.k0(i2, (Boolean) obj);
                }
            });
        }
    }

    public static void m0(int i, Boolean bool) {
    }

    public void n0(String str, int i, AuthHelper.OTPResponse oTPResponse) {
        if (!oTPResponse.getRc().equals("00")) {
            Affinity.info(this, -1, getString(R.string.title_warning), oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.m0(i2, (Boolean) obj);
                }
            });
            return;
        }
        if (str.equalsIgnoreCase("call")) {
            this.q = oTPResponse.getToken();
            Intent intent = new Intent();
            String str2 = this.q;
            if (str2 != null) {
                intent.putExtra("phoneCaller", str2);
            }
            sendBroadcast(intent);
        }
    }

    public void o0(String str) {
        this.g.setText(str);
    }

    public void p0() {
        G0(this.s, this.p);
    }

    public void q0() {
        S0(this.s, this.r);
    }

    public void r0(View view) {
        try {
            if (this.w.getType().equals(ScOtpTypeEntity.TYPE_WA_NOTIFICATION) && this.s == 2 && this.w.isIs_otp_initiate()) {
                P0();
            } else {
                Q0();
            }
        } catch (Exception e) {
            Objects.requireNonNull(e.getMessage());
        }
    }

    public void s0(View view) {
        M0();
    }

    public void t0(Void r1) {
    }

    public void u0(Exception exc) {
        StringBuilder sb = new StringBuilder();
        sb.append("after 5 minutes you don't have match sms come");
        sb.append(exc);
        R0();
    }

    public void v0() {
        G0(this.s, this.p);
    }

    public void x0(Bundle bundle, int i, Boolean bool) {
        Affinity.purge(this, BonjourActivity.class, bundle);
    }

    public void y0(final String str, int i, AuthHelper.OTPResponse oTPResponse) {
        if (oTPResponse.getRc().equals("00")) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(DateTime.parse(DateTime.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss"));
            calendar.add(13, 10);
            V(calendar.getTime());
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.w0(str);
                }
            }, 1000L);
            return;
        }
        if (!oTPResponse.getRc().equals(LoginMessage.RC_OTP_INVALID) && this.r.equals("not:wa:link:otp")) {
            Affinity.info(this, false, oTPResponse.getMessage());
            R0();
        } else {
            final Bundle bundle = new Bundle();
            bundle.putByte(BonjourActivity.NAV_TO_BONJOUR, (byte) 4);
            Affinity.info(this, -1, "Informasi", oTPResponse.getMessage(), new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.x0(bundle, i2, (Boolean) obj);
                }
            });
            R0();
        }
    }

    public void z0(String str) {
        Affinity.purge(this, GantiPINActivity.class, GantiPINActivity.getBundle(this, this.o, str, 0, this.p));
    }

    public final void E0() {
        this.j.setOnClickListener(null);
        this.i.setVisibility(0);
        this.n.setVisibility(8);
        this.h.setText(getString(R.string.info_unverified_account_head));
        if (this.e == 0) {
            this.l.setEnabled(false);
            this.l.setTextColor(ContextCompat.getColor(this, R.color.grey));
            this.l.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_whatsapp_disable, 0, 0, 0);
        }
    }

    public final void w0(String str) {
        AuthHelper.doLoginv2(this, this.o, "", str, 2, this.p, new BBCallback() {
            @Override
            public final void do_callback(int i, Object obj) {
                AuthOtpActivity.this.X(i, (AuthHelper.LoginMessageNew) obj);
            }
        });
    }

    public final void G0(int i, final String str) {
        this.g.setText("");
        E0();
        if (i == 2) {
            AuthHelper.requestOTPv2(this, this.o, 2, str, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.f0(i2, (AuthHelper.OTPResponse) obj);
                }
            });
            return;
        }
        if (i == 0 || i == 3) {
            AuthHelper.requestOTPv2(this, this.o, 0, str, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.i0(i2, (AuthHelper.OTPResponse) obj);
                }
            });
        } else if (i == 1) {
            AuthHelper.requestOTPv2(this, this.o, 1, str, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.l0(i2, (AuthHelper.OTPResponse) obj);
                }
            });
        } else {
            AuthHelper.requestOTPv2(this, this.o, 1, str, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.n0(str, i2, (AuthHelper.OTPResponse) obj);
                }
            });
        }
    }

    public final void H0() {
        this.g.requestFocus();
        ((InputMethodManager) getSystemService("input_method")).showSoftInput(this.g, 1);
        this.g.addTextChangedListener(new a());
    }

    public final void I0() {
        String var = Var.toString(new AppSession(this).retrieve(AppSession.HASH_SMS_RETRIEVE), "");
        if (this.p.equals("SMS") && !var.isEmpty()) {
            N0();
        } else if (this.p.equals("WhatsApp")) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.p0();
                }
            }, 500L);
        }
        this.g.setText("");
        H0();
    }

    public final void J0() {
        ScOtpTypeEntity scOtpTypeEntity = this.w;
        if (scOtpTypeEntity != null) {
            if (scOtpTypeEntity.getType().equals(ScOtpTypeEntity.TYPE_WA_NOTIFICATION) && this.e == 1 && this.w.isIs_otp_initiate() && this.s == 2) {
                V(new Date());
                H0();
            } else {
                if (this.r.equals("not:wa:link:otp")) {
                    I0();
                    return;
                }
                this.g.setText(this.r);
                this.g.requestFocus();
                ((InputMethodManager) getSystemService("input_method")).showSoftInput(this.g, 1);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        AuthOtpActivity.this.q0();
                    }
                }, 500L);
            }
        }
    }

    public final void K0() {
        ScOtpTypeEntity scOtpTypeEntity = this.w;
        if (scOtpTypeEntity != null && scOtpTypeEntity.getType().equals(ScOtpTypeEntity.TYPE_WA_NOTIFICATION) && this.e == 1 && this.w.isIs_otp_initiate() && this.s == 2) {
            P0();
        }
    }

    public final void L0() {
        this.l.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                AuthOtpActivity.this.r0(view);
            }
        });
        this.k.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                AuthOtpActivity.this.s0(view);
            }
        });
    }

    public final void M0() {
        this.p = "SMS";
        I0();
    }

    public final void N0() {
        IntentFilter intentFilter;
        BBSmsReceiver bBSmsReceiver = this.t;
        if (bBSmsReceiver != null) {
            try {
                try {
                    unregisterReceiver(bBSmsReceiver);
                } catch (IllegalArgumentException e) {
                    Objects.requireNonNull(e.getMessage());
                }
            } finally {
                this.t = null;
            }
        }
        if (this.v != null) {
            this.v = null;
        }
        this.v = new IntentFilter("com.google.android.gms.auth.api.phone.SMS_RETRIEVED");
        BBSmsReceiver bBSmsReceiver2 = new BBSmsReceiver();
        this.t = bBSmsReceiver2;
        bBSmsReceiver2.setSmsReceiverListener(new b());
        BBFourDigitReceiver bBFourDigitReceiver = new BBFourDigitReceiver();
        this.u = bBFourDigitReceiver;
        bBFourDigitReceiver.setFourDigitReceiverListener(new c());
        SmsRetrieverClient client = SmsRetriever.getClient(this);
        client.startSmsRetriever();
        Task startSmsRetriever = client.startSmsRetriever();
        startSmsRetriever.addOnSuccessListener(new OnSuccessListener() {
            public final void onSuccess(Object obj) {
                AuthOtpActivity.this.t0((Void) obj);
            }
        });
        startSmsRetriever.addOnFailureListener(new OnFailureListener() {
            public final void onFailure(Exception exc) {
                AuthOtpActivity.this.u0(exc);
            }
        });
        BBSmsReceiver bBSmsReceiver3 = this.t;
        if (bBSmsReceiver3 != null && (intentFilter = this.v) != null) {
            if (Build.VERSION.SDK_INT >= 33) {
                registerReceiver(bBSmsReceiver3, intentFilter, 2);
            } else {
                registerReceiver(bBSmsReceiver3, intentFilter);
            }
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                AuthOtpActivity.this.v0();
            }
        }, 500L);
    }

    public final void O0() {
        this.j.setBackgroundDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.button_rounded25dp_gray, (Resources.Theme) null));
    }

    public final void P0() {
        Affinity.openDraftWhatsApp(this, this.w.getPhoneToMessage(), "*Request OTP Login " + Device.getDeviceUUID(this) + " " + this.w.getInitial() + "*\nKirim pesan ini untuk mendapatkan konten OTP");
    }

    public final void Q0() {
        this.p = "WhatsApp";
        I0();
    }

    public final void R0() {
        this.i.setVisibility(8);
        this.n.setVisibility(0);
        this.g.setText("");
        O0();
        L0();
        if (Var.toInt(new AppSession(this).retrieve(AppSession.PROPERTY_REGISTERED_WHATSAPP), 0) == 0) {
            this.l.setEnabled(false);
            this.l.setTextColor(ContextCompat.getColor(this, R.color.grey));
            this.l.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_whatsapp_disable, 0, 0, 0);
        } else {
            this.l.setEnabled(true);
            this.l.setTextColor(ContextCompat.getColor(this, R.color.green_whatsapp));
            this.l.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_whatsapp, 0, 0, 0);
        }
    }

    public final void S0(int i, final String str) {
        E0();
        if (i == 2) {
            AuthHelper.validateOTPv2(this, this.o, str, 2, this.p, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.y0(str, i2, (AuthHelper.OTPResponse) obj);
                }
            });
        } else if (i == 0 || i == 3) {
            AuthHelper.validateOTPv2(this, this.o, str, 0, this.p, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.A0(str, i2, (AuthHelper.OTPResponse) obj);
                }
            });
        } else {
            AuthHelper.validateOTPv2(this, this.o, str, 1, this.p, new BBCallback() {
                @Override
                public final void do_callback(int i2, Object obj) {
                    AuthOtpActivity.this.D0(str, i2, (AuthHelper.OTPResponse) obj);
                }
            });
        }
    }

    public final void V(Date date) {
        this.i.setVisibility(0);
        d dVar = new d(date.getTime() - new Date().getTime(), 1000L);
        this.f = dVar;
        dVar.start();
    }

    @Override
    public int getLayoutResource() {
        return R.layout.activity_auth_otp;
    }

    @Override
    public int getRootLayoutId() {
        return 0;
    }

    public void onActivityResult(int i, int i2, @Nullable Intent intent) {
        if (i != 2374) {
            super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        } else if (W(this)) {
            DialogPlus dialogPlus = this.m;
            if (dialogPlus != null) {
                dialogPlus.dismiss();
            }
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.Y();
                }
            }, 500L);
        }
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == 2131366324) {
            Affinity.launch(this, LiveChatActivity.class);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        EventHelper.sendAllEvents(this, FirebaseHelper.EVENT_SCREEN_VIEW, getClass().getSimpleName().replace("Activity", ""));
        this.r = "not:wa:link:otp";
        if (bundle != null) {
            this.o = bundle.getString("phone", "");
            this.s = bundle.getInt("state", 1);
            this.e = bundle.getInt("is_wa", 0);
        } else if (getIntent().getExtras() != null) {
            Bundle extras = getIntent().getExtras();
            this.o = extras.getString("phone", "");
            this.s = extras.getInt("state", 1);
            this.e = extras.getInt("is_wa", 0);
            this.r = extras.getString("wa:otp", "not:wa:link:otp");
            String string = extras.getString("config_wa", "");
            if (string.isEmpty()) {
                this.w = null;
            } else {
                this.w = buildScOtpTypeEntity(string);
            }
        } else {
            this.o = "";
            this.s = 1;
            this.e = 0;
        }
        StringBuilder sb = new StringBuilder();
        sb.append("onCreate: phone : ");
        sb.append(this.o);
        StringBuilder sb2 = new StringBuilder();
        sb2.append("onCreate: state : ");
        sb2.append(this.s);
        StringBuilder sb3 = new StringBuilder();
        sb3.append("onCreate: isWA : ");
        sb3.append(this.e);
        int color = ResourcesCompat.getColor(getResources(), R.color.colorTransparent, (Resources.Theme) null);
        Toolbar toolbar = this.bb_toolbar;
        if (toolbar != null) {
            toolbar.setBackgroundColor(color);
            this.bb_toolbar.setNavigationIcon(R.drawable.ic_chevron_left_primary_24dp);
            Drawable navigationIcon = this.bb_toolbar.getNavigationIcon();
            Objects.requireNonNull(navigationIcon);
            navigationIcon.setColorFilter(getResources().getColor(R.color.new_button_text_color), PorterDuff.Mode.SRC_ATOP);
            TextView textView = (TextView) findViewById(R.id.toolbar_title);
            int i = this.s;
            if (i == 2) {
                textView.setText(getString(R.string.bonjour_toolbar_login));
            } else if (i == 0 || i == 3) {
                textView.setText(getString(R.string.bonjour_toolbar_reset));
            } else {
                textView.setText(getString(R.string.bonjour_toolbar_register));
            }
        }
        int i2 = this.e;
        if ((i2 == 0 && this.s == 2) || ((i2 == 0 && this.s == 3) || ((i2 == 0 && this.s == 0) || (i2 == 0 && this.s == 1)))) {
            this.p = "SMS";
        } else {
            this.p = "WhatsApp";
        }
        this.i = findViewById(R.id.vg_cooldown);
        TextView textView2 = (TextView) findViewById(R.id.tv_label);
        this.h = (TextView) findViewById(R.id.tv_timeline_cooldown);
        this.n = findViewById(R.id.vg_resend_otp);
        findViewById(R.id.acib_back).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                AuthOtpActivity.this.Z(view);
            }
        });
        this.k = findViewById(R.id.sms_button);
        this.l = findViewById(R.id.wa_button);
        textView2.setText(Compat.Html_fromHtml(getString(R.string.bonjour_otp_subheading_override, this.o)));
        this.g = findViewById(R.id.input_otp);
        findViewById(R.id.toolbar_help_container).setOnClickListener(this);
        this.j = findViewById(R.id.btn_validate_otp);
        if (this.w == null) {
            ApiConfig.fetchScOtpType(this, new BBCallback() {
                @Override
                public final void do_callback(int i3, Object obj) {
                    AuthOtpActivity.this.b0(i3, (String) obj);
                }
            });
        } else {
            K0();
            J0();
        }
    }

    public void onDestroy() {
        super.onDestroy();
        try {
            BBFourDigitReceiver bBFourDigitReceiver = this.u;
            if (bBFourDigitReceiver != null) {
                unregisterReceiver(bBFourDigitReceiver);
            }
            BBSmsReceiver bBSmsReceiver = this.t;
            if (bBSmsReceiver != null) {
                unregisterReceiver(bBSmsReceiver);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onInteractionListener() {
    }

    public void onOTPComplete(String str) {
        S0(this.s, str);
    }

    public void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        try {
            BBFourDigitReceiver bBFourDigitReceiver = this.u;
            if (bBFourDigitReceiver != null) {
                unregisterReceiver(bBFourDigitReceiver);
            }
            BBSmsReceiver bBSmsReceiver = this.t;
            if (bBSmsReceiver != null) {
                unregisterReceiver(bBSmsReceiver);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.last_four_digit");
        int i = Build.VERSION.SDK_INT;
        if (i >= 26) {
            registerReceiver(this.u, intentFilter, 2);
        } else {
            registerReceiver(this.u, intentFilter);
        }
        if (i > 27) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.c0();
                }
            }, 500L);
        }
        if (this.t == null || this.v == null) {
            return;
        }
        if (i >= 26) {
            registerReceiver(this.u, intentFilter, 2);
        } else {
            registerReceiver(this.u, intentFilter);
        }
    }

    @Override
    public void sendEvent(String str, String str2, String str3, String str4, ArrayList<String> arrayList) {
        if (str4.contains(":")) {
            final String trim = str4.split("#")[1].trim();
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public final void run() {
                    AuthOtpActivity.this.o0(trim);
                }
            });
        }
    }

    public static Bundle getBundle(AuthActivity authActivity, String str, int i, int i2, String str2) {
        Bundle bundle = new Bundle();
        bundle.putAll(authActivity.getGPSBundle());
        bundle.putString("phone", str);
        bundle.putInt("state", i);
        bundle.putInt("is_wa", i2);
        bundle.putString("config_wa", str2);
        return bundle;
    }

    public static Bundle getBundle(String str, int i, int i2, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("phone", str);
        bundle.putInt("state", i);
        bundle.putInt("is_wa", i2);
        bundle.putString("wa:otp", str2);
        return bundle;
    }
}