导航菜单

页面标题

页面副标题

Chaupal v3.2 - OpinionatedSoln.java 源代码

正在查看: Chaupal v3.2 应用的 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.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 java.util.Objects;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import org.jetbrains.annotations.NotNull;

@Metadata
public final class OpinionatedSoln {
    private static boolean alertShownForStatus;
    private static boolean callbackSent;
    private static boolean checkedForSubMinorVersion;
    private static DismissCallback dismissCallback;

    @NotNull
    public static final OpinionatedSoln INSTANCE = new OpinionatedSoln();

    @NotNull
    private static final ArrayList<String> dialogItemTitles = new ArrayList<>();

    @NotNull
    private static final ArrayList<String> dialogItemSubTitles = new ArrayList<>();

    @NotNull
    private static final ArrayList<Boolean> dialogItemStatus = new ArrayList<>();

    @Metadata
    public interface DismissCallback {
        void alertDismissed();
    }

    @Metadata
    public interface HandleDialogShowPreference {
        void errorFound();
    }

    private OpinionatedSoln() {
    }

    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 void checkIfVersionUpdateExists(final Activity activity, String str) {
        final Ref.BooleanRef booleanRef = new Ref.BooleanRef();
        e.a("https://mvnrepository.com/artifact/com.razorpay/checkout/" + str, new Callback() {
            @Override
            public final void run(ResponseObject responseObject) {
                OpinionatedSoln.m12checkIfVersionUpdateExists$lambda0(booleanRef, activity, responseObject);
            }
        });
    }

    public static final void m12checkIfVersionUpdateExists$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);
        }
    }

    private final String getUpdatedVersionNumber(boolean z) {
        String str = (String) kotlin.text.j.w0(BuildConfig.VERSION_NAME, new String[]{"."}, false, 0, 6, (Object) null).get(0);
        String str2 = (String) kotlin.text.j.w0(BuildConfig.VERSION_NAME, new String[]{"."}, false, 0, 6, (Object) null).get(1);
        String str3 = (String) kotlin.text.j.w0(BuildConfig.VERSION_NAME, new String[]{"."}, false, 0, 6, (Object) null).get(2);
        if (z) {
            return str + '.' + (Integer.parseInt(str2) + 1) + ".0";
        }
        return str + '.' + str2 + '.' + (Integer.parseInt(str3) + 1);
    }

    public static final void m13showDialog$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 m14showDialog$lambda2(DialogInterface dialogInterface) {
        INSTANCE.sendCallbackIfExists();
    }

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

    public final boolean getAlertShownForStatus() {
        return alertShownForStatus;
    }

    public final Object getBuildConfigValue(@NotNull Context context, String str) {
        Intrinsics.checkNotNullParameter(context, "context");
        try {
            Field field = str != null ? Class.forName(context.getPackageName() + ".BuildConfig").getField(str) : null;
            if (field != null) {
                return field.get(null);
            }
        } catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException unused) {
        }
        return null;
    }

    public final boolean getCheckedForSubMinorVersion() {
        return checkedForSubMinorVersion;
    }

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

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

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

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

    public final void showDialog(@NotNull final Activity activity) {
        Intrinsics.checkNotNullParameter(activity, "activity");
        Object buildConfigValue = getBuildConfigValue(activity, "DEBUG");
        if (buildConfigValue == null) {
            CheckoutUtils.a();
            sendCallbackIfExists();
            return;
        }
        if (!((Boolean) buildConfigValue).booleanValue() || alertShownForStatus) {
            CheckoutUtils.a();
            sendCallbackIfExists();
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        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) {

            @NotNull
            private final Activity a;

            @NotNull
            private final ArrayList<String> b;

            @NotNull
            private final ArrayList<String> c;

            @NotNull
            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
            @NotNull
            public final View getView(int i, View view, @NotNull ViewGroup viewGroup) {
                Intrinsics.checkNotNullParameter(viewGroup, "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);
                Objects.requireNonNull(findViewById, "null cannot be cast to non-null type android.widget.TextView");
                View findViewById2 = inflate2.findViewById(R.id.iv_check_mark);
                Objects.requireNonNull(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);
                Objects.requireNonNull(findViewById3, "null cannot be cast to non-null type android.widget.TextView");
                TextView textView = (TextView) findViewById3;
                ((TextView) findViewById).setText(this.b.get(i));
                Boolean bool = this.d.get(i);
                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(i));
                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.m13showDialog$lambda1(activity, adapterView, view, i, j);
            }
        });
        builder.setView(inflate);
        builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public final void onDismiss(DialogInterface dialogInterface) {
                OpinionatedSoln.m14showDialog$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.m15showDialog$lambda3(activity, dialogInterface, i);
                }
            });
        }
        Boolean opinionatedSolnPreference = BaseConfig.getOpinionatedSolnPreference(activity);
        Intrinsics.checkNotNullExpressionValue(opinionatedSolnPreference, "getOpinionatedSolnPreference(activity)");
        if (opinionatedSolnPreference.booleanValue() || !z) {
            if (!z) {
                BaseConfig.setOpinionatedSolnPreference(activity, Boolean.TRUE);
            }
            AlertDialog show = builder.show();
            alertShownForStatus = true;
            new CountDownTimerC0212a(show).start();
            CheckoutUtils.a();
            return;
        }
        HashMap hashMap = new HashMap();
        Iterator<String> it2 = dialogItemTitles.iterator();
        while (it2.hasNext()) {
            String next = it2.next();
            Intrinsics.checkNotNullExpressionValue(next, "item");
            ArrayList<String> arrayList4 = dialogItemSubTitles;
            ArrayList<String> arrayList5 = dialogItemTitles;
            String str = arrayList4.get(arrayList5.indexOf(next));
            Intrinsics.checkNotNullExpressionValue(str, "dialogItemSubTitles[dial…ItemTitles.indexOf(item)]");
            hashMap.put(next, str);
            dialogItemStatus.get(arrayList5.indexOf(next)).booleanValue();
        }
        hashMap.toString();
        sendCallbackIfExists();
        CheckoutUtils.a();
    }

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