导航菜单

页面标题

页面副标题

Biko v2.0.23 - OpinionatedSoln.java 源代码

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

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


package com.razorpay;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.text.StringsKt;

@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\n\bÆ\u0002\u0018\u00002\u00020\u0001:\u0003$%&B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0002J\u0018\u0010\u0019\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u001a\u001a\u00020\u0011H\u0002J\u001a\u0010\u001b\u001a\u0004\u0018\u00010\u00012\u0006\u0010\u001c\u001a\u00020\u001d2\b\u0010\u001e\u001a\u0004\u0018\u00010\u0011J\u0010\u0010\u001f\u001a\u00020\u00112\u0006\u0010 \u001a\u00020\u0004H\u0002J\u000e\u0010!\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018J\u0016\u0010!\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0013\u001a\u00020\u0014J\u0006\u0010\"\u001a\u00020\u0016J\u000e\u0010#\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018R\u001a\u0010\u0003\u001a\u00020\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u000e\u0010\t\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\n\u001a\u00020\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\u0006\"\u0004\b\f\u0010\bR\u001e\u0010\r\u001a\u0012\u0012\u0004\u0012\u00020\u00040\u000ej\b\u0012\u0004\u0012\u00020\u0004`\u000fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001e\u0010\u0010\u001a\u0012\u0012\u0004\u0012\u00020\u00110\u000ej\b\u0012\u0004\u0012\u00020\u0011`\u000fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001e\u0010\u0012\u001a\u0012\u0012\u0004\u0012\u00020\u00110\u000ej\b\u0012\u0004\u0012\u00020\u0011`\u000fX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082.¢\u0006\u0002\n\u0000¨\u0006'"}, d2 = {"Lcom/razorpay/OpinionatedSoln;", "", "()V", "alertShownForStatus", "", "getAlertShownForStatus", "()Z", "setAlertShownForStatus", "(Z)V", "callbackSent", "checkedForSubMinorVersion", "getCheckedForSubMinorVersion", "setCheckedForSubMinorVersion", "dialogItemStatus", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "dialogItemSubTitles", "", "dialogItemTitles", "dismissCallback", "Lcom/razorpay/OpinionatedSoln$DismissCallback;", "checkEnvVariablesForProject", "", "activity", "Landroid/app/Activity;", "checkIfVersionUpdateExists", "version", "getBuildConfigValue", "context", "Landroid/content/Context;", "fieldName", "getUpdatedVersionNumber", "isMinor", "integrationStatusCheck", "sendCallbackIfExists", "showDialog", "DismissCallback", "HandleDialogShowPreference", "MyListAdapter", "checkout_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class OpinionatedSoln {
    private static boolean alertShownForStatus;
    private static boolean callbackSent;
    private static boolean checkedForSubMinorVersion;
    private static DismissCallback dismissCallback;
    public static final OpinionatedSoln INSTANCE = new OpinionatedSoln();
    private static final ArrayList<String> dialogItemTitles = new ArrayList<>();
    private static final ArrayList<String> dialogItemSubTitles = new ArrayList<>();
    private static final ArrayList<Boolean> dialogItemStatus = new ArrayList<>();

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&¨\u0006\u0004"}, d2 = {"Lcom/razorpay/OpinionatedSoln$DismissCallback;", "", "alertDismissed", "", "checkout_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
    public interface DismissCallback {
        void alertDismissed();
    }

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&¨\u0006\u0004"}, d2 = {"Lcom/razorpay/OpinionatedSoln$HandleDialogShowPreference;", "", "errorFound", "", "checkout_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
    public interface HandleDialogShowPreference {
        void errorFound();
    }

    private OpinionatedSoln() {
    }

    public final boolean getAlertShownForStatus() {
        return alertShownForStatus;
    }

    public final void setAlertShownForStatus(boolean z) {
        alertShownForStatus = z;
    }

    public final boolean getCheckedForSubMinorVersion() {
        return checkedForSubMinorVersion;
    }

    public final void setCheckedForSubMinorVersion(boolean z) {
        checkedForSubMinorVersion = z;
    }

    public final void integrationStatusCheck(Activity activity) {
        Intrinsics.checkNotNullParameter(activity, "activity");
        checkIfVersionUpdateExists(activity, getUpdatedVersionNumber(true));
    }

    public final void integrationStatusCheck(Activity activity, DismissCallback dismissCallback2) {
        Intrinsics.checkNotNullParameter(activity, "activity");
        Intrinsics.checkNotNullParameter(dismissCallback2, "dismissCallback");
        Activity activity2 = activity;
        g$_H$.a().a(activity2);
        CheckoutUtils.e(activity2);
        callbackSent = false;
        dismissCallback = dismissCallback2;
        checkIfVersionUpdateExists(activity, getUpdatedVersionNumber(true));
    }

    private final void checkEnvVariablesForProject(Activity activity) {
        dialogItemTitles.add("Min SDK Version Check");
        dialogItemSubTitles.add("Min SDK Version Compatible");
        dialogItemStatus.add(Boolean.TRUE);
        showDialog(activity);
    }

    private final String getUpdatedVersionNumber(boolean isMinor) {
        String str = (String) StringsKt.split$default(BuildConfig.VERSION_NAME, new String[]{"."}, false, 0, 6, (Object) null).get(0);
        String str2 = (String) StringsKt.split$default(BuildConfig.VERSION_NAME, new String[]{"."}, false, 0, 6, (Object) null).get(1);
        String str3 = (String) StringsKt.split$default(BuildConfig.VERSION_NAME, new String[]{"."}, false, 0, 6, (Object) null).get(2);
        if (isMinor) {
            return str + '.' + (Integer.parseInt(str2) + 1) + ".0";
        }
        return str + '.' + str2 + '.' + (Integer.parseInt(str3) + 1);
    }

    private final void checkIfVersionUpdateExists(final Activity activity, String version) {
        final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
        M$_3_.a("https://mvnrepository.com/artifact/com.razorpay/checkout/" + version, new Callback() {
            @Override
            public final void run(ResponseObject responseObject) {
                OpinionatedSoln.m346checkIfVersionUpdateExists$lambda0(booleanRef, activity, responseObject);
            }
        });
    }

    public static final void m346checkIfVersionUpdateExists$lambda0(Ref.BooleanRef booleanRef, Activity activity, ResponseObject responseObject) {
        Intrinsics.checkNotNullParameter(booleanRef, "$versionUpdateExists");
        Intrinsics.checkNotNullParameter(activity, "$activity");
        if (responseObject != null && responseObject.getResponseCode() == 200) {
            booleanRef.element = true;
            dialogItemTitles.add("Version Upgrade Check");
            dialogItemSubTitles.add("A version update was found. Click here to go to docs");
            dialogItemStatus.add(Boolean.FALSE);
            INSTANCE.checkEnvVariablesForProject(activity);
            return;
        }
        if (!checkedForSubMinorVersion) {
            checkedForSubMinorVersion = true;
            OpinionatedSoln opinionatedSoln = INSTANCE;
            opinionatedSoln.checkIfVersionUpdateExists(activity, opinionatedSoln.getUpdatedVersionNumber(false));
        } else {
            booleanRef.element = false;
            dialogItemTitles.add("Version Upgrade Check");
            dialogItemSubTitles.add("Running the latest version");
            dialogItemStatus.add(Boolean.TRUE);
            INSTANCE.checkEnvVariablesForProject(activity);
        }
    }

    public final void showDialog(final Activity activity) {
        Intrinsics.checkNotNullParameter(activity, "activity");
        Activity activity2 = activity;
        Object buildConfigValue = getBuildConfigValue(activity2, "DEBUG");
        if (buildConfigValue != null) {
            if (((Boolean) buildConfigValue).booleanValue() && !alertShownForStatus) {
                AlertDialog.Builder builder = new AlertDialog.Builder(activity2);
                View inflate = activity.getLayoutInflater().inflate(R.layout.sdk_integration_status, (ViewGroup) null);
                Intrinsics.checkNotNullExpressionValue(inflate, "activity.layoutInflater.…integration_status, null)");
                ListView listView = (ListView) inflate.findViewById(R.id.check_list);
                final ArrayList<String> arrayList = dialogItemTitles;
                final ArrayList<String> arrayList2 = dialogItemSubTitles;
                final ArrayList<Boolean> arrayList3 = dialogItemStatus;
                listView.setAdapter((ListAdapter) new ArrayAdapter<String>(activity, arrayList, arrayList2, arrayList3) {
                    private final Activity a;
                    private final ArrayList<String> b;
                    private final ArrayList<String> c;
                    private final ArrayList<Boolean> d;

                    {
                        super(activity, R.layout.single_item);
                        Intrinsics.checkNotNullParameter(activity, "context");
                        Intrinsics.checkNotNullParameter(arrayList, "itemTitles");
                        Intrinsics.checkNotNullParameter(arrayList2, "itemDescs");
                        Intrinsics.checkNotNullParameter(arrayList3, "status");
                        this.a = activity;
                        this.b = arrayList;
                        this.c = arrayList2;
                        this.d = arrayList3;
                    }

                    @Override
                    public final int getCount() {
                        return this.b.size();
                    }

                    @Override
                    public final View getView(int position, View view, ViewGroup parent) {
                        Intrinsics.checkNotNullParameter(parent, "parent");
                        LayoutInflater layoutInflater = this.a.getLayoutInflater();
                        Intrinsics.checkNotNullExpressionValue(layoutInflater, "context.layoutInflater");
                        View inflate2 = layoutInflater.inflate(R.layout.single_item, (ViewGroup) null, true);
                        View findViewById = inflate2.findViewById(R.id.tv_title);
                        Intrinsics.checkNotNull(findViewById, "null cannot be cast to non-null type android.widget.TextView");
                        View findViewById2 = inflate2.findViewById(R.id.iv_check_mark);
                        Intrinsics.checkNotNull(findViewById2, "null cannot be cast to non-null type android.widget.ImageView");
                        ImageView imageView = (ImageView) findViewById2;
                        View findViewById3 = inflate2.findViewById(R.id.tv_sub_item);
                        Intrinsics.checkNotNull(findViewById3, "null cannot be cast to non-null type android.widget.TextView");
                        TextView textView = (TextView) findViewById3;
                        ((TextView) findViewById).setText(this.b.get(position));
                        Boolean bool = this.d.get(position);
                        Intrinsics.checkNotNullExpressionValue(bool, "status[position]");
                        if (bool.booleanValue()) {
                            imageView.setImageResource(R.drawable.ic_tick_mark);
                        } else {
                            imageView.setImageResource(R.drawable.ic_alert);
                        }
                        textView.setText(this.c.get(position));
                        Intrinsics.checkNotNullExpressionValue(inflate2, "rowView");
                        return inflate2;
                    }
                });
                listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    @Override
                    public final void onItemClick(AdapterView adapterView, View view, int i, long j) {
                        OpinionatedSoln.m347showDialog$lambda1(activity, adapterView, view, i, j);
                    }
                });
                builder.setView(inflate);
                builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public final void onDismiss(DialogInterface dialogInterface) {
                        OpinionatedSoln.m348showDialog$lambda2(dialogInterface);
                    }
                });
                Iterator<Boolean> it = arrayList3.iterator();
                boolean z = true;
                while (it.hasNext()) {
                    if (!it.next().booleanValue()) {
                        z = false;
                    }
                }
                if (z) {
                    builder.setNegativeButton("Hide notification forever", new DialogInterface.OnClickListener() {
                        @Override
                        public final void onClick(DialogInterface dialogInterface, int i) {
                            OpinionatedSoln.m349showDialog$lambda3(activity, dialogInterface, i);
                        }
                    });
                }
                Boolean opinionatedSolnPreference = BaseConfig.getOpinionatedSolnPreference(activity2);
                Intrinsics.checkNotNullExpressionValue(opinionatedSolnPreference, "getOpinionatedSolnPreference(activity)");
                if (opinionatedSolnPreference.booleanValue() || !z) {
                    if (!z) {
                        BaseConfig.setOpinionatedSolnPreference(activity2, Boolean.TRUE);
                    }
                    final AlertDialog show = builder.show();
                    alertShownForStatus = true;
                    new CountDownTimer() {
                        @Override
                        public final void onTick(long millisUntilFinished) {
                        }

                        {
                            super(5000L, 1000L);
                        }

                        @Override
                        public final void onFinish() {
                            show.dismiss();
                            OpinionatedSoln.INSTANCE.sendCallbackIfExists();
                        }
                    }.start();
                    CheckoutUtils.a();
                    return;
                }
                HashMap hashMap = new HashMap();
                Iterator<String> it2 = dialogItemTitles.iterator();
                String str = "";
                while (it2.hasNext()) {
                    String next = it2.next();
                    Intrinsics.checkNotNullExpressionValue(next, "item");
                    ArrayList<String> arrayList4 = dialogItemSubTitles;
                    ArrayList<String> arrayList5 = dialogItemTitles;
                    String str2 = arrayList4.get(arrayList5.indexOf(next));
                    Intrinsics.checkNotNullExpressionValue(str2, "dialogItemSubTitles[dial…ItemTitles.indexOf(item)]");
                    hashMap.put(next, str2);
                    if (!dialogItemStatus.get(arrayList5.indexOf(next)).booleanValue()) {
                        str = "https://razorpay.com/docs/payments/payment-gateway/android-integration/standard";
                    }
                }
                Log.w("com.razorpay.checkout", "RAZORPAY_SDK: " + hashMap + '\n' + str);
                sendCallbackIfExists();
                CheckoutUtils.a();
                return;
            }
            CheckoutUtils.a();
            sendCallbackIfExists();
            return;
        }
        CheckoutUtils.a();
        sendCallbackIfExists();
    }

    public static final void m347showDialog$lambda1(Activity activity, AdapterView adapterView, View view, int i, long j) {
        Intrinsics.checkNotNullParameter(activity, "$activity");
        if (i == 0) {
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(Uri.parse("https://razorpay.com/docs/payments/payment-gateway/android-integration/standard/#list-of-razorpay-android-standard-sdk-versions-last"));
            activity.startActivity(intent);
        }
    }

    public static final void m348showDialog$lambda2(DialogInterface dialogInterface) {
        INSTANCE.sendCallbackIfExists();
    }

    public static final void m349showDialog$lambda3(Activity activity, DialogInterface dialogInterface, int i) {
        Intrinsics.checkNotNullParameter(activity, "$activity");
        Activity activity2 = activity;
        BaseConfig.setOpinionatedSolnPreference(activity2, Boolean.FALSE);
        Toast.makeText(activity2, "Status will be shown in logs. RAZORPAY_SDK", 1).show();
        INSTANCE.sendCallbackIfExists();
    }

    public final void sendCallbackIfExists() {
        DismissCallback dismissCallback2 = dismissCallback;
        if (dismissCallback2 == null || callbackSent) {
            return;
        }
        if (dismissCallback2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("dismissCallback");
            dismissCallback2 = null;
        }
        dismissCallback2.alertDismissed();
        callbackSent = true;
    }

    public final Object getBuildConfigValue(Context context, String fieldName) {
        Intrinsics.checkNotNullParameter(context, "context");
        try {
            Field field = fieldName != null ? Class.forName(context.getPackageName() + ".BuildConfig").getField(fieldName) : null;
            if (field != null) {
                return field.get(null);
            }
            return null;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return null;
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
            return null;
        } catch (NoSuchFieldException e3) {
            e3.printStackTrace();
            return null;
        }
    }
}