导航菜单

页面标题

页面副标题

Biko v2.0.23 - WebCheckoutActivity.java 源代码

正在查看: Biko v2.0.23 应用的 WebCheckoutActivity.java JAVA 源代码文件

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


package app.callpe.ui.payment;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.webkit.CookieManager;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import app.callpe.common.utils.AppsFlyerAnalyticsHelper;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.helper_functions.AnalyticsHelper;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.APIError;
import app.callpe.data.model.ErrorHandler;
import app.callpe.data.model.LoginResponse;
import app.callpe.data.model.OrderSuccess;
import app.callpe.databinding.ActivityWebViewBinding;
import app.callpe.service.ApiService;
import app.callpe.ui.payment.WebCheckoutActivity.WebClient;
import com.adjust.sdk.Constants;
import com.facebook.internal.FacebookRequestErrorClassification;
import com.google.gson.Gson;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.Locale;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;

@Metadata(d1 = {"\u0000P\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0004\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\b\u0007\u0018\u00002\u00020\u0001:\u0001%B\u0005¢\u0006\u0002\u0010\u0002J$\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u00152\b\u0010\u0016\u001a\u0004\u0018\u00010\f2\b\u0010\u0017\u001a\u0004\u0018\u00010\fH\u0002J\"\u0010\u0018\u001a\u00020\u00132\u0006\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u001a2\b\u0010\u001c\u001a\u0004\u0018\u00010\u001dH\u0014J\b\u0010\u001e\u001a\u00020\u0013H\u0016J\u0012\u0010\u001f\u001a\u00020\u00132\b\u0010 \u001a\u0004\u0018\u00010!H\u0015J\u000e\u0010\"\u001a\u00020\u00132\u0006\u0010#\u001a\u00020$R\u001e\u0010\u0003\u001a\u00020\u00048\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u000e\u0010\t\u001a\u00020\nX\u0082.¢\u0006\u0002\n\u0000R$\u0010\u000b\u001a\u00020\f8\u0006@\u0006X\u0087.¢\u0006\u0014\n\u0000\u0012\u0004\b\r\u0010\u0002\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011¨\u0006&"}, d2 = {"Lapp/callpe/ui/payment/WebCheckoutActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "()V", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "binding", "Lapp/callpe/databinding/ActivityWebViewBinding;", "userId", "", "getUserId$annotations", "getUserId", "()Ljava/lang/String;", "setUserId", "(Ljava/lang/String;)V", "getOrderResponse", "", "topUpId", "", "mobile", FacebookRequestErrorClassification.KEY_NAME, "onActivityResult", "requestCode", "", "resultCode", "data", "Landroid/content/Intent;", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "setProgress", "isVisible", "", "WebClient", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class WebCheckoutActivity extends Hilt_WebCheckoutActivity {

    @Inject
    public ApiService apiService;
    private ActivityWebViewBinding binding;

    @Inject
    public String userId;

    public static void getUserId$annotations() {
    }

    public final void setProgress(boolean isVisible) {
    }

    public final ApiService getApiService() {
        ApiService apiService = this.apiService;
        if (apiService != null) {
            return apiService;
        }
        Intrinsics.throwUninitializedPropertyAccessException("apiService");
        return null;
    }

    public final void setApiService(ApiService apiService) {
        Intrinsics.checkNotNullParameter(apiService, "<set-?>");
        this.apiService = apiService;
    }

    public final String getUserId() {
        String str = this.userId;
        if (str != null) {
            return str;
        }
        Intrinsics.throwUninitializedPropertyAccessException("userId");
        return null;
    }

    public final void setUserId(String str) {
        Intrinsics.checkNotNullParameter(str, "<set-?>");
        this.userId = str;
    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityWebViewBinding inflate = ActivityWebViewBinding.inflate(getLayoutInflater());
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        this.binding = inflate;
        if (inflate == null) {
            Intrinsics.throwUninitializedPropertyAccessException("binding");
            inflate = null;
        }
        setContentView(inflate.getRoot());
        long longExtra = getIntent().getLongExtra("topUpId", -1L);
        getIntent().getIntExtra("amount", 0);
        Context context = (Context) this;
        AnalyticsHelper.INSTANCE.sendScreenOpenEvent(context);
        AppsFlyerAnalyticsHelper.sendScreenOpenEvent(context);
        String string = SharedPref.getString(context, PrefKeys.INSTALL_SOURCE);
        String str = string;
        if (!(str == null || str.length() == 0)) {
            Intrinsics.checkNotNullExpressionValue(string, "installSource");
            String lowerCase = string.toLowerCase(Locale.ROOT);
            Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
            if (StringsKt.contains$default(lowerCase, Constants.REFERRER_API_GOOGLE, false, 2, (Object) null)) {
                AnalyticsHelper.INSTANCE.sendScreenOpenEventGoogle(context);
            }
        }
        if (longExtra != -1) {
            LoginResponse loginResponse = (LoginResponse) new Gson().fromJson(SharedPref.getString(context, PrefKeys.LOGIN_RESPONSE), LoginResponse.class);
            if (loginResponse != null) {
                getOrderResponse(longExtra, loginResponse.getMobile(), loginResponse.getName());
                return;
            }
            return;
        }
        finish();
    }

    private final void getOrderResponse(long topUpId, String mobile, String name) {
        setProgress(true);
        getApiService().createOrder(topUpId).enqueue(new Callback<OrderSuccess>() {
            public void onResponse(Call<OrderSuccess> call, Response<OrderSuccess> response) {
                ActivityWebViewBinding activityWebViewBinding;
                ActivityWebViewBinding activityWebViewBinding2;
                ActivityWebViewBinding activityWebViewBinding3;
                ActivityWebViewBinding activityWebViewBinding4;
                ActivityWebViewBinding activityWebViewBinding5;
                ActivityWebViewBinding activityWebViewBinding6;
                ActivityWebViewBinding activityWebViewBinding7;
                Intrinsics.checkNotNullParameter(call, "call");
                Intrinsics.checkNotNullParameter(response, "response");
                WebCheckoutActivity.this.setProgress(false);
                try {
                    Timber.e("response %s", new Object[]{response.raw()});
                    if (response.isSuccessful()) {
                        if (response.body() != null) {
                            String string = SharedPref.getString((Context) WebCheckoutActivity.this, PrefKeys.AUTH_TOKEN);
                            if (string == null) {
                                string = "";
                            }
                            StringBuilder sb = new StringBuilder();
                            sb.append("https://razorpay-dev.onato.in/payments?&orderId=");
                            OrderSuccess orderSuccess = (OrderSuccess) response.body();
                            ActivityWebViewBinding activityWebViewBinding8 = null;
                            sb.append(orderSuccess != null ? orderSuccess.getOrderId() : null);
                            sb.append("&appId=app.b1k0&token=");
                            sb.append(string);
                            String sb2 = sb.toString();
                            Timber.e("url ---- " + sb2, new Object[0]);
                            activityWebViewBinding = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                                activityWebViewBinding = null;
                            }
                            activityWebViewBinding.webView.getSettings().setJavaScriptEnabled(true);
                            activityWebViewBinding2 = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding2 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                                activityWebViewBinding2 = null;
                            }
                            activityWebViewBinding2.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
                            activityWebViewBinding3 = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding3 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                                activityWebViewBinding3 = null;
                            }
                            activityWebViewBinding3.webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
                            activityWebViewBinding4 = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding4 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                                activityWebViewBinding4 = null;
                            }
                            activityWebViewBinding4.webView.setWebViewClient(WebCheckoutActivity.this.new WebClient());
                            activityWebViewBinding5 = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding5 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                                activityWebViewBinding5 = null;
                            }
                            WebSettings settings = activityWebViewBinding5.webView.getSettings();
                            Intrinsics.checkNotNullExpressionValue(settings, "binding.webView.settings");
                            CookieManager cookieManager = CookieManager.getInstance();
                            activityWebViewBinding6 = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding6 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                                activityWebViewBinding6 = null;
                            }
                            cookieManager.setAcceptThirdPartyCookies(activityWebViewBinding6.webView, true);
                            settings.setUserAgentString("Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1");
                            activityWebViewBinding7 = WebCheckoutActivity.this.binding;
                            if (activityWebViewBinding7 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("binding");
                            } else {
                                activityWebViewBinding8 = activityWebViewBinding7;
                            }
                            activityWebViewBinding8.webView.loadUrl(sb2);
                            return;
                        }
                        return;
                    }
                    try {
                        APIError parseError = ErrorHandler.parseError(response);
                        Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
                        Toast.makeText((Context) WebCheckoutActivity.this, WebCheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } catch (Exception unused) {
                    Toast.makeText((Context) WebCheckoutActivity.this, "Error", 0).show();
                }
            }

            public void onFailure(Call<OrderSuccess> call, Throwable t) {
                Intrinsics.checkNotNullParameter(call, "call");
                Intrinsics.checkNotNullParameter(t, "t");
                WebCheckoutActivity.this.setProgress(false);
                Timber.e("onFailure: " + t.getCause(), new Object[0]);
                Helper.noNetworkToast((Context) WebCheckoutActivity.this, t);
            }
        });
    }

    @Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J$\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u001c\u0010\u000b\u001a\u00020\n2\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\f\u001a\u0004\u0018\u00010\rH\u0016¨\u0006\u000e"}, d2 = {"Lapp/callpe/ui/payment/WebCheckoutActivity$WebClient;", "Landroid/webkit/WebViewClient;", "(Lapp/callpe/ui/payment/WebCheckoutActivity;)V", "doUpdateVisitedHistory", "", "view", "Landroid/webkit/WebView;", "url", "", "isReload", "", "shouldOverrideUrlLoading", com.birjuvachhani.locus.Constants.INTENT_EXTRA_CONFIGURATION, "Landroid/webkit/WebResourceRequest;", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
    public final class WebClient extends WebViewClient {
        public WebClient() {
        }

        @Override
        public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
            super.doUpdateVisitedHistory(view, url, isReload);
            if (url != null && StringsKt.contains$default(url, "success", false, 2, (Object) null)) {
                ActivityExtKt.toast((Activity) WebCheckoutActivity.this, "Payment success");
                return;
            }
            if (url != null && StringsKt.contains$default(url, "failed", false, 2, (Object) null)) {
                ActivityExtKt.toast((Activity) WebCheckoutActivity.this, "Payment failed");
            }
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
            String str;
            Uri url;
            if (request == null || (url = request.getUrl()) == null || (str = url.toString()) == null) {
                str = "";
            }
            if (StringsKt.startsWith$default(str, Constants.SCHEME, false, 2, (Object) null) && StringsKt.startsWith$default(str, "http", false, 2, (Object) null)) {
                return true;
            }
            try {
                if (str.contentEquals("paytmmp")) {
                    return false;
                }
                Timber.e("url " + str, new Object[0]);
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.setData(Uri.parse(str));
                WebCheckoutActivity.this.startActivityForResult(intent, 2001);
                return true;
            } catch (ActivityNotFoundException unused) {
                return true;
            }
        }
    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 2001) {
            Activity activity = (Activity) this;
            ActivityExtKt.toast(activity, "I am called.................");
            Timber.e("data----------- " + data, new Object[0]);
            Bundle extras = data != null ? data.getExtras() : null;
            if (extras != null) {
                for (String str : extras.keySet()) {
                    Timber.e("IntentData " + str + ": " + extras.get(str), new Object[0]);
                }
                return;
            }
            ActivityExtKt.toast(activity, "null saaaaaaaaaaaaaaaaaaa");
        }
    }

    public void onBackPressed() {
        DialogHelper.showReasonDialog((Context) this, getString(2131953083), getString(2131952110), false, new DialogHelper.Listener() {
            @Override
            public void onNegativeClick() {
            }

            @Override
            public void onPositiveClick() {
                WebCheckoutActivity.this.finish();
            }
        });
    }
}