导航菜单

页面标题

页面副标题

Chaupal v3.2 - WebViewActivity.java 源代码

正在查看: Chaupal v3.2 应用的 WebViewActivity.java JAVA 源代码文件

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


package com.yupptv.ott;

import android.R;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.os.Handler;
import android.text.Html;
import android.text.TextUtils;
import android.util.Base64;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.d;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.h0;
import com.android.billingclient.api.Purchase;
import com.appsflyer.AppsFlyerLib;
import com.clevertap.android.sdk.CleverTapAPI;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.razorpay.Checkout;
import com.razorpay.PaymentData;
import com.razorpay.PaymentResultWithDataListener;
import com.yupptv.ott.enums.DialogType;
import com.yupptv.ott.enums.InAppType;
import com.yupptv.ott.fragments.PaymentsFragment;
import com.yupptv.ott.fragments.j1;
import com.yupptv.ott.fragments.k1;
import com.yupptv.ott.interfaces.InAppStatusListener;
import com.yupptv.ottsdk.OttSDK;
import com.yupptv.ottsdk.enums.TenantBuildType;
import com.yupptv.ottsdk.managers.Application.AppManager;
import com.yupptv.ottsdk.managers.Payment.PaymentManager;
import com.yupptv.ottsdk.managers.Preferences.PreferenceManager;
import com.yupptv.ottsdk.model.Error;
import com.yupptv.ottsdk.model.User;
import com.yupptv.ottsdk.model.payments.OrderIdResponse;
import com.yupptv.ottsdk.model.payments.OrderStatusResponse;
import com.yupptv.ottsdk.model.payments.packagefeature.Package;
import com.yupptv.ottsdk.model.payments.packagefeature.PackageGeneric;
import com.yupptv.ottsdk.model.payments.packagefeature.PackageResponse;
import com.yupptv.ottsdk.model.payments.packagefeature.SupportedGateway;
import com.yupptv.ottsdk.model.systemfeatures.Features;
import com.yupptv.ottsdk.model.user.Configs;
import com.yupptv.ottsdk.utils.DeviceUtils;
import com.yupptv.ottsdk.utils.OttLog;
import hd.a;
import hd.e0;
import hd.i0;
import in.juspay.hyper.webview.upi.HyperWebViewServices;
import in.juspay.hyperinteg.HyperServiceHolder;
import in.juspay.hypersdk.ui.HyperPaymentsCallback;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;

public class WebViewActivity extends com.yupptv.ott.activity.a implements InAppStatusListener, oc.k, PaymentResultWithDataListener {
    private static final String l0 = "com.yupptv.ott.WebViewActivity";
    private static String m0 = null;
    static boolean n0 = true;
    public boolean A;
    private long B;
    private long C;
    final Handler D;
    String E;
    String F;
    String G;
    boolean H;
    boolean I;
    ValueCallback<Uri[]> J;
    int K;
    String L;
    String M;
    hd.a0 N;
    private HyperServiceHolder O;
    private JSONObject P;
    private String Q;
    private String R;
    private String S;
    private String T;
    private String U;
    private String V;
    private String W;
    private String X;
    private String Y;
    private String Z;
    WebView e;
    private String e0;
    HyperWebViewServices f;
    private String f0;
    boolean g0;
    boolean h0;
    OrderStatusResponse i0;
    String j;
    PaymentManager.PaymentCallback<PackageGeneric> j0;
    public final Runnable k0;
    String m;
    String n;
    String o;
    Dialog q;
    TextView r;
    dc.a s;
    public Package t;
    public PaymentsFragment.PurchaseItem u;
    String y;
    String z;
    String g = "";
    String h = "";
    String i = "";
    String k = "";
    String l = "";
    String p = "-1";
    private List<PackageResponse> v = new ArrayList();
    private int w = 0;
    List<PaymentsFragment.PurchaseItem> x = new ArrayList();

    class a implements Runnable {
        a() {
        }

        @Override
        public void run() {
            OttLog.error(WebViewActivity.l0, "checking order status " + WebViewActivity.this.C);
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                webViewActivity.A = true;
                webViewActivity.T0(false);
                WebViewActivity.this.D.removeCallbacks(this);
                return;
            }
            if (!webViewActivity.A && webViewActivity.C < WebViewActivity.this.B) {
                WebViewActivity webViewActivity2 = WebViewActivity.this;
                webViewActivity2.D0(webViewActivity2.m);
                WebViewActivity.this.C += 10000;
                WebViewActivity.this.D.postDelayed(this, 10000L);
                return;
            }
            WebViewActivity webViewActivity3 = WebViewActivity.this;
            webViewActivity3.A = false;
            webViewActivity3.D.removeCallbacks(this);
            if (WebViewActivity.this.C >= WebViewActivity.this.B) {
                WebViewActivity webViewActivity4 = WebViewActivity.this;
                webViewActivity4.A = true;
                webViewActivity4.T0(false);
                if (WebViewActivity.this.e.getContext() != null) {
                    Toast.makeText(WebViewActivity.this.e.getContext(), 2131952634, 1).show();
                }
            }
        }
    }

    class b implements PaymentManager.PaymentCallback<OrderStatusResponse> {
        final String a;

        b(String str) {
            this.a = str;
        }

        @Override
        public void onSuccess(OrderStatusResponse orderStatusResponse) {
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                webViewActivity.A = true;
                webViewActivity.T0(false);
                WebViewActivity webViewActivity2 = WebViewActivity.this;
                webViewActivity2.D.removeCallbacks(webViewActivity2.k0);
            }
            String upperCase = orderStatusResponse.getStatus().toUpperCase();
            upperCase.hashCode();
            switch (upperCase) {
                case "F":
                    WebViewActivity.this.T0(false);
                    WebViewActivity webViewActivity3 = WebViewActivity.this;
                    webViewActivity3.A = true;
                    Handler handler = webViewActivity3.D;
                    if (handler != null) {
                        handler.removeCallbacks(webViewActivity3.k0);
                    }
                    String str = WebViewActivity.this.n;
                    if (str != null && str.equalsIgnoreCase("googleinapp")) {
                        String B0 = WebViewActivity.this.B0();
                        if (!B0.equalsIgnoreCase(InAppType.SUBSCRIPTION.getValue()) && !B0.equalsIgnoreCase(InAppType.NONCONSUMABLE.getValue())) {
                            WebViewActivity.this.s.g(false);
                            break;
                        } else {
                            WebViewActivity.this.s.f(false, B0);
                            break;
                        }
                    } else {
                        WebViewActivity.this.U0(orderStatusResponse.getMessage());
                        break;
                    }
                    break;
                case "P":
                    WebViewActivity webViewActivity4 = WebViewActivity.this;
                    webViewActivity4.A = false;
                    Toast.makeText(webViewActivity4.e.getContext(), orderStatusResponse.getMessage() + " . " + WebViewActivity.this.e.getContext().getResources().getString(2131952005), 1).show();
                    break;
                case "S":
                    WebViewActivity webViewActivity5 = WebViewActivity.this;
                    webViewActivity5.A = true;
                    webViewActivity5.T0(false);
                    WebViewActivity webViewActivity6 = WebViewActivity.this;
                    Handler handler2 = webViewActivity6.D;
                    if (handler2 != null) {
                        handler2.removeCallbacks(webViewActivity6.k0);
                    }
                    WebViewActivity.this.i0 = orderStatusResponse;
                    if (orderStatusResponse.getStartTime() != null) {
                        WebViewActivity.this.y = new SimpleDateFormat("ddMMyyyy", Locale.getDefault()).format(new Date(orderStatusResponse.getStartTime().longValue()));
                    }
                    if (orderStatusResponse.getExpiryDate() != null) {
                        try {
                            String expiryDate = orderStatusResponse.getExpiryDate();
                            Locale locale = Locale.ENGLISH;
                            WebViewActivity.this.z = new SimpleDateFormat("ddMMyyyy", locale).format(new SimpleDateFormat("dd/MMM/yyyy", locale).parse(expiryDate));
                        } catch (ParseException unused) {
                        }
                    }
                    if (orderStatusResponse.getTargetParams() != null) {
                        WebViewActivity.this.h = orderStatusResponse.getTargetParams().getMsg1() != null ? orderStatusResponse.getTargetParams().getMsg1() : "";
                        WebViewActivity.this.i = orderStatusResponse.getTargetParams().getMsg2() != null ? orderStatusResponse.getTargetParams().getMsg2() : "";
                    }
                    String str2 = WebViewActivity.this.n;
                    if (str2 != null && str2.equalsIgnoreCase("googleinapp")) {
                        String B02 = WebViewActivity.this.B0();
                        if (!B02.equalsIgnoreCase(InAppType.SUBSCRIPTION.getValue()) && !B02.equalsIgnoreCase(InAppType.NONCONSUMABLE.getValue())) {
                            WebViewActivity.this.s.g(true);
                            break;
                        } else {
                            WebViewActivity.this.s.f(true, B02);
                            break;
                        }
                    } else {
                        WebViewActivity webViewActivity7 = WebViewActivity.this;
                        webViewActivity7.J0(false, this.a, webViewActivity7.h, webViewActivity7.i, true);
                        break;
                    }
                    break;
            }
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                return;
            }
            webViewActivity.T0(false);
            WebViewActivity webViewActivity2 = WebViewActivity.this;
            webViewActivity2.A = true;
            if (webViewActivity2 == null) {
                webViewActivity2.A = true;
                webViewActivity2.T0(false);
                WebViewActivity webViewActivity3 = WebViewActivity.this;
                webViewActivity3.D.removeCallbacks(webViewActivity3.k0);
            }
        }
    }

    class c implements AppManager.AppManagerCallback<JSONObject> {
        c() {
        }

        public void onSuccess(JSONObject jSONObject) {
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            eVar.setResult(-1, eVar.getIntent());
            WebViewActivity.this.finish();
        }

        public void onFailure(Error error) {
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            eVar.setResult(-1, eVar.getIntent());
            WebViewActivity.this.finish();
        }
    }

    class d implements PaymentManager.PaymentCallback<OrderIdResponse> {
        final PaymentsFragment.PurchaseItem a;
        final String b;

        d(PaymentsFragment.PurchaseItem purchaseItem, String str) {
            this.a = purchaseItem;
            this.b = str;
        }

        @Override
        public void onSuccess(OrderIdResponse orderIdResponse) {
            WebViewActivity.this.P0(orderIdResponse, this.a, this.b);
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity.this.O0(error);
        }
    }

    class e implements PaymentManager.PaymentCallback<OrderIdResponse> {
        final PaymentsFragment.PurchaseItem a;
        final String b;

        e(PaymentsFragment.PurchaseItem purchaseItem, String str) {
            this.a = purchaseItem;
            this.b = str;
        }

        @Override
        public void onSuccess(OrderIdResponse orderIdResponse) {
            WebViewActivity.this.P0(orderIdResponse, this.a, this.b);
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity.this.O0(error);
        }
    }

    class f implements PaymentManager.PaymentCallback<OrderIdResponse> {
        f() {
        }

        @Override
        public void onSuccess(OrderIdResponse orderIdResponse) {
            if (WebViewActivity.this == null) {
                return;
            }
            if (orderIdResponse == null || orderIdResponse.getTargetParams() == null) {
                WebViewActivity.this.finish();
                return;
            }
            WebViewActivity.this.J0(false, orderIdResponse.getOrderId(), orderIdResponse.getTargetParams().getMsg1() != null ? orderIdResponse.getTargetParams().getMsg1() : "", orderIdResponse.getTargetParams().getMsg2() != null ? orderIdResponse.getTargetParams().getMsg2() : "", false);
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                return;
            }
            webViewActivity.J0(true, "", error.getMessage(), (error.getDetails() == null || error.getDetails().getDescription() == null) ? "" : error.getDetails().getDescription(), false);
            hd.h.b("orderFialedCallback", "" + error.toString());
        }
    }

    class g implements PaymentManager.PaymentCallback<OrderIdResponse> {
        final String a;

        g(String str) {
            this.a = str;
        }

        @Override
        public void onSuccess(OrderIdResponse orderIdResponse) {
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                return;
            }
            webViewActivity.X(this.a);
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                return;
            }
            webViewActivity.T0(false);
            WebViewActivity.this.J0(true, "", error.getMessage(), (error.getDetails() == null || error.getDetails().getDescription() == null) ? "" : error.getDetails().getDescription(), false);
            Toast.makeText((Context) WebViewActivity.this, 2131952634, 1).show();
        }
    }

    class h implements FragmentManager.l {
        h() {
        }

        public void a() {
            if (WebViewActivity.this.getSupportFragmentManager().q0() == 0) {
                WebViewActivity.this.findViewById(2131428566).setVisibility(8);
            }
        }
    }

    class i extends WebChromeClient {

        class a implements DialogInterface.OnClickListener {
            final JsResult a;

            a(JsResult jsResult) {
                this.a = jsResult;
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                this.a.confirm();
            }
        }

        i() {
        }

        @Override
        public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
            new d.a(WebViewActivity.this).i(2131951682).f(str2).setPositiveButton(R.string.ok, new a(jsResult)).b(false).create().show();
            return true;
        }
    }

    class j extends WebChromeClient {
        j() {
        }

        @Override
        public void onProgressChanged(WebView webView, int i) {
            String str;
            super.onProgressChanged(webView, i);
            if (WebViewActivity.m0.equalsIgnoreCase(hd.r.y1) || WebViewActivity.m0.equalsIgnoreCase(hd.r.B1)) {
                Configs c = hd.a.a.c(OTTApplication.o());
                if (c == null || c.getSiteURL() == null) {
                    str = "";
                } else {
                    str = c.getSiteURL();
                    if (webView == null || webView.getUrl() == null || !webView.getUrl().endsWith("/")) {
                        if (str.endsWith("/")) {
                            str = str.subSequence(0, str.length() - 1).toString();
                        }
                    } else if (!str.endsWith("/")) {
                        str = str + "/";
                    }
                }
                if (WebViewActivity.this.j.contains("profiles")) {
                    str = str + "/home";
                }
                hd.h.a("DEBUG", "siteUrl " + str);
                hd.h.a("DEBUG", "view.getUrl() " + webView.getUrl());
                if (webView.getUrl() == null || !webView.getUrl().equalsIgnoreCase(str)) {
                    return;
                }
                WebViewActivity.this.e.destroy();
                WebViewActivity.this.setResult(101);
                WebViewActivity.this.finish();
            }
        }
    }

    class k extends WebChromeClient {
        k() {
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            ValueCallback<Uri[]> valueCallback2 = WebViewActivity.this.J;
            if (valueCallback2 != null) {
                valueCallback2.onReceiveValue(null);
            }
            WebViewActivity.this.J = valueCallback;
            Intent intent = new Intent("android.intent.action.GET_CONTENT");
            intent.addCategory("android.intent.category.OPENABLE");
            intent.setType("*/*");
            WebViewActivity.this.startActivityForResult(Intent.createChooser(intent, "File Chooser"), 103);
            return true;
        }
    }

    class l implements PaymentManager.PaymentCallback<PackageGeneric> {
        l() {
        }

        @Override
        public void onSuccess(PackageGeneric packageGeneric) {
            WebViewActivity webViewActivity = WebViewActivity.this;
            if (webViewActivity == null) {
                return;
            }
            webViewActivity.T0(false);
            if (packageGeneric == null) {
                return;
            }
            if (WebViewActivity.this.v != null && WebViewActivity.this.v.size() > 0) {
                WebViewActivity.this.v.clear();
            }
            WebViewActivity.this.v.addAll(packageGeneric.getPackageResponse());
            if (WebViewActivity.this.v != null) {
                WebViewActivity.this.x.clear();
            }
            com.google.gson.d dVar = new com.google.gson.d();
            if (WebViewActivity.this.v.size() > 0) {
                for (int i = 0; i < WebViewActivity.this.v.size(); i++) {
                    int size = ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().size();
                    for (int i2 = 0; i2 < size; i2++) {
                        PaymentsFragment.PurchaseItem purchaseItem = new PaymentsFragment.PurchaseItem();
                        if (((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getName() != null) {
                            purchaseItem.a = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getName();
                        }
                        purchaseItem.n = false;
                        purchaseItem.o = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getIsSubscribed().booleanValue();
                        purchaseItem.p = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getSelectable().booleanValue();
                        purchaseItem.q = 0;
                        purchaseItem.j = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getId().intValue();
                        purchaseItem.k = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getSalePrice().doubleValue();
                        purchaseItem.m = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getPackageMasterId().intValue();
                        purchaseItem.c = ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getMaster().getName();
                        String str = "";
                        purchaseItem.e = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getFreeTrial() != null ? ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getFreeTrial().getDurationQuantity() + " " + ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getFreeTrial().getDurationText() : "";
                        purchaseItem.i = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getCurrency();
                        purchaseItem.f = ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getMaster().getPackageType();
                        if (((PackageResponse) WebViewActivity.this.v.get(i)).getSupportedGateway() != null && ((PackageResponse) WebViewActivity.this.v.get(i)).getSupportedGateway().size() > 0) {
                            str = ((SupportedGateway) ((PackageResponse) WebViewActivity.this.v.get(i)).getSupportedGateway().get(0)).getCode();
                        }
                        purchaseItem.g = str;
                        purchaseItem.w = (Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2);
                        purchaseItem.t = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getDurationCode();
                        purchaseItem.s = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getFreeTrial();
                        purchaseItem.x = ((PackageResponse) WebViewActivity.this.v.get(i)).getSupportedGateway();
                        purchaseItem.u = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getExpiryDate().longValue();
                        purchaseItem.l = ((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getListPrice().doubleValue();
                        purchaseItem.y = dVar.q(((Package) ((PackageResponse) WebViewActivity.this.v.get(i)).getPackageInfo().getPackages().get(i2)).getFeatures());
                        WebViewActivity.this.x.add(purchaseItem);
                    }
                }
            }
            for (int i3 = 0; i3 < WebViewActivity.this.x.size(); i3++) {
                PaymentsFragment.PurchaseItem purchaseItem2 = WebViewActivity.this.x.get(i3);
                hd.h.a(WebViewActivity.l0, "shouldOverrideUrlLoading testpackage: " + purchaseItem2.w.getParameters().getGoogleInAppPackageCode() + "  gid: " + WebViewActivity.this.R);
                Package r0 = purchaseItem2.w;
                if (r0 != null && r0.getParameters() != null && purchaseItem2.w.getParameters().getGoogleInAppPackageCode() != null && purchaseItem2.w.getParameters().getGoogleInAppPackageCode().equalsIgnoreCase(WebViewActivity.this.R.trim())) {
                    WebViewActivity webViewActivity2 = WebViewActivity.this;
                    webViewActivity2.u = purchaseItem2;
                    webViewActivity2.t = purchaseItem2.w;
                    webViewActivity2.F = purchaseItem2.c;
                    webViewActivity2.n = "googleinapp";
                    cc.c.d().o(cc.b.J1, cc.b.B0().x(WebViewActivity.this.t.getId().toString(), purchaseItem2.k, WebViewActivity.this.n, purchaseItem2.i));
                    if (WebViewActivity.this.S.equalsIgnoreCase("googleinapp")) {
                        ?? r4 = WebViewActivity.this;
                        r4.s.h(r4, r4, r4.A0(), WebViewActivity.this.B0(), i3, WebViewActivity.this.e0, WebViewActivity.this.f0);
                        return;
                    } else {
                        WebViewActivity webViewActivity3 = WebViewActivity.this;
                        webViewActivity3.z0(webViewActivity3.u, null, webViewActivity3.S);
                        return;
                    }
                }
            }
        }

        @Override
        public void onFailure(Error error) {
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            if (eVar == null || eVar.isFinishing()) {
                return;
            }
            WebViewActivity.this.T0(false);
            WebViewActivity.this.U0(error.getMessage());
        }
    }

    class m extends com.google.gson.reflect.a<sc.e> {
        m() {
        }
    }

    class n implements oc.h {
        final PaymentsFragment.PurchaseItem a;
        final String c;

        n(PaymentsFragment.PurchaseItem purchaseItem, String str) {
            this.a = purchaseItem;
            this.c = str;
        }

        @Override
        public void o(boolean z, int i, HashMap hashMap) {
            Set keySet = hashMap.keySet();
            WebViewActivity.this.z0(this.a, this.c, String.valueOf(hashMap.get(((String[]) Arrays.copyOf(keySet.toArray(), keySet.size(), String[].class))[i])));
        }

        @Override
        public void y(boolean z, int i, int i2) {
        }
    }

    class o implements PaymentManager.PaymentCallback<OrderIdResponse> {
        o() {
        }

        @Override
        public void onSuccess(OrderIdResponse orderIdResponse) {
            hd.h.a("DEBUG", "verifyInAppPaymentWithOrderId onSuccess " + orderIdResponse.toString());
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            if (eVar == null || eVar.isFinishing()) {
                return;
            }
            WebViewActivity.this.X(orderIdResponse.getOrderId());
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity.this.T0(false);
            hd.h.a("DEBUG", "verifyInAppPaymentWithOrderId onFailure " + error.getMessage());
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            if (eVar == null || eVar.isFinishing()) {
                return;
            }
            WebViewActivity.this.U0(error.getMessage());
        }
    }

    class p implements PaymentManager.PaymentCallback<OrderIdResponse> {
        p() {
        }

        @Override
        public void onSuccess(OrderIdResponse orderIdResponse) {
            WebViewActivity.this.T0(false);
            hd.h.a("DEBUG", "verifyInAppPaymentWithOrderId onSuccess " + orderIdResponse.toString());
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            if (eVar == null || eVar.isFinishing()) {
                return;
            }
            WebViewActivity.this.X(orderIdResponse.getOrderId());
        }

        @Override
        public void onFailure(Error error) {
            WebViewActivity.this.T0(false);
            hd.h.a("DEBUG", "verifyInAppPaymentWithOrderId onFailure " + error.getMessage());
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            if (eVar == null || eVar.isFinishing()) {
                return;
            }
            WebViewActivity.this.U0(error.getMessage());
        }
    }

    public WebViewActivity() {
        String str = com.yupptv.ott.a.I;
        this.y = str;
        this.z = str;
        this.A = false;
        this.B = 60000L;
        this.C = 0L;
        this.D = new Handler();
        this.E = "";
        this.F = "";
        this.G = "pot";
        this.H = false;
        this.I = false;
        this.L = "THEME_PREFERENCE";
        this.M = "b";
        this.P = null;
        this.Q = "";
        this.R = "";
        this.S = "googleinapp";
        this.T = "";
        this.U = "";
        this.V = "";
        this.W = "";
        this.X = "";
        this.Y = "";
        this.Z = "";
        this.e0 = "";
        this.f0 = "";
        this.g0 = false;
        this.h0 = false;
        this.i0 = null;
        this.j0 = new l();
        this.k0 = new a();
    }

    public String A0() {
        Package r0 = this.t;
        String str = "notavailable";
        if (r0 != null && (r0 instanceof Package)) {
            try {
                String googleInAppPackageCode = r0.getFreeTrial() == null ? this.t.getParameters().getGoogleInAppPackageCode() : this.t.getParameters().getGoogleInAppFreeTrailPackageCode();
                if (googleInAppPackageCode != null) {
                    if (googleInAppPackageCode.trim().length() >= 1) {
                        str = googleInAppPackageCode;
                    }
                }
            } catch (NullPointerException unused) {
            }
        }
        hd.h.a("DEBUG", "selectedSku + " + str);
        return str;
    }

    public String B0() {
        String value = InAppType.SUBSCRIPTION.getValue();
        Package r1 = this.t;
        if (r1 != null && (r1 instanceof Package)) {
            try {
                if (r1.getParameters() != null && this.t.getParameters().getGoogleInAppPackageType() != null && !this.t.getParameters().getGoogleInAppPackageType().trim().isEmpty()) {
                    value = this.t.getParameters().getGoogleInAppPackageType();
                }
            } catch (NullPointerException e2) {
                e2.printStackTrace();
            }
        }
        hd.h.a("DEBUG", "skuType  + " + value);
        return value;
    }

    private String C0(int i2) {
        return String.format("#%06X", Integer.valueOf(androidx.core.content.a.getColor(this, i2) & 16777215));
    }

    public void D0(String str) {
        String str2 = com.yupptv.ott.a.I;
        this.y = str2;
        this.z = str2;
        if (OttSDK.getInstance() == null || OttSDK.getInstance().getPaymentManager() == null) {
            return;
        }
        OttSDK.getInstance().getPaymentManager().getOrderStatus(str, new b(str));
    }

    private String F0(Long l2) {
        return l2.longValue() > 0 ? new SimpleDateFormat("ddMMMyyyy", Locale.ENGLISH).format(new Date(l2.longValue())) : "";
    }

    private String G0() {
        JSONObject jSONObject = new JSONObject();
        try {
            if (this.i0 != null) {
                String D = e0.D();
                String F0 = F0(this.i0.getStartTime());
                if (!TextUtils.isEmpty(D)) {
                    jSONObject.put("Date & time :", D);
                }
                Package r1 = this.t;
                if (r1 != null && !TextUtils.isEmpty(String.valueOf(r1.getListPrice()))) {
                    jSONObject.put("Amount Paid :", String.valueOf(this.t.getListPrice()));
                }
                if (!TextUtils.isEmpty(this.i0.getOrderId())) {
                    jSONObject.put("Order No. :", this.i0.getOrderId());
                }
                if (!F0.isEmpty()) {
                    jSONObject.put("Valid from :", F0);
                }
                if (!TextUtils.isEmpty(this.i0.getExpiryDate())) {
                    jSONObject.put("Renews on :", this.i0.getExpiryDate());
                }
                if (!TextUtils.isEmpty(this.i0.getGateway())) {
                    jSONObject.put("Payment mode :", this.i0.getGateway());
                }
            }
        } catch (Exception e2) {
            hd.h.b("PaymentInfo", e2.getMessage());
        }
        return jSONObject.toString();
    }

    private String H0() {
        Configs c2;
        a.C0133a c0133a = hd.a.a;
        if (c0133a.c(OTTApplication.o()) == null) {
            return null;
        }
        c2 = c0133a.c(OTTApplication.o());
        String str = m0;
        str.hashCode();
        switch (str) {
            case "nav_from_hamburger_terms":
                getSupportActionBar().C(getString(2131952893));
                return (c2 == null || c2.getTermsConditionsPageUrl() == null) ? "" : c2.getTermsConditionsPageUrl();
            case "nav_from_hamburger_faq":
                getSupportActionBar().C(getResources().getString(2131952219));
                return (c2 == null || c2.getFaqPageUrl() == null) ? "" : c2.getFaqPageUrl();
            case "nav_roku_store":
                getSupportActionBar().C("Roku");
                return "https://my.roku.com/account/add?channel=frndlytv";
            case "nav_amazon_store":
                getSupportActionBar().C("Amazon");
                return "https://www.amazon.com/Frndly-TV/dp/B07VC9NCQN/ref=sr_1_1?keywords=FrndlyTV&qid=1564137654&s=gateway&sr=8-1";
            case "nav_privacy_policy":
            case "nav_from_hamburger_privacy":
                getSupportActionBar().C(getResources().getString(2131952682));
                hd.h.b("Privacy Policy : ", c2.getPrivacyPolicyPageUrl());
                return c2.getPrivacyPolicyPageUrl() != null ? c2.getPrivacyPolicyPageUrl() : "";
            case "nav_privacy_terms":
                getSupportActionBar().C(getResources().getString(2131952681));
                return (c2 == null || c2.getTermsConditionsPageUrl() == null) ? "" : c2.getTermsConditionsPageUrl();
            case "nav_compliance_report":
                getSupportActionBar().C(getString(2131951913));
                return (c2 == null || c2.getComplianceReport() == null) ? "" : c2.getComplianceReport();
            case "nav_aboutus":
            case "nav_take_a_test":
                getSupportActionBar().C(getResources().getString(2131951660));
                return (c2 == null || c2.getAboutUsPageUrl() == null) ? "" : c2.getAboutUsPageUrl();
            case "nav_contact_us":
            case "nav_from_hamburger_contactus":
                getSupportActionBar().C(getString(2131951923));
                return (c2 == null || c2.getContactUsPageUrl() == null) ? "" : c2.getContactUsPageUrl();
            case "nav_grievance_redressal":
                getSupportActionBar().C(getResources().getString(2131952279));
                return (c2 == null || c2.getGrievanceRedressalUrl() == null) ? "" : c2.getGrievanceRedressalUrl();
            case "nav_faq":
                getSupportActionBar().C(getResources().getString(2131952219));
                return (c2 == null || c2.getFaqPageUrl() == null) ? "" : c2.getFaqPageUrl();
            case "nav_help":
                getSupportActionBar().C(getResources().getString(2131952291));
                return (c2 == null || c2.getHelpPageUrl() == null) ? "" : c2.getHelpPageUrl();
            default:
                if (getIntent().getExtras().getString(hd.r.r0) != null) {
                    return getIntent().getExtras().getString(hd.r.r0);
                }
                return null;
        }
    }

    public void J0(boolean z, String str, String str2, String str3, boolean z2) {
        String str4;
        String str5;
        String str6;
        Bundle bundle = new Bundle();
        bundle.putString(hd.r.y0, hd.r.i1);
        String str7 = "";
        bundle.putString("PAYMENT_TRANSACTION_ID", str.trim().length() > 0 ? str : "");
        if (z2) {
            str5 = "PAYMENT_TRANSACTION_ID";
            cc.c.d().o(cc.b.R1, cc.b.B0().a0(this.t.getId().toString(), this.t.getCurrency(), this.t.getSalePrice(), this.t.getListPrice(), com.yupptv.ott.a.I, this.y, this.z.toString(), String.valueOf(this.g0), this.n, String.valueOf(this.h0), this.t.getName()));
            cc.c d2 = cc.c.d();
            String str8 = cc.a.C0;
            cc.b B0 = cc.b.B0();
            String str9 = com.yupptv.ott.a.I;
            String currency = this.t.getCurrency();
            String name = this.t.getName();
            String name2 = this.t.getName();
            Double listPrice = this.t.getListPrice();
            Double listPrice2 = this.t.getListPrice();
            Double salePrice = this.t.getSalePrice();
            String str10 = com.yupptv.ott.a.I;
            String str11 = this.n;
            d2.v(str8, B0.b0(str, str9, currency, name, name2, listPrice, listPrice2, salePrice, str10, str10, str11, str11, String.valueOf(this.g0), com.yupptv.ott.a.I));
            bundle.putBoolean("IS_PAYMENT_SUCCESS", true);
            String str12 = this.h;
            if (str12 == "") {
                str12 = "Success";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE1", str12);
            String str13 = this.i;
            if (str13 == "") {
                str13 = "";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE2", str13);
            StringBuilder sb2 = new StringBuilder();
            sb2.append("Transaction ID : ");
            str4 = str;
            sb2.append(str4);
            bundle.putString("PAYMENT_SUCCESS_MESSAGE3", sb2.toString());
        } else {
            str4 = str;
            str5 = "PAYMENT_TRANSACTION_ID";
            cc.c d3 = cc.c.d();
            String str14 = cc.b.S1;
            cc.b B02 = cc.b.B0();
            String num = this.t.getId().toString();
            String currency2 = this.t.getCurrency();
            Double salePrice2 = this.t.getSalePrice();
            Double listPrice3 = this.t.getListPrice();
            String str15 = com.yupptv.ott.a.I;
            d3.o(str14, B02.c0(num, currency2, salePrice2, listPrice3, str15, str15, String.valueOf(this.h0), com.yupptv.ott.a.I));
            cc.c.d().v(cc.a.B0, cc.b.B0().d0(com.yupptv.ott.a.I, this.t.getCurrency(), this.t.getName(), this.t.getListPrice(), this.t.getSalePrice()));
            bundle.putBoolean("IS_PAYMENT_SUCCESS", false);
            String str16 = this.h;
            if (str16 == "") {
                str16 = "Your payment is unsuccessful";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE1", str16);
            String str17 = this.i;
            if (str17 == "") {
                str17 = "Please try again";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE2", str17);
        }
        if (str.trim().length() > 0) {
            str6 = str5;
            str7 = str4;
        } else {
            str6 = str5;
        }
        bundle.putString(str6, str7);
        Fragment j1Var = new j1();
        if (com.yupptv.ott.a.Y) {
            j1Var = new k1();
            bundle.putString("PAYMENT_INFO_JSON", G0());
        }
        j1Var.setArguments(bundle);
        if (getSupportFragmentManager() != null) {
            findViewById(2131428566).setVisibility(0);
            if (z) {
                getSupportFragmentManager().q().r(2131428566, j1Var, "paymentSuccess").g("paymentSuccess").j();
            } else {
                getSupportFragmentManager().q().r(2131428566, j1Var, "paymentSuccess").j();
            }
        }
    }

    public void K0(boolean z) {
        Dialog dialog = this.q;
        if (dialog != null) {
            if (!z) {
                this.r.setVisibility(8);
                return;
            }
            TextView textView = this.r;
            if (textView != null) {
                if (textView.getVisibility() == 8) {
                    this.r.setVisibility(0);
                }
            } else {
                TextView textView2 = (TextView) dialog.findViewById(2131429110);
                this.r = textView2;
                textView2.setText(getString(2131952005));
                this.r.setVisibility(0);
            }
        }
    }

    public void L0(boolean z) {
        if (!z) {
            Dialog dialog = this.q;
            if (dialog != null) {
                dialog.dismiss();
                TextView textView = this.r;
                if (textView == null || textView.getVisibility() != 0) {
                    return;
                }
                S0(false);
                return;
            }
            return;
        }
        Dialog dialog2 = this.q;
        if (dialog2 == null) {
            Dialog dialog3 = new Dialog(this);
            this.q = dialog3;
            dialog3.setContentView(2131624043);
            this.q.show();
        } else if (!dialog2.isShowing()) {
            this.q.show();
        }
        WindowManager.LayoutParams attributes = this.q.getWindow().getAttributes();
        attributes.width = -1;
        this.q.getWindow().setAttributes(attributes);
        this.q.getWindow().setBackgroundDrawable(new ColorDrawable(0));
    }

    private void N0(boolean z) {
        Bundle bundle = new Bundle();
        if (z) {
            bundle.putBoolean("IS_PAYMENT_SUCCESS", true);
            String str = this.h;
            if (str == "") {
                str = "Success";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE1", str);
            String str2 = this.i;
            if (str2 == "") {
                str2 = "";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE2", str2);
            bundle.putString("PAYMENT_SUCCESS_MESSAGE3", "Transaction ID : " + this.m);
        } else {
            bundle.putBoolean("IS_PAYMENT_SUCCESS", false);
            String str3 = this.h;
            if (str3 == "") {
                str3 = "Your payment is unsuccessful";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE1", str3);
            String str4 = this.i;
            if (str4 == "") {
                str4 = "Please try again";
            }
            bundle.putString("PAYMENT_SUCCESS_MESSAGE2", str4);
        }
        bundle.putString("PAYMENT_TRANSACTION_ID", this.m.trim().length() > 0 ? this.m : "");
        if (!hd.e.T.equalsIgnoreCase("news9plus")) {
            OrderStatusResponse orderStatusResponse = this.i0;
            bundle.putString("plan_name", orderStatusResponse != null ? orderStatusResponse.getPlanName() : null);
            bundle.putString("plan_price", this.t.getListPrice().toString());
        }
        bundle.putString(hd.r.y0, hd.r.i1);
        Fragment j1Var = new j1();
        if (com.yupptv.ott.a.Y) {
            j1Var = new k1();
            bundle.putString("PAYMENT_INFO_JSON", G0());
        }
        j1Var.setArguments(bundle);
        findViewById(2131428566).setVisibility(0);
        getSupportFragmentManager().q().c(2131428566, j1Var, "paymentSuccess").g("home").j();
    }

    public void O0(Error error) {
        T0(false);
        U0(error.getMessage());
    }

    public void P0(OrderIdResponse orderIdResponse, PaymentsFragment.PurchaseItem purchaseItem, String str) {
        this.m = orderIdResponse.getOrderId();
        if (orderIdResponse.getTargetParams().getRazorpayOrderId() != null) {
            this.T = orderIdResponse.getTargetParams().getRazorpayOrderId();
        }
        if (orderIdResponse.getTargetParams().getRazorpay_customer_id() != null) {
            this.U = orderIdResponse.getTargetParams().getRazorpay_customer_id();
        }
        if (orderIdResponse.getTargetParams().getIsRecurring() != null) {
            this.V = orderIdResponse.getTargetParams().getIsRecurring();
        }
        this.W = orderIdResponse.getTargetParams().getAmount();
        this.X = orderIdResponse.getTargetParams().getCurrency();
        if (orderIdResponse.getTargetParams().getRazorpay_subscription_id() != null) {
            this.Y = orderIdResponse.getTargetParams().getRazorpay_subscription_id();
        }
        if (orderIdResponse.getTargetParams().getClientSecret() != null) {
            this.Z = orderIdResponse.getTargetParams().getClientSecret();
        }
        if (orderIdResponse.getCaptureCall().booleanValue()) {
            V0(purchaseItem, str);
        } else {
            X(this.m);
        }
    }

    public String Q0(Configs configs) {
        String str;
        String str2;
        String siteURL = configs.getSiteURL();
        a.C0133a c0133a = hd.a.a;
        if (c0133a.g(OTTApplication.o()) == null) {
            return null;
        }
        PreferenceManager g2 = c0133a.g(OTTApplication.o());
        str = "";
        if (g2 != null) {
            String sessionId = g2.getSessionId() != null ? g2.getSessionId() : "";
            str = g2.getDeviceUniqueId() != null ? g2.getDeviceUniqueId() : "";
            str = "bi===" + str + "&&&si===" + sessionId + "&&&ci===" + g2.getYuppDeviceId() + "&&&utm_source===APP&&&redirect===invoice&&&orderId===" + this.o;
        }
        String encodeToString = Base64.encodeToString(str.getBytes(), 3);
        try {
            encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
        } catch (UnsupportedEncodingException unused) {
        }
        if (siteURL.endsWith("/")) {
            str2 = siteURL + "sso/manage?ut=" + encodeToString;
        } else {
            str2 = siteURL + "/sso/manage?ut=" + encodeToString;
        }
        hd.h.a("DEBUG", "siteurl " + str2);
        return str2;
    }

    private void S0(final boolean z) {
        if (isFinishing()) {
            return;
        }
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                WebViewActivity.this.K0(z);
            }
        });
    }

    public void T0(final boolean z) {
        if (isFinishing()) {
            return;
        }
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                WebViewActivity.this.L0(z);
            }
        });
    }

    public void U0(String str) {
        if (TextUtils.isEmpty(str.trim())) {
            return;
        }
        Toast.makeText((Context) this, (CharSequence) str, 1).show();
    }

    private void W0(String str) {
        str.hashCode();
        switch (str) {
            case "BEN":
                if (n0) {
                    OTTApplication.N(this);
                    hd.a.a.b(OTTApplication.o()).setLocaleBengali(this);
                    n0 = false;
                    return;
                }
                return;
            case "ENG":
                if (n0) {
                    OTTApplication.O(this);
                    OttSDK.setLocaleEnglish(this);
                    n0 = false;
                    return;
                }
                return;
            case "HIN":
                if (n0) {
                    OTTApplication.Q(this);
                    hd.a.a.b(OTTApplication.o()).setLocaleHindi(this);
                    n0 = false;
                    break;
                }
                break;
            case "POT":
                if (n0) {
                    OTTApplication.R(this);
                    OttSDK.setLocalePortuguese(this);
                    n0 = false;
                    return;
                }
                return;
            case "TAM":
                break;
            case "TEL":
                if (n0) {
                    OTTApplication.T(this);
                    hd.a.a.b(OTTApplication.o()).setLocaleTelugu(this);
                    n0 = false;
                    return;
                }
                return;
            default:
                return;
        }
        if (n0) {
            OTTApplication.S(this);
            hd.a.a.b(OTTApplication.o()).setLocaleTamil(this);
            n0 = false;
        }
    }

    private void Y(PaymentsFragment.PurchaseItem purchaseItem, String str) {
        PreferenceManager g2 = hd.a.a.g(OTTApplication.o());
        if (g2 != null && g2.getIpInfo() != null && g2.getIpInfo().getCountry() != null && !g2.getIpInfo().getCountry().equalsIgnoreCase("India")) {
            z0(purchaseItem, str, "card");
            return;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("UPI", "upi");
        linkedHashMap.put("Cards", "card");
        linkedHashMap.put("Others", "emandate");
        hd.u.J0(this, DialogType.PAYMENT_OPTIONS, linkedHashMap, new n(purchaseItem, str));
    }

    private void y0(String str, String str2, String str3, String str4, String str5) {
        T0(true);
        S0(true);
        cc.c d2 = cc.c.d();
        String str6 = cc.b.K1;
        cc.b B0 = cc.b.B0();
        String num = this.t.getId().toString();
        Double salePrice = this.t.getSalePrice();
        String str7 = this.n;
        String currency = this.t.getCurrency();
        String str8 = com.yupptv.ott.a.I;
        d2.o(str6, B0.y(num, salePrice, str7, currency, "true", str8, str8));
        hd.a.a.b(OTTApplication.o()).getPaymentManager().completeRazorPayPayment(str, str2, str3, str4, str5, new g(str));
    }

    public void z0(PaymentsFragment.PurchaseItem purchaseItem, String str, String str2) {
        this.n = "razorpay";
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("packages", String.valueOf(purchaseItem.j));
            jSONObject.put("gateway", "razorpay");
            jSONObject.put("userConsent", "true");
            jSONObject.put("method", str2);
            if (str != null) {
                jSONObject.put("externalTransactionToken", str);
            }
        } catch (JSONException unused) {
        }
        T0(true);
        S0(true);
        a.C0133a c0133a = hd.a.a;
        PreferenceManager g2 = c0133a.g(OTTApplication.o());
        if (g2 == null || g2.getSystemFeaturesData() == null || g2.getSystemFeaturesData().getSystemFeatures() == null || g2.getSystemFeaturesData().getSystemFeatures().getEncryptApisList() == null || g2.getSystemFeaturesData().getSystemFeatures().getEncryptApisList().getFields() == null || g2.getSystemFeaturesData().getSystemFeatures().getEncryptApisList().getFields().getPayment() == null || !g2.getSystemFeaturesData().getSystemFeatures().getEncryptApisList().getFields().getPayment().equalsIgnoreCase("true")) {
            c0133a.b(OTTApplication.o()).getPaymentManager().getOrderId(jSONObject, new e(purchaseItem, str2));
        } else {
            c0133a.b(OTTApplication.o()).getPaymentManager().getOrderId(jSONObject, new d(purchaseItem, str2));
        }
    }

    @Override
    public void B(String str) {
        String str2;
        String str3;
        PaymentsFragment.PurchaseItem purchaseItem;
        Configs appConfigurations;
        if (str.isEmpty()) {
            return;
        }
        hd.h.a("WebViewActivity>>", "AlternativeBilling::" + str);
        String siteURL = (OttSDK.getInstance() == null || (appConfigurations = OttSDK.getInstance().getApplicationManager().getAppConfigurations()) == null || appConfigurations.getSiteURL() == null) ? "" : appConfigurations.getSiteURL();
        a.C0133a c0133a = hd.a.a;
        if (c0133a.g(OTTApplication.o()) == null) {
            Toast.makeText((Context) this, (CharSequence) getResources().getString(2131952830), 0).show();
            T0(false);
            return;
        }
        if (!com.yupptv.ott.a.W || (purchaseItem = this.u) == null) {
            PreferenceManager g2 = c0133a.g(OTTApplication.o());
            String sessionId = g2.getSessionId() != null ? g2.getSessionId() : "";
            String deviceUniqueId = g2.getDeviceUniqueId() != null ? g2.getDeviceUniqueId() : "";
            int yuppDeviceId = g2.getYuppDeviceId();
            String str4 = "buy/juspay/" + this.t.getId().toString();
            hd.h.a("DEBUG", "path " + str4);
            hd.h.a("DEBUG", "sessionId " + sessionId);
            hd.h.a("DEBUG", "boxId " + deviceUniqueId);
            hd.h.a("DEBUG", "clientId " + yuppDeviceId);
            hd.h.a("DEBUG", "pi " + this.Q);
            hd.h.a("DEBUG", "token " + str);
            this.K = this.N.m(this.L);
            String str5 = ("bi===" + deviceUniqueId + "&&&si===" + sessionId + "&&&ci===" + yuppDeviceId + "&&&pi===" + this.Q + "&&&tk===" + str) + "&&&theme===w";
            if (str4 == null || str4.trim().length() <= 0) {
                str2 = str5 + "&&&redirect===plans/list";
            } else {
                str2 = str5 + "&&&redirect===" + str4;
            }
            hd.h.a("DEBUG", "siteurl string to encode " + str2);
            String encodeToString = Base64.encodeToString(str2.getBytes(), 2);
            try {
                encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
            } catch (UnsupportedEncodingException e2) {
                e2.printStackTrace();
            }
            if (siteURL.endsWith("/")) {
                str3 = siteURL + "sso/manage?ut=" + encodeToString;
            } else {
                str3 = siteURL + "/sso/manage?ut=" + encodeToString;
            }
            hd.h.a("DEBUG", "siteurl " + str3);
            this.e.loadUrl(str3);
        } else {
            this.n = "razorpay";
            Y(purchaseItem, str);
        }
        T0(false);
    }

    public void E0() {
        T0(true);
        if (OttSDK.getInstance() == null || OttSDK.getInstance().getPaymentManager() == null) {
            return;
        }
        OttSDK.getInstance().getPaymentManager().getPackagesGeneric("true", null, null, this.j0);
    }

    public String I0(String str) {
        String str2;
        a.C0133a c0133a = hd.a.a;
        Configs c2 = c0133a.c(OTTApplication.o());
        if (c2 != null && c2.getFlexiPlanUrl() != null && c2.getFlexiPlanUrl().trim().length() > 0) {
            return M0(str, c2);
        }
        String siteURL = (c2 == null || c2.getSiteURL() == null) ? "" : c2.getSiteURL();
        PreferenceManager g2 = c0133a.g(OTTApplication.o());
        if (g2 == null) {
            Toast.makeText((Context) this, (CharSequence) getResources().getString(2131952830), 0).show();
            return str;
        }
        String sessionId = g2.getSessionId() != null ? g2.getSessionId() : "";
        String deviceUniqueId = g2.getDeviceUniqueId() != null ? g2.getDeviceUniqueId() : "";
        int yuppDeviceId = g2.getYuppDeviceId();
        hd.h.a("DEBUG", "sessionId " + sessionId);
        hd.h.a("DEBUG", "boxId " + deviceUniqueId);
        hd.h.a("DEBUG", "clientId " + yuppDeviceId);
        String str3 = "bi===" + deviceUniqueId + "&&&si===" + sessionId + "&&&ci===" + yuppDeviceId + "&&&theme===w";
        if (com.yupptv.ott.a.h) {
            str3 = str3 + "&&&lang===" + this.G.toLowerCase();
        }
        String str4 = str3 + "&&&redirect===plans/list";
        if (com.yupptv.ott.a.l) {
            str4 = (((str4 + "&&&os===Android") + "&&&os_version===" + DeviceUtils.os_version) + "&&&limit_ad_tracking===false") + "&&&branch_key===key_live_kfRjeIpRvXzvCEEzGMp6YmpaEFn7AXvK";
        }
        hd.a0 a0Var = this.N;
        if (a0Var != null && a0Var.j() != null && !this.N.j().isEmpty()) {
            str4 = str4 + "&&&app_instance_id===" + this.N.j();
        }
        hd.h.a("url>>", "siteurl>>2 " + str4);
        String encodeToString = Base64.encodeToString(str4.getBytes(), 2);
        try {
            encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
        } catch (UnsupportedEncodingException unused) {
        }
        if (siteURL.endsWith("/")) {
            str2 = siteURL + "sso/manage?ut=" + encodeToString;
        } else {
            str2 = siteURL + "/sso/manage?ut=" + encodeToString;
        }
        hd.h.a("DEBUG", "siteurl " + str2);
        return str2;
    }

    public String M0(String str, Configs configs) {
        String str2;
        String flexiPlanUrl = configs.getFlexiPlanUrl();
        a.C0133a c0133a = hd.a.a;
        if (c0133a.g(OTTApplication.o()) != null) {
            PreferenceManager g2 = c0133a.g(OTTApplication.o());
            str2 = "";
            if (g2 != null) {
                String sessionId = g2.getSessionId() != null ? g2.getSessionId() : "";
                str2 = g2.getDeviceUniqueId() != null ? g2.getDeviceUniqueId() : "";
                str2 = "bi===" + str2 + "&&&si===" + sessionId + "&&&ci===" + g2.getYuppDeviceId() + "&&&utm_source===APP&&&redirect===/";
            }
            if (configs.getExternalBrowserValidityTimeInSec() != null) {
                try {
                    if (Integer.parseInt(configs.getExternalBrowserValidityTimeInSec()) > 0) {
                        str2 = str2 + "&&&validity===" + (System.currentTimeMillis() + (r9 * 1000));
                    }
                } catch (NumberFormatException unused) {
                }
            }
            if (g2 == null || g2.getLoggedUser() == null) {
                str2 = str2 + "&&&OTTSMSID===-1&&&mobile===-1&&&auth_id===-1";
            } else {
                User loggedUser = g2.getLoggedUser();
                if (loggedUser != null) {
                    if (loggedUser.getExternalUserId() != null) {
                        str2 = str2 + "&&&OTTSMSID===" + loggedUser.getExternalUserId();
                    }
                    if (loggedUser.getPhoneNumber() != null) {
                        String phoneNumber = loggedUser.getPhoneNumber();
                        if (phoneNumber != null) {
                            phoneNumber = i0.a(phoneNumber);
                            if (phoneNumber.trim().length() > 10) {
                                phoneNumber = phoneNumber.substring(phoneNumber.length() - 10);
                            }
                        }
                        str2 = str2 + "&&&mobile===" + phoneNumber;
                    }
                    if (loggedUser.getAuthToken() != null) {
                        str2 = str2 + "&&&auth_id===" + loggedUser.getAuthToken();
                    }
                }
            }
            String str3 = str2 + "&&&appsflyerId===" + AppsFlyerLib.getInstance().getAppsFlyerUID(this) + "&&&advertisingId===" + hd.a0.y(this).u("pref_key_advertising_id");
            if (g2 != null && g2.getIpInfo() != null && g2.getIpInfo().getTrueIP() != null && g2.getIpInfo().getTrueIP().trim().length() > 0) {
                str3 = str3 + "&&&ip===" + g2.getIpInfo().getTrueIP();
            }
            if (com.yupptv.ott.a.l) {
                str3 = (((str3 + "&&&os===Android") + "&&&os_version===" + DeviceUtils.os_version) + "&&&limit_ad_tracking===false") + "&&&branch_key===key_live_kfRjeIpRvXzvCEEzGMp6YmpaEFn7AXvK";
            }
            hd.a0 a0Var = this.N;
            if (a0Var != null && a0Var.j() != null && !this.N.j().isEmpty()) {
                str3 = str3 + "&&&app_instance_id===" + this.N.j();
            }
            hd.h.a("DEBUG", "siteurl string to encode " + str3);
            String encodeToString = Base64.encodeToString(str3.getBytes(), 3);
            try {
                encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
            } catch (UnsupportedEncodingException unused2) {
            }
            if (flexiPlanUrl.endsWith("?")) {
                str = flexiPlanUrl + "ut=" + encodeToString;
            } else {
                str = flexiPlanUrl + "?ut=" + encodeToString;
            }
            hd.h.a("DEBUG", "siteurl " + str);
        }
        return str;
    }

    public void R0() {
        setRequestedOrientation(1);
    }

    public void V0(PaymentsFragment.PurchaseItem purchaseItem, String str) {
        Checkout.clearUserData(this);
        Checkout checkout = new Checkout();
        a.C0133a c0133a = hd.a.a;
        checkout.setKeyID(c0133a.c(OTTApplication.o()).getRpayLiveId());
        checkout.setImage(2131232491);
        try {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put(AppMeasurementSdk.ConditionalUserProperty.NAME, "" + getResources().getString(com.razorpay.R.string.app_name));
            jSONObject.put("recurring", this.V.equalsIgnoreCase("true") ? 1 : 0);
            jSONObject.put("customer_id", this.U);
            jSONObject.put("description", String.format(getResources().getString(2131952854), hd.j.b("" + purchaseItem.u, "dd/MM/yyyy")));
            if (!this.T.isEmpty()) {
                jSONObject.put("order_id", this.T);
            } else if (!this.Y.isEmpty()) {
                jSONObject.put("subscription_id", this.Y);
            }
            jSONObject.put("currency", this.X);
            jSONObject.put("amount", this.W);
            jSONObject.put("method", new JSONObject().put("upi", false).put("card", false).put("netbanking", false).put("wallet", false).put(str, true));
            User loggedUser = c0133a.g(OTTApplication.o()).getLoggedUser();
            if (loggedUser != null && loggedUser.getPhoneNumber() != null) {
                JSONObject jSONObject2 = new JSONObject();
                jSONObject2.put("contact", loggedUser.getPhoneNumber());
                jSONObject2.put("email", loggedUser.getEmail());
                jSONObject.put("prefill", jSONObject2);
            }
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put(AppMeasurementSdk.ConditionalUserProperty.NAME, getResources().getString(com.razorpay.R.string.app_name));
            jSONObject.put("notes", jSONObject3);
            checkout.open(this, jSONObject);
            T0(false);
        } catch (Exception e2) {
            U0("Error in payment: " + e2.getMessage());
        }
    }

    public void X(String str) {
        if (str == null || str.length() < 1) {
            return;
        }
        this.C = 0L;
        this.A = false;
        this.m = str;
        this.D.postDelayed(this.k0, 1000L);
    }

    public void X0() {
        getSupportActionBar().r(getResources().getDrawable(2131100505));
        getSupportActionBar().x(2131230881);
    }

    public void Y0(sc.e eVar, int i2) {
        User loggedUser;
        hd.h.a("DEBUG", "verifyInAppPaymentWithOrderId " + eVar.c());
        hd.h.a("DEBUG", "verifyInAppPaymentWithOrderId " + eVar.h());
        Dialog dialog = this.q;
        if (dialog != null) {
            dialog.setCancelable(false);
        }
        T0(true);
        S0(true);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("packages", "" + this.t.getId());
            jSONObject.put("orderId", eVar.c());
            jSONObject.put("packageName", eVar.d());
            jSONObject.put("productId", eVar.e());
            if (B0().equalsIgnoreCase(InAppType.SUBSCRIPTION.getValue())) {
                jSONObject.put("purchaseState", "" + i2);
            } else {
                jSONObject.put("purchaseState", "" + eVar.f());
            }
            jSONObject.put("purchaseToken", eVar.h());
            jSONObject.put("purchaseTime", "" + eVar.g());
            if (eVar.b() != null) {
                jSONObject.put("autoRenewing", eVar.b().booleanValue() ? "true" : "false");
                this.g0 = eVar.b().booleanValue();
            }
            if (eVar.a() != null) {
                jSONObject.put("acknowledged", eVar.a().booleanValue() ? "true" : "false");
            }
            jSONObject.put("gateway", "googleinapp");
            if (OttSDK.getInstance() != null && (loggedUser = OttSDK.getInstance().getPreferenceManager().getLoggedUser()) != null && loggedUser.getPhoneNumber() != null) {
                jSONObject.put("phone_number", loggedUser.getPhoneNumber());
            }
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
        a.C0133a c0133a = hd.a.a;
        if (c0133a.b(OTTApplication.o()) != null) {
            Features e3 = c0133a.e(OTTApplication.o());
            if (e3 == null || e3.getEncryptApisList() == null || e3.getEncryptApisList().getFields() == null || e3.getEncryptApisList().getFields().getPayment() == null || !e3.getEncryptApisList().getFields().getPayment().equalsIgnoreCase("true")) {
                c0133a.b(OTTApplication.o()).getPaymentManager().getOrderId(jSONObject, new p());
            } else {
                c0133a.b(OTTApplication.o()).getPaymentManager().getOrderIdEnc(jSONObject, new o());
            }
        }
    }

    @Override
    public void n(Object obj, int i2) {
        hd.h.a("DEBUG", "verify payment called");
        OttLog.error(l0, " verify payment called");
        if (obj == null || !(obj instanceof Purchase)) {
            return;
        }
        sc.e eVar = (sc.e) new com.google.gson.d().i(((Purchase) obj).a(), new m().getType());
        cc.c d2 = cc.c.d();
        String str = cc.b.K1;
        cc.b B0 = cc.b.B0();
        String num = this.t.getId().toString();
        Double salePrice = this.t.getSalePrice();
        String str2 = this.n;
        String currency = this.t.getCurrency();
        String str3 = com.yupptv.ott.a.I;
        d2.o(str, B0.y(num, salePrice, str2, currency, "true", str3, str3));
        Y0(eVar, i2);
    }

    protected void onActivityResult(int i2, int i3, Intent intent) {
        if (i2 == 103) {
            if (this.J == null || intent == null || i3 != -1) {
                return;
            }
            String dataString = intent.getDataString();
            this.J.onReceiveValue(dataString != null ? new Uri[]{Uri.parse(dataString)} : null);
            this.J = null;
        }
        if (i2 == 19) {
            this.f.onActivityResult(i2, i3, intent);
        }
        super/*androidx.fragment.app.h*/.onActivityResult(i2, i3, intent);
    }

    public void onBackPressed() {
        if (isFinishing()) {
            return;
        }
        boolean z = false;
        if (m0.equalsIgnoreCase(hd.r.y1)) {
            WebView webView = this.e;
            if (webView != null && webView.canGoBack()) {
                this.e.goBack();
                return;
            }
            setResult(101);
        } else if (m0.equalsIgnoreCase(hd.r.b1)) {
            WebView webView2 = this.e;
            if (webView2 != null && webView2.canGoBack()) {
                this.e.goBack();
                return;
            }
        } else {
            if (m0.equalsIgnoreCase(hd.r.B1)) {
                setResult(-2);
                T0(false);
                finish();
                super/*androidx.activity.ComponentActivity*/.onBackPressed();
                return;
            }
            if (m0.equalsIgnoreCase(hd.r.A1)) {
                setResult(35);
                T0(false);
                finish();
                super/*androidx.activity.ComponentActivity*/.onBackPressed();
                return;
            }
            if (m0.equalsIgnoreCase(hd.r.C1)) {
                WebView webView3 = this.e;
                if (webView3 != null && webView3.canGoBack()) {
                    this.e.goBack();
                    return;
                }
                setResult(36);
                T0(false);
                finish();
                super/*androidx.activity.ComponentActivity*/.onBackPressed();
                return;
            }
        }
        T0(false);
        String str = this.n;
        if (str != null && str.equalsIgnoreCase(hd.r.H)) {
            finish();
            super/*androidx.activity.ComponentActivity*/.onBackPressed();
            return;
        }
        getIntent().putExtra(hd.r.t0, this.m);
        if (this.p.equalsIgnoreCase("final") || this.p.equalsIgnoreCase("-1")) {
            z = true;
        } else {
            setResult(-2, getIntent());
        }
        if (z) {
            hd.a.n(OTTApplication.o()).getApplicationManager().getConfigurationData((TenantBuildType) null, new c());
        } else {
            finish();
            super/*androidx.activity.ComponentActivity*/.onBackPressed();
        }
    }

    protected void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.h*/.onCreate(bundle);
        R0();
        setContentView(2131624533);
        T0(true);
        Checkout.preload(getApplicationContext());
        String str = "";
        this.T = "";
        this.Y = "";
        cc.b.B0().C1("Webview");
        a.C0133a c0133a = hd.a.a;
        User loggedUser = c0133a.g(OTTApplication.o()).getLoggedUser();
        if (loggedUser == null || loggedUser.getPackages() == null || loggedUser.getPackages().isEmpty()) {
            this.h0 = false;
        } else {
            this.h0 = true;
        }
        this.N = hd.a0.y(this);
        Bundle extras = getIntent().getExtras();
        this.H = false;
        if (extras != null && extras.containsKey(hd.r.s0)) {
            this.H = extras.getBoolean(hd.r.s0);
        }
        String str2 = (String) getIntent().getSerializableExtra("load_fragment");
        m0 = str2;
        if (str2.equalsIgnoreCase(hd.r.y1) || m0.equalsIgnoreCase(hd.r.B1) || m0.equalsIgnoreCase(hd.r.C1)) {
            getSupportActionBar().k();
        } else {
            getSupportActionBar().u(true);
            getSupportActionBar().z(true);
            getSupportActionBar().t(true);
        }
        X0();
        if (OTTApplication.w() != null) {
            this.G = OTTApplication.w().C();
        }
        if (com.yupptv.ott.a.h) {
            W0(this.G);
        } else {
            W0("ENG");
        }
        getSupportFragmentManager().l(new h());
        Configs c2 = c0133a.c(OTTApplication.o());
        if (c2 != null && c2.getUserChoiceBillingGateway() != null && c2.getUserChoiceBillingGateway().contains("razorpay")) {
            com.yupptv.ott.a.W = true;
        }
        if (getIntent().getExtras().getString(hd.r.r0) != null) {
            this.j = getIntent().getExtras().getString(hd.r.r0);
            if (!m0.equalsIgnoreCase(hd.r.y1) && !m0.equalsIgnoreCase(hd.r.B1)) {
                if (getIntent().getExtras().getString(hd.r.I0) != null) {
                    getSupportActionBar().C(Html.fromHtml("<font color=\"" + C0(2131100236) + "\">" + getIntent().getExtras().getString(hd.r.I0) + "</font>"));
                } else {
                    getSupportActionBar().C(m0.equalsIgnoreCase("nav_from_banner") ? "" : getString(2131952627));
                }
            }
        } else {
            String H0 = H0();
            this.j = H0;
            hd.h.a("url>>", H0);
            if (com.yupptv.ott.a.h) {
                if (this.j.endsWith("white") || this.j.endsWith("black") || this.j.endsWith("b")) {
                    this.j += "&lang_type=" + this.G.toLowerCase();
                } else {
                    this.j += "?lang_type=" + this.G.toLowerCase();
                }
            }
            hd.h.a("", "weburl2 " + this.j);
            hd.h.a("url>>", "siteurl>>2 " + this.j);
        }
        if (getIntent().getExtras().getString(hd.r.t0) != null) {
            this.m = getIntent().getExtras().getString(hd.r.t0);
        } else {
            this.m = "";
        }
        if (getIntent().getExtras().getString(hd.r.R) != null) {
            this.n = getIntent().getExtras().getString(hd.r.R);
        } else {
            this.n = "";
        }
        if (this.j == null) {
            Toast.makeText((Context) this, 2131952523, 1).show();
            setResult(-2);
            finish();
            return;
        }
        if (this.n.equalsIgnoreCase(hd.r.H)) {
            if (getIntent().getExtras().getString(hd.r.q0) != null) {
                this.k = getIntent().getExtras().getString(hd.r.q0);
            } else {
                this.k = "";
            }
        }
        OttLog.error("WebViewActivity", "url : " + this.j);
        if (Uri.parse(this.j).getQueryParameter("redirectstatus") != null) {
            this.p = Uri.parse(this.j).getQueryParameter("redirectstatus");
        }
        WebView webView = (WebView) findViewById(2131429646);
        this.e = webView;
        webView.getSettings().setJavaScriptEnabled(true);
        this.e.addJavascriptInterface(new r3.j(CleverTapAPI.H(this)), com.yupptv.ott.a.C);
        this.e.getSettings().setDomStorageEnabled(true);
        this.e.setWebViewClient(new q(this));
        WebView.setWebContentsDebuggingEnabled(false);
        this.f = new HyperWebViewServices(this, this.e);
        this.s = h0.b(this).a(dc.a.class);
        this.e.setBackgroundColor(Color.parseColor("#000000"));
        this.e.setWebChromeClient(new i());
        this.e.setWebChromeClient(new j());
        this.e.setWebChromeClient(new k());
        this.e.setHorizontalScrollBarEnabled(false);
        this.e.setVerticalScrollBarEnabled(false);
        String str3 = this.j;
        if (str3 != null) {
            if (!TextUtils.isEmpty(str3) && this.j.contains("sso/manage")) {
                HashMap hashMap = new HashMap();
                hashMap.put(cc.a.k0, "General");
                cc.c.d().r(cc.a.W, hashMap);
            }
            String str4 = m0;
            if (str4 == null || !str4.equalsIgnoreCase(hd.r.w1)) {
                if (!this.j.contains("pdf")) {
                    this.e.loadUrl(this.j);
                    return;
                }
                this.e.loadUrl("https://drive.google.com/viewerng/viewer?embedded=true&url=" + this.j);
                return;
            }
            if (c0133a.g(OTTApplication.o()) == null) {
                this.e.loadUrl(this.j);
                return;
            }
            User loggedUser2 = c0133a.g(OTTApplication.o()).getLoggedUser();
            String trim = (c0133a.c(OTTApplication.o()) == null || c0133a.c(OTTApplication.o()).getLmsEntryUrl() == null) ? "" : c0133a.c(OTTApplication.o()).getLmsEntryUrl().trim();
            if (loggedUser2 != null && loggedUser2.getAttributes() != null) {
                User.Attributes attributes = loggedUser2.getAttributes();
                str = "un=" + attributes.getLms_user_name() + "&pd=" + attributes.getLms_password() + "&url=" + this.j;
            }
            if (str.trim().length() > 0) {
                this.e.postUrl(trim, str.getBytes());
            } else {
                this.e.loadUrl(this.j);
            }
        }
    }

    public void onDestroy() {
        super.onDestroy();
        WebView webView = this.e;
        if (webView != null) {
            webView.loadUrl("about:blank");
            this.e.stopLoading();
            this.e.clearHistory();
            this.e.clearCache(true);
            this.e.removeJavascriptInterface(com.yupptv.ott.a.C);
            this.e.setWebChromeClient(null);
            this.e.setWebViewClient(null);
            ((ViewGroup) this.e.getParent()).removeView(this.e);
            this.e.destroy();
            this.e = null;
        }
        HyperServiceHolder hyperServiceHolder = this.O;
        if (hyperServiceHolder != null) {
            hyperServiceHolder.setCallback((HyperPaymentsCallback) null);
        }
        T0(false);
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == 16908332) {
            onBackPressed();
        }
        return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
    }

    @Override
    public void onPaymentError(int i2, String str, PaymentData paymentData) {
        cc.c.d().o(cc.b.K1, cc.b.B0().y(this.t.getId().toString(), this.t.getSalePrice(), this.n, this.t.getCurrency(), "false", str, String.valueOf(i2)));
        hd.a.a.b(OTTApplication.o()).getPaymentManager().completeRazorPayPaymentOnFailure(this.m, i2 == 0 ? "Checkout.PAYMENT_CANCELED" : i2 == 2 ? "Checkout.NETWORK_ERROR" : i2 == 3 ? "Checkout.INVALID_OPTIONS" : i2 == 6 ? "Checkout.TLS_ERROR" : "", str, new f());
    }

    @Override
    public void onPaymentFinished(Boolean bool) {
        if (this.e.getContext() == null) {
            return;
        }
        if (!bool.booleanValue()) {
            Toast.makeText(this.e.getContext(), getResources().getString(2131952634), 1).show();
            if (hd.e.T.equalsIgnoreCase("news9plus")) {
                cc.c d2 = cc.c.d();
                String str = cc.b.S1;
                cc.b B0 = cc.b.B0();
                String num = this.t.getId().toString();
                String currency = this.t.getCurrency();
                Double salePrice = this.t.getSalePrice();
                Double listPrice = this.t.getListPrice();
                String str2 = com.yupptv.ott.a.I;
                d2.o(str, B0.c0(num, currency, salePrice, listPrice, str2, str2, String.valueOf(this.h0), com.yupptv.ott.a.I));
                cc.c.d().v(cc.a.B0, cc.b.B0().d0(com.yupptv.ott.a.I, this.t.getCurrency(), this.t.getName(), this.t.getListPrice(), this.t.getSalePrice()));
            } else {
                HashMap hashMap = new HashMap();
                hashMap.put("page_name", "transaction_failed");
                hashMap.put("source", cc.b.B0().K0());
                cc.c.d().t("subscription_page_appeared", hashMap);
            }
            N0(bool.booleanValue());
            return;
        }
        Toast.makeText(this.e.getContext(), this.e.getContext().getResources().getString(2131952631), 1).show();
        if (hd.e.T.equalsIgnoreCase("news9plus")) {
            cc.c.d().o(cc.b.R1, cc.b.B0().a0(this.t.getId().toString(), this.t.getCurrency(), this.t.getSalePrice(), this.t.getListPrice(), com.yupptv.ott.a.I, this.y, this.z.toString(), String.valueOf(this.g0), this.n, String.valueOf(this.h0), this.t.getName()));
            cc.c d3 = cc.c.d();
            String str3 = cc.a.C0;
            cc.b B02 = cc.b.B0();
            String str4 = this.m;
            String str5 = com.yupptv.ott.a.I;
            String currency2 = this.t.getCurrency();
            String name = this.t.getName();
            String name2 = this.t.getName();
            Double listPrice2 = this.t.getListPrice();
            Double listPrice3 = this.t.getListPrice();
            Double salePrice2 = this.t.getSalePrice();
            String str6 = com.yupptv.ott.a.I;
            String str7 = this.n;
            d3.v(str3, B02.b0(str4, str5, currency2, name, name2, listPrice2, listPrice3, salePrice2, str6, str6, str7, str7, String.valueOf(this.g0), com.yupptv.ott.a.I));
        } else {
            HashMap hashMap2 = new HashMap();
            hashMap2.put("page_name", "success");
            hashMap2.put("source", cc.b.B0().K0());
            cc.c.d().t("subscription_page_appeared", hashMap2);
        }
        N0(bool.booleanValue());
    }

    @Override
    public void onPaymentSuccess(String str, PaymentData paymentData) {
        String str2 = this.m;
        if (str2 == null || str2.length() < 1) {
            return;
        }
        if (!this.T.isEmpty()) {
            y0(this.m, "razorpay_order_id", this.T, str, paymentData.getSignature());
        } else {
            if (this.Y.isEmpty()) {
                return;
            }
            y0(this.m, "razorpay_subscription_id", this.Y, str, paymentData.getSignature());
        }
    }

    protected void onResume() {
        super/*androidx.fragment.app.h*/.onResume();
        R0();
    }

    protected void onStart() {
        super.onStart();
    }

    @Override
    public void setTitle(String str) {
    }

    private class q extends WebViewClient {
        private Context a;

        class a implements DialogInterface.OnClickListener {
            final SslErrorHandler a;

            a(SslErrorHandler sslErrorHandler) {
                this.a = sslErrorHandler;
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                this.a.proceed();
            }
        }

        class b implements DialogInterface.OnClickListener {
            final SslErrorHandler a;

            b(SslErrorHandler sslErrorHandler) {
                this.a = sslErrorHandler;
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                this.a.cancel();
            }
        }

        public q(Context context) {
            this.a = context;
        }

        private String a() {
            String str;
            a.C0133a c0133a = hd.a.a;
            Configs c = c0133a.c(OTTApplication.o());
            String siteURL = (c == null || c.getSiteURL() == null) ? "" : c.getSiteURL();
            if (WebViewActivity.this == null || c0133a.g(OTTApplication.o()) == null) {
                return null;
            }
            PreferenceManager g = c0133a.g(OTTApplication.o());
            String sessionId = g.getSessionId() != null ? g.getSessionId() : "";
            String deviceUniqueId = g.getDeviceUniqueId() != null ? g.getDeviceUniqueId() : "";
            String encodeToString = Base64.encodeToString(("bi===" + deviceUniqueId + "&&&si===" + sessionId + "&&&ci===" + g.getYuppDeviceId()).getBytes(), 2);
            try {
                encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
            } catch (UnsupportedEncodingException unused) {
            }
            hd.a0 a0Var = WebViewActivity.this.N;
            if (a0Var != null && a0Var.j() != null && !WebViewActivity.this.N.j().isEmpty()) {
                encodeToString = encodeToString + "&&&app_instance_id===" + WebViewActivity.this.N.j();
            }
            if (siteURL.endsWith("/")) {
                str = siteURL + "settings?ut=" + encodeToString;
            } else {
                str = siteURL + "/settings?ut=" + encodeToString;
            }
            hd.h.a("AccountSettingsUrl>>", "siteurl " + str);
            return str;
        }

        public void b(String str) {
            String str2;
            if (str == null) {
                return;
            }
            a.C0133a c0133a = hd.a.a;
            Configs c = c0133a.c(OTTApplication.o());
            String siteURL = (c == null || c.getSiteURL() == null) ? "" : c.getSiteURL();
            if (WebViewActivity.this != null) {
                if (c0133a.g(OTTApplication.o()) == null) {
                    androidx.appcompat.app.e eVar = WebViewActivity.this;
                    Toast.makeText((Context) eVar, (CharSequence) eVar.getResources().getString(2131952830), 0).show();
                    return;
                }
                PreferenceManager g = c0133a.g(OTTApplication.o());
                String sessionId = g.getSessionId() != null ? g.getSessionId() : "";
                String deviceUniqueId = g.getDeviceUniqueId() != null ? g.getDeviceUniqueId() : "";
                String str3 = ("bi===" + deviceUniqueId + "&&&si===" + sessionId + "&&&ci===" + g.getYuppDeviceId()) + "&&&theme===w";
                if (com.yupptv.ott.a.h) {
                    str3 = str3 + "&&&lang===" + WebViewActivity.this.G.toLowerCase();
                }
                long currentTimeMillis = System.currentTimeMillis();
                if (c != null && c.getExternalBrowserValidityTimeInSec() != null && c.getExternalBrowserValidityTimeInSec().length() > 0) {
                    currentTimeMillis += Long.parseLong(c.getExternalBrowserValidityTimeInSec()) * 1000;
                }
                if (str.trim().length() > 0) {
                    str3 = str3 + "&&&redirect===" + str + "&&&validity===" + currentTimeMillis + "&&&from===settings";
                }
                if (com.yupptv.ott.a.l) {
                    str3 = (((str3 + "&&&os===Android") + "&&&os_version===" + DeviceUtils.os_version) + "&&&limit_ad_tracking===false") + "&&&branch_key===key_live_kfRjeIpRvXzvCEEzGMp6YmpaEFn7AXvK";
                }
                hd.a0 a0Var = WebViewActivity.this.N;
                if (a0Var != null && a0Var.j() != null && !WebViewActivity.this.N.j().isEmpty()) {
                    str3 = str3 + "&&&app_instance_id===" + WebViewActivity.this.N.j();
                }
                hd.h.a("DEBUG", "siteurl string to encode " + str3);
                String encodeToString = Base64.encodeToString(str3.getBytes(), 2);
                try {
                    encodeToString = URLEncoder.encode(encodeToString, "UTF-8");
                } catch (UnsupportedEncodingException unused) {
                }
                if (siteURL.endsWith("/")) {
                    str2 = siteURL + "sso/manage?ut=" + encodeToString;
                } else {
                    str2 = siteURL + "/sso/manage?ut=" + encodeToString;
                }
                ?? r0 = WebViewActivity.this;
                if (r0.I) {
                    hd.u.j(r0, str2, true);
                } else {
                    c(str2);
                }
                hd.h.a("DEBUG", "siteurl " + str2);
            }
        }

        public void c(String str) {
            try {
                WebViewActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
            } catch (Exception unused) {
            }
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            WebViewActivity.this.T0(false);
            super.onPageStarted(webView, str, bitmap);
        }

        @Override
        public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
            super.onReceivedError(webView, webResourceRequest, webResourceError);
            OttLog.error(WebViewActivity.l0, "onReceivedError" + webResourceError);
        }

        @Override
        public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
            super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
            OttLog.error(WebViewActivity.l0, "onReceivedHttpError" + webResourceResponse);
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            OttLog.error(WebViewActivity.l0, "onReceivedSslError" + sslError);
            androidx.appcompat.app.d create = new d.a(WebViewActivity.this).create();
            int primaryError = sslError.getPrimaryError();
            String str = (primaryError != 0 ? primaryError != 1 ? primaryError != 2 ? primaryError != 3 ? "SSL Certificate error." : "The certificate authority is not trusted." : "The certificate Hostname mismatch." : "The certificate has expired." : "The certificate is not yet valid.") + " Do you want to continue anyway?";
            create.setTitle("SSL Certificate Error");
            create.l(str);
            create.k(-1, "OK", new a(sslErrorHandler));
            create.k(-2, "Cancel", new b(sslErrorHandler));
            androidx.appcompat.app.e eVar = WebViewActivity.this;
            if (eVar == null || eVar.isFinishing()) {
                return;
            }
            create.show();
        }

        @Override
        public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
            OttLog.error(WebViewActivity.l0, "shouldInterceptRequest : url " + webResourceRequest);
            return super.shouldInterceptRequest(webView, webResourceRequest);
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            String str2;
            hd.h.b("override url :  ", " 2 : " + str);
            if (str == null) {
                return false;
            }
            if (str.startsWith("upi://")) {
                WebViewActivity.this.startActivityForResult(new Intent("android.intent.action.VIEW", Uri.parse(str)), 2001);
                return true;
            }
            Uri parse = Uri.parse(str);
            if (str.contains("juspay")) {
                WebViewActivity.this.f.attach();
            }
            if (parse != null && str.contains("buy/googleinapp?_gid=") && !TextUtils.isEmpty(parse.getQueryParameter("_gid"))) {
                WebViewActivity.this.R = parse.getQueryParameter("_gid");
                WebViewActivity.this.Q = parse.getQueryParameter("pi");
                if (!TextUtils.isEmpty(parse.getQueryParameter("_upgrade"))) {
                    WebViewActivity.this.e0 = parse.getQueryParameter("_upgrade");
                }
                if (!TextUtils.isEmpty(parse.getQueryParameter("oldPurchaseToken"))) {
                    WebViewActivity.this.f0 = parse.getQueryParameter("oldPurchaseToken");
                }
                if (!TextUtils.isEmpty(parse.getQueryParameter("payment_mode"))) {
                    WebViewActivity.this.S = parse.getQueryParameter("payment_mode");
                }
                hd.h.a("OverrideUrlLoading::", "gid:: " + WebViewActivity.this.R + "subscription_type::" + WebViewActivity.this.e0 + "oldPurchaseToken::" + WebViewActivity.this.f0 + "-payment_mode::" + WebViewActivity.this.S);
                WebViewActivity.this.E0();
                return true;
            }
            if (str.contains("pdf")) {
                webView.loadUrl(str);
                return true;
            }
            if (str.contains("delete-account")) {
                WebViewActivity.this.setResult(111);
                WebViewActivity.this.finish();
                return true;
            }
            String str3 = WebViewActivity.this.n;
            if (str3 != null && str3.equalsIgnoreCase(hd.r.H)) {
                if (parse.getQueryParameter("paymentId") != null) {
                    WebViewActivity.this.getIntent().putExtra(hd.r.u0, parse.getQueryParameter("paymentId"));
                    WebViewActivity.this.getIntent().putExtra(hd.r.v0, parse.getQueryParameter("PayerID"));
                    WebViewActivity.this.getIntent().putExtra(hd.r.w0, parse.getQueryParameter("token"));
                    WebViewActivity.this.getIntent().putExtra(hd.r.x0, "VERIFIED");
                    androidx.appcompat.app.e eVar = WebViewActivity.this;
                    eVar.setResult(99, eVar.getIntent());
                    WebViewActivity.this.finish();
                    return true;
                }
                if (parse.getQueryParameter("token") != null) {
                    WebViewActivity.this.getIntent().putExtra(hd.r.u0, parse.getQueryParameter("token"));
                    WebViewActivity.this.getIntent().putExtra(hd.r.w0, parse.getQueryParameter("token"));
                    WebViewActivity.this.getIntent().putExtra(hd.r.x0, "VERIFIED");
                    androidx.appcompat.app.e eVar2 = WebViewActivity.this;
                    eVar2.setResult(99, eVar2.getIntent());
                    WebViewActivity.this.finish();
                    return true;
                }
                String str4 = WebViewActivity.this.k;
                if (str4 != null && str4.length() > 10 && str.contains(WebViewActivity.this.k)) {
                    WebViewActivity.this.getIntent().putExtra(hd.r.x0, "FAILED");
                    androidx.appcompat.app.e eVar3 = WebViewActivity.this;
                    eVar3.setResult(99, eVar3.getIntent());
                    WebViewActivity.this.finish();
                    return true;
                }
            }
            if (WebViewActivity.m0.equalsIgnoreCase(hd.r.y1) || WebViewActivity.m0.equalsIgnoreCase(hd.r.B1) || WebViewActivity.m0.equalsIgnoreCase(hd.r.C1)) {
                Configs c = hd.a.a.c(OTTApplication.o());
                str2 = "";
                if (c != null && c.getSiteURL() != null) {
                    String siteURL = c.getSiteURL();
                    if (hd.e.T.equalsIgnoreCase("dishtv")) {
                        if (str.endsWith("/")) {
                            if (!siteURL.endsWith("/")) {
                                str2 = siteURL + "/";
                            }
                        } else if (siteURL.endsWith("/")) {
                            str2 = siteURL.subSequence(0, siteURL.length() - 1).toString();
                        }
                    } else if (siteURL != null && siteURL.trim().length() > 0) {
                        if (!siteURL.endsWith("/")) {
                            siteURL = siteURL + "/";
                        }
                        String flexiSigninUrl = c.getFlexiSigninUrl();
                        if (flexiSigninUrl == null || flexiSigninUrl.trim().length() == 0) {
                            flexiSigninUrl = "flexisignin NA";
                        }
                        str2 = c.getFlexiPlanRedirectionUrl() != null ? c.getFlexiPlanRedirectionUrl() : "";
                        if ((str.equalsIgnoreCase(siteURL + "signin") || str.equalsIgnoreCase(flexiSigninUrl) || str.contains("signin")) && OttSDK.getInstance().getPreferenceManager().getLoggedUser() == null) {
                            OttLog.error("DEBUG", " redirection url :" + siteURL + "signin");
                            WebViewActivity.this.e.destroy();
                            Intent intent = WebViewActivity.this.getIntent();
                            intent.putExtra(hd.r.m1, true);
                            if (str2 != null && !str2.trim().isEmpty()) {
                                hd.h.b("redirectionalUrl", " 1 : " + str2);
                                hd.h.b("redirectionalUrl", " 2 : " + str);
                                intent.putExtra(hd.r.n1, str2);
                            }
                            intent.putExtra(hd.r.M1, Uri.parse(str).getQueryParameter("pd"));
                            WebViewActivity.this.setResult(34, intent);
                            WebViewActivity.this.finish();
                            return true;
                        }
                        if (str.contains("/OTTPlans")) {
                            webView.loadUrl(WebViewActivity.this.I0(str));
                            return false;
                        }
                        if (str.contains("/user/settings")) {
                            String a2 = a();
                            if (a2 != null && a2.trim().length() > 0) {
                                webView.loadUrl(a2);
                            }
                            return false;
                        }
                        if (str.contains("/openlink")) {
                            if (!str.contains("redirect=")) {
                                return false;
                            }
                            String substring = str.substring(str.indexOf("redirect=") + 9);
                            if (substring.contains("http") || substring.contains("https")) {
                                hd.h.b("redirectValue", "value : " + substring);
                                c(substring);
                            } else {
                                WebViewActivity.this.I = true;
                                b(substring);
                            }
                            return true;
                        }
                        str.contains("jpayload=");
                    }
                    str2 = siteURL;
                }
                if (str.equalsIgnoreCase(str2)) {
                    if (WebViewActivity.m0.equalsIgnoreCase(hd.r.B1)) {
                        WebViewActivity.this.onBackPressed();
                        return true;
                    }
                    if (WebViewActivity.m0.equalsIgnoreCase(hd.r.C1)) {
                        WebViewActivity.this.setResult(36);
                        WebViewActivity.this.T0(false);
                    } else {
                        WebViewActivity.this.setResult(101);
                    }
                    WebViewActivity.this.finish();
                    return true;
                }
                if (str.contains("appclose")) {
                    if (str.contains("redirectionURL") && !TextUtils.isEmpty(parse.getQueryParameter("redirectionURL"))) {
                        if (parse.getQueryParameter("redirectionURL").equalsIgnoreCase("true")) {
                            WebViewActivity.this.setResult(161);
                            WebViewActivity.this.finish();
                        } else if (parse.getQueryParameter("redirectionURL").equalsIgnoreCase("invoice") && str.contains("orderId") && !TextUtils.isEmpty(parse.getQueryParameter("orderId"))) {
                            WebViewActivity.this.o = parse.getQueryParameter("orderId");
                            String str5 = WebViewActivity.this.o;
                            if (str5 != null && !str5.isEmpty()) {
                                hd.u.j(WebViewActivity.this, WebViewActivity.this.Q0(c), true);
                            }
                        }
                    }
                    return true;
                }
            }
            if (str.startsWith("tel:")) {
                try {
                    WebViewActivity.this.startActivity(new Intent("android.intent.action.DIAL", parse));
                    return true;
                } catch (ActivityNotFoundException unused) {
                    return false;
                }
            }
            if (str.startsWith("mailto:")) {
                try {
                    WebViewActivity.this.startActivity(new Intent("android.intent.action.VIEW", parse));
                    return true;
                } catch (ActivityNotFoundException unused2) {
                    return false;
                }
            }
            if (str.contains("/status.html")) {
                WebViewActivity webViewActivity = WebViewActivity.this;
                webViewActivity.p = "final";
                webViewActivity.onBackPressed();
                return true;
            }
            if (str.contains("mpaisastatus")) {
                webView.loadUrl(str.replace("http:", "https:"));
                return false;
            }
            Configs c2 = hd.a.a.c(OTTApplication.o());
            if (c2 != null && c2.getSiteURL() != null) {
                String siteURL2 = c2.getSiteURL();
                if (str.endsWith("/")) {
                    siteURL2.endsWith("/");
                } else if (siteURL2.endsWith("/")) {
                    siteURL2.subSequence(0, siteURL2.length() - 1).toString();
                }
            }
            return false;
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            super.onReceivedError(webView, i, str, str2);
            OttLog.error(WebViewActivity.l0, "onReceived Error : code  " + i + " description : " + str);
            String str3 = WebViewActivity.l0;
            StringBuilder sb2 = new StringBuilder();
            sb2.append("onReceived Error : failedurl : ");
            sb2.append(str2);
            OttLog.error(str3, sb2.toString());
            if (WebViewActivity.this.p.equalsIgnoreCase("-1")) {
                WebViewActivity.this.p = "0";
            }
            WebViewActivity.this.onBackPressed();
        }
    }
}