正在查看: Chaupal v3.2 应用的 BaseCheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Chaupal v3.2 应用的 BaseCheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.razorpay;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.Toast;
import androidx.core.view.n0;
import androidx.core.view.o0;
import com.razorpay.CheckoutPresenterImpl;
import java.util.ConcurrentModificationException;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
class BaseCheckoutActivity extends Activity implements CheckoutPresenterImpl.CheckoutView, SmsAgentInterface {
private static int UPI_REQUEST_CODE = 99;
protected Object checkoutBridgeObject;
private RelativeLayout container;
private ViewGroup parent;
protected CheckoutPresenter presenter;
private WebChromeClient primaryWebChromeClient;
private WebView primaryWebView;
private WebViewClient primaryWebViewClient;
private l rzpbar;
private WebChromeClient secondaryWebChromeClient;
private WebView secondaryWebView;
private WebViewClient secondaryWebViewClient;
private B smsAgent;
interface SetOptionsCallback {
void onError();
void onFeatureDisabled();
void onOptionsSet();
}
BaseCheckoutActivity() {
}
private void createContainer() {
RelativeLayout relativeLayout = new RelativeLayout(this);
this.container = relativeLayout;
relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
this.container.setBackgroundColor(0);
this.parent.addView(this.container);
this.primaryWebView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
this.secondaryWebView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
this.primaryWebView.setContentDescription("primary_webview");
this.secondaryWebView.setContentDescription("secondary_webview");
this.container.addView(this.primaryWebView);
this.container.addView(this.secondaryWebView);
String progressBarColor = this.presenter.getProgressBarColor();
if (progressBarColor != null) {
this.rzpbar = new l(this, this.container, progressBarColor);
} else {
this.rzpbar = new l(this, this.container);
}
this.presenter.setUpAddOn();
}
private void createPrimaryWebView(Object obj) {
WebView webView = new WebView(this);
this.primaryWebView = webView;
webView.setBackgroundColor(Color.parseColor("#99000000"));
this.primaryWebView.setContentDescription("primary_webview");
BaseUtils.setWebViewSettings(this, this.primaryWebView, false);
this.primaryWebView.clearFormData();
this.primaryWebView.addJavascriptInterface(obj, "CheckoutBridge");
this.primaryWebView.setWebChromeClient(this.primaryWebChromeClient);
this.primaryWebView.setWebViewClient(this.primaryWebViewClient);
}
private void createSecondaryWebView() {
WebView webView = new WebView(this);
this.secondaryWebView = webView;
webView.setBackgroundColor(Color.parseColor("#99000000"));
BaseUtils.setWebViewSettings(this, this.secondaryWebView, false);
this.secondaryWebView.clearFormData();
WebView webView2 = this.secondaryWebView;
final CheckoutInteractor checkoutInteractor = (CheckoutInteractor) this.presenter;
webView2.addJavascriptInterface(new Object(checkoutInteractor) {
private CheckoutInteractor a;
{
this.a = checkoutInteractor;
}
@JavascriptInterface
public final void relay(String str) {
this.a.sendDataToWebView(1, str);
}
}, "MagicBridge");
this.secondaryWebView.addJavascriptInterface(new CheckoutBridge((CheckoutInteractor) this.presenter, 2), "CheckoutBridge");
this.secondaryWebView.setVisibility(8);
this.secondaryWebView.setWebChromeClient(this.secondaryWebChromeClient);
this.secondaryWebView.setWebViewClient(this.secondaryWebViewClient);
}
public static o0 lambda$onCreate$0(View view, o0 o0Var) {
androidx.core.graphics.d f = o0Var.f(o0.m.c());
view.setPadding(f.a, f.b, f.c, f.d);
return o0Var;
}
private void setWebChromeClient(int i, WebChromeClient webChromeClient) {
if (i == 1) {
this.primaryWebChromeClient = webChromeClient;
} else {
if (i != 2) {
return;
}
this.secondaryWebChromeClient = webChromeClient;
}
}
private void setWebViewClient(int i, WebViewClient webViewClient) {
if (i == 1) {
this.primaryWebViewClient = webViewClient;
} else {
if (i != 2) {
return;
}
this.secondaryWebViewClient = webViewClient;
}
}
@Override
public void addJavascriptInterfaceToPrimaryWebview(Object obj, String str) {
this.primaryWebView.addJavascriptInterface(obj, str);
}
@Override
public void checkSmsPermission() {
}
@Override
public void clearWebViewHistory(int i) {
if (i == 1) {
this.primaryWebView.clearHistory();
} else {
if (i != 2) {
return;
}
this.secondaryWebView.clearHistory();
}
}
@Override
public void destroy(int i, String str) {
Intent intent = new Intent();
intent.putExtra("RESULT", str);
if (str == null || TextUtils.isEmpty(str)) {
i = 5;
}
setResult(i, intent);
BaseUtils.getInstance().clearMetadata();
finish();
}
@Override
public WebView getWebView(int i) {
if (i == 1) {
return this.primaryWebView;
}
if (i != 2) {
return null;
}
return this.secondaryWebView;
}
@Override
public void hideProgressBar() {
l lVar = this.rzpbar;
if (lVar != null) {
lVar.a();
}
}
@Override
public boolean isWebViewVisible(int i) {
WebView webView;
if (i == 1) {
WebView webView2 = this.primaryWebView;
if (webView2 != null && webView2.getVisibility() == 0) {
return true;
}
} else if (i == 2 && (webView = this.secondaryWebView) != null && webView.getVisibility() == 0) {
return true;
}
return false;
}
@Override
public void loadData(int i, String str, String str2, String str3) {
if (i == 1) {
this.primaryWebView.loadData(str, str2, str3);
} else {
if (i != 2) {
return;
}
this.secondaryWebView.loadData(str, str2, str3);
}
}
@Override
public void loadDataWithBaseURL(int i, String str, String str2, String str3, String str4, String str5) {
if (i == 1) {
this.primaryWebView.loadDataWithBaseURL(str, str2, str3, str4, str5);
} else {
if (i != 2) {
return;
}
this.secondaryWebView.loadDataWithBaseURL(str, str2, str3, str4, str5);
}
}
@Override
public void loadUrl(int i, String str) {
if (i != 1) {
if (i != 2) {
return;
}
this.secondaryWebView.loadUrl(str);
} else {
WebView webView = this.primaryWebView;
if (webView != null) {
webView.loadUrl(str);
}
}
}
@Override
public void makeWebViewVisible(int i) {
if (i == 1) {
if (this.primaryWebView.getVisibility() == 8) {
this.primaryWebView.setVisibility(0);
this.secondaryWebView.setVisibility(8);
CheckoutUtils.a();
AnalyticsUtil.trackEvent(AnalyticsEvent.WEB_VIEW_SECONDARY_TO_PRIMARY_SWITCH);
return;
}
return;
}
if (i == 2 && this.secondaryWebView.getVisibility() == 8) {
this.primaryWebView.setVisibility(8);
this.secondaryWebView.setVisibility(0);
CheckoutUtils.a();
AnalyticsUtil.trackEvent(AnalyticsEvent.WEB_VIEW_PRIMARY_TO_SECONDARY_SWITCH);
}
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 1001) {
this.presenter.sendOtpPermissionCallback(true);
}
this.presenter.onActivityResultReceived(i, i2, intent);
}
@Override
public void onBackPressed() {
this.presenter.backPressed(new HashMap());
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
}
@Override
public void onCreate(Bundle bundle) {
boolean z;
String str = p$_5$.b;
try {
if (!str.equalsIgnoreCase(A.a(this, "sdk_version"))) {
A.b(this, "rzp_config_json", null);
A.b(this, "rzp_config_version", null);
A.b(this, "sdk_version", str);
}
} catch (NullPointerException unused) {
A.b(this, "rzp_config_json", null);
A.b(this, "rzp_config_version", null);
A.b(this, "sdk_version", str);
}
p$_5$.a().a(this);
BaseUtils.checkForLatestVersion(this, p$_5$.c);
this.presenter.setCheckoutLoadStartAt();
AnalyticsUtil.libraryType = "CHECKOUTJS";
setWebViewClient(1, new PrimaryWebViewClient(this.presenter));
setWebViewClient(2, new SecondaryWebViewClient(this.presenter));
setWebChromeClient(1, new k(this.presenter));
setWebChromeClient(2, new z(this.presenter));
BaseUtils.setup();
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_INIT);
requestWindowFeature(1);
super.onCreate(bundle);
if (bundle == null) {
bundle = getIntent().getExtras();
z = false;
} else {
z = true;
}
if (this.presenter.setOptions(bundle, z)) {
this.parent = (ViewGroup) findViewById(android.R.id.content);
n0.a(getWindow(), true);
androidx.core.view.d0.F0(this.parent, new androidx.core.view.w() {
public final o0 a(View view, o0 o0Var) {
o0 lambda$onCreate$0;
lambda$onCreate$0 = BaseCheckoutActivity.lambda$onCreate$0(view, o0Var);
return lambda$onCreate$0;
}
});
createPrimaryWebView(this.checkoutBridgeObject);
createSecondaryWebView();
createContainer();
if (CheckoutUtils.a(bundle)) {
this.presenter.setOptionsWithDynamicUrl(this, bundle, z, new b__J_(this));
} else if (J__A$.a().a != null) {
J__A$.a().c = true;
this.presenter.loadFetchedForm(J__A$.a().b, J__A$.a().a);
} else {
this.presenter.loadForm("");
}
this.presenter.passPrefillToSegment();
if ((getWindow().getAttributes().flags & 1024) != 0) {
R$$r_.a(this);
}
if (this.presenter.isAllowRotation()) {
return;
}
if (q.a(this)) {
setFinishOnTouchOutside(false);
WindowManager.LayoutParams attributes = getWindow().getAttributes();
int a = q.a(this, 375);
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int i = displayMetrics.heightPixels;
int identifier = getResources().getIdentifier("status_bar_height", "dimen", "android");
int dimensionPixelSize = i - (identifier > 0 ? getResources().getDimensionPixelSize(identifier) : 0);
if (dimensionPixelSize > 600) {
dimensionPixelSize = q.a(this, 600);
}
attributes.height = dimensionPixelSize;
attributes.width = a;
getWindow().setAttributes(attributes);
} else if (Build.VERSION.SDK_INT != 26) {
setRequestedOrientation(1);
}
this.presenter.fetchCondfig();
this.presenter.handleCardSaving();
if (BaseUtils.isDeviceHaveCorrectTlsVersion()) {
return;
}
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_TLS_ERROR);
destroy(6, "TLSv1 is not supported for security reasons");
}
}
@Override
protected void onDestroy() {
AnalyticsUtil.trackEvent(AnalyticsEvent.ACTIVITY_ONDESTROY_CALLED);
try {
this.presenter.cleanUpOnDestroy();
} catch (ConcurrentModificationException e) {
AnalyticsUtil.reportError(getClass().getName(), "S0", e.getLocalizedMessage());
e.printStackTrace();
}
super.onDestroy();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
this.presenter.onRequestPermissionsResult(i, strArr, iArr);
}
@Override
public void onResume() {
super.onResume();
this.presenter.onResumeTriggered();
}
@Override
public void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
this.presenter.saveInstanceState(bundle);
}
@Override
public void postSms(String str, String str2) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sender", str);
jSONObject.put("message", str2);
loadUrl(1, String.format("OTPElf.showOTP('%s','%s')", str2, str));
} catch (JSONException e) {
AnalyticsUtil.reportError(getClass().getName(), "S1", e.getMessage());
e.printStackTrace();
}
}
@Override
public void setSmsPermission(boolean z) {
this.presenter.sendOtpPermissionCallback(z);
}
@Override
public void showProgressBar(int i) {
l lVar = this.rzpbar;
if (lVar != null) {
lVar.a(i);
}
}
@Override
public void showToast(String str, int i) {
Toast.makeText(this, str, i).show();
}
}