正在查看: Clash Legends v0.0.1 应用的 JuspayBrowserFragment.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 JuspayBrowserFragment.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.juspay.godel.ui;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.provider.Settings;
import android.provider.Telephony;
import android.telephony.CellInfo;
import android.telephony.CellInfoCdma;
import android.telephony.CellInfoGsm;
import android.telephony.CellInfoLte;
import android.telephony.CellInfoWcdma;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.telephony.TelephonyManager;
import android.text.Html;
import android.util.Base64;
import android.util.Log;
import android.view.GestureDetector;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.view.GestureDetectorCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.onesignal.core.internal.database.impl.OneSignalDbContract;
import com.onesignal.location.internal.common.LocationConstants;
import com.payu.india.Payu.PayuConstants;
import com.payu.upisdk.util.UpiConstant;
import in.juspay.godel.R;
import in.juspay.godel.analytics.Event;
import in.juspay.godel.analytics.GodelTracker;
import in.juspay.godel.browser.DummyWebviewClient;
import in.juspay.godel.browser.JuspayWebChromeClient;
import in.juspay.godel.browser.JuspayWebViewClient;
import in.juspay.godel.browser.WebviewClientImpl;
import in.juspay.godel.core.AssetService;
import in.juspay.godel.core.ConfigService;
import in.juspay.godel.core.Constants;
import in.juspay.godel.core.GodelOffReasons;
import in.juspay.godel.core.JuspayDropoutAnalyser;
import in.juspay.godel.core.LoggingUtil;
import in.juspay.godel.core.OtpSms;
import in.juspay.godel.core.PaymentDetails;
import in.juspay.godel.core.RemoteAssetService;
import in.juspay.godel.core.WebLabService;
import in.juspay.godel.ui.OnScreenDisplay;
import in.juspay.godel.ui.dialog.JuspayBranding;
import in.juspay.godel.ui.dialog.JuspayWaitingDialogManager;
import in.juspay.godel.ui.uber.UberController;
import in.juspay.godel.util.DropoutInterface;
import in.juspay.godel.util.EncryptionHelper;
import in.juspay.godel.util.FragmentConfig;
import in.juspay.godel.util.JuspayLogger;
import in.juspay.godel.util.JuspayRunnable;
import in.juspay.godel.util.KeyValueStore;
import in.juspay.godel.util.OnSwipeTouchListener;
import in.juspay.godel.util.OtpUtil;
import in.juspay.godel.util.SessionInfo;
import in.juspay.godel.util.UncaughtExceptionHandler;
import in.juspay.juspaysafe.BrowserParams;
import in.juspay.juspaysafe.JuspaySafeBrowser;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.Thread;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Stack;
import kotlinx.coroutines.DebugKt;
import kotlinx.coroutines.scheduling.WorkQueueKt;
import org.apache.http.conn.util.InetAddressUtils;
import org.apache.http.util.EncodingUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class JuspayBrowserFragment extends GodelFragment implements ValueAnimator.AnimatorUpdateListener, DialogInterface.OnCancelListener, LocationListener, View.OnClickListener, View.OnTouchListener, ViewTreeObserver.OnGlobalLayoutListener, OnScreenDisplay.View.ExpandAnimationListener, DropoutInterface {
private static Properties N;
public static String a;
private static KeyValueStore aX;
private static Map<String, String> ab;
public static JuspayBrowserFragment b;
private static String bx;
public static state h;
public static Thread.UncaughtExceptionHandler r;
private static preInitRunnable x;
private static preInitRunnable y;
private String F;
private View K;
private FrameLayout M;
private ProgressBar O;
private JuspayWebView P;
private JuspayWebViewClient Q;
private String S;
private Integer U;
private Integer V;
private Integer W;
private String Z;
private GestureDetectorCompat aB;
private String aE;
private String aF;
private FragmentManager aH;
private boolean aJ;
private ConnectivityChangeReceiver aK;
private boolean aL;
private boolean aO;
private boolean aQ;
private String aU;
private Constants.CountdownTimerFragment aW;
private SmsReceiver ac;
private String ad;
private JuspayWebChromeClient af;
private GodelFragment aj;
private GodelFragment ak;
private AlertDialog am;
private String ax;
private CountDownTimer bA;
private LocationManager bC;
private String[] bG;
private OnScreenDisplay bI;
private View bK;
private AlertDialog bO;
private boolean bP;
private View bc;
private View bd;
private String[] bi;
private OnSwipeTouchListener bz;
public String c;
public String d;
public String e;
public String f;
public UberController l;
JuspayWebviewCallback v;
JuspayBackButtonCallback w;
private static boolean z = true;
public static boolean g = false;
private static Stack<OtpSms> G = new Stack<>();
public static boolean i = false;
public static boolean j = false;
private static final String J = JuspayBrowserFragment.class.getName();
private static boolean L = true;
public static boolean k = false;
private static boolean ar = true;
private static PaymentDetails ay = new PaymentDetails();
private static String aY = null;
private static String aZ = null;
private static String ba = null;
private static boolean bh = false;
private static String bm = null;
private static String bn = null;
private static JSONObject bo = null;
private static List<JSONObject> bp = new ArrayList();
private static Double bq = Double.valueOf(0.0d);
private static Long br = 3000L;
private static int bs = 3000;
private static int bt = 5000;
private static String bu = "VR" + SessionInfo.getInstance().b().replaceAll("-", "") + "S";
private static boolean bv = false;
static Dialog q = null;
private static boolean bw = false;
private static boolean by = false;
private static JuspayBrowserFragment bL = null;
public static String u = Constants.NA;
private Context A = null;
private boolean B = false;
private boolean C = true;
private JSONObject D = new JSONObject();
private String[] E = new String[0];
private String H = "";
private String I = null;
private String R = "";
private Boolean T = false;
private Integer X = 0;
private boolean Y = false;
private boolean aa = false;
private Map<String, String> ae = null;
private boolean ag = false;
private boolean ah = false;
private boolean ai = false;
private Boolean al = true;
private boolean an = true;
private boolean ao = true;
private Integer ap = 0;
private boolean aq = false;
private String as = null;
private Long at = 0L;
private Long au = 90000L;
private Long av = 0L;
private long aw = System.currentTimeMillis();
private int az = 0;
private int aA = 0;
private String aC = "";
private Integer aD = 2;
private boolean aG = true;
private boolean aI = false;
private boolean aM = true;
private boolean aN = true;
private JSONObject aP = new JSONObject();
Dialog m = null;
private long aR = System.currentTimeMillis();
private ArrayList<Long> aS = new ArrayList<>();
private long aT = 0;
private boolean aV = true;
private boolean bb = false;
private boolean be = false;
private String bf = "v1";
private boolean bg = false;
public ArrayList<String> n = new ArrayList<>();
private String bj = null;
private boolean bk = true;
private boolean bl = false;
JSONObject o = new JSONObject();
JSONObject p = new JSONObject();
private int bB = 0;
private int bD = 1000;
private float bE = 50.0f;
private boolean bF = false;
private String bH = null;
private Constants.AnimationType bJ = null;
public boolean s = false;
private JSONObject bM = new JSONObject();
private JSONObject bN = new JSONObject();
public boolean t = false;
private JuspayBranding bQ = null;
public interface JuspayWebviewCallback {
void webviewReady();
}
public interface PreInitCallback {
void onResult(boolean z, Integer[] numArr);
}
public enum state {
STARTING,
FINISHING
}
static int e(JuspayBrowserFragment juspayBrowserFragment) {
int i2 = juspayBrowserFragment.bB;
juspayBrowserFragment.bB = i2 + 1;
return i2;
}
public String[] a() {
return this.E;
}
private String[] bh() {
JSONObject configForTrustManager = ConfigService.getInstance().getConfigForTrustManager();
String[] strArr = new String[0];
if (configForTrustManager != null) {
try {
JSONArray jSONArray = configForTrustManager.getJSONArray("defaultDomainRegex");
strArr = new String[jSONArray.length()];
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
strArr[i2] = (String) jSONArray.get(i2);
}
} catch (JSONException e) {
JuspayLogger.a(J, e);
} catch (Exception e2) {
}
}
return strArr;
}
public void a(String str) {
if (str != null) {
try {
if (!str.equals("")) {
this.O.setProgressTintList(ColorStateList.valueOf(Color.parseColor(str)));
}
} catch (Exception e) {
JuspayLogger.a(J, e);
this.O.setProgressTintList(ColorStateList.valueOf(-12303292));
return;
}
}
if (ConfigService.getInstance() != null && ConfigService.getInstance().getJSONObject("progress_bar_config") != null && ConfigService.getInstance().getJSONObject("progress_bar_config").has("color")) {
this.O.setProgressTintList(ColorStateList.valueOf(Color.parseColor(ConfigService.getInstance().getJSONObject("progress_bar_config").getString("color"))));
} else {
this.O.setProgressTintList(ColorStateList.valueOf(Color.parseColor("#000000")));
}
}
public static JuspayBrowserFragment b() {
return bL;
}
public static boolean d() {
return (z && WebLabService.getInstance().isEnabled("canStoreCustomerId")) && ((KeyguardManager) b().A.getSystemService("keyguard")).isKeyguardSecure();
}
public String e() {
return this.bH;
}
public void b(String str) {
this.bH = str;
}
public void a(boolean z2) {
this.aV = z2;
}
public void a(Constants.CountdownTimerFragment countdownTimerFragment) {
this.aW = countdownTimerFragment;
}
public boolean f() {
return this.aV;
}
public void b(boolean z2) {
this.bF = z2;
}
public boolean g() {
return this.bk;
}
public static String c(String str) {
Properties properties = N;
if (properties != null) {
return properties.getProperty(str);
}
return null;
}
public String h() {
if (aX() != null) {
return aX().j();
}
return null;
}
public boolean i() {
if (aX() != null) {
return aX().k();
}
return false;
}
public View j() {
return this.K;
}
public void c(boolean z2) {
this.aG = z2;
this.aO = z2;
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.CLICK).d("Set to " + z2).c("customer_id_checkbox"));
}
public boolean k() {
return this.aG;
}
public void d(String str) {
this.as = str;
}
public boolean l() {
return this.bg;
}
public void d(boolean z2) {
this.bg = z2;
}
public static boolean m() {
return bh;
}
public static void e(boolean z2) {
bh = z2;
}
public void n() {
this.bb = true;
}
public boolean o() {
return this.bb;
}
public String p() {
return this.bf;
}
public Integer q() {
return this.V;
}
public void a(Integer num) {
this.V = num;
}
public Integer r() {
return this.W;
}
public void b(Integer num) {
this.W = num;
}
public void e(String str) {
UberController uberController;
if ("acs".equals(str) && getWebView() != null) {
getWebView().b();
} else if ("uber".equals(str) && (uberController = this.l) != null && uberController.a() != null) {
this.l.a().b();
}
}
public void f(String str) {
UberController uberController;
if ("acs".equals(str) && getWebView() != null) {
getWebView().d();
} else if ("uber".equals(str) && (uberController = this.l) != null && uberController.a() != null) {
this.l.a().d();
}
}
public void a(String str, boolean z2) {
UberController uberController;
if (z2 && (uberController = this.l) != null) {
uberController.c();
}
if (getWebView() != null) {
a(str, getWebView());
}
}
public void g(String str) {
UberController uberController = this.l;
if (uberController != null && uberController.a() != null) {
a(str, this.l.a());
}
}
public void h(String str) {
UberController uberController;
if ("acs".equals(str) && getWebView() != null) {
getWebView().c();
} else if ("uber".equals(str) && (uberController = this.l) != null && uberController.a() != null) {
this.l.a().c();
}
}
public int a(int i2, boolean z2) {
if (c() != null && i2 > 0) {
try {
return Math.round(i2 * c().getResources().getDisplayMetrics().density);
} catch (Exception e) {
JuspayLogger.b(J, "Error in dpToPx " + i2, e);
}
}
return i2;
}
public void i(String str) {
UberController uberController;
InputMethodManager inputMethodManager = (InputMethodManager) c().getSystemService("input_method");
if ("acs".equals(str) && getWebView() != null) {
inputMethodManager.showSoftInput(getWebView(), 1);
} else if ("uber".equals(str) && (uberController = this.l) != null && uberController.a() != null) {
inputMethodManager.showSoftInput(this.l.a(), 1);
}
}
public void j(String str) {
UberController uberController;
InputMethodManager inputMethodManager = (InputMethodManager) c().getSystemService("input_method");
if ("acs".equals(str) && getWebView() != null) {
inputMethodManager.hideSoftInputFromWindow(getWebView().getWindowToken(), 0);
} else if ("uber".equals(str) && (uberController = this.l) != null && uberController.a() != null) {
inputMethodManager.hideSoftInputFromWindow(this.l.a().getWindowToken(), 0);
}
}
public void a(String str, WebView webView) {
try {
if (webView != null && str != null) {
webView.evaluateJavascript(str, null);
} else {
JuspayLogger.f(J, "Unable to insert javascript content: " + str);
}
} catch (Throwable th) {
JuspayLogger.b(J, "Exception while trying to insert Javascript ", th);
}
}
public void k(String str) {
this.ax = str;
}
public String s() {
return this.ax;
}
public PaymentDetails t() {
return ay;
}
public OnScreenDisplay u() {
return this.bI;
}
private int bi() {
OnScreenDisplay.View view = (OnScreenDisplay.View) j().findViewById(R.id.juspay_osd);
if (view != null && view.getVisibility() == 0) {
return getResources().getDimensionPixelSize(R.dimen.osd_collapsed_height);
}
return 0;
}
public void v() {
FrameLayout frameLayout = (FrameLayout) j().findViewById(R.id.juspay_browser_frame);
frameLayout.setForeground(null);
frameLayout.setPadding(0, 0, 0, 0);
((OnScreenDisplay.View) j().findViewById(R.id.juspay_osd)).setVisibility(8);
}
@Override
public void onAnimationStart(boolean visible) {
GodelTracker.getInstance().a(new Event().a(Event.Action.INFO).a(Event.Category.UI).c("osd_visiblity").d(visible ? "shown" : "hidden"));
if (visible) {
j().setBackgroundColor(-16777216);
j("acs");
a(false);
return;
}
a(true);
}
@Override
public void onAnimationEnd(boolean visible) {
if (!visible) {
j().setBackgroundColor(-1);
}
}
public void showOnScreenDisplay(OnScreenDisplay onScreenDisplay) {
String str = J;
JuspayLogger.b(str, "showOnScreenDisplay() called with: onScreenDisplay = [" + onScreenDisplay + "], osdVisible = [" + this.s + "]");
if (onScreenDisplay == null || this.s) {
return;
}
this.bI = onScreenDisplay;
if (WebLabService.getInstance() != null && WebLabService.getInstance().isEnabled(Constants.ON_SCREEN_DISPLAY_ENABLED)) {
this.bI = onScreenDisplay;
JuspayLogger.b(str, "showOnScreenDisplay() called with: getJuspayView = [" + j() + "]");
final FrameLayout frameLayout = (FrameLayout) j().findViewById(R.id.juspay_browser_frame);
final int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.osd_collapsed_height);
ValueAnimator ofInt = ValueAnimator.ofInt(0, dimensionPixelSize);
ofInt.setDuration(300L);
ofInt.setInterpolator(new AccelerateDecelerateInterpolator());
ofInt.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
JuspayLogger.b(JuspayBrowserFragment.J, "onAnimationUpdate() called with: animation = [" + animation + "]");
frameLayout.setPadding(0, (int) (dimensionPixelSize * animation.getAnimatedFraction()), 0, 0);
}
});
ofInt.start();
OnScreenDisplay.View view = (OnScreenDisplay.View) j().findViewById(R.id.juspay_osd);
this.s = true;
view.setY(dimensionPixelSize * (-1));
view.setAlpha(0.25f);
view.setVisibility(0);
view.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).translationYBy(dimensionPixelSize).setDuration(300L);
view.setAnimationListener(this);
view.inflateOnScreenDisplay(onScreenDisplay);
}
}
public void w() {
this.X = Integer.valueOf(this.X.intValue() + 1);
}
public Integer x() {
return this.X;
}
public void l(String str) {
if (!this.aN) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("merchant_pref").d("customer_id_frag_off"));
z("customer_id_frag_off");
return;
}
NetbankingCustomerIdFragment bY = bY();
if (bY == null) {
bY = new NetbankingCustomerIdFragment();
Bundle bundle = new Bundle();
bundle.putString("buttonText", str);
bundle.putBoolean("autoSelect", this.aO);
bY.setArguments(bundle);
}
b(bY);
}
public JSONObject y() {
return this.aP;
}
public void z() {
this.aP = new JSONObject();
}
public void A() {
if (!this.aM) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("merchant_pref").d("password_frag_off"));
z("password_frag_off");
} else {
PasswordHelperFragment ca = ca();
if (ca == null) {
ca = new PasswordHelperFragment();
}
b(ca);
}
}
public void B() {
GenericPasswordFragment bZ = bZ();
if (bZ == null) {
bZ = new GenericPasswordFragment();
}
b(bZ);
}
public void C() {
b(new NetbankingDefaultFragment());
}
public void m(String str) {
this.aC = str;
}
public boolean D() {
return this.aI;
}
public void f(boolean z2) {
this.aI = z2;
}
public void g(boolean z2) {
this.aJ = z2;
}
public void juspayBackPressedHandler(boolean showBackPressDialog) {
String str;
GodelTracker.getInstance().a(true);
f(showBackPressDialog);
if (D() && this.w == null) {
JuspayLogger.c(J, "For complete handling of back button presses, please create interface JuspayBackButtonCallback and use juspayBrowserFragment#setupJuspayBackButtonCallbackInterface to receive a callback when user cancels transaction.");
}
OnScreenDisplay.View view = (OnScreenDisplay.View) j().findViewById(R.id.juspay_osd);
if (view != null && view.getVisibility() == 0 && view.isExpanded()) {
view.toggleView(false);
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.INFO).d("osd_backpressed").c("Back pressed at osd expanded view"));
JuspayLogger.b(J, "back pressed at osd expanded view");
return;
}
if (aX() != null) {
a(false);
}
try {
String str2 = J;
JuspayLogger.b(str2, "BackButton implementation done by merchant ? " + showBackPressDialog);
if (s() == null) {
str = "";
} else {
str = "Url - " + s();
}
if (this.ak != null) {
str = str + " At Fragment - " + this.ak.getClass().getSimpleName();
}
if (str.equalsIgnoreCase("")) {
str = "Embarrassing. Couldn't determine where back button was clicked.";
}
O(str);
if (!str.equalsIgnoreCase("Embarrassing. Couldn't determine where back button was clicked.") && D() && !SessionInfo.getInstance().j()) {
JuspayLogger.b(str2, "Backbutton - Sending event to main webview");
this.Q.b(String.valueOf(D()));
} else {
JuspayLogger.b(str2, "Backbutton - Showing Dialog from Java");
O();
}
} catch (Exception e) {
JuspayLogger.b(J, "Couldn't handle back button", e);
}
}
@Override
public void onClick(View v) {
Dialog dialog;
int id = v.getId();
if (id == R.id.reload_image_button) {
j = true;
a("window.location.reload(true);", getWebView());
q.dismiss();
JuspayLogger.b(J, "Reload DialogBox : onClick");
i = false;
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.INFO).d("click").c("reload_button"));
q = null;
return;
}
if (id == R.id.custom_help_dialog_root_view && (dialog = this.m) != null) {
dialog.dismiss();
}
}
public class JuspayDialogInterface implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
private String b;
JuspayDialogInterface(String id) {
this.b = "";
this.b = id;
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (this.b.equals("RELOAD_BUTTON")) {
boolean unused = JuspayBrowserFragment.bv = false;
JuspayLogger.b(JuspayBrowserFragment.J, "Reload DialogBox : onDismiss");
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.INFO).d("dismiss").c("reload_button"));
JuspayBrowserFragment.q = null;
if (!JuspayBrowserFragment.j) {
JuspayBrowserFragment.this.a(JuspayWebViewClient.b, JuspayWebViewClient.a);
return;
}
return;
}
if (this.b.equals("HELP_DIALOG")) {
JuspayBrowserFragment.this.m = null;
} else if (this.b.equals("SHOW_CANCEL") && JuspayBrowserFragment.this.aX() != null && !JuspayBrowserFragment.g) {
JuspayBrowserFragment.this.a(true);
}
}
@Override
public void onClick(DialogInterface dialog, int which) {
char c;
String str = this.b;
switch (str.hashCode()) {
case -737865363:
if (str.equals("SHOW_ERROR_REPORT")) {
c = 2;
break;
}
c = 65535;
break;
case -301202939:
if (str.equals("SHOW_RETRY_OPTIONS")) {
c = 0;
break;
}
c = 65535;
break;
case 552560124:
if (str.equals("SHOW_CANCEL")) {
c = 1;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
JuspayLogger.b(JuspayBrowserFragment.J, String.valueOf(which));
JuspayBrowserFragment juspayBrowserFragment = JuspayBrowserFragment.this;
juspayBrowserFragment.ap = Integer.valueOf(juspayBrowserFragment.ap.intValue() + 1);
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.INFO).c("num_otp_retries").d(JuspayBrowserFragment.this.ap.toString()));
switch (which) {
case 0:
JuspayBrowserFragment.this.D("manual_otp");
a();
break;
case 1:
JuspayBrowserFragment.this.D("wait more");
b();
break;
case 2:
JuspayBrowserFragment.this.D("regenerate_otp");
c();
if (JuspayBrowserFragment.this.aX() != null) {
JuspayBrowserFragment.this.aX().a(Integer.valueOf(JuspayBrowserFragment.this.aK()));
break;
}
break;
}
case 1:
if (which == -1) {
JuspayBrowserFragment.g = true;
dialog.dismiss();
JuspayBrowserFragment.this.O("Closing Godel via dialog box.");
JuspayBrowserFragment.this.q("dialog");
break;
} else if (which == -2) {
JuspayBrowserFragment.this.O("User dismissed close godel dialog box");
dialog.dismiss();
if (JuspayBrowserFragment.this.aX() != null) {
JuspayBrowserFragment.this.a(true);
break;
}
}
break;
case 2:
if (which == -1) {
JuspayLogger.a(JuspayBrowserFragment.J, "issue_reported", ((EditText) JuspayBrowserFragment.this.c().getLayoutInflater().inflate(R.layout.juspay_report_issue_dialog, (ViewGroup) null).findViewById(R.id.report_issue_edittext)).getText().toString());
Toast.makeText(JuspayBrowserFragment.this.c(), "Issue reported successfully!", 1).show();
break;
} else if (which == -2 && dialog != null) {
dialog.cancel();
dialog.dismiss();
break;
}
break;
}
}
private void a() {
JuspayLogger.b(JuspayBrowserFragment.J, "IN MANUAL OTP JB");
JuspayBrowserFragment.this.z("Manual entry selected in retry dialog");
JuspayBrowserFragment.this.Q.h();
}
private void b() {
if (JuspayBrowserFragment.this.aX() != null) {
JuspayBrowserFragment.this.aX().a(JuspayBrowserFragment.this.aK());
}
}
private void c() {
JuspayLogger.b(JuspayBrowserFragment.J, "Regenerating OTP: ");
JuspayBrowserFragment.this.Q.c();
}
}
public void E() {
try {
if (WebLabService.getInstance() != null && WebLabService.getInstance().isEnabled("reloadDialog")) {
if (!bv) {
j = false;
bv = true;
if (q == null) {
q = new Dialog(c());
}
q.requestWindowFeature(1);
q.setContentView(R.layout.juspay_reload_alert_box);
((ImageButton) q.findViewById(R.id.reload_image_button)).setOnClickListener(this);
q.setOnDismissListener(new JuspayDialogInterface("RELOAD_BUTTON"));
try {
if (c() != null && !c().isFinishing()) {
q.show();
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.INFO).d("shown").c("reload_button"));
}
} catch (Exception e) {
JuspayLogger.b(J, "Activity was not present when trying to show dialog", e);
}
return;
}
return;
}
a(JuspayWebViewClient.b, JuspayWebViewClient.a);
} catch (Exception e2) {
JuspayLogger.b(J, "Exception while showing Reload Dialog", e2);
}
}
public static void F() {
Dialog dialog;
try {
if (bv && (dialog = q) != null) {
dialog.dismiss();
JuspayLogger.b(J, "dismissReloadDialog : Dismissing Reload DialogBox");
} else {
JuspayLogger.b(J, "dismissReloadDialog : Reload DialogBox not present");
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while dismissing Dialog", e);
}
}
public void G() {
getWebView().stopLoading();
}
public void h(boolean z2) {
i = z2;
JuspayLogger.b(J, "network Listener = " + i);
}
public void H() {
JuspayLogger.b(J, "reload called");
getWebView().reload();
}
public void I() {
JuspayLogger.b(J, "goBack called");
getWebView().goBack();
}
public void J() {
JuspayLogger.b(J, "goForward called");
getWebView().goForward();
}
public void n(String str) {
JuspayLogger.b(J, "loadUrl with url = " + str);
getWebView().loadUrl(str);
}
public void a(String str, JSONObject jSONObject) {
String str2 = J;
JuspayLogger.b(str2, "postUrl with url = " + str + ", postData = " + jSONObject.toString());
if (jSONObject != null) {
Iterator<String> keys = jSONObject.keys();
String str3 = null;
while (keys.hasNext()) {
try {
String next = keys.next();
str3 = next + "+" + jSONObject.getString(next) + "&";
} catch (JSONException e) {
JuspayLogger.b(J, "postUrl JSONException", e);
}
}
String substring = str3.substring(0, str3.length() - 2);
getWebView().postUrl(str, EncodingUtils.getBytes(substring, "BASE64"));
JuspayLogger.b(J, "postDataString = " + substring);
return;
}
JuspayLogger.b(str2, "postData is null");
}
public void o(String str) {
if (str != null && !str.equals(this.H)) {
this.I = this.H;
try {
this.p.put("juspay_past_url_index_" + this.p.length(), str);
JuspayLogger.b(J, "pastUrls length = " + this.p.length() + " , pastUrls = " + this.p.toString());
} catch (Exception e) {
JuspayLogger.b(J, "setCurrentUrlAcs Exception", e);
}
this.H = str;
}
}
public int K() {
return this.p.length();
}
public String getCurrentUrlAcs() {
return this.H;
}
public String L() {
return this.p.toString();
}
public boolean M() {
return this.p.length() == 1 || this.p.length() == 0;
}
public boolean N() {
NetworkInfo activeNetworkInfo;
ConnectivityManager connectivityManager = (ConnectivityManager) c().getSystemService("connectivity");
return (connectivityManager == null || (activeNetworkInfo = connectivityManager.getActiveNetworkInfo()) == null || !activeNetworkInfo.isConnected()) ? false : true;
}
public void a(int i2, String str) {
try {
JuspayBackButtonCallback juspayBackButtonCallback = this.w;
if (juspayBackButtonCallback != null && i2 != 0) {
juspayBackButtonCallback.onReceivedError(i2, str);
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while calling onReceivedError Callback", e);
}
}
public void O() {
if (D()) {
AlertDialog create = new AlertDialog.Builder(c()).setTitle("Cancel Transaction?").setMessage("This would cancel your ongoing transaction.").setPositiveButton(android.R.string.yes, new JuspayDialogInterface("SHOW_CANCEL")).setNegativeButton(android.R.string.no, new JuspayDialogInterface("SHOW_CANCEL")).create();
this.bO = create;
create.setOnDismissListener(new JuspayDialogInterface("SHOW_CANCEL"));
this.bO.show();
}
}
public String P() {
return (this.c.equals("SUCCESS") && this.d.equals("SUCCESS") && this.e.equals("SUCCESS")) ? "SUCCESS" : (this.c.equals(UpiConstant.FAILURE) || this.d.equals(UpiConstant.FAILURE) || this.e.equals(UpiConstant.FAILURE)) ? UpiConstant.FAILURE : "UNKNOWN";
}
public void p(String str) {
try {
this.bM.put("url", str);
R();
} catch (JSONException e) {
JuspayLogger.b(J, "Exception setting URL to session info", e);
}
}
public JSONObject Q() {
return this.bM;
}
public void R() {
throw new UnsupportedOperationException("Method not decompiled: in.juspay.godel.ui.JuspayBrowserFragment.R():void");
}
public void q(String str) {
JuspayLogger.f(J, "Cancelling transaction via " + str);
try {
R();
JuspayWebViewClient.i();
JuspayDropoutAnalyser.getInstance().getDropoutReasons(getWebView(), this, this);
} catch (NullPointerException e) {
JuspayLogger.b(J, "Exception while cancelling transaction: ", e);
z();
}
}
@Override
public void dropResult(JSONObject result) {
try {
JSONObject jSONObject = this.bM;
if (jSONObject != null) {
jSONObject.put("dropout_reasons", result);
}
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.INFO).c("session_info").d(this.bM.toString()));
bj();
} catch (JSONException e) {
JuspayLogger.a(J, e);
}
z();
}
private void bj() {
try {
JuspayBackButtonCallback juspayBackButtonCallback = this.w;
if (juspayBackButtonCallback != null) {
juspayBackButtonCallback.transactionCancelled();
this.w.transactionCancelled(this.bM);
} else {
JuspayLogger.c(J, "Finishing activity. Use JuspayBackButtonCallback to get control of transaction-cancel event.");
c().finish();
if (JuspaySafeBrowser.callBack != null) {
JuspaySafeBrowser.callBack.ontransactionAborted();
JuspaySafeBrowser.callBack.onTransactionAborted(this.bM);
} else {
GodelTracker.getInstance().h("Callback object was null in transaction aborted callback");
}
}
} catch (NullPointerException | JSONException e) {
JuspayLogger.c(J, "Exception while cancelling transaction: " + e);
}
}
public void O(String str) {
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.CLICK).c("back_button_pressed").d(str));
JuspayLogger.b(J, "BackButton pressed at " + str);
}
public void i(boolean z2) {
this.aL = z2;
}
public boolean S() {
return this.aL;
}
public void T() {
if (aX() != null) {
aX().i();
}
}
private int bk() {
return WifiManager.calculateSignalLevel(((WifiManager) this.A.getSystemService("wifi")).getConnectionInfo().getRssi(), 5);
}
private int bl() {
CellInfoLte cellInfoLte;
TelephonyManager telephonyManager = (TelephonyManager) this.A.getSystemService("phone");
try {
CellInfo cellInfo = telephonyManager.getAllCellInfo().get(0);
if (cellInfo instanceof CellInfoGsm) {
CellInfoGsm cellInfoGsm = (CellInfoGsm) telephonyManager.getAllCellInfo().get(0);
if (cellInfoGsm != null) {
return cellInfoGsm.getCellSignalStrength().getDbm();
}
return -1;
}
if (cellInfo instanceof CellInfoCdma) {
CellInfoCdma cellInfoCdma = (CellInfoCdma) telephonyManager.getAllCellInfo().get(0);
if (cellInfoCdma != null) {
return cellInfoCdma.getCellSignalStrength().getDbm();
}
return -1;
}
if (cellInfo instanceof CellInfoWcdma) {
CellInfoWcdma cellInfoWcdma = (CellInfoWcdma) telephonyManager.getAllCellInfo().get(0);
if (cellInfoWcdma != null) {
return cellInfoWcdma.getCellSignalStrength().getDbm();
}
return -1;
}
if ((cellInfo instanceof CellInfoLte) && (cellInfoLte = (CellInfoLte) telephonyManager.getAllCellInfo().get(0)) != null) {
return cellInfoLte.getCellSignalStrength().getDbm();
}
return -1;
} catch (Exception e) {
JuspayLogger.b(J, "Execption while getting mobile data strength", e);
return -1;
}
}
public void r(String str) {
a(str, -1);
}
public void a(String str, int i2) {
boolean z2;
if (WebLabService.getInstance() != null && !SessionInfo.getInstance().j() && WebLabService.getInstance().isEnabled(Constants.LOSE_CONFIG)) {
JSONObject configLoseConditions = ConfigService.getInstance().getConfigLoseConditions();
if (OtpUtil.a(configLoseConditions)) {
switch (str.hashCode()) {
case 1573700043:
if (str.equals("num_pages")) {
z2 = false;
break;
}
default:
z2 = -1;
break;
}
switch (z2) {
case false:
if (configLoseConditions.optInt("num_pages", -1) <= i2) {
JuspayLogger.a(J, "shouldLoseConfig set to true", "numPages = " + i2);
e(true);
break;
}
break;
default:
if (configLoseConditions.optBoolean(str, false)) {
JuspayLogger.a(J, "shouldLoseConfig set to true", str);
e(true);
break;
}
break;
}
}
}
}
private class SmsReceiver extends BroadcastReceiver {
private SmsReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
try {
if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) {
a(intent);
}
} catch (Exception e) {
JuspayLogger.b(JuspayBrowserFragment.J, "Failed to receive sms", e);
}
}
private void a(Intent intent) {
ArrayList<OtpSms> a;
Bundle extras = intent.getExtras();
if (extras != null) {
Object[] objArr = (Object[]) extras.get("pdus");
int length = objArr.length;
SmsMessage[] smsMessageArr = new SmsMessage[length];
for (int i = 0; i < length; i++) {
SmsMessage createFromPdu = SmsMessage.createFromPdu((byte[]) objArr[i]);
smsMessageArr[i] = createFromPdu;
String upperCase = createFromPdu.getOriginatingAddress().toUpperCase();
String messageBody = smsMessageArr[i].getMessageBody();
JuspayLogger.b(JuspayBrowserFragment.J, "Message is from " + upperCase + " and body is " + messageBody);
Date date = new Date(smsMessageArr[i].getTimestampMillis());
new ArrayList();
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("Sms received").d("from: " + upperCase));
OtpUtil otpUtil = new OtpUtil(JuspayBrowserFragment.this.c());
if (JuspayBrowserFragment.ay.getBank() != null) {
a = otpUtil.a(upperCase, messageBody, date, JuspayBrowserFragment.ay.getBank());
if (a.isEmpty()) {
a = otpUtil.a(upperCase, messageBody, date, "JUSPAY");
}
} else {
a = otpUtil.a(upperCase, messageBody, date, Constants.UNKNOWN_BANK);
}
if (!a.isEmpty()) {
JuspayLogger.b(JuspayBrowserFragment.J, "Received otp for " + a.get(0).getBank());
JuspayBrowserFragment.this.a(a);
JuspayBrowserFragment.this.getWebView().scrollBy(1, 1);
}
}
}
}
}
private class ConnectivityChangeReceiver extends BroadcastReceiver {
private ConnectivityChangeReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
try {
GodelTracker.getInstance().h("mobile_data_connected_" + SessionInfo.getInstance().p(context));
GodelTracker.getInstance().h("wifi_connected_" + SessionInfo.getInstance().q(context));
if (intent.getExtras() == null) {
JuspayLogger.b(JuspayBrowserFragment.J, "no extras");
} else {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("typeName", activeNetworkInfo.getTypeName());
jSONObject.put("connectivity", activeNetworkInfo.getState());
jSONObject.put("isRoaming", activeNetworkInfo.isRoaming());
JuspayLogger.b(JuspayBrowserFragment.J, "Network Info JSON - " + jSONObject);
try {
GodelTracker.getInstance().a(new Event().d(String.valueOf(jSONObject)).c("network_state_changed").a(Event.Category.UI));
GodelTracker.getInstance().a(new Event().d(JuspayBrowserFragment.ba()).c("ip_address").a(Event.Category.GODEL));
} catch (Throwable th) {
JuspayLogger.b(JuspayBrowserFragment.J, "Couldn't log network_state_changed", th);
}
}
}
} catch (JSONException e) {
JuspayLogger.b(JuspayBrowserFragment.J, "Exception in creating JSON from broadcast receiver", e);
} catch (Throwable th2) {
JuspayLogger.b(JuspayBrowserFragment.J, "Exception in reading Network info from broadcast receiver", th2);
}
NetworkInfo activeNetworkInfo2 = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo2 != null && activeNetworkInfo2.isConnected()) {
if (JuspayBrowserFragment.i && !SessionInfo.getInstance().j()) {
JuspayBrowserFragment.i = false;
JuspayBrowserFragment.F();
JuspayBrowserFragment juspayBrowserFragment = JuspayBrowserFragment.this;
juspayBrowserFragment.a("GK.smartReload();", juspayBrowserFragment.getWebView());
return;
}
return;
}
if (!SessionInfo.getInstance().j()) {
JuspayBrowserFragment.i = true;
JuspayBrowserFragment.this.E();
}
}
}
public String[] U() {
return this.bi;
}
public static boolean V() {
return L;
}
public void W() {
Activity c = c();
getActivity();
int memoryClass = ((ActivityManager) c.getSystemService("activity")).getMemoryClass();
int i2 = 4;
try {
int i3 = WebLabService.getInstance().getWebLabRules(ConfigService.getInstance()).getInt("shouldUseMemory");
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("weblab_shouldUseMemory").d(Integer.toString(i3) + " MB"));
i2 = i3;
} catch (JSONException e) {
} catch (Exception e2) {
JuspayLogger.b(J, "Exception while fetching shouldUseMemory from config", e2);
}
if (memoryClass < i2) {
SessionInfo.getInstance().g(GodelOffReasons.LOW_ON_MEMORY);
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("low_on_memory").d("Switching off godel - Available memory : " + Integer.toString(memoryClass) + " MB"));
}
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("shouldUseMemoryAvailable").d(Integer.toString(memoryClass) + " MB"));
}
public void a(android.os.Bundle r24) {
throw new UnsupportedOperationException("Method not decompiled: in.juspay.godel.ui.JuspayBrowserFragment.a(android.os.Bundle):void");
}
public static boolean X() {
return ar;
}
private void q(boolean z2) {
GodelTracker.getInstance().a(new Event().a(Event.Category.CONFIG).a(Event.Action.CHECK).d(String.valueOf(z2)).c("merchant_pref_lower_os"));
}
private void c(Bundle bundle) {
try {
this.ae = (HashMap) bundle.getSerializable("customHeaders");
} catch (Exception e) {
this.ae = null;
JuspayLogger.b(J, "Error while parsing Map of custom Headers", e);
}
}
public boolean Y() {
return this.be;
}
public String Z() {
return this.bj;
}
private void d(Bundle bundle) {
t(bundle.getBoolean("passwordFragment", true));
s(bundle.getBoolean("customerIdFragment", true));
r(bundle.getBoolean("customerIdSaveAutoSelect", true));
}
private void r(boolean z2) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("merchant_pref").d("customer_id_auto_save_" + z2));
this.aO = z2;
}
private void s(boolean z2) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("merchant_pref").d("customer_id_frag_" + z2));
this.aN = z2;
}
private void t(boolean z2) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("merchant_pref").d("password_frag_" + z2));
this.aM = z2;
}
private void u(boolean z2) {
if (z2) {
bx();
GodelTracker.getInstance().a(new Event().d(String.valueOf(z2)).c("clearing_cookies").a(Event.Category.GODEL));
}
}
public String aa() {
return this.o.toString();
}
public void s(String str) {
int i2;
try {
if (WebLabService.getInstance().getWebLabRules(ConfigService.getInstance()).has("setNumberOfExtraParameterAllowed")) {
i2 = WebLabService.getInstance().getWebLabRules(ConfigService.getInstance()).getInt("setNumberOfExtraParameterAllowed");
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("number_of_extraParameters_allowed").d(Integer.toString(i2)));
} else {
i2 = Integer.parseInt(str);
}
} catch (Exception e) {
int parseInt = Integer.parseInt(str);
JuspayLogger.b(J, "Exception while fetching setNumberOfExtraParameterAllowed from config", e);
i2 = parseInt;
}
Integer valueOf = Integer.valueOf(i2);
this.aD = valueOf;
c(valueOf);
}
public void ab() {
int i2 = 10;
try {
int i3 = WebLabService.getInstance().getWebLabRules(ConfigService.getInstance()).getInt("setNumberOfExtraParameterAllowed");
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("number_of_extraParameters_allowed").d(Integer.toString(i3)));
i2 = i3;
} catch (JSONException e) {
JuspayLogger.b(J, "Exception while fetching setNumberOfExtraParameterAllowed from config", e);
} catch (Exception e2) {
JuspayLogger.b(J, "Exception while fetching setNumberOfExtraParameterAllowed from config", e2);
}
Integer valueOf = Integer.valueOf(i2);
this.aD = valueOf;
c(valueOf);
}
private void c(Integer num) {
try {
new KeyValueStore(c()).a(Constants.NUMBER_OF_EXTRA_PARAMETERS_ALLOWED, num.intValue());
JuspayLogger.b(J, "NumberOfExtraParameterAllowed is now set to " + num);
} catch (Exception e) {
JuspayLogger.b(J, "Exception trying to store NumberOfExtraParameterAllowed", e);
}
}
private void bm() {
this.aD = Integer.valueOf(new KeyValueStore(c()).b(Constants.NUMBER_OF_EXTRA_PARAMETERS_ALLOWED, 5));
JuspayLogger.b(J, "NumberOfExtraParameterAllowed is now set to " + this.aD + " from shared preferences");
}
private void e(Bundle bundle) {
HashMap hashMap = new HashMap();
try {
bm();
for (String str : bundle.keySet()) {
if (str.startsWith("udf_")) {
if (hashMap.size() < this.aD.intValue()) {
hashMap.put(str, bundle.getString(str));
JuspayLogger.b(J, "Keys: " + str + " size: " + hashMap.size());
} else {
JuspayLogger.g(J, "Number of extra parameter exceeded " + this.aD + "..discarding: " + str);
}
}
}
if (hashMap.size() > 0) {
ay.setExtraParams(hashMap);
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception trying to track merchant arguments", e);
}
}
private void bn() {
if (ay.getMerchantId() == null) {
JuspayLogger.c(J, "Required field: merchantId is not present during JB invocation");
}
if (ay.getClientId() == null) {
JuspayLogger.c(J, "Required field: clientId is not present during JB invocation");
}
if (ay.getTransactionId() == null) {
JuspayLogger.c(J, "Required field: transactionId is not present during JB invocation");
}
}
@Override
public void onAnimationUpdate(ValueAnimator animation) {
if (this.bJ == Constants.AnimationType.ANIMATION_TYPE_HEIGHT) {
this.bK.getLayoutParams().height = ((Integer) animation.getAnimatedValue()).intValue();
this.bK.requestLayout();
} else if (this.bJ == Constants.AnimationType.ANIMATION_TYPE_PADDING) {
this.bK.setPadding(0, 0, 0, ((Integer) animation.getAnimatedValue()).intValue());
this.bK.requestLayout();
}
}
public void a(View view, int i2, int i3, int i4, Constants.AnimationType animationType) {
this.bK = view;
this.bJ = animationType;
ValueAnimator ofInt = ValueAnimator.ofInt(i3, i4);
ofInt.addUpdateListener(this);
ofInt.setInterpolator(new DecelerateInterpolator());
ofInt.setDuration(i2);
ofInt.start();
}
public void a(View view) {
view.measure(-1, -2);
view.getLayoutParams().height = 0;
view.setVisibility(0);
}
private void bo() {
c().getWindow().addFlags(WorkQueueKt.BUFFER_CAPACITY);
}
private boolean bp() {
try {
return ((TelephonyManager) c().getSystemService("phone")).getPhoneType() != 0;
} catch (Throwable th) {
JuspayLogger.b(J, "Exception while trying to get telephony service. Returning false.", th);
return false;
}
}
private void bq() {
try {
boolean d = d();
if (d) {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
EncryptionHelper.a().a(a, keyStore, getContext());
}
GodelTracker.getInstance().a("can_store_customer_id", String.valueOf(d));
} catch (Exception e) {
JuspayLogger.a(J, e);
}
}
public JuspayBrowserFragment() {
ay = new PaymentDetails();
bL = this;
}
@Override
public void onAttach(Context activity) {
super.onAttach(activity);
if (b == null) {
b = this;
}
bm = getString(R.string.juspay_config_location);
bn = getString(R.string.juspay_analytics_endpoint);
a = "juspay_safe_browser_" + getString(R.string.godel_version);
g = false;
G.clear();
h = state.STARTING;
a(state.STARTING);
GodelTracker.a(state.STARTING);
Activity c = c();
this.A = c;
JuspayLogger.a(c);
bB();
bD();
a(this.A);
this.ap = 0;
bE();
bq();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
JuspayLogger.b(J, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]");
boolean z2 = savedInstanceState.getBoolean("openConnectionCalled", by);
by = z2;
if (!z2) {
JuspayLogger.c("IntegrationError", "JuspayBrowserFragment.openJuspayConnection() is not called.");
}
b = (JuspayBrowserFragment) getFragmentManager().getFragment(savedInstanceState, "parentFragment");
}
if (cc() && WebLabService.getInstance().isEnabled(Constants.LOG_MOVEMENT_DETECTION)) {
try {
this.bC = (LocationManager) this.A.getSystemService("location");
Criteria criteria = new Criteria();
criteria.setPowerRequirement(1);
criteria.setAccuracy(1);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(false);
criteria.setSpeedRequired(false);
String bestProvider = this.bC.getBestProvider(criteria, false);
if (ConfigService.getInstance() != null) {
JSONObject jSONObject = ConfigService.getInstance().getJSONObject("movement_config");
if (OtpUtil.a(jSONObject)) {
this.bD = jSONObject.getInt("min_locationt_time");
this.bE = jSONObject.getInt("min_distance");
}
}
if (bestProvider != null) {
T(bestProvider);
}
} catch (Exception e) {
JuspayLogger.b(J, "Error while retrieving Location params from config", e);
}
}
}
public void onSaveInstanceState(Bundle outState) {
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.FALLBACK).c("activity_recreation").d("might_get_killed"));
GodelFragment godelFragment = this.ak;
if (godelFragment != null && godelFragment.isAdded()) {
bw().putFragment(outState, "currentFragment", this.ak);
}
JuspayBrowserFragment juspayBrowserFragment = b;
if (juspayBrowserFragment != null && juspayBrowserFragment.isAdded()) {
getFragmentManager().putFragment(outState, "parentFragment", b);
}
outState.putBoolean("openConnectionCalled", by);
outState.putString("lastSessionId", GodelTracker.getInstance().h());
outState.putSerializable("osd", this.bI);
outState.putBoolean("logsPostingEnabled", ar);
super.onSaveInstanceState(outState);
}
public static void openJuspayConnection(Context activityContext) {
by = true;
}
public void ac() {
JuspayWaitingDialogManager.b(this).e();
hideRetryOptionsDialog();
UberController uberController = this.l;
if (uberController != null) {
uberController.c();
}
AlertDialog alertDialog = this.bO;
if (alertDialog != null) {
if (alertDialog.isShowing()) {
this.bO.dismiss();
}
this.bO.cancel();
ListView listView = this.bO.getListView();
if (listView != null) {
listView.setOnClickListener(null);
}
this.bO = null;
}
}
private void a(Context context) {
SessionInfo.getInstance().c(this.A);
ConfigService.getInstance().initConfig(context);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
this.K = inflater.inflate(R.layout.juspay_webview, container, false);
JuspayLogger.b(J, "Browser Fragment onCreateView - " + this.K);
this.M = (FrameLayout) this.K.findViewById(R.id.webview_layout);
this.P = (JuspayWebView) this.K.findViewById(R.id.juspay_browser_view);
this.O = (ProgressBar) this.K.findViewById(R.id.progress_bar);
this.ap = 0;
this.aj = null;
b = this;
return this.K;
}
private boolean b(Context context) {
if (context != null) {
KeyValueStore keyValueStore = new KeyValueStore(context);
if (keyValueStore.a("GODEL_EXCEPTION_OFF")) {
JSONObject config = ConfigService.getInstance().getConfig();
long optLong = config != null ? config.optLong("ON_EXCEPTION_GODEL_OFF_STICKINESS", 86400000L) : 86400000L;
long currentTimeMillis = System.currentTimeMillis() - keyValueStore.c("GODEL_EXCEPTION_OFF", System.currentTimeMillis());
String c = keyValueStore.c("EXCEPTION_INFO", (String) null);
Event event = new Event();
event.c("godel_off_exception_info");
event.d(c);
event.a(Event.Category.GODEL);
event.a(Event.Action.INFO);
GodelTracker.getInstance().a(event);
if (currentTimeMillis <= optLong) {
return true;
}
keyValueStore.b("GODEL_EXCEPTION_OFF");
keyValueStore.b("EXCEPTION_OFF");
return false;
}
return false;
}
return false;
}
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SessionInfo.getInstance().a(ay);
String str = J;
JuspayLogger.b(str, "GODEL BUILD VERSION: " + getString(R.string.build_version));
JuspayLogger.b(str, "browser Fragment onActivityCreated");
aq();
SessionInfo.getInstance().c();
by();
this.aF = getWebView().getSettings().getUserAgentString();
this.aB = new GestureDetectorCompat(c(), new GestureListener());
bo();
bF();
bG();
bH();
JuspayLogger.b(str, "Telephony Service found: " + bp());
JuspayLogger.b(str, "IP address: " + ba());
if (getArguments() != null) {
startPaymentWithArguments(getArguments());
} else {
startPaymentWithArguments(new Bundle());
}
if (b(c())) {
WebLabService.getInstance().disableGodel(GodelOffReasons.ON_GODEL_EXCEPTION);
}
if (!bp()) {
JuspayLogger.b(str, "No telephony service found.. disabling JB");
SessionInfo.getInstance().g(GodelOffReasons.TELEPHONY_NOT_FOUND);
}
FragmentConfig.a();
if (savedInstanceState != null) {
if (this.ak == null) {
this.ak = (GodelFragment) bw().getFragment(savedInstanceState, "currentFragment");
}
if (this.ak != null) {
au();
}
bu();
f(savedInstanceState);
showOnScreenDisplay((OnScreenDisplay) savedInstanceState.getSerializable("osd"));
}
this.aQ = WebLabService.getInstance().isEnabled("hardwareAcceleration");
JuspayLogger.a(str, "hardware_acceleration_enabled", this.aQ + "");
if (this.aQ) {
j().setLayerType(2, null);
getWebView().setLayerType(2, null);
} else {
j().setLayerType(1, null);
getWebView().setLayerType(1, null);
}
if (WebLabService.getInstance() != null && !SessionInfo.getInstance().j() && WebLabService.getInstance().isEnabled(Constants.GLOBAL_EXCEPTION_HANDLING)) {
r = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler(c()));
}
this.l = new UberController(this);
bt();
SessionInfo.getInstance().s(c());
br();
W();
bS();
GodelTracker.getInstance().a(new Event().a(Event.Action.INFO).a(Event.Category.GODEL).c("godel_sdk_version").d("sdk_1423"));
GodelTracker.getInstance().a(new Event().a(Event.Action.INFO).a(Event.Category.GODEL).c("godel_sdk_git_sha").d("831e42d46"));
}
private void br() {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c("activity_name").d(c().getClass().getName()));
try {
bs();
long j2 = ConfigService.getInstance().getJSONObject("cacheable_config_v2").getLong("CACHEABLE_TTL");
File[] listFiles = new File(c().getApplicationContext().getCacheDir().getAbsolutePath().concat("/WebResourcesCacheDir/")).listFiles();
long currentTimeMillis = System.currentTimeMillis();
int i2 = 0;
while (listFiles != null) {
if (i2 < listFiles.length) {
if (listFiles[i2].lastModified() + j2 > currentTimeMillis) {
this.n.add(listFiles[i2].getName());
} else {
listFiles[i2].delete();
}
i2++;
} else {
return;
}
}
} catch (NullPointerException e) {
JuspayLogger.b(J, "Exception While Reading TTL from Config", e);
} catch (Exception e2) {
JuspayLogger.b(J, "Exception creating Juspay Cache Directory", e2);
}
}
public String t(String str) {
return str.split("\\?")[0].split("#")[0].replaceAll("[^a-zA-Z0-9.]", "_");
}
public void u(String str) {
try {
File file = new File(c().getApplicationContext().getCacheDir().getAbsolutePath().concat("/WebResourcesCacheDir/").concat(t(str)));
if (file.exists()) {
file.delete();
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while trying to clear cache", e);
}
}
private void bs() {
File file = new File(c().getApplicationContext().getCacheDir(), "WebResourcesCacheDir");
if (!file.exists()) {
file.mkdir();
}
}
private void f(Bundle bundle) {
try {
String string = bundle.getString("lastSessionId");
JuspayLogger.d(J, "Last Godel Session Id - " + string);
JSONObject jSONObject = new JSONObject();
jSONObject.put("oldSessionId", string);
jSONObject.put("newSessionId", GodelTracker.getInstance().h());
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).c(Constants.LINK_SESSION).d(jSONObject.toString()));
} catch (JSONException e) {
JuspayLogger.b(J, "Error while linking session ID", e);
}
}
private void bt() {
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.copyFrom(c().getWindow().getAttributes());
if (layoutParams.softInputMode != 16) {
c().getWindow().setSoftInputMode(16);
Log.e("IntegrationError", "android:windowSoftInputMode=\"adjustResize\" not set for the host activity - " + c().getClass().getName());
}
PackageManager packageManager = c().getPackageManager();
String packageName = c().getPackageName();
HashMap hashMap = new HashMap();
hashMap.put("Internet", Integer.valueOf(packageManager.checkPermission("android.permission.INTERNET", packageName)));
hashMap.put("Access Network State", Integer.valueOf(packageManager.checkPermission("android.permission.ACCESS_NETWORK_STATE", packageName)));
hashMap.put("Read Phone State", Integer.valueOf(packageManager.checkPermission("android.permission.READ_PHONE_STATE", packageName)));
for (String str : hashMap.keySet()) {
if (((Integer) hashMap.get(str)).intValue() == -1) {
Log.e("IntegrationError", "Permission - " + str + " not found. Please add this permission in your AndroidManifest.xml. Ignore if added and build version >=23");
}
}
GodelTracker.getInstance().a(new Event().a(Event.Action.INFO).a(Event.Category.GODEL).c("godel_sdk_version").d("sdk_1423"));
GodelTracker.getInstance().a(new Event().a(Event.Action.INFO).a(Event.Category.GODEL).c("godel_sdk_git_sha").d("831e42d46"));
JuspayLogger.d("IntegrationInfo", "Integration Info:\n\tGodel Build - sdk_1423\n\tBuild Version - " + getString(R.string.build_version) + "\n\tGit Sha - 831e42d46\n\tOSD Sha - " + BuildConfig.GODEL_OSD_SDK_BUILD);
}
private void bu() {
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.INFO).c("activity_recreation").d("was_killed_restarting"));
}
private void bv() {
this.aH = getChildFragmentManager();
}
private FragmentManager bw() {
if (this.aH == null) {
bv();
}
return this.aH;
}
private void bx() {
try {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.INFO).c("Cookie Manager").d("Clearing Cookies"));
CookieSyncManager.createInstance(c()).sync();
CookieManager.getInstance().removeAllCookie();
} catch (Exception e) {
JuspayLogger.b(J, "Failed to clear cookies", e);
}
}
private class GestureListener extends GestureDetector.SimpleOnGestureListener {
private GestureListener() {
}
@Override
public boolean onDown(MotionEvent event) {
return true;
}
@Override
public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
Event c = new Event().a(Event.Category.UI).a(Event.Action.INFO).c("fling");
if (JuspayBrowserFragment.this.ak != null) {
c.d(JuspayBrowserFragment.this.ak.getClass().toString());
} else {
c.d("fragment_unknown");
}
GodelTracker.getInstance().a(c);
if (event2.getY() <= event1.getY()) {
if (JuspayBrowserFragment.this.aj != null) {
JuspayBrowserFragment.this.at();
return true;
}
return true;
}
JuspayBrowserFragment.this.as();
return true;
}
}
@Override
public boolean onTouch(View v, MotionEvent event) {
int id = v.getId();
if (id == R.id.empty_view) {
if (this.bc.getVisibility() == 4) {
return false;
}
ad();
return true;
}
if (id == R.id.fragment_content) {
return this.aB.onTouchEvent(event);
}
return false;
}
public void b(View view) {
View findViewById = view.findViewById(R.id.empty_view);
this.bc = findViewById;
d(findViewById);
this.bd = view.findViewById(R.id.mid_line);
this.bc.setOnTouchListener(this);
}
public void ad() {
if (this.bc != null && this.bd != null) {
getWebView().scrollBy(1, 1);
this.bd.setVisibility(0);
this.bc.setVisibility(4);
ar();
Event c = new Event().a(Event.Category.UI).a(Event.Action.OTHER).c("hide_blur");
GodelFragment godelFragment = this.ak;
if (godelFragment != null) {
c.d(godelFragment.getClass().toString());
} else {
c.d("fragment_unknown");
}
GodelTracker.getInstance().a(c);
}
}
public void c(View view) {
view.findViewById(R.id.fragment_content).setOnTouchListener(this);
}
private void d(View view) {
int b2 = FragmentConfig.b("overlay_top_color");
int b3 = FragmentConfig.b("overlay_bottom_color");
if (b2 != 0 && b3 != 0) {
view.setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{b2, b3}));
}
}
@Override
public void onGlobalLayout() {
GodelFragment godelFragment;
if (!c().isFinishing()) {
try {
if (!ae() && this.aj == null && (godelFragment = this.ak) != null) {
if (!godelFragment.getClass().getName().equals("in.juspay.godel.ui.ACSOptionsFragment")) {
View findViewById = j().findViewById(R.id.fragment_content);
if (findViewById != null) {
getWebView().getLayoutParams().height = findViewById.getTop();
getWebView().requestLayout();
return;
}
return;
}
}
View findViewById2 = j().findViewById(R.id.show_fragment_content);
View findViewById3 = j().findViewById(R.id.password_helper_fragment);
View findViewById4 = j().findViewById(R.id.password_generic_fragment);
View findViewById5 = j().findViewById(R.id.netbanking_default_fragment);
View findViewById6 = j().findViewById(R.id.customer_id_fragment);
if (findViewById2 != null) {
a((j().getHeight() - findViewById2.getHeight()) - bi());
} else if (findViewById3 != null) {
a((j().getHeight() - findViewById3.getHeight()) - bi());
} else if (findViewById4 != null) {
a((j().getHeight() - findViewById4.getHeight()) - bi());
} else if (findViewById5 != null) {
a((j().getHeight() - findViewById5.getHeight()) - bi());
} else if (findViewById6 != null) {
a((j().getHeight() - findViewById6.getHeight()) - bi());
} else {
getWebView().setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
getWebView().requestLayout();
}
} catch (RuntimeException e) {
JuspayLogger.b(J, "Error in GlobalLayoutListener", e);
}
}
}
private void by() {
ViewTreeObserver viewTreeObserver = this.M.getViewTreeObserver();
if (viewTreeObserver != null) {
viewTreeObserver.addOnGlobalLayoutListener(this);
}
}
public boolean ae() {
return (bY() == null && bX() == null && ca() == null && bZ() == null) ? false : true;
}
public void af() {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.INFO).c("password_helper_hidden").d(String.valueOf(this.aA)));
JuspayLogger.b(J, "Hiding Password Helper");
if (ca() != null) {
C();
} else {
au();
}
}
public void v(String str) {
if (str != null) {
if (str.length() < this.az) {
this.aA++;
try {
String a2 = FragmentConfig.a("highlight_show_password_backspace");
GodelFragment godelFragment = this.ak;
if (godelFragment != null && godelFragment.getClass().getName().equals("in.juspay.godel.ui.PasswordHelperFragment") && a2 != null && a2.equals("true")) {
((PasswordHelperFragment) this.ak).b();
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while Highlighting Show Password Button", e);
}
}
this.az = str.length();
}
if (ca() != null) {
ca().a(str);
} else if (bZ() != null) {
bZ().a(str);
}
}
public void w(String str) {
if (bY() != null) {
bY().a(str);
} else if (ca() != null) {
ca().b(str);
} else if (bX() != null) {
bX().a(str);
}
}
public boolean ag() {
return this.bP;
}
public void j(boolean z2) {
this.bP = z2;
}
private void P(String str) {
if (!WebLabService.getInstance().isEnabled(str) || SessionInfo.getInstance().j()) {
JuspayLogger.b(J, " Weblab is off for " + str + ". Disabling JB..");
if (!SessionInfo.getInstance().j()) {
SessionInfo.getInstance().g("FEATURE_DISABLED_" + str);
}
c().runOnUiThread(new JuspayRunnable(JuspayRunnable.a, str, this));
}
}
private void bz() {
P("GODEL");
}
protected void ah() {
Activity c = c();
try {
HashMap hashMap = new HashMap();
hashMap.put("android_id", aj());
hashMap.put("screen_width", SessionInfo.getInstance().l(c));
hashMap.put("screen_height", SessionInfo.getInstance().k(c));
hashMap.put("screen_ppi", SessionInfo.getInstance().m(c));
hashMap.put(PayuConstants.NETWORK_INFO, SessionInfo.getInstance().h(c));
hashMap.put("network_type", String.valueOf(SessionInfo.getInstance().i(c)));
hashMap.put("app_version", SessionInfo.getInstance().j(c));
hashMap.put("app_debuggable", String.valueOf((c.getApplicationInfo().flags & 2) != 0));
hashMap.put("dev_options_enabled", String.valueOf(SessionInfo.getInstance().r(c)));
if (!SessionInfo.getInstance().j() && WebLabService.getInstance().isEnabled("location")) {
hashMap.put("device_location", SessionInfo.getInstance().o(c).toString());
} else {
GodelTracker.getInstance().h("Not Logging location");
}
SessionInfo.getInstance().a(ay.getClientId());
GodelTracker.getInstance().a(c.getApplicationInfo().sourceDir, c.getApplicationInfo().packageName, String.valueOf(c.getApplicationInfo().loadLabel(c.getPackageManager())), hashMap);
GodelTracker.getInstance().b(ay);
GodelTracker.getInstance().e(ay.getClientId());
} catch (Exception e) {
JuspayLogger.a(J, e);
}
long currentTimeMillis = System.currentTimeMillis();
long currentTimeMillis2 = System.currentTimeMillis();
String str = J;
JuspayLogger.b(str, "Time taken for local config load in milliseconds: " + (currentTimeMillis2 - currentTimeMillis));
WebLabService.getInstance().setAttributes(c, ConfigService.getInstance());
ao();
JuspayLogger.b(str, "ClientId: " + SessionInfo.getInstance().i());
if (ay.getClientId() == null) {
JuspayLogger.b(str, "ClientId is null. Not renewing weblab info.");
return;
}
bA();
c(c);
GodelTracker.getInstance().k();
}
private void bA() {
try {
this.D.put("device_id", ai());
this.D.put("android_id", aj());
this.D.put("mac_address", ak());
GodelTracker.getInstance().a("device_identifiers", this.D.toString());
} catch (JSONException e) {
JuspayLogger.b(J, "Exception when logging device identifiers", e);
}
}
public String ai() {
KeyValueStore keyValueStore = new KeyValueStore(c());
if (c().checkSelfPermission("android.permission.READ_PHONE_STATE") != 0) {
return keyValueStore.a("device_id") ? keyValueStore.c("device_id", "") : "";
}
String n = SessionInfo.getInstance().n(this.A);
keyValueStore.a("device_id", n);
return n;
}
public String aj() {
return EncryptionHelper.a().a(Settings.Secure.getString(getContext().getContentResolver(), "android_id"));
}
public String ak() {
try {
for (NetworkInterface networkInterface : Collections.list(NetworkInterface.getNetworkInterfaces())) {
if (networkInterface.getName().equalsIgnoreCase("wlan0")) {
byte[] hardwareAddress = networkInterface.getHardwareAddress();
if (hardwareAddress == null) {
return "";
}
StringBuilder sb = new StringBuilder();
for (byte b2 : hardwareAddress) {
sb.append(String.format("%02X:", Byte.valueOf(b2)));
}
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
return EncryptionHelper.a().a(sb.toString());
}
}
} catch (Exception e) {
JuspayLogger.a(J, e);
}
return EncryptionHelper.a().a("02:00:00:00:00:00");
}
private void c(Context context) {
String str = J;
JuspayLogger.b(str, "renew Config called");
ConfigService.getInstance().renewInfo(g(), ay.getClientId(), context, new JuspayRunnable(JuspayRunnable.b, context, this), new JuspayRunnable(JuspayRunnable.c, context, this));
JuspayLogger.b(str, "renew Config complete");
}
private void bB() {
try {
N = new Properties();
InputStream open = c().getApplicationContext().getAssets().open("godel.properties");
N.load(open);
open.close();
} catch (IOException e) {
Log.w(J, "No File named godel.properties found in assets");
}
}
private static void d(Context context) {
try {
N = new Properties();
InputStream open = context.getAssets().open("godel.properties");
N.load(open);
open.close();
} catch (IOException e) {
Log.w(J, "No File named godel.properties found in assets");
}
}
public String x(String str) throws JSONException {
String str2 = (String) ConfigService.getInstance().getJSONObject("certificates_location").get(str);
String c = c("remote_assets_domain");
Uri parse = Uri.parse(str2);
if (c != null) {
String format = String.format("%s://%s%s", parse.getScheme(), c, parse.getPath());
JuspayLogger.b(J, format);
return format;
}
return str2;
}
public String y(String str) throws JSONException {
String str2 = (String) ConfigService.getInstance().getJSONObject("remotes").get(str);
String c = c("remote_assets_domain");
Uri parse = Uri.parse(str2);
if (c != null) {
String format = String.format("%s://%s%s", parse.getScheme(), c, parse.getPath());
JuspayLogger.b(J, format);
return format;
}
return str2;
}
public void startPaymentWithArguments(Bundle arguments) {
this.aw = System.currentTimeMillis();
JuspayLogger.b(J, "session_start_time" + this.aw);
a(arguments);
ah();
if (arguments.size() > 0) {
al();
}
}
public void startPaymentWithArguments(BrowserParams browserParams) {
a(browserParams.toBundle());
ah();
al();
}
public void al() {
bC();
k(true);
}
private void bC() {
if (!SessionInfo.getInstance().j()) {
this.Q.a(new WebviewClientImpl(getWebView(), this, this.Q));
GodelTracker.getInstance().a(new Event().d(DebugKt.DEBUG_PROPERTY_VALUE_ON).c("godel_engine_initialized").a(Event.Category.GODEL));
} else {
this.Q.a(new DummyWebviewClient(getWebView(), this, this.Q));
GodelTracker.getInstance().a(new Event().d(DebugKt.DEBUG_PROPERTY_VALUE_OFF).c("godel_engine_initialized").a(Event.Category.GODEL));
}
}
public static void preInit(Context ctx, String clientId, boolean isRemoteAssetDownloadEnabled, PreInitCallback preInitCallback) {
JuspayLogger.d(J, "preInit called");
aX = new KeyValueStore(ctx);
SessionInfo.getInstance().c(ctx);
e(ctx);
d(ctx);
bE();
x = new preInitRunnable(true, ctx, preInitCallback);
y = new preInitRunnable(false, ctx, preInitCallback);
ConfigService.getInstance().renewInfo(isRemoteAssetDownloadEnabled, clientId, ctx, x, y);
}
private static class preInitRunnable implements Runnable {
private PreInitCallback a;
private Boolean b;
private Context c;
private preInitRunnable(Boolean status, Context context, PreInitCallback preInitCallback) {
this.b = status;
this.c = context;
this.a = preInitCallback;
}
@Override
public void run() {
if (!this.b.booleanValue()) {
JuspayLogger.c(JuspayBrowserFragment.J, "Error Getting Pre Init Config");
return;
}
try {
JSONObject jSONObject = ConfigService.getInstance().getJSONObject("remotes");
String unused = JuspayBrowserFragment.aY = (String) jSONObject.get("acs_js_source");
String unused2 = JuspayBrowserFragment.aZ = (String) jSONObject.get("uber_js_source");
String unused3 = JuspayBrowserFragment.ba = (String) jSONObject.get("uber_html_source");
JuspayBrowserFragment.b(this.c, this.a);
} catch (JSONException e) {
JuspayLogger.a(JuspayBrowserFragment.J, e);
}
}
}
public static void b(final Context context, final PreInitCallback preInitCallback) {
new AsyncTask<Void, Void, Boolean>() {
@Override
public Boolean doInBackground(Void... voidArr) {
try {
String[] strArr = {JuspayBrowserFragment.aY, JuspayBrowserFragment.aZ, JuspayBrowserFragment.ba};
Integer[] numArr = new Integer[2];
numArr[0] = 0;
numArr[1] = 0;
boolean z2 = true;
for (int i2 = 0; i2 < 3; i2++) {
String str = strArr[i2];
boolean content = RemoteAssetService.getInstance().getContent(str, context, JuspayBrowserFragment.aX.c("CONFIG_TTL_MILLISECONDS", 30000L));
JuspayLogger.b(JuspayBrowserFragment.J, "Pre Init for [" + str + "] = " + content);
char c = content ? (char) 0 : (char) 1;
numArr[c] = Integer.valueOf(numArr[c].intValue() + 1);
z2 = z2 && content;
}
preInitCallback.onResult(z2, numArr);
return Boolean.valueOf(z2);
} catch (FileNotFoundException | JSONException e) {
JuspayLogger.a(JuspayBrowserFragment.J, e);
return false;
}
}
@Override
public void onPostExecute(Boolean bool) {
JuspayLogger.b(JuspayBrowserFragment.J, "PRE INIT RESULT - " + bool);
}
}.execute(new Void[0]);
}
public static String am() {
return bn;
}
public static String an() {
return bm;
}
private void bD() {
String c = c("analytics_endpoint");
if (c != null) {
bn = c;
GodelTracker.getInstance().a(new Event().d(String.format("Overriding analytics endpoint with %s for %s", c, ay.getClientId())).c("info").a(Event.Category.GODEL));
}
}
private static void bE() {
String c = c("config_source");
if (c != null) {
bm = c;
GodelTracker.getInstance().a(new Event().d(String.format("overriding configjs location with %s for merchant: %s", c, ay.getClientId())).c("info").a(Event.Category.GODEL));
}
}
private static void e(Context context) {
bm = context.getString(R.string.juspay_config_location);
}
public void ao() {
bz();
P("ANDROID_VERSION_" + String.valueOf(Build.VERSION.SDK_INT));
P("GODEL_VERSION_" + c().getString(R.string.godel_version));
P("SCREEN_" + (Integer.valueOf(c().getResources().getConfiguration().screenLayout & 15).toString() + "-" + Float.valueOf(c().getResources().getDisplayMetrics().density).toString()));
r("godel_initialized");
}
private void bF() {
this.ag = c().getPackageManager().checkPermission("android.permission.SEND_SMS", c().getPackageName()) == 0;
}
private void bG() {
this.ah = SessionInfo.getInstance().a((Context) getActivity(), "android.permission.READ_SMS");
}
private void bH() {
this.ai = SessionInfo.getInstance().a((Context) getActivity(), "android.permission.RECEIVE_SMS");
}
private void bI() {
this.B = SessionInfo.getInstance().a((Context) getActivity(), "android.permission.READ_PHONE_STATE");
}
private void bJ() {
bH();
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.provider.Telephony.SMS_RECEIVED");
intentFilter.setPriority(999);
try {
if (this.ai) {
this.ac = new SmsReceiver();
c().registerReceiver(this.ac, intentFilter);
JuspayLogger.b(J, "Registered SMS receiver");
GodelTracker.getInstance().a(new Event().d("sms").c("receiver_registered").a(Event.Category.UI));
} else {
GodelTracker.getInstance().a(new Event().d("no permission to receive sms").c("sms").a(Event.Category.UI));
}
} catch (Throwable th) {
JuspayLogger.b(J, "Failed to register SMS broadcast receiver (Ignoring)", th);
}
}
private void bK() {
if (!this.bl) {
bJ();
}
this.bl = true;
}
private void bL() {
try {
this.aK = new ConnectivityChangeReceiver();
c().registerReceiver(this.aK, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
JuspayLogger.b(J, "Registered Connectivity receiver");
GodelTracker.getInstance().a(new Event().d("connectivity").c("receiver_registered").a(Event.Category.UI));
} catch (Throwable th) {
JuspayLogger.b(J, "Failed to register Connectivity receiver (Ignoring)", th);
}
}
public void onResume() {
String str;
OtpSms a2;
try {
h = state.STARTING;
GodelTracker.getInstance().a(new Event().d("maximized").c("app_state").a(Event.Category.UI));
this.Q.d("maximized");
} catch (Throwable th) {
JuspayLogger.b(J, "Couldn't track onResume", th);
}
JuspayLogger.b(J, "Godel on Resume");
k = false;
super.onResume();
bo();
bK();
bL();
Fragment findFragmentById = getChildFragmentManager().findFragmentById(R.id.juspay_browser_user_input_area);
GodelFragment godelFragment = this.ak;
if (godelFragment != null && findFragmentById != godelFragment) {
if (this.aj != null) {
as();
} else {
b(godelFragment);
}
}
if (this.Y || this.aa) {
if (getWebView() != null && (str = this.Z) != null && Q(str).equals(Q(getWebView().getUrl()))) {
aA();
if (this.Y) {
z("Remove If any existing fragment");
ay();
} else if (this.aa) {
if ((this.ak instanceof RequestSMSFragment) && (findFragmentById instanceof RequestSMSFragment)) {
z("Permission Denied");
if (shouldShowRequestPermissionRationale("android.permission.READ_SMS")) {
n(false);
} else {
n(true);
}
} else if (shouldShowRequestPermissionRationale("android.permission.READ_SMS")) {
n(false);
} else {
n(true);
}
}
} else if ((this.ak instanceof RequestSMSFragment) && (findFragmentById instanceof RequestSMSFragment)) {
z("Context Changed");
}
this.Y = false;
this.aa = false;
}
GodelFragment godelFragment2 = this.ak;
if (godelFragment2 != null && (godelFragment2 instanceof WaitingFragment)) {
z("Removing Waiting Fragment on maximize of an app");
}
if (aX() != null && (a2 = aX().a(this.at)) != null) {
try {
aX().a(a2);
} catch (Exception e) {
JuspayLogger.b(J, "Exception while handling onOtpReceive - ", e);
}
}
showOnScreenDisplay(this.bI);
}
private String Q(String str) {
if (str.charAt(str.length() - 1) == '#') {
return str.substring(0, str.length() - 1);
}
return str;
}
public void onPause() {
try {
h = state.FINISHING;
UberController uberController = this.l;
if (uberController != null) {
uberController.d();
}
JuspayWaitingDialogManager.b(this).e();
GodelTracker.getInstance().a(new Event().d("minimized").c("app_state").a(Event.Category.UI));
this.Q.d("minimized");
} catch (Throwable th) {
JuspayLogger.b(J, "Couldn't track onPause", th);
}
JuspayLogger.b(J, "Godel on Pause");
if (aX() != null) {
a(false);
}
k = true;
super.onPause();
bN();
j("acs");
this.Q.a();
if (c().isFinishing() || isRemoving()) {
bM();
bU();
bV();
}
}
protected void b(Bundle bundle) {
if (bundle.getString("acs_url") != null) {
HashMap hashMap = new HashMap(5);
ab = hashMap;
hashMap.put("acs_url", bundle.getString("acs_url"));
ab.put("term_url", bundle.getString("term_url"));
ab.put("md", bundle.getString("md"));
ab.put("pareq", bundle.getString("pareq"));
}
}
private void bM() {
try {
if (this.ac != null && this.bl) {
this.bl = false;
c().unregisterReceiver(this.ac);
this.ac = null;
JuspayLogger.b(J, "Unregistered SMS receiver");
GodelTracker.getInstance().a(new Event().d("sms").c("receiver_unregistered").a(Event.Category.UI));
}
} catch (Throwable th) {
JuspayLogger.b(J, "Failed to unregister SMS receiver (Ignoring)", th);
}
}
private void bN() {
try {
if (this.aK != null) {
c().unregisterReceiver(this.aK);
this.aK = null;
JuspayLogger.b(J, "Unregistered Connectivity receiver");
GodelTracker.getInstance().a(new Event().d("connectivity").c("receiver_unregistered").a(Event.Category.UI));
}
} catch (Throwable th) {
JuspayLogger.b(J, "Failed to unregister connectivity receiver (Ignoring)", th);
}
}
public void k(boolean z2) {
if (ab != null) {
getWebView().loadUrl("file:///android_asset/juspay/acs_blank.html");
aB();
return;
}
if (this.ad != null) {
String str = J;
JuspayLogger.b(str, "Loading 3D secure through JusPay: " + this.ad);
if (this.aE != null) {
JuspayLogger.b(str, "Initializing webview using POST");
getWebView().postUrl(this.ad, EncodingUtils.getBytes(this.aE, "BASE64"));
return;
} else if (this.ae != null) {
getWebView().loadUrl(this.ad, this.ae);
return;
} else {
getWebView().loadUrl(this.ad);
return;
}
}
getWebView().loadUrl("file:///android_asset/juspay/acs_blank.html");
aB();
JuspayLogger.c(J, "URL is missing. Not loading anything in webview");
}
public static abstract class JuspayBackButtonCallback {
public abstract void transactionCancelled(JSONObject jSONObject) throws JSONException;
@Deprecated
public void transactionCancelled() {
}
public void onReceivedError(int errorCode, String failingUrl) {
}
}
public JuspayBranding ap() {
return this.bQ;
}
public void setupJuspayWebviewCallbackInterface(JuspayWebviewCallback webviewCallback) {
JuspayLogger.b(J, "Setting up webviewCallback");
this.v = webviewCallback;
}
public void setupBrandingInterface(JuspayBranding juspayBranding) {
this.bQ = juspayBranding;
}
public void setupJuspayBackButtonCallbackInterface(JuspayBackButtonCallback backButtonCallback) {
JuspayLogger.b(J, "Setting up backButtonCallback");
this.w = backButtonCallback;
}
public void l(boolean z2) {
try {
getWebView().getSettings().setJavaScriptCanOpenWindowsAutomatically(z2);
} catch (Exception e) {
JuspayLogger.b(J, "Exception while setting web settings", e);
}
}
protected void aq() {
WebSettings settings = getWebView().getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setDomStorageEnabled(true);
settings.setAppCacheMaxSize(5242880L);
settings.setAppCachePath(getContext().getApplicationContext().getCacheDir().getAbsolutePath());
settings.setAllowFileAccess(true);
settings.setAppCacheEnabled(true);
settings.setCacheMode(-1);
if (!bO()) {
settings.setCacheMode(1);
}
this.Q = newWebViewClient(getWebView());
this.af = newWebChromeClient();
if (JuspayLogger.a()) {
JuspayWebView.setWebContentsDebuggingEnabled(true);
}
getWebView().setWebViewClient(this.Q);
getWebView().setWebChromeClient(this.af);
JuspayWebviewCallback juspayWebviewCallback = this.v;
if (juspayWebviewCallback != null) {
juspayWebviewCallback.webviewReady();
}
bP();
}
private boolean bO() {
Context context = getContext();
getContext();
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
private void bP() {
this.bz = new OnSwipeTouchListener(this) {
@Override
public boolean a() {
JuspayBrowserFragment.this.R("right");
return false;
}
@Override
public boolean b() {
JuspayBrowserFragment.this.R("left");
if (WebLabService.getInstance() != null && WebLabService.getInstance().isEnabled("issue_reporting")) {
JuspayBrowserFragment.e(JuspayBrowserFragment.this);
if (JuspayBrowserFragment.this.bB == 1) {
JuspayBrowserFragment.this.bQ();
}
if (JuspayBrowserFragment.this.bB == 5) {
JuspayBrowserFragment.this.cb();
JuspayBrowserFragment.this.bB = 0;
JuspayBrowserFragment.this.bR();
}
}
return false;
}
@Override
public boolean c() {
JuspayBrowserFragment.this.R("down");
return false;
}
@Override
public boolean d() {
JuspayBrowserFragment.this.R("up");
return false;
}
};
getWebView().setOnTouchListener(this.bz);
}
public void R(String str) {
if (WebLabService.getInstance() != null && !SessionInfo.getInstance().j() && WebLabService.getInstance().isEnabled(Constants.LOG_SWIPE)) {
JuspayLogger.a(J, "webview_swiped", str);
}
}
public void bQ() {
bR();
CountDownTimer countDownTimer = new CountDownTimer(2000L, 100L) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
JuspayBrowserFragment.this.bB = 0;
JuspayBrowserFragment.this.bR();
}
};
this.bA = countDownTimer;
countDownTimer.start();
}
public void bR() {
CountDownTimer countDownTimer = this.bA;
if (countDownTimer != null) {
countDownTimer.cancel();
this.bA = null;
}
}
private void bS() {
if (getWebView() != null) {
WebSettings settings = getWebView().getSettings();
settings.setBuiltInZoomControls(WebLabService.getInstance().isEnabled("zoomEnabled"));
settings.setDisplayZoomControls(WebLabService.getInstance().isEnabled("displayZoom"));
}
}
protected JuspayWebChromeClient newWebChromeClient() {
return new JuspayWebChromeClient(this);
}
protected JuspayWebViewClient newWebViewClient(JuspayWebView juspayWebView) {
return new JuspayWebViewClient(juspayWebView, this);
}
public void a(ArrayList<OtpSms> arrayList) {
OtpSms otpSms = arrayList.isEmpty() ? null : arrayList.get(0);
String otp = otpSms != null ? otpSms.getOtp() : null;
String str = J;
JuspayLogger.b(str, "webview url is " + getWebView().getUrl());
if (otp != null && aX() != null) {
aX().a(otpSms);
return;
}
JuspayLogger.b(str, "OTP is: " + otp + ", OTPFragment is: " + aX());
if (otpSms != null && otpSms.getSms() != null) {
JuspayLogger.b(str, "Did not understand received OTP: " + otpSms.getSms().toLowerCase());
}
Iterator<OtpSms> it = arrayList.iterator();
while (it.hasNext()) {
G.push(it.next());
}
}
public void m(boolean z2) {
OTPFragment.a = z2;
}
public void a(boolean z2, int i2, int i3) {
OTPFragment.a = z2;
a(Integer.valueOf(i2));
b(Integer.valueOf(i3));
}
private boolean a(GodelFragment godelFragment) {
if (godelFragment instanceof OTPFragment) {
r("fragment_otp");
return WebLabService.getInstance().isEnabled("fragment_otp");
}
if (godelFragment instanceof ACSOptionsFragment) {
r("fragment_acs");
return WebLabService.getInstance().isEnabled("fragment_acs");
}
if (godelFragment instanceof NetbankingCustomerIdFragment) {
r("fragment_nb_customer_id");
return WebLabService.getInstance().isEnabled("fragment_nb_customer_id");
}
if (godelFragment instanceof PasswordHelperFragment) {
r("fragment_password");
return WebLabService.getInstance().isEnabled("fragment_password");
}
if (godelFragment instanceof NetbankingDefaultFragment) {
r("fragment_nb_default");
return WebLabService.getInstance().isEnabled("fragment_nb_default");
}
if (godelFragment instanceof WaitingFragment) {
r("fragment_waiting");
return WebLabService.getInstance().isEnabled("fragment_waiting");
}
if (godelFragment instanceof GenericPasswordFragment) {
r("fragment_password_generic");
return WebLabService.getInstance().isEnabled("fragment_password_generic");
}
return true;
}
private void b(GodelFragment godelFragment) {
UberController uberController = this.l;
if (uberController != null && uberController.b() != null) {
this.l.b(this.l.b().a(godelFragment.getClass().getName()));
}
if (!a(godelFragment)) {
JuspayLogger.a(J, "fragment_off", godelFragment.getClass().getName());
z("Removing if any fragment exists");
return;
}
if (SessionInfo.getInstance().j()) {
v();
JuspayLogger.b(J, "Disabling loading fragment since JB is disabled");
return;
}
String str = J;
JuspayLogger.b(str, "Request to load " + godelFragment.getClass().getName());
if (getActivity() != null) {
GodelFragment godelFragment2 = this.ak;
if (godelFragment2 == null || a(godelFragment, godelFragment2)) {
JuspayLogger.b(str, "Loading Assistant fragment " + godelFragment.getClass().getName());
try {
FragmentTransaction beginTransaction = bw().beginTransaction();
if (this.aj != null) {
JuspayLogger.b(str, "Removing ShowButton Fragment");
beginTransaction.remove(this.aj);
this.aj = null;
}
if (godelFragment.getClass().getName().equals("in.juspay.godel.ui.WaitingFragment")) {
c(godelFragment);
}
if (!godelFragment.getClass().getName().equals("in.juspay.godel.ui.WaitingFragment")) {
w();
}
a(godelFragment, beginTransaction);
beginTransaction.replace(R.id.juspay_browser_user_input_area, godelFragment, godelFragment.getClass().getSimpleName());
beginTransaction.show(godelFragment);
beginTransaction.commitAllowingStateLoss();
bw().executePendingTransactions();
GodelTracker.getInstance().a(this.ax, godelFragment);
this.ak = godelFragment;
} catch (Exception e) {
JuspayLogger.b(J, "Error in execute pending transactions ", e);
}
}
}
}
public void a(String str, String str2) {
try {
if (str == null || str2 == null) {
Dialog dialog = this.m;
if (dialog != null && dialog.isShowing()) {
this.m.dismiss();
return;
}
return;
}
if (this.m == null) {
Dialog dialog2 = new Dialog(c(), R.style.FullScreenDialog);
this.m = dialog2;
dialog2.setContentView(R.layout.juspay_custom_help_fullscreen);
TextView textView = (TextView) this.m.findViewById(R.id.help_text_title);
TextView textView2 = (TextView) this.m.findViewById(R.id.help_text_body);
if (textView != null) {
textView.setText(Html.fromHtml(str));
}
if (textView2 != null) {
textView2.setText(Html.fromHtml(str2));
}
this.m.setCanceledOnTouchOutside(true);
this.m.getWindow().setWindowAnimations(R.style.HelpDialogAnimation);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.copyFrom(this.m.getWindow().getAttributes());
int i2 = layoutParams.height;
this.m.setOnDismissListener(new JuspayDialogInterface("HELP_DIALOG"));
this.m.show();
this.m.getWindow().setLayout(-1, i2);
View findViewById = this.m.findViewById(R.id.custom_help_dialog_root_view);
if (findViewById != null) {
findViewById.setOnClickListener(this);
}
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while showing Custom Help Dialog", e);
}
}
private boolean a(GodelFragment godelFragment, GodelFragment godelFragment2) {
String name = godelFragment.getClass().getName();
return (name.equals(godelFragment2.getClass().getName()) && name.equals(WaitingFragment.class.getName())) ? false : true;
}
private void a(GodelFragment godelFragment, FragmentTransaction fragmentTransaction) {
if (godelFragment.getClass().getName().equals("in.juspay.godel.ui.ACSOptionsFragment")) {
fragmentTransaction.setCustomAnimations(R.anim.juspay_slide_from_below, R.anim.juspay_slide_to_above);
}
if (godelFragment.getClass().getName().equals("in.juspay.godel.ui.WaitingFragment") && this.R.equals("ACSOptionsFragment")) {
JuspayLogger.b(J, "acsType - " + this.aC);
if (this.aC.equals(Constants.OTP)) {
this.S = getResources().getString(R.string.retrieveOTP);
} else if (this.aC.equals("pass")) {
this.S = getResources().getString(R.string.loadingPasswordPage);
} else {
this.S = getResources().getString(R.string.connectingToBank);
}
fragmentTransaction.setCustomAnimations(R.anim.juspay_slide_from_below, R.anim.juspay_slide_to_above);
}
this.R = godelFragment.getClass().getSimpleName();
}
private void c(GodelFragment godelFragment) {
String str = this.R;
if (str != null && str.equals("ACSOptionsFragment")) {
if (this.aC.equals(Constants.OTP)) {
S("waiting_text_otp");
} else if (this.aC.equals("pass")) {
S("waiting_text_pass");
}
} else {
String str2 = this.R;
if (str2 != null && str2.equals("OTPFragment")) {
S("waiting_text_success");
} else {
S("waiting_text_connect");
}
}
Bundle bundle = new Bundle();
bundle.putString("message", this.S);
godelFragment.setArguments(bundle);
}
private void S(String str) {
String a2 = FragmentConfig.a(str);
if (a2 != null) {
this.S = a2;
}
}
public void ar() {
JuspayLogger.b(J, "Resetting WebView Height");
View findViewById = j().findViewById(R.id.fragment_content);
if (findViewById != null) {
getWebView().getLayoutParams().height = findViewById.getTop();
} else {
getWebView().setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
}
getWebView().requestLayout();
}
public void a(int i2) {
getWebView().getLayoutParams().width = -1;
getWebView().getLayoutParams().height = i2;
getWebView().requestLayout();
}
public void as() {
String str = J;
JuspayLogger.b(str, "Hiding Assistant fragment");
if (this.ak != null && !ae()) {
FragmentTransaction beginTransaction = bw().beginTransaction();
beginTransaction.hide(this.ak);
if (this.aj != null) {
JuspayLogger.b(str, "Using earlier SAF");
beginTransaction.show(this.aj);
} else {
this.aj = new MaximizeFragment();
JuspayLogger.b(str, "Creating new SAF");
beginTransaction.add(R.id.juspay_browser_user_input_area, this.aj);
}
beginTransaction.commitAllowingStateLoss();
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.OTHER).c("hide_godel_fragment"));
getWebView().setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
getWebView().requestLayout();
}
}
void at() {
String str = J;
JuspayLogger.b(str, "Showing Assistant fragment");
if (this.ak != null) {
FragmentTransaction beginTransaction = bw().beginTransaction();
if (this.aj != null) {
JuspayLogger.b(str, "Removing Show Button Fragment");
beginTransaction.remove(this.aj);
this.aj = null;
}
beginTransaction.show(this.ak);
beginTransaction.commitAllowingStateLoss();
GodelTracker.getInstance().a(new Event().a(Event.Category.UI).a(Event.Action.OTHER).c("show_godel_fragment"));
}
}
public void z(String str) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.FALLBACK).c("reason").d(str));
JuspayLogger.b(J, "Removing Assistant Fragment: " + str);
au();
}
void au() {
if (this.ak != null) {
FragmentTransaction beginTransaction = bw().beginTransaction();
beginTransaction.remove(this.ak);
GodelFragment godelFragment = this.aj;
if (godelFragment != null) {
beginTransaction.remove(godelFragment);
this.aj = null;
}
beginTransaction.commitAllowingStateLoss();
this.ak = null;
}
}
public RequestSMSFragment av() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof RequestSMSFragment) {
return (RequestSMSFragment) godelFragment;
}
return null;
}
public void n(boolean z2) {
RequestSMSFragment av = av();
if (av == null) {
av = new RequestSMSFragment();
if (z2) {
Bundle bundle = new Bundle();
bundle.putBoolean("never_ask_opted", z2);
av.setArguments(bundle);
}
}
b(av);
}
public void aw() {
ACSOptionsFragment aCSOptionsFragment;
if (bW() != null) {
aCSOptionsFragment = bW();
} else {
aCSOptionsFragment = new ACSOptionsFragment();
Bundle bundle = new Bundle();
bundle.putBoolean("otp_enabled", this.an);
bundle.putBoolean("passwd_enabled", this.ao);
aCSOptionsFragment.setArguments(bundle);
}
b(aCSOptionsFragment);
}
public boolean A(String str) {
try {
if (c() != null) {
PackageInfo packageInfo = c().getPackageManager().getPackageInfo(c().getPackageName(), 4096);
if (packageInfo.requestedPermissions != null) {
for (String str2 : packageInfo.requestedPermissions) {
if (str2.equals(str)) {
return true;
}
}
}
}
} catch (Exception e) {
JuspayLogger.a(J, e);
}
return false;
}
public void B(String str) {
JSONObject jSONObject;
ACSOptionsFragment aCSOptionsFragment;
Boolean valueOf = Boolean.valueOf(this.an);
Boolean valueOf2 = Boolean.valueOf(this.ao);
try {
jSONObject = new JSONObject(str);
} catch (JSONException e) {
JuspayLogger.a(J, e);
jSONObject = null;
}
try {
if (jSONObject.has("otp_enabled")) {
valueOf = Boolean.valueOf(new JSONObject(str).getBoolean("otp_enabled"));
} else if (jSONObject.has("password_enabled")) {
valueOf2 = Boolean.valueOf(new JSONObject(str).getBoolean("password_enabled"));
}
} catch (JSONException e2) {
JuspayLogger.a(J, e2);
}
if (bW() != null) {
aCSOptionsFragment = bW();
} else {
aCSOptionsFragment = new ACSOptionsFragment();
Bundle bundle = new Bundle();
bundle.putBoolean("otp_enabled", valueOf.booleanValue());
bundle.putBoolean("passwd_enabled", valueOf2.booleanValue());
aCSOptionsFragment.setArguments(bundle);
}
b(aCSOptionsFragment);
}
int ax() {
try {
return c().getPackageManager().getPackageInfo(c().getPackageName(), 0).applicationInfo.targetSdkVersion;
} catch (PackageManager.NameNotFoundException e) {
GodelTracker.getInstance().a("Exception trying to find target version ", new Date(System.currentTimeMillis()), e);
return 0;
}
}
public void ay() {
OTPFragment oTPFragment;
bG();
bH();
ArrayList arrayList = new ArrayList();
if (!this.ai && WebLabService.getInstance().isEnabled("feature_dynamic_sms_permission")) {
arrayList.add("android.permission.RECEIVE_SMS");
}
if (!this.ah && WebLabService.getInstance().isEnabled("feature_dynamic_sms_permission")) {
arrayList.add("android.permission.READ_SMS");
}
KeyValueStore keyValueStore = new KeyValueStore(c());
if (!this.bF) {
if (arrayList.size() == 0) {
keyValueStore.a("neverAskAgainSMSRead", (Boolean) false);
keyValueStore.a("neverAskAgainSMSReceive", (Boolean) false);
JuspayLogger.b(J, "Sms read permissions found");
GodelTracker.getInstance().h("sms_permissions_present");
if (aX() != null) {
oTPFragment = aX();
} else {
oTPFragment = new OTPFragment();
}
b(oTPFragment);
return;
}
z("Sms read permissions not found ");
GodelTracker.getInstance().h("Sms read permissions not found");
if (!bp()) {
GodelTracker.getInstance().h("No telephony service available");
return;
}
if (!A("android.permission.READ_SMS") && !A("android.permission.RECEIVE_SMS")) {
Log.e(J, "Please check if permissions for READ_SMS and RECEIVE_SMS are declared in Manifest");
GodelTracker.getInstance().h("Sms permission not declared in manifest");
return;
}
if (!SessionInfo.getInstance().j() && WebLabService.getInstance() != null && WebLabService.getInstance().isEnabled("feature_dynamic_sms_permission")) {
if (ax() > 22 && shouldShowRequestPermissionRationale("android.permission.READ_SMS")) {
GodelTracker.getInstance().h("Showing permission dialog");
az();
requestPermissions(new String[]{"android.permission.READ_SMS", "android.permission.RECEIVE_SMS"}, 1);
return;
} else if (ax() <= 22 || (keyValueStore.a("neverAskAgainSMSRead", false).booleanValue() && keyValueStore.a("neverAskAgainSMSReceive", false).booleanValue())) {
GodelTracker.getInstance().h("user opted for never ask again");
n(true);
return;
} else {
GodelTracker.getInstance().h("Showing permission dialog");
az();
requestPermissions(new String[]{"android.permission.READ_SMS", "android.permission.RECEIVE_SMS"}, 1);
return;
}
}
GodelTracker.getInstance().h("Dynamic SMS Permission flow feature disabled by godel");
return;
}
JuspayLogger.b(J, "Activity is in background or OTP fragment removed");
}
public void az() {
if (getWebView() != null) {
String url = getWebView().getUrl();
this.Z = url;
if (url != null) {
GodelTracker.getInstance().h("Sms permission requested at url " + this.Z);
}
}
}
public void aA() {
this.Z = null;
GodelTracker.getInstance().h("Sms permission requested at url " + this.Z + " cleared");
}
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
JuspayLogger.b(J, "onRequestPermissionsResult() called with: requestCode = [" + requestCode + "], permissions = [" + permissions + "], grantResults = [" + grantResults + "]");
KeyValueStore keyValueStore = new KeyValueStore(c());
if (requestCode == 1 && permissions != null && grantResults != null) {
boolean z2 = true;
for (String str : permissions) {
if (str.equals("android.permission.READ_SMS")) {
bG();
if (this.ah) {
GodelTracker.getInstance().h("READ_SMS permission granted");
} else {
keyValueStore.a("neverAskAgainSMSRead", Boolean.valueOf(!shouldShowRequestPermissionRationale(str)));
GodelTracker.getInstance().h("READ_SMS permission denied");
z2 = false;
}
} else if (str.equals("android.permission.RECEIVE_SMS")) {
bH();
if (this.ai) {
GodelTracker.getInstance().h("RECEIVE_SMS permission granted");
} else {
keyValueStore.a("neverAskAgainSMSReceive", Boolean.valueOf(!shouldShowRequestPermissionRationale(permissions[0])));
GodelTracker.getInstance().h("RECEIVE_SMS permission denied");
z2 = false;
}
} else if (str.equals("android.permission.READ_PHONE_STATE")) {
bI();
if (this.B) {
GodelTracker.getInstance().h("READ_PHONE_STATE permission granted");
GodelTracker.getInstance().a("device_id", SessionInfo.getInstance().n(this.A));
} else {
GodelTracker.getInstance().h("READ_PHONE_STATE permission denied");
}
}
}
if (z2) {
this.Y = true;
} else {
this.aa = true;
}
}
if (requestCode == 2 && permissions != null && grantResults != null) {
if (grantResults.length > 0 && grantResults[0] == 0) {
GodelTracker.getInstance().h("READ_PHONE_STATE permission granted");
GodelTracker.getInstance().a("device_id", SessionInfo.getInstance().n(this.A));
} else {
GodelTracker.getInstance().h("READ_PHONE_STATE permission denied");
}
}
}
public void aB() {
WaitingFragment waitingFragment;
if (aI().booleanValue()) {
if (aY() != null) {
waitingFragment = aY();
} else {
waitingFragment = new WaitingFragment();
}
b(waitingFragment);
}
}
public void C(String str) {
JuspayLogger.f(J, "Set State is not supported now");
}
private void bT() {
if (g) {
x = null;
y = null;
bL = null;
N = null;
ab = null;
ay = null;
aX = null;
aY = null;
aZ = null;
ba = null;
bm = null;
bo = null;
bp = null;
bq = null;
br = null;
q = null;
bx = null;
b = null;
G.clear();
FrameLayout frameLayout = this.M;
if (frameLayout != null && frameLayout.getViewTreeObserver() != null) {
this.M.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
JuspayWebViewClient juspayWebViewClient = this.Q;
if (juspayWebViewClient != null) {
juspayWebViewClient.a();
this.Q = null;
}
JuspayWebView juspayWebView = this.P;
if (juspayWebView != null) {
juspayWebView.removeJavascriptInterface("Gatekeeper");
this.P.stopLoading();
this.P.removeAllViews();
this.P.destroy();
this.P = null;
return;
}
return;
}
JuspayLogger.b(J, "Not resetting static variables, another session has started!");
}
private void bU() {
boolean z2;
try {
if (x().intValue() > 0 && SessionInfo.getInstance().wasGodelEnabled()) {
z2 = true;
} else {
z2 = false;
}
GodelTracker.getInstance().a(new Event().d(String.valueOf(z2)).c("was_godel_enabled").a(Event.Category.GODEL));
} catch (Exception e) {
JuspayLogger.b(J, "Exception in onDestroyView. Couldn't track was_godel_enabled", e);
}
ac();
((FrameLayout) j().findViewById(R.id.juspay_browser_frame)).removeAllViews();
}
private void bV() {
if (!SessionInfo.getInstance().l()) {
JuspayLogger.g(J, "INTEGRATION ERROR - Payment Status not sent");
}
au();
GodelTracker.getInstance().b(ay);
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.INFO).c("session_killing").d("Session is getting killed"));
try {
GodelTracker.getInstance().exitTrackingWithDelay();
} catch (JSONException e) {
JuspayLogger.b(J, "Error exiting godel tracker with delay", e);
}
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = r;
if (uncaughtExceptionHandler != null && !(uncaughtExceptionHandler instanceof UncaughtExceptionHandler)) {
Thread.setDefaultUncaughtExceptionHandler(uncaughtExceptionHandler);
} else {
Thread.setDefaultUncaughtExceptionHandler(null);
}
a(state.FINISHING);
bT();
}
public void onDestroyView() {
super.onDestroyView();
}
public void onDestroy() {
super.onDestroy();
}
private void a(state stateVar) {
if (stateVar == state.STARTING || (stateVar == state.FINISHING && g)) {
AssetService.getInstance().resetSingleton();
ConfigService.getInstance().resetSingleton();
RemoteAssetService.getInstance().resetSingleton();
WebLabService.getInstance().resetSingleton();
EncryptionHelper.a().b();
SessionInfo.getInstance().a();
JuspayWaitingDialogManager.b(this).c();
JuspayDropoutAnalyser.getInstance().resetSingleton();
LocationDetector.a().b();
LoggingUtil.getInstance().resetSingleton();
UberController uberController = this.l;
if (uberController != null && g) {
uberController.e();
this.l = null;
return;
}
return;
}
JuspayLogger.b(J, "A new session has stopped reset of all singletons");
}
public void aC() {
this.T = true;
}
public Boolean aD() {
return this.T;
}
public void aE() {
Map<String, String> map = ab;
if (map != null) {
String format = String.format("setupAcsForm('%s','%s','%s','%s')", map.get("acs_url"), ab.get("pareq"), ab.get("term_url"), ab.get("md"));
JuspayLogger.b(J, "Injecting ACS script: " + format);
a(format, getWebView());
}
}
public boolean aF() {
return this.ag;
}
public JuspayWebView getWebView() {
return this.P;
}
public ProgressBar aG() {
return this.O;
}
public JuspayWebViewClient aH() {
return this.Q;
}
public Boolean aI() {
return this.al;
}
public void D(String str) {
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.CLICK).c("otp_time_out_option").d(str));
}
@Override
public void onCancel(DialogInterface dialog) {
if (aX() != null) {
aX().a(aK());
}
}
public void aJ() {
String str;
String str2;
String str3;
CharSequence[] charSequenceArr;
if (FragmentConfig.a("enter_otp_manually") == null) {
str = "Enter OTP Manually";
} else {
str = FragmentConfig.a("enter_otp_manually");
}
if (FragmentConfig.a("wait_more") == null) {
str2 = "Wait More";
} else {
str2 = FragmentConfig.a("wait_more");
}
if (FragmentConfig.a("regenerate_otp") == null) {
str3 = "Regenerate OTP";
} else {
str3 = FragmentConfig.a("regenerate_otp");
}
if (aD().booleanValue()) {
charSequenceArr = new CharSequence[]{str, str2, str3};
} else {
charSequenceArr = new CharSequence[]{str, str2};
}
UberController uberController = this.l;
if (uberController != null && uberController.b() != null) {
this.l.b(this.l.b().d());
}
AlertDialog.Builder builder = new AlertDialog.Builder(c());
builder.setTitle(FragmentConfig.a("retry_dialog_title", "Could not read OTP"));
builder.setCancelable(true);
builder.setOnCancelListener(this);
builder.setItems(charSequenceArr, new JuspayDialogInterface("SHOW_RETRY_OPTIONS"));
try {
AlertDialog show = builder.show();
this.am = show;
show.setCanceledOnTouchOutside(false);
} catch (Exception e) {
JuspayLogger.b(J, "Activity Destroyed before Showing Retry Options Dialog", e);
}
}
public void a(Constants.RetryOptionType retryOptionType) {
this.ap = Integer.valueOf(this.ap.intValue() + 1);
D("shown");
if (retryOptionType == Constants.RetryOptionType.ENTER_MANUALLY) {
JuspayLogger.b(J, "IN MANUAL OTP JB");
D("manual_otp");
as();
this.Q.h();
return;
}
if (retryOptionType == Constants.RetryOptionType.REGENERATE_OTP) {
JuspayLogger.b(J, "Regenerating OTP: ");
D("regenerate_otp");
if (aX() != null) {
aX().a(Integer.valueOf(aK()));
}
this.Q.c();
return;
}
if (retryOptionType == Constants.RetryOptionType.WAIT_MORE) {
D("wait more");
if (aX() != null) {
a(Constants.CountdownTimerFragment.WAITING_30_SECONDS);
aX().a(aX().b(), 0, Constants.CountdownTimerFragment.WAITING_30_SECONDS);
}
}
}
public int aK() {
Integer num = this.U;
if (num != null) {
return num.intValue();
}
return 45000;
}
public void hideRetryOptionsDialog() {
AlertDialog alertDialog = this.am;
if (alertDialog != null) {
alertDialog.dismiss();
D(OneSignalDbContract.NotificationTable.COLUMN_NAME_DISMISSED);
this.am = null;
}
}
public void aL() {
JuspayLogger.b(J, "disabling regenerate option form the OTP timeout Dialog");
this.T = false;
}
public void aM() {
this.an = false;
if (bW() != null) {
bW().a();
}
}
public void aN() {
this.ao = false;
if (bW() != null) {
bW().b();
}
}
public void E(String str) {
Constants.CustomerIdPersistType customerIdPersistType;
if (this.aN) {
KeyValueStore keyValueStore = new KeyValueStore(c());
String str2 = ay.getBank() + "_customerId";
if (k()) {
customerIdPersistType = Constants.CustomerIdPersistType.STORE;
JuspayLogger.b(J, "Saving Customer ID " + str + " with key " + str2);
try {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
keyValueStore.a(str2, Base64.encodeToString(EncryptionHelper.a().a(a, str, keyStore), 0));
} catch (Exception e) {
JuspayLogger.a(J, e);
}
} else {
customerIdPersistType = Constants.CustomerIdPersistType.FORGET;
if (keyValueStore.a(str2)) {
JuspayLogger.b(J, "Removing Customer ID for " + str2);
keyValueStore.b(str2);
}
}
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.PREFERENCES).c("customer_id").d(customerIdPersistType.name()));
return;
}
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.PREFERENCES).c("customer_id").d("Not Storing as Fragment was switched Off"));
}
public String F(String str) {
KeyValueStore keyValueStore = new KeyValueStore(c());
try {
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
keyStore.load(null);
byte[] decode = Base64.decode(keyValueStore.c(str, ""), 0);
if (!keyValueStore.a(str)) {
return "";
}
return EncryptionHelper.a().a(a, decode, keyStore);
} catch (IOException e) {
JuspayLogger.a(J, e);
return "";
} catch (KeyStoreException e2) {
JuspayLogger.a(J, e2);
return "";
} catch (NoSuchAlgorithmException e3) {
JuspayLogger.a(J, e3);
return "";
} catch (CertificateException e4) {
JuspayLogger.a(J, e4);
return "";
}
}
public void aO() {
JuspayLogger.f(J, "Page matched.");
if (!S()) {
i(true);
aS();
}
}
public void aP() {
JuspayLogger.f(J, "no page matched. No implementation");
}
public void aQ() {
JuspayLogger.f(J, "dom check failure. No implementation");
}
public void aR() {
JuspayLogger.f(J, "transaction completed. No implementation");
}
public void aS() {
JuspayLogger.f(J, "transaction started. No implementation");
}
public void a(Long l) {
this.at = l;
}
public void b(Long l) {
JuspayLogger.b(J, "Setting sms back reading time form session start time - " + l);
this.av = l;
}
public Long aT() {
return this.av;
}
public void c(Long l) {
String str = J;
JuspayLogger.b(str, "Setting sms back reading time - " + l);
JuspayLogger.b(str, "current time - " + System.currentTimeMillis() + "time from which it reads " + (System.currentTimeMillis() - l.longValue()));
this.au = l;
}
public long aU() {
return this.aw;
}
public void G(String str) {
JuspayLogger.f(J, "starting share content on sharing apps");
Intent intent = new Intent();
intent.setAction("android.intent.action.SEND");
intent.putExtra("android.intent.extra.TEXT", str);
intent.setType("text/plain");
startActivity(intent);
}
public void b(String str, String str2) {
String defaultSmsPackage = Telephony.Sms.getDefaultSmsPackage(this.A);
Intent intent = new Intent("android.intent.action.SEND");
intent.setType("text/plain");
intent.putExtra("android.intent.extra.TEXT", str);
intent.putExtra(PayuConstants.IFSC_ADDRESS, str2);
if (defaultSmsPackage != null) {
intent.setPackage(defaultSmsPackage);
}
startActivity(intent);
}
public boolean c(String str, String str2) {
if (this.ag) {
try {
SmsManager.getDefault().sendTextMessage(str2, null, str, null, null);
Toast.makeText(this.A, "Sms Sent ", 1).show();
return true;
} catch (Exception e) {
Toast.makeText(this.A, "Could not send sms", 1).show();
JuspayLogger.b(J, "Exception while sending sms", e);
return false;
}
}
return false;
}
public Long aV() {
return this.at;
}
public Stack<OtpSms> aW() {
return G;
}
public void H(String str) {
if (str.equalsIgnoreCase("")) {
return;
}
ConfigService.getInstance().updatePiConfig(str);
FragmentConfig.a();
ay.setBank(str.toUpperCase());
P("pi_" + ay.getBank());
if (this.U == null) {
this.U = Integer.valueOf(new OtpUtil(c()).c(ay.getBank()));
}
GodelTracker.getInstance().f(ay.getBank());
}
private ACSOptionsFragment bW() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof ACSOptionsFragment) {
return (ACSOptionsFragment) godelFragment;
}
return null;
}
private NetbankingDefaultFragment bX() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof NetbankingDefaultFragment) {
return (NetbankingDefaultFragment) godelFragment;
}
return null;
}
private NetbankingCustomerIdFragment bY() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof NetbankingCustomerIdFragment) {
return (NetbankingCustomerIdFragment) godelFragment;
}
return null;
}
public OTPFragment aX() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof OTPFragment) {
return (OTPFragment) godelFragment;
}
return null;
}
private GenericPasswordFragment bZ() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof GenericPasswordFragment) {
return (GenericPasswordFragment) godelFragment;
}
return null;
}
private PasswordHelperFragment ca() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof PasswordHelperFragment) {
return (PasswordHelperFragment) godelFragment;
}
return null;
}
public WaitingFragment aY() {
GodelFragment godelFragment = this.ak;
if (godelFragment instanceof WaitingFragment) {
return (WaitingFragment) godelFragment;
}
return null;
}
public GodelFragment aZ() {
return this.ak;
}
public void o(boolean z2) {
NetbankingCustomerIdFragment bY = bY();
if (bY != null) {
bY.a(z2);
GodelTracker.getInstance().a(new Event().a(Event.Category.GODEL).a(Event.Action.CHECK).d("Set to " + z2).c("customer_id_checkbox"));
}
}
public static String ba() {
try {
Iterator it = Collections.list(NetworkInterface.getNetworkInterfaces()).iterator();
while (it.hasNext()) {
for (InetAddress inetAddress : Collections.list(((NetworkInterface) it.next()).getInetAddresses())) {
if (!inetAddress.isLoopbackAddress()) {
String upperCase = inetAddress.getHostAddress().toUpperCase();
if (InetAddressUtils.isIPv4Address(upperCase)) {
return upperCase;
}
}
}
}
return "";
} catch (Exception e) {
JuspayLogger.b(J, "Failed to Retreive IP address", e);
return "";
}
}
public void setWebViewClient(JuspayWebViewClient webViewClient) {
this.Q = webViewClient;
}
public void I(String str) {
if (str != null) {
this.aU = str;
this.aR = System.currentTimeMillis();
this.aS.clear();
this.aT = 0L;
}
}
public void a(boolean z2, String str) {
if (z2) {
if (this.aS.size() == 0) {
this.aT = System.currentTimeMillis();
}
this.aS.add(Long.valueOf(System.currentTimeMillis() - this.aT));
this.aT = System.currentTimeMillis();
return;
}
String str2 = this.aU;
if (str2 == null || !str2.equals(str) || this.aS.size() <= 0) {
return;
}
long j2 = 0;
if (System.currentTimeMillis() - this.aR != 0) {
GodelTracker.getInstance().a(new Event().a(Event.Category.ACS).a(Event.Action.INFO).c("typing_speed_for_" + str).d(String.valueOf(this.aS.size() / (System.currentTimeMillis() - this.aR))));
Iterator<Long> it = this.aS.iterator();
long j3 = 0;
while (it.hasNext()) {
j3 += it.next().longValue();
}
long size = j3 / this.aS.size();
Iterator<Long> it2 = this.aS.iterator();
while (it2.hasNext()) {
long longValue = size - it2.next().longValue();
j2 += longValue * longValue;
}
GodelTracker.getInstance().a(new Event().a(Event.Category.ACS).a(Event.Action.INFO).c("user_typing_statistics_for_" + str).d(String.valueOf("mean=" + size + " sd=" + Math.sqrt(j2 / this.aS.size()))));
}
}
public void d(String str, String str2) {
aH().a(str, str2);
}
public void onDetach() {
super.onDetach();
e(false);
if (getWebView() != null) {
getWebView().stopLoading();
getWebView().loadUrl("file:///android_asset/juspay/acs_blank.html");
getWebView().destroy();
}
}
public void cb() {
try {
AlertDialog.Builder builder = new AlertDialog.Builder(c());
builder.setTitle("Report an issue to Juspay!");
builder.setView(c().getLayoutInflater().inflate(R.layout.juspay_report_issue_dialog, (ViewGroup) null));
builder.setPositiveButton("Report", new JuspayDialogInterface("SHOW_ERROR_REPORT"));
builder.setNegativeButton("Cancel", new JuspayDialogInterface("SHOW_ERROR_REPORT"));
builder.show();
JuspayLogger.f(J, "Issue reporting dialog shown");
} catch (Exception e) {
JuspayLogger.b(J, "Error while reporting issue to juspay", e);
}
}
private boolean cc() {
PackageManager packageManager = c().getPackageManager();
String packageName = c().getPackageName();
return packageManager.checkPermission(LocationConstants.ANDROID_COARSE_LOCATION_PERMISSION_STRING, packageName) == 0 || packageManager.checkPermission(LocationConstants.ANDROID_FINE_LOCATION_PERMISSION_STRING, packageName) == 0;
}
private boolean cd() {
return c().getPackageManager().checkPermission("android.permission.ACCESS_WIFI_STATE", c().getPackageName()) == 0;
}
public boolean J(String str) {
try {
String[] U = U();
if (U != null && str != null) {
for (String str2 : U) {
if (str2 != null && str2.length() > 0 && str.contains(str2)) {
return true;
}
}
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while checking domain for custom dialog", e);
}
return false;
}
private String[] ce() {
JSONArray optJSONArray;
try {
JSONObject configForWaitingDialog = ConfigService.getInstance().getConfigForWaitingDialog();
if (OtpUtil.a(configForWaitingDialog) && (optJSONArray = configForWaitingDialog.optJSONArray("blacklist_dialog_domains")) != null) {
return (String[]) OtpUtil.a(optJSONArray).toArray(new String[0]);
}
return null;
} catch (Exception e) {
JuspayLogger.b(J, "exception while getting blacklist dialog domains", e);
return null;
}
}
public boolean K(String str) {
try {
String[] ce = ce();
this.bG = ce;
if (ce != null && str != null) {
for (String str2 : ce) {
if (str2 != null && str2.length() > 0 && str.contains(str2)) {
return true;
}
}
}
} catch (Exception e) {
JuspayLogger.b(J, "Exception while checking domain for custom dialog", e);
}
return false;
}
@Override
public void onLocationChanged(Location location) {
JSONObject jSONObject = new JSONObject();
if (location != null) {
try {
jSONObject.put("longitude", location.getLongitude());
jSONObject.put("latitude", location.getLatitude());
} catch (JSONException e) {
JuspayLogger.b(J, "Error while getting location data", e);
return;
}
}
if (SessionInfo.getInstance().p(this.A)) {
jSONObject.put("mobile_data_strength", bl());
} else if (SessionInfo.getInstance().q(this.A) && cd()) {
jSONObject.put("wifi_strength", bk());
}
Event event = new Event();
event.c("location_change_data");
event.d(jSONObject.toString());
event.a(Event.Category.GODEL);
event.a(Event.Action.INFO);
GodelTracker.getInstance().a(event);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
private void T(String str) {
try {
this.bC.requestLocationUpdates(str, this.bD, this.bE, this);
} catch (SecurityException e) {
JuspayLogger.a(J, e);
}
}
}