导航菜单

页面标题

页面副标题

Oolka v2.4.42 - PicassoExtsKt.java 源代码

正在查看: Oolka v2.4.42 应用的 PicassoExtsKt.java JAVA 源代码文件

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


package co.hyperverge.hyperkyc.utils.extensions;

import android.app.Application;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import android.widget.ImageView;
import co.hyperverge.hyperkyc.R;
import co.hyperverge.hyperkyc.core.hv.AnalyticsLogger;
import co.hyperverge.hyperkyc.ui.WebViewFragment;
import co.hyperverge.hyperkyc.ui.custom.RoundCornerPicassoTransform;
import co.hyperverge.hyperlogger.HyperLogger;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.b0;
import com.squareup.picasso.x;
import java.util.regex.Matcher;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.ArraysKt;
import kotlin.coroutines.Continuation;
import kotlin.g;
import kotlin.h;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.StringsKt;

@Metadata
@SourceDebugExtension({"SMAP\nPicassoExts.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PicassoExts.kt\nco/hyperverge/hyperkyc/utils/extensions/PicassoExtsKt\n+ 2 LogExts.kt\nco/hyperverge/hyperkyc/utils/extensions/LogExtsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,90:1\n14#2:91\n28#2,10:92\n62#2,12:102\n40#2,12:115\n62#2,12:127\n52#2:139\n50#2,6:140\n14#2:146\n28#2,10:147\n62#2,12:157\n40#2,12:170\n62#2,12:182\n52#2:194\n50#2,6:195\n14#2:201\n28#2,10:202\n62#2,12:212\n40#2,12:225\n62#2,12:237\n52#2:249\n50#2,6:250\n14#2:256\n28#2,10:257\n62#2,12:267\n40#2,12:280\n62#2,12:292\n52#2:304\n50#2,6:305\n1#3:114\n1#3:169\n1#3:224\n1#3:279\n*S KotlinDebug\n*F\n+ 1 PicassoExts.kt\nco/hyperverge/hyperkyc/utils/extensions/PicassoExtsKt\n*L\n21#1:91\n21#1:92,10\n21#1:102,12\n21#1:115,12\n21#1:127,12\n21#1:139\n21#1:140,6\n49#1:146\n49#1:147,10\n49#1:157,12\n49#1:170,12\n49#1:182,12\n49#1:194\n49#1:195,6\n59#1:201\n59#1:202,10\n59#1:212,12\n59#1:225,12\n59#1:237,12\n59#1:249\n59#1:250,6\n84#1:256\n84#1:257,10\n84#1:267,12\n84#1:280,12\n84#1:292,12\n84#1:304\n84#1:305,6\n21#1:114\n49#1:169\n59#1:224\n84#1:279\n*E\n"})
public final class PicassoExtsKt {
    private static final String getCountryFlagUrl(String str) {
        return "https://hv-camera-web-sg.s3.ap-southeast-1.amazonaws.com/images/flags/" + str + ".png";
    }

    public static final Object getFlagBitmap(String str, Continuation continuation) {
        String canonicalName;
        Object b;
        String canonicalName2;
        String className;
        String className2;
        final kotlin.coroutines.g gVar = new kotlin.coroutines.g(kotlin.coroutines.intrinsics.b.c(continuation));
        HyperLogger.Level level = HyperLogger.Level.DEBUG;
        HyperLogger companion = HyperLogger.Companion.getInstance();
        StringBuilder sb = new StringBuilder();
        StackTraceElement[] stackTrace = new Throwable().getStackTrace();
        Intrinsics.checkNotNullExpressionValue(stackTrace, "Throwable().stackTrace");
        StackTraceElement stackTraceElement = (StackTraceElement) ArraysKt.firstOrNull(stackTrace);
        if ((stackTraceElement == null || (className2 = stackTraceElement.getClassName()) == null || (canonicalName = StringsKt.substringAfterLast$default(className2, '.', (String) null, 2, (Object) null)) == null) && (canonicalName = gVar.getClass().getCanonicalName()) == null) {
            canonicalName = "N/A";
        }
        Matcher matcher = LogExtsKt.ANON_CLASS_PATTERN.matcher(canonicalName);
        if (matcher.find()) {
            canonicalName = matcher.replaceAll("");
            Intrinsics.checkNotNullExpressionValue(canonicalName, "replaceAll(\"\")");
        }
        if (canonicalName.length() > 23 && Build.VERSION.SDK_INT < 26) {
            canonicalName = canonicalName.substring(0, 23);
            Intrinsics.checkNotNullExpressionValue(canonicalName, "this as java.lang.String…ing(startIndex, endIndex)");
        }
        sb.append(canonicalName);
        sb.append(" - ");
        String str2 = "getFlagBitmap() called with: countryId = " + str;
        if (str2 == null) {
            str2 = "null ";
        }
        sb.append(str2);
        sb.append(' ');
        sb.append("");
        companion.log(level, sb.toString());
        if (!CoreExtsKt.isRelease()) {
            try {
                g.a aVar = kotlin.g.b;
                Object invoke = Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", new Class[0]).invoke(null, new Object[0]);
                Intrinsics.checkNotNull(invoke, "null cannot be cast to non-null type android.app.Application");
                b = kotlin.g.b(((Application) invoke).getPackageName());
            } catch (Throwable th) {
                g.a aVar2 = kotlin.g.b;
                b = kotlin.g.b(h.a(th));
            }
            if (kotlin.g.f(b)) {
                b = "";
            }
            String str3 = (String) b;
            if (CoreExtsKt.isDebug()) {
                Intrinsics.checkNotNullExpressionValue(str3, "packageName");
                if (StringsKt.contains$default(str3, "co.hyperverge", false, 2, (Object) null)) {
                    StackTraceElement[] stackTrace2 = new Throwable().getStackTrace();
                    Intrinsics.checkNotNullExpressionValue(stackTrace2, "Throwable().stackTrace");
                    StackTraceElement stackTraceElement2 = (StackTraceElement) ArraysKt.firstOrNull(stackTrace2);
                    String str4 = ((stackTraceElement2 == null || (className = stackTraceElement2.getClassName()) == null || (canonicalName2 = StringsKt.substringAfterLast$default(className, '.', (String) null, 2, (Object) null)) == null) && (canonicalName2 = gVar.getClass().getCanonicalName()) == null) ? "N/A" : canonicalName2;
                    Matcher matcher2 = LogExtsKt.ANON_CLASS_PATTERN.matcher(str4);
                    if (matcher2.find()) {
                        str4 = matcher2.replaceAll("");
                        Intrinsics.checkNotNullExpressionValue(str4, "replaceAll(\"\")");
                    }
                    if (str4.length() > 23 && Build.VERSION.SDK_INT < 26) {
                        str4 = str4.substring(0, 23);
                        Intrinsics.checkNotNullExpressionValue(str4, "this as java.lang.String…ing(startIndex, endIndex)");
                    }
                    StringBuilder sb2 = new StringBuilder();
                    String str5 = "getFlagBitmap() called with: countryId = " + str;
                    if (str5 == null) {
                        str5 = "null ";
                    }
                    sb2.append(str5);
                    sb2.append(' ');
                    sb2.append("");
                    Log.println(3, str4, sb2.toString());
                }
            }
        }
        Picasso.get().j(getCountryFlagUrl(str)).o(75, 75).q(new RoundCornerPicassoTransform(24.0f)).e(R.drawable.hs_ic_baseline_outlined_flag_24).b().m(new b0() {
            public void onBitmapFailed(Exception exc, Drawable drawable) {
                Unit unit;
                if (exc != null) {
                    Continuation<Bitmap> continuation2 = gVar;
                    g.a aVar3 = kotlin.g.b;
                    continuation2.resumeWith(kotlin.g.b(h.a(exc)));
                    unit = Unit.a;
                } else {
                    unit = null;
                }
                if (unit == null) {
                    Continuation<Bitmap> continuation3 = gVar;
                    g.a aVar4 = kotlin.g.b;
                    continuation3.resumeWith(kotlin.g.b(h.a(new IllegalStateException("flag bitmap load failed"))));
                }
            }

            public void onBitmapLoaded(Bitmap bitmap, Picasso.e eVar) {
                Unit unit;
                if (bitmap != null) {
                    gVar.resumeWith(kotlin.g.b(bitmap));
                    unit = Unit.a;
                } else {
                    unit = null;
                }
                if (unit == null) {
                    Continuation<Bitmap> continuation2 = gVar;
                    g.a aVar3 = kotlin.g.b;
                    continuation2.resumeWith(kotlin.g.b(h.a(new IllegalStateException("flag bitmap is null"))));
                }
            }

            public void onPrepareLoad(Drawable drawable) {
            }
        });
        Object a = gVar.a();
        if (a == kotlin.coroutines.intrinsics.b.d()) {
            kotlin.coroutines.jvm.internal.h.c(continuation);
        }
        return a;
    }

    public static final void load(ImageView imageView, final Uri uri, final Function1 function1) {
        String canonicalName;
        Object b;
        String canonicalName2;
        String className;
        String className2;
        Intrinsics.checkNotNullParameter(imageView, "<this>");
        Intrinsics.checkNotNullParameter(uri, "uri");
        Intrinsics.checkNotNullParameter(function1, "onComplete");
        HyperLogger.Level level = HyperLogger.Level.DEBUG;
        HyperLogger companion = HyperLogger.Companion.getInstance();
        StringBuilder sb = new StringBuilder();
        StackTraceElement[] stackTrace = new Throwable().getStackTrace();
        Intrinsics.checkNotNullExpressionValue(stackTrace, "Throwable().stackTrace");
        StackTraceElement stackTraceElement = (StackTraceElement) ArraysKt.firstOrNull(stackTrace);
        if ((stackTraceElement == null || (className2 = stackTraceElement.getClassName()) == null || (canonicalName = StringsKt.substringAfterLast$default(className2, '.', (String) null, 2, (Object) null)) == null) && (canonicalName = imageView.getClass().getCanonicalName()) == null) {
            canonicalName = "N/A";
        }
        Matcher matcher = LogExtsKt.ANON_CLASS_PATTERN.matcher(canonicalName);
        if (matcher.find()) {
            canonicalName = matcher.replaceAll("");
            Intrinsics.checkNotNullExpressionValue(canonicalName, "replaceAll(\"\")");
        }
        if (canonicalName.length() > 23 && Build.VERSION.SDK_INT < 26) {
            canonicalName = canonicalName.substring(0, 23);
            Intrinsics.checkNotNullExpressionValue(canonicalName, "this as java.lang.String…ing(startIndex, endIndex)");
        }
        sb.append(canonicalName);
        sb.append(" - ");
        String str = imageView + ".load() called with: uri = " + uri + ", onComplete = " + function1;
        if (str == null) {
            str = "null ";
        }
        sb.append(str);
        sb.append(' ');
        sb.append("");
        companion.log(level, sb.toString());
        if (!CoreExtsKt.isRelease()) {
            try {
                g.a aVar = kotlin.g.b;
                Object invoke = Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", new Class[0]).invoke(null, new Object[0]);
                Intrinsics.checkNotNull(invoke, "null cannot be cast to non-null type android.app.Application");
                b = kotlin.g.b(((Application) invoke).getPackageName());
            } catch (Throwable th) {
                g.a aVar2 = kotlin.g.b;
                b = kotlin.g.b(h.a(th));
            }
            if (kotlin.g.f(b)) {
                b = "";
            }
            String str2 = (String) b;
            if (CoreExtsKt.isDebug()) {
                Intrinsics.checkNotNullExpressionValue(str2, "packageName");
                if (StringsKt.contains$default(str2, "co.hyperverge", false, 2, (Object) null)) {
                    StackTraceElement[] stackTrace2 = new Throwable().getStackTrace();
                    Intrinsics.checkNotNullExpressionValue(stackTrace2, "Throwable().stackTrace");
                    StackTraceElement stackTraceElement2 = (StackTraceElement) ArraysKt.firstOrNull(stackTrace2);
                    String str3 = ((stackTraceElement2 == null || (className = stackTraceElement2.getClassName()) == null || (canonicalName2 = StringsKt.substringAfterLast$default(className, '.', (String) null, 2, (Object) null)) == null) && (canonicalName2 = imageView.getClass().getCanonicalName()) == null) ? "N/A" : canonicalName2;
                    Matcher matcher2 = LogExtsKt.ANON_CLASS_PATTERN.matcher(str3);
                    if (matcher2.find()) {
                        str3 = matcher2.replaceAll("");
                        Intrinsics.checkNotNullExpressionValue(str3, "replaceAll(\"\")");
                    }
                    if (str3.length() > 23 && Build.VERSION.SDK_INT < 26) {
                        str3 = str3.substring(0, 23);
                        Intrinsics.checkNotNullExpressionValue(str3, "this as java.lang.String…ing(startIndex, endIndex)");
                    }
                    StringBuilder sb2 = new StringBuilder();
                    String str4 = imageView + ".load() called with: uri = " + uri + ", onComplete = " + function1;
                    if (str4 == null) {
                        str4 = "null ";
                    }
                    sb2.append(str4);
                    sb2.append(' ');
                    sb2.append("");
                    Log.println(3, str3, sb2.toString());
                }
            }
        }
        x i = Picasso.get().i(uri);
        if (imageView.getScaleType() == ImageView.ScaleType.CENTER_CROP) {
            i.h();
            i.a();
        }
        i.p(uri.toString()).l(imageView, new Callback() {
            public void onError(Exception exc) {
                Function1<Exception, Unit> function12 = function1;
                if (exc == null) {
                    exc = new Exception("error loading image - " + uri);
                }
                function12.invoke(exc);
            }

            public void onSuccess() {
                function1.invoke((Object) null);
            }
        });
    }

    public static void load$default(ImageView imageView, Uri uri, Function1 function1, int i, Object obj) {
        if ((i & 2) != 0) {
            function1 = new Function1<Exception, Unit>() {
                public final void invoke(Exception exc) {
                }

                public Object invoke(Object obj2) {
                    invoke((Exception) obj2);
                    return Unit.a;
                }
            };
        }
        load(imageView, uri, function1);
    }

    public static final void loadFlag(ImageView imageView, String str, float f, float f2) {
        String canonicalName;
        Object b;
        String canonicalName2;
        String className;
        String className2;
        Intrinsics.checkNotNullParameter(imageView, "<this>");
        Intrinsics.checkNotNullParameter(str, AnalyticsLogger.Keys.COUNTRY_ID);
        HyperLogger.Level level = HyperLogger.Level.DEBUG;
        HyperLogger companion = HyperLogger.Companion.getInstance();
        StringBuilder sb = new StringBuilder();
        StackTraceElement[] stackTrace = new Throwable().getStackTrace();
        Intrinsics.checkNotNullExpressionValue(stackTrace, "Throwable().stackTrace");
        StackTraceElement stackTraceElement = (StackTraceElement) ArraysKt.firstOrNull(stackTrace);
        if ((stackTraceElement == null || (className2 = stackTraceElement.getClassName()) == null || (canonicalName = StringsKt.substringAfterLast$default(className2, '.', (String) null, 2, (Object) null)) == null) && (canonicalName = imageView.getClass().getCanonicalName()) == null) {
            canonicalName = "N/A";
        }
        Matcher matcher = LogExtsKt.ANON_CLASS_PATTERN.matcher(canonicalName);
        if (matcher.find()) {
            canonicalName = matcher.replaceAll("");
            Intrinsics.checkNotNullExpressionValue(canonicalName, "replaceAll(\"\")");
        }
        if (canonicalName.length() > 23 && Build.VERSION.SDK_INT < 26) {
            canonicalName = canonicalName.substring(0, 23);
            Intrinsics.checkNotNullExpressionValue(canonicalName, "this as java.lang.String…ing(startIndex, endIndex)");
        }
        sb.append(canonicalName);
        sb.append(" - ");
        String str2 = imageView + ".loadFlag() called with: countryId = " + str + ", width = " + f + ", height = " + f2;
        if (str2 == null) {
            str2 = "null ";
        }
        sb.append(str2);
        sb.append(' ');
        sb.append("");
        companion.log(level, sb.toString());
        if (!CoreExtsKt.isRelease()) {
            try {
                g.a aVar = kotlin.g.b;
                Object invoke = Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", new Class[0]).invoke(null, new Object[0]);
                Intrinsics.checkNotNull(invoke, "null cannot be cast to non-null type android.app.Application");
                b = kotlin.g.b(((Application) invoke).getPackageName());
            } catch (Throwable th) {
                g.a aVar2 = kotlin.g.b;
                b = kotlin.g.b(h.a(th));
            }
            if (kotlin.g.f(b)) {
                b = "";
            }
            String str3 = (String) b;
            if (CoreExtsKt.isDebug()) {
                Intrinsics.checkNotNullExpressionValue(str3, "packageName");
                if (StringsKt.contains$default(str3, "co.hyperverge", false, 2, (Object) null)) {
                    StackTraceElement[] stackTrace2 = new Throwable().getStackTrace();
                    Intrinsics.checkNotNullExpressionValue(stackTrace2, "Throwable().stackTrace");
                    StackTraceElement stackTraceElement2 = (StackTraceElement) ArraysKt.firstOrNull(stackTrace2);
                    String str4 = ((stackTraceElement2 == null || (className = stackTraceElement2.getClassName()) == null || (canonicalName2 = StringsKt.substringAfterLast$default(className, '.', (String) null, 2, (Object) null)) == null) && (canonicalName2 = imageView.getClass().getCanonicalName()) == null) ? "N/A" : canonicalName2;
                    Matcher matcher2 = LogExtsKt.ANON_CLASS_PATTERN.matcher(str4);
                    if (matcher2.find()) {
                        str4 = matcher2.replaceAll("");
                        Intrinsics.checkNotNullExpressionValue(str4, "replaceAll(\"\")");
                    }
                    if (str4.length() > 23 && Build.VERSION.SDK_INT < 26) {
                        str4 = str4.substring(0, 23);
                        Intrinsics.checkNotNullExpressionValue(str4, "this as java.lang.String…ing(startIndex, endIndex)");
                    }
                    StringBuilder sb2 = new StringBuilder();
                    String str5 = imageView + ".loadFlag() called with: countryId = " + str + ", width = " + f + ", height = " + f2;
                    if (str5 == null) {
                        str5 = "null ";
                    }
                    sb2.append(str5);
                    sb2.append(' ');
                    sb2.append("");
                    Log.println(3, str4, sb2.toString());
                }
            }
        }
        x j = Picasso.get().j(getCountryFlagUrl(str));
        Context context = imageView.getContext();
        Intrinsics.checkNotNullExpressionValue(context, "context");
        int dpToPx = UIExtsKt.dpToPx(context, f);
        Context context2 = imageView.getContext();
        Intrinsics.checkNotNullExpressionValue(context2, "context");
        x o = j.o(dpToPx, UIExtsKt.dpToPx(context2, f2));
        Intrinsics.checkNotNullExpressionValue(imageView.getContext(), "context");
        o.q(new RoundCornerPicassoTransform(UIExtsKt.dpToPx(r3, 5.0f))).e(R.drawable.hs_ic_baseline_outlined_flag_24).a().k(imageView);
    }

    public static void loadFlag$default(ImageView imageView, String str, float f, float f2, int i, Object obj) {
        if ((i & 2) != 0) {
            f = 36.0f;
        }
        if ((i & 4) != 0) {
            f2 = 24.0f;
        }
        loadFlag(imageView, str, f, f2);
    }

    public static final void load(ImageView imageView, String str) {
        String canonicalName;
        Object b;
        String canonicalName2;
        String className;
        String className2;
        Intrinsics.checkNotNullParameter(imageView, "<this>");
        Intrinsics.checkNotNullParameter(str, WebViewFragment.ARG_URL);
        HyperLogger.Level level = HyperLogger.Level.DEBUG;
        HyperLogger companion = HyperLogger.Companion.getInstance();
        StringBuilder sb = new StringBuilder();
        StackTraceElement[] stackTrace = new Throwable().getStackTrace();
        Intrinsics.checkNotNullExpressionValue(stackTrace, "Throwable().stackTrace");
        StackTraceElement stackTraceElement = (StackTraceElement) ArraysKt.firstOrNull(stackTrace);
        if ((stackTraceElement == null || (className2 = stackTraceElement.getClassName()) == null || (canonicalName = StringsKt.substringAfterLast$default(className2, '.', (String) null, 2, (Object) null)) == null) && (canonicalName = imageView.getClass().getCanonicalName()) == null) {
            canonicalName = "N/A";
        }
        Matcher matcher = LogExtsKt.ANON_CLASS_PATTERN.matcher(canonicalName);
        if (matcher.find()) {
            canonicalName = matcher.replaceAll("");
            Intrinsics.checkNotNullExpressionValue(canonicalName, "replaceAll(\"\")");
        }
        if (canonicalName.length() > 23 && Build.VERSION.SDK_INT < 26) {
            canonicalName = canonicalName.substring(0, 23);
            Intrinsics.checkNotNullExpressionValue(canonicalName, "this as java.lang.String…ing(startIndex, endIndex)");
        }
        sb.append(canonicalName);
        sb.append(" - ");
        String str2 = imageView + ".load() called with: url = " + str;
        if (str2 == null) {
            str2 = "null ";
        }
        sb.append(str2);
        sb.append(' ');
        sb.append("");
        companion.log(level, sb.toString());
        if (!CoreExtsKt.isRelease()) {
            try {
                g.a aVar = kotlin.g.b;
                Object invoke = Class.forName("android.app.AppGlobals").getMethod("getInitialApplication", new Class[0]).invoke(null, new Object[0]);
                Intrinsics.checkNotNull(invoke, "null cannot be cast to non-null type android.app.Application");
                b = kotlin.g.b(((Application) invoke).getPackageName());
            } catch (Throwable th) {
                g.a aVar2 = kotlin.g.b;
                b = kotlin.g.b(h.a(th));
            }
            if (kotlin.g.f(b)) {
                b = "";
            }
            String str3 = (String) b;
            if (CoreExtsKt.isDebug()) {
                Intrinsics.checkNotNullExpressionValue(str3, "packageName");
                if (StringsKt.contains$default(str3, "co.hyperverge", false, 2, (Object) null)) {
                    StackTraceElement[] stackTrace2 = new Throwable().getStackTrace();
                    Intrinsics.checkNotNullExpressionValue(stackTrace2, "Throwable().stackTrace");
                    StackTraceElement stackTraceElement2 = (StackTraceElement) ArraysKt.firstOrNull(stackTrace2);
                    String str4 = ((stackTraceElement2 == null || (className = stackTraceElement2.getClassName()) == null || (canonicalName2 = StringsKt.substringAfterLast$default(className, '.', (String) null, 2, (Object) null)) == null) && (canonicalName2 = imageView.getClass().getCanonicalName()) == null) ? "N/A" : canonicalName2;
                    Matcher matcher2 = LogExtsKt.ANON_CLASS_PATTERN.matcher(str4);
                    if (matcher2.find()) {
                        str4 = matcher2.replaceAll("");
                        Intrinsics.checkNotNullExpressionValue(str4, "replaceAll(\"\")");
                    }
                    if (str4.length() > 23 && Build.VERSION.SDK_INT < 26) {
                        str4 = str4.substring(0, 23);
                        Intrinsics.checkNotNullExpressionValue(str4, "this as java.lang.String…ing(startIndex, endIndex)");
                    }
                    StringBuilder sb2 = new StringBuilder();
                    String str5 = imageView + ".load() called with: url = " + str;
                    if (str5 == null) {
                        str5 = "null ";
                    }
                    sb2.append(str5);
                    sb2.append(' ');
                    sb2.append("");
                    Log.println(3, str4, sb2.toString());
                }
            }
        }
        Picasso.get().j(str).k(imageView);
    }
}