APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:JioFiberPartner
版本号:5.2.0
包名称:com.jfp.prod

MD5 校验值:7cd346351ab05a28e42aff65173e0141

反编译源代码说明

OTPActivity.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.leptonsoftware.fibernet;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.ColorDrawable;
import android.location.Location;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import com.android.volley.VolleyError;
import com.android.volley.c;
import com.android.volley.j;
import com.android.volley.k;
import com.android.volley.toolbox.k;
import com.android.volley.toolbox.l;
import com.google.android.material.snackbar.Snackbar;
import com.leptonsoftware.fibernet.broadcasts.SmsBroadcastReceiver;
import com.leptonsoftware.fibernet.datamodel.languageObj;
import com.leptonsoftware.fibernet.jsonparser.ApiType;
import com.leptonsoftware.fibernet.jsonparser.JsonParser;
import com.leptonsoftware.fibernet.jsonparser.WebApi;
import com.leptonsoftware.fibernet.logger.LepLogger;
import com.leptonsoftware.fibernet.repository.NetworkRespCodes;
import com.leptonsoftware.fibernet.repository.RemoteDataCallback;
import com.leptonsoftware.fibernet.repository.RemoteDataRepository;
import com.leptonsoftware.fibernet.requests.BaseReq;
import com.leptonsoftware.fibernet.requests.GetOTPReq;
import com.leptonsoftware.fibernet.requests.VerifyOTPReq;
import com.leptonsoftware.fibernet.responses.BaseResp;
import com.leptonsoftware.fibernet.responses.GetOTPResp;
import com.leptonsoftware.fibernet.responses.LangResourceResp;
import com.leptonsoftware.fibernet.responses.TokenResponse;
import com.leptonsoftware.fibernet.responses.VerifyOTPResp;
import com.leptonsoftware.fibernet.toasty.Toasty;
import com.leptonsoftware.fibernet.util.AppConstants;
import com.leptonsoftware.fibernet.util.AppUtil;
import com.leptonsoftware.fibernet.util.SharePrefConstants;
import com.leptonsoftware.fibernet.util.SharePrefFactory;
import com.leptonsoftware.fibernet.views.OtpEditText;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import l3.a;
import u4.e;
import u4.f;

public class OTPActivity extends BaseActivity {
    private static final String FORMAT = "%02d:%02d";
    private static final int PERMISSION_CONSTANT = 100;
    private static final int REQ_USER_CONSENT = 200;
    private static final String TAG = "OTPActivity";
    private Location current_login_location;
    private OtpEditText etOTP;
    private boolean forceLogin;
    private ImageView ivLeptonLogo;
    private TextView iv_back;
    private ImageView iv_show_hide_pwd;
    private ImageView iv_toolbar_logout;
    private LangResourceResp langResourceResp;
    LinearLayout lllang;
    private Bundle mBundle;
    private LepLogger mLepLogger;
    private CountDownTimer mResendOTPTimer;
    private TokenResponse mTokenResponse;
    private ProgressDialog progressDialog;
    private languageObj sellanguageObj;
    private SmsBroadcastReceiver smsBroadcastReceiver;
    private Spinner sp_lang;
    private TextView tvContinue;
    private TextView tvMessage;
    private TextView tvMessageTop;
    private TextView tvResendOTP;
    private TextView tvSpectra;
    private TextView tvTimer;
    private TextView tv_copyright;
    private TextView tv_toolbar_title;
    private TextView tv_toolbar_user_name;
    private TextView tventerotp;
    private TextView tvterms;
    private TextView version;
    boolean doubleBackToExitPressedOnce = false;
    View.OnClickListener mOnClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int id = view.getId();
            if (id == com.jfp.prod.R.id.ivLeptonLogo) {
                if (OTPActivity.this.getCallingActivity() != null && (OTPActivity.this.getCallingActivity() == null || !OTPActivity.this.getCallingActivity().getPackageName().equalsIgnoreCase(BuildConfig.APPLICATION_ID))) {
                    OTPActivity.this.finish();
                    return;
                }
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.setData(Uri.parse("https://www.leptonsoftware.com/"));
                OTPActivity.this.startActivity(intent);
                return;
            }
            if (id != com.jfp.prod.R.id.tvContinue) {
                if (id != com.jfp.prod.R.id.tvResendOTP) {
                    return;
                }
                OTPActivity.this.startSmsUserConsent();
                OTPActivity.this.etOTP.setText("");
                OTPActivity.this.getOTP();
                return;
            }
            if (AppUtil.isNetworkConnected(OTPActivity.this.getApplicationContext())) {
                if (OTPActivity.this.isValidData()) {
                    OTPActivity oTPActivity = OTPActivity.this;
                    oTPActivity.verifyOTP(oTPActivity.etOTP.getText().toString().trim());
                    return;
                }
                return;
            }
            OTPActivity oTPActivity2 = OTPActivity.this;
            oTPActivity2.alertDialog(oTPActivity2.getString(com.jfp.prod.R.string.alert), OTPActivity.this.getString(com.jfp.prod.R.string.message_noInternet));
        }
    };
    private int resendOTPClicked = 0;
    private int verifyOTPClicked = 0;
    RemoteDataCallback mRemoteDataCallback = new RemoteDataCallback() {
        @Override
        public void remoteDataResponse(ApiType apiType, int i10, Object obj) {
            OTPActivity.this.dismissProgressDialog();
            int i11 = AnonymousClass14.$SwitchMap$com$leptonsoftware$fibernet$jsonparser$ApiType[apiType.ordinal()];
            if (i11 == 1) {
                if (i10 == 200) {
                    GetOTPResp getOTPResp = (GetOTPResp) obj;
                    if (getOTPResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) {
                        OTPActivity.this.uiStateOnGetOTP(getOTPResp.getResults());
                        return;
                    } else {
                        OTPActivity oTPActivity = OTPActivity.this;
                        oTPActivity.alertDialog(oTPActivity.getString(com.jfp.prod.R.string.error), getOTPResp.getError_message());
                        return;
                    }
                }
                if (i10 == 401) {
                    if (obj == null || obj.toString().isEmpty()) {
                        return;
                    }
                    try {
                        String obj2 = obj.toString();
                        BaseResp baseResp = (BaseResp) JsonParser.convertJsonToBean(ApiType.BASE_RESPONSE, obj.toString());
                        if (baseResp != null) {
                            if (baseResp.getError_message() != null) {
                                obj2 = baseResp.getError_message();
                            } else if (baseResp.getMessage() != null) {
                                obj2 = baseResp.getMessage();
                            }
                        }
                        OTPActivity oTPActivity2 = OTPActivity.this;
                        AppUtil.logoutAlertDialog(oTPActivity2, oTPActivity2.getString(com.jfp.prod.R.string.error), obj2);
                        return;
                    } catch (Exception e10) {
                        e10.printStackTrace();
                        return;
                    }
                }
                OTPActivity oTPActivity3 = OTPActivity.this;
                oTPActivity3.alertDialog(oTPActivity3.getString(com.jfp.prod.R.string.error), obj.toString());
                return;
            }
            if (i11 != 2) {
                return;
            }
            if (i10 == 200) {
                VerifyOTPResp verifyOTPResp = (VerifyOTPResp) obj;
                if (verifyOTPResp.getStatus().equalsIgnoreCase(NetworkRespCodes.OK)) {
                    OTPActivity.this.uiStateOnVerifyOTP(verifyOTPResp.getResults());
                    return;
                } else {
                    OTPActivity oTPActivity4 = OTPActivity.this;
                    oTPActivity4.alertDialog(oTPActivity4.getString(com.jfp.prod.R.string.error), verifyOTPResp.getError_message());
                    return;
                }
            }
            if (i10 == 401) {
                if (obj == null || obj.toString().isEmpty()) {
                    return;
                }
                try {
                    String obj3 = obj.toString();
                    BaseResp baseResp2 = (BaseResp) JsonParser.convertJsonToBean(ApiType.BASE_RESPONSE, obj.toString());
                    if (baseResp2 != null) {
                        if (baseResp2.getError_message() != null) {
                            obj3 = baseResp2.getError_message();
                        } else if (baseResp2.getMessage() != null) {
                            obj3 = baseResp2.getMessage();
                        }
                    }
                    OTPActivity oTPActivity5 = OTPActivity.this;
                    AppUtil.logoutAlertDialog(oTPActivity5, oTPActivity5.getString(com.jfp.prod.R.string.error), obj3);
                    return;
                } catch (Exception e11) {
                    e11.printStackTrace();
                    return;
                }
            }
            OTPActivity oTPActivity6 = OTPActivity.this;
            oTPActivity6.alertDialog(oTPActivity6.getString(com.jfp.prod.R.string.error), obj.toString());
        }
    };

    static class AnonymousClass14 {
        static final int[] $SwitchMap$com$leptonsoftware$fibernet$jsonparser$ApiType;

        static {
            int[] iArr = new int[ApiType.values().length];
            $SwitchMap$com$leptonsoftware$fibernet$jsonparser$ApiType = iArr;
            try {
                iArr[ApiType.GET_OTP.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                $SwitchMap$com$leptonsoftware$fibernet$jsonparser$ApiType[ApiType.VERIFY_OTP.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    private void alertDialogOtherDeviceConfirmBox(String str) {
        final Dialog dialog = new Dialog(this);
        dialog.requestWindowFeature(1);
        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
        dialog.setContentView(com.jfp.prod.R.layout.custom_alert);
        dialog.setCanceledOnTouchOutside(false);
        dialog.setCancelable(true);
        ImageView imageView = (ImageView) dialog.findViewById(com.jfp.prod.R.id.iv_icon);
        Button button = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_ok);
        Button button2 = (Button) dialog.findViewById(com.jfp.prod.R.id.btn_cancel);
        TextView textView = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_title);
        TextView textView2 = (TextView) dialog.findViewById(com.jfp.prod.R.id.tv_message);
        imageView.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.alert));
        button.setBackground(dialog.getContext().getDrawable(com.jfp.prod.R.drawable.btn_alert_ok_info));
        button2.setVisibility(0);
        textView.setText("Info");
        textView2.setText(str);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (dialog.isShowing()) {
                    OTPActivity.this.forceLogin = true;
                    dialog.dismiss();
                }
            }
        });
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (dialog.isShowing()) {
                    dialog.dismiss();
                }
            }
        });
        dialog.show();
    }

    private void changeExpireTime(long j10) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(13, (int) j10);
        SharePrefFactory.setStringPref(this, SharePrefConstants.TIME_REMAINING, String.valueOf(calendar.getTimeInMillis()));
        System.out.println("Time" + calendar.getTime());
    }

    public void dismissProgressDialog() {
        ProgressDialog progressDialog;
        if (isFinishing() || (progressDialog = this.progressDialog) == null || !progressDialog.isShowing()) {
            return;
        }
        this.progressDialog.dismiss();
    }

    private void finishResendOTPTimer() {
        CountDownTimer countDownTimer = this.mResendOTPTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
            this.mResendOTPTimer = null;
        }
    }

    public void getOTP() {
        Bundle bundle = this.mBundle;
        if (bundle == null) {
            return;
        }
        GetOTPReq getOTPReq = new GetOTPReq(bundle.getString("userName"), this.mBundle.getLong("userId"), "Mobile");
        BaseReq baseReq = new BaseReq();
        baseReq.setData(JsonParser.convertBeanToJson(getOTPReq));
        showProgressDialog("Requesting for OTP...");
        RemoteDataRepository.getInstance().getOTP(getHeaderMap(), ApiType.GET_OTP, baseReq, this.mRemoteDataCallback);
    }

    private void getOtpFromMessage(String str, int i10) {
        Pattern.compile("(|^)\\d{6}");
        Matcher matcher = Pattern.compile("(|^)\\d{" + this.etOTP.mMaxLength + "}").matcher(str);
        if (matcher.find()) {
            this.etOTP.setText(matcher.group(0));
        }
    }

    private void initViews() {
        this.version = (TextView) findViewById(com.jfp.prod.R.id.version);
        this.tvContinue = (TextView) findViewById(com.jfp.prod.R.id.tvContinue);
        this.tv_copyright = (TextView) findViewById(com.jfp.prod.R.id.tv_copyright);
        this.tvResendOTP = (TextView) findViewById(com.jfp.prod.R.id.tvResendOTP);
        this.tvTimer = (TextView) findViewById(com.jfp.prod.R.id.tvTimer);
        this.etOTP = (OtpEditText) findViewById(com.jfp.prod.R.id.etOTP);
        this.tvMessage = (TextView) findViewById(com.jfp.prod.R.id.tvMessage);
        this.tvMessageTop = (TextView) findViewById(com.jfp.prod.R.id.tvMessageTop);
        this.tventerotp = (TextView) findViewById(com.jfp.prod.R.id.tventerotp);
        this.tvterms = (TextView) findViewById(com.jfp.prod.R.id.tvterms);
        setTypeface();
    }

    public boolean isValidData() {
        if (this.etOTP.getText().toString().trim().isEmpty()) {
            Snackbar.w(this.etOTP, getResources().getString(com.jfp.prod.R.string.enter_otp), -1).r();
            return false;
        }
        int length = this.etOTP.getText().toString().trim().length();
        OtpEditText otpEditText = this.etOTP;
        if (length >= otpEditText.mMaxLength) {
            return true;
        }
        Snackbar.w(otpEditText, getResources().getString(com.jfp.prod.R.string.enter_valid_otp), -1).r();
        return false;
    }

    public void moveNext() {
        if (this.mTokenResponse.getIsMasterLogin() != null) {
            SharePrefFactory.setStringPref(this, SharePrefConstants.MASTERLOGIN, this.mTokenResponse.getIsMasterLogin());
        }
        if (AppUtil.setGlobalSettingData(this.mTokenResponse, this.mLepLogger, this, "")) {
            if (SharePrefFactory.getStringPref(this, SharePrefConstants.MASTERLOGIN).equalsIgnoreCase("False") && SharePrefFactory.getIntPref(this, SharePrefConstants.IS_CURRENT_LOCATION_ENABLED, 0) == 1) {
                AppUtil.startCurrentLocationUpdate(getApplicationContext());
            }
            openActivity(ModuleActivity.class, true, null);
            return;
        }
        alertDialog(getString(com.jfp.prod.R.string.error), "Global settings not configured properly. Please contact to administrator");
    }

    private void registerBroadcastReceiver() {
        SmsBroadcastReceiver smsBroadcastReceiver = new SmsBroadcastReceiver();
        this.smsBroadcastReceiver = smsBroadcastReceiver;
        smsBroadcastReceiver.smsBroadcastReceiverListener = new SmsBroadcastReceiver.SmsBroadcastReceiverListener() {
            @Override
            public void onFailure() {
            }

            @Override
            public void onSuccess(Intent intent) {
                if (OTPActivity.this.getCallingActivity() != null && (OTPActivity.this.getCallingActivity() == null || !OTPActivity.this.getCallingActivity().getPackageName().equalsIgnoreCase(BuildConfig.APPLICATION_ID))) {
                    OTPActivity.this.finish();
                } else {
                    OTPActivity.this.startActivityForResult(intent, 200);
                }
            }
        };
        registerReceiver(this.smsBroadcastReceiver, new IntentFilter("com.google.android.gms.auth.api.phone.SMS_RETRIEVED"));
    }

    private void setListener() {
        this.tvContinue.setOnClickListener(this.mOnClickListener);
        this.tvResendOTP.setOnClickListener(this.mOnClickListener);
        this.etOTP.addTextChangedListener(new TextWatcher() {
            @Override
            public void afterTextChanged(Editable editable) {
                if (editable == null || editable.toString().length() <= 5) {
                    OTPActivity.this.tvContinue.setEnabled(false);
                } else {
                    OTPActivity.this.tvContinue.setEnabled(true);
                }
            }

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i10, int i11, int i12) {
            }
        });
    }

    private void setTypeface() {
        if (AppUtil.isJioPartnerFiber()) {
            this.tvTimer.setTypeface(AppUtil.getStaticJioTypeMediumTypeface(this));
            this.tvResendOTP.setTypeface(AppUtil.getStaticJioTypeMediumTypeface(this));
            this.tvMessageTop.setTypeface(AppUtil.getStaticJioTypeMediumTypeface(this));
            this.tventerotp.setTypeface(AppUtil.getStaticJioTypeBoldTypeface(this));
            this.tvterms.setTypeface(AppUtil.getStaticJioTypeMediumTypeface(this));
            this.tvterms.setMovementMethod(LinkMovementMethod.getInstance());
        }
        this.tvContinue.setTypeface(AppUtil.getStaticRobotoMediumTypeface(this));
    }

    private void showFooterMessage(String str, long j10) {
        if (str == null || str.isEmpty()) {
            return;
        }
        alertDialogAutoDismiss("Info", str, j10);
    }

    private void showProgressDialog(String str) {
        if (this.progressDialog != null) {
            this.progressDialog = null;
        }
        this.progressDialog = ProgressDialog.show(this, null, str, true);
    }

    private void showResendOTPTimer(long j10, final boolean z9) {
        finishResendOTPTimer();
        this.mResendOTPTimer = new CountDownTimer(TimeUnit.SECONDS.toMillis(j10), 1000L) {
            @Override
            public void onFinish() {
                OTPActivity.this.tvTimer.setVisibility(8);
                OTPActivity.this.tvMessage.setText("");
                if (z9) {
                    OTPActivity.this.tvContinue.setEnabled(true);
                    OTPActivity.this.tvResendOTP.setEnabled(true);
                    OTPActivity.this.etOTP.setEnabled(true);
                } else {
                    OTPActivity.this.tvResendOTP.setEnabled(true);
                    OTPActivity.this.etOTP.setEnabled(true);
                }
            }

            @Override
            public void onTick(long j11) {
                if (OTPActivity.this.tvTimer.getVisibility() != 0) {
                    OTPActivity.this.tvTimer.setVisibility(0);
                }
                if (OTPActivity.this.tvResendOTP.isEnabled()) {
                    OTPActivity.this.tvResendOTP.setEnabled(false);
                }
                if (OTPActivity.this.tvContinue.isEnabled() && z9) {
                    OTPActivity.this.tvContinue.setEnabled(false);
                    OTPActivity.this.etOTP.setEnabled(false);
                }
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                String format = String.format(OTPActivity.FORMAT, Long.valueOf(timeUnit.toMinutes(j11) - TimeUnit.HOURS.toMinutes(timeUnit.toHours(j11))), Long.valueOf(timeUnit.toSeconds(j11) - TimeUnit.MINUTES.toSeconds(timeUnit.toMinutes(j11))));
                OTPActivity.this.tvTimer.setText(" " + format + " ");
            }
        }.start();
    }

    public void startSmsUserConsent() {
        a.a(this).r(null).j(new f<Void>() {
            @Override
            public void onSuccess(Void r12) {
            }
        }).g(new e() {
            @Override
            public void onFailure(Exception exc) {
            }
        });
    }

    private void testGetOTP() {
    }

    private void testValidateOTP() {
    }

    private void tokenRequest() {
        final j a10 = l.a(this);
        k kVar = new k(1, WebApi.getWebApi(ApiType.TOKEN), new k.b<String>() {
            @Override
            public void onResponse(String str) {
                OTPActivity.this.mLepLogger.error(OTPActivity.TAG, "Response()" + str);
                OTPActivity.this.progressDialog.dismiss();
                if (str != null) {
                    try {
                        if (!str.isEmpty()) {
                            OTPActivity.this.mTokenResponse = (TokenResponse) JsonParser.convertJsonToBean(ApiType.TOKEN, str);
                            if (OTPActivity.this.mTokenResponse != null) {
                                if (!OTPActivity.this.mTokenResponse.isActive()) {
                                    OTPActivity oTPActivity = OTPActivity.this;
                                    oTPActivity.alertDialog(oTPActivity.getString(com.jfp.prod.R.string.error), OTPActivity.this.getString(com.jfp.prod.R.string.account_deactivated));
                                } else {
                                    OTPActivity oTPActivity2 = OTPActivity.this;
                                    SharePrefFactory.setStringPref(oTPActivity2, SharePrefConstants.MASTERLOGIN, oTPActivity2.mTokenResponse.getIsMasterLogin());
                                    OTPActivity.this.moveNext();
                                }
                            } else {
                                OTPActivity.this.mLepLogger.error(OTPActivity.TAG, "tokenRequest():onResponse(): unable to parse the data:" + str);
                                OTPActivity oTPActivity3 = OTPActivity.this;
                                oTPActivity3.alertDialog(oTPActivity3.getString(com.jfp.prod.R.string.error), "Data parsing error");
                            }
                            a10.e();
                        }
                    } catch (Exception e10) {
                        e10.printStackTrace();
                        OTPActivity.this.mLepLogger.error(OTPActivity.TAG, "tokenRequest():onResponse(): Exception:" + e10.getMessage());
                        OTPActivity oTPActivity4 = OTPActivity.this;
                        oTPActivity4.alertDialog(oTPActivity4.getString(com.jfp.prod.R.string.error), e10.getMessage());
                        return;
                    }
                }
                OTPActivity.this.mLepLogger.error(OTPActivity.TAG, "tokenRequest():onResponse(): response is:" + str);
                OTPActivity oTPActivity5 = OTPActivity.this;
                oTPActivity5.alertDialog(oTPActivity5.getString(com.jfp.prod.R.string.error), "Response is empty");
                a10.e();
            }
        }, new k.a() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                OTPActivity.this.progressDialog.dismiss();
                OTPActivity oTPActivity = OTPActivity.this;
                AppUtil.onVolleyErrorResponseHandling(oTPActivity, oTPActivity.mLepLogger, volleyError, OTPActivity.TAG);
                a10.e();
            }
        }) {
            @Override
            public Map<String, String> getHeaders() {
                HashMap hashMap = new HashMap();
                if (OTPActivity.this.mBundle != null) {
                    hashMap.put("Authorization", "bearer " + OTPActivity.this.mBundle.getString("access_token"));
                }
                OTPActivity.this.mLepLogger.info(OTPActivity.TAG, "getModule(): getHeaders():" + hashMap.toString());
                return hashMap;
            }

            @Override
            protected Map<String, String> getParams() {
                HashMap hashMap = new HashMap();
                hashMap.put("grant_type", "refresh_token");
                if (OTPActivity.this.mBundle != null) {
                    hashMap.put("refresh_token", OTPActivity.this.mBundle.getString("refresh_token"));
                }
                OTPActivity.this.mLepLogger.info(OTPActivity.TAG, "tokenRequest(): getParams():" + hashMap.toString());
                return hashMap;
            }
        };
        this.mLepLogger.info(TAG, "tokenRequest() URL:" + kVar.getUrl());
        kVar.setRetryPolicy(new c(constants.MY_SOCKET_TIMEOUT_MS, 0, 1.0f));
        a10.a(kVar);
        this.progressDialog = ProgressDialog.show(this, null, "Creating secure connection...", true);
    }

    public void uiStateOnGetOTP(GetOTPResp.Result result) {
        if (result == null) {
            alertDialog(getString(com.jfp.prod.R.string.error), "Invalid response");
            return;
        }
        this.tvMessageTop.setText("Enter the " + result.getOTP_length() + "-digit OTP sent to\n" + result.getMasked_mobile_no());
        this.etOTP.setFilters(new InputFilter[]{new InputFilter.LengthFilter(result.getOTP_length())});
        this.etOTP.mMaxLength = result.getOTP_length();
        this.etOTP.mNumChars = (float) result.getOTP_length();
        focusOnEdittextView(this.etOTP);
        long resend_otp_timer = result.getResend_otp_timer();
        if (result.isIs_locked()) {
            resend_otp_timer = result.getLocked_timer();
            this.tvMessage.setText(result.getMessage());
        } else {
            showFooterMessage(result.getMessage(), result.getAlert_message_timeout());
        }
        showResendOTPTimer(resend_otp_timer, result.isIs_locked());
    }

    public void uiStateOnVerifyOTP(VerifyOTPResp.Result result) {
        if (result == null) {
            alertDialog(getString(com.jfp.prod.R.string.error), "Invalid response");
            return;
        }
        this.tvMessage.setText(result.getMessage());
        if (result.isIs_verified()) {
            tokenRequest();
            return;
        }
        if (result.getLocked_timer() > 0) {
            showResendOTPTimer(result.getLocked_timer(), true);
        }
        showFooterMessage(result.getFooter_message(), result.getAlert_message_timeout());
    }

    public void verifyOTP(String str) {
        Bundle bundle = this.mBundle;
        if (bundle == null) {
            return;
        }
        VerifyOTPReq verifyOTPReq = new VerifyOTPReq(bundle.getString("userName"), this.mBundle.getLong("userId"), str, "Mobile");
        BaseReq baseReq = new BaseReq();
        baseReq.setData(JsonParser.convertBeanToJson(verifyOTPReq));
        showProgressDialog("Verifying OTP...");
        RemoteDataRepository.getInstance().verifyOTP(getHeaderMap(), ApiType.VERIFY_OTP, baseReq, this.mRemoteDataCallback);
    }

    public HashMap<String, String> getHeaderMap() {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("Authorization", "bearer " + this.mBundle.get("access_token"));
        return hashMap;
    }

    @Override
    public void initLogger() {
        LepLogger lepLogger = LepLogger.getInstance();
        this.mLepLogger = lepLogger;
        if (!lepLogger.init(getResources().getString(com.jfp.prod.R.string.app_name))) {
            System.out.println("Unable to init logger.");
            finish();
        }
        this.mLepLogger.setCurrentLogLevel(0);
    }

    @Override
    public boolean isStoragePermissionGranted() {
        if (Build.VERSION.SDK_INT >= 23) {
            if (checkSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") == 0) {
                Log.v(TAG, "Permission is granted");
                return true;
            }
            Log.v(TAG, "Permission is revoked");
            return false;
        }
        Log.v(TAG, "Permission is granted");
        return true;
    }

    @Override
    public void onActivityResult(int i10, int i11, Intent intent) {
        super.onActivityResult(i10, i11, intent);
        if (i10 == 200 && i11 == -1 && intent != null) {
            String stringExtra = intent.getStringExtra("com.google.android.gms.auth.api.phone.EXTRA_SMS_MESSAGE");
            showToast(stringExtra);
            getOtpFromMessage(stringExtra, this.etOTP.mMaxLength);
        }
    }

    @Override
    public void onBackPressed() {
        if (this.doubleBackToExitPressedOnce) {
            finish();
        }
        this.doubleBackToExitPressedOnce = true;
        showToast("Please click BACK again to exit");
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                OTPActivity.this.doubleBackToExitPressedOnce = false;
            }
        }, 2000L);
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(com.jfp.prod.R.layout.activity_otp);
        initViews();
        setListener();
        String flavourName = AppUtil.getFlavourName("PROD");
        this.version.setText("Version 5.2.0 (" + flavourName + ")");
        this.mBundle = getIntent().getExtras();
        startSmsUserConsent();
        this.tvResendOTP.callOnClick();
    }

    @Override
    public void onRequestPermissionsResult(int i10, String[] strArr, int[] iArr) {
        if (i10 == 100) {
            for (int i11 = 0; i11 < strArr.length; i11++) {
                if (iArr[i11] != 0) {
                    onCreateErrorDialog(getString(com.jfp.prod.R.string.exit), strArr[i11] + " denied");
                    return;
                }
            }
            initLogger();
            if (((LocationManager) getSystemService(AppConstants.Offline_Location_Action)).isProviderEnabled("gps")) {
                return;
            }
            buildAlertMessageNoGps();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onStart() {
        super.onStart();
        registerBroadcastReceiver();
    }

    @Override
    public void onStop() {
        super.onStop();
        unregisterReceiver(this.smsBroadcastReceiver);
    }

    @Override
    public void showToast(String str) {
        Toasty.info((Context) this, (CharSequence) str, 0, true).show();
    }
}