导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - e.java 源代码

正在查看: Hopscotch v9.7.2 应用的 e.java JAVA 源代码文件

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


package com.clevertap.android.sdk.bitmap;

import com.clevertap.android.sdk.n1;
import com.clevertap.android.sdk.network.e;
import com.clevertap.android.sdk.y0;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.Map;
import kotlin.Pair;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;

public final class e {

    @NotNull
    private final k bitmapInputStreamReader;
    private HttpURLConnection connection;
    private long downloadStartTimeInMilliseconds;

    @NotNull
    private final i httpUrlConnectionParams;

    @NotNull
    private final Pair<Boolean, Integer> sizeConstrainedPair;
    private String srcUrl;

    public e(@NotNull i iVar, @NotNull k kVar, @NotNull Pair<Boolean, Integer> pair) {
        Intrinsics.checkNotNullParameter(iVar, "httpUrlConnectionParams");
        Intrinsics.checkNotNullParameter(kVar, "bitmapInputStreamReader");
        Intrinsics.checkNotNullParameter(pair, "sizeConstrainedPair");
        this.httpUrlConnectionParams = iVar;
        this.bitmapInputStreamReader = kVar;
        this.sizeConstrainedPair = pair;
    }

    public final HttpURLConnection a(URL url) {
        URLConnection openConnection = url.openConnection();
        Intrinsics.checkNotNull(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
        HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
        httpURLConnection.setConnectTimeout(this.httpUrlConnectionParams.a());
        httpURLConnection.setReadTimeout(this.httpUrlConnectionParams.c());
        httpURLConnection.setUseCaches(this.httpUrlConnectionParams.e());
        httpURLConnection.setDoInput(this.httpUrlConnectionParams.b());
        for (Map.Entry<String, String> entry : this.httpUrlConnectionParams.d().entrySet()) {
            httpURLConnection.addRequestProperty(entry.getKey(), entry.getValue());
        }
        return httpURLConnection;
    }

    @NotNull
    public final com.clevertap.android.sdk.network.e b(@NotNull String str) {
        Intrinsics.checkNotNullParameter(str, "srcUrl");
        y0.j("initiating bitmap download in BitmapDownloader....");
        this.srcUrl = str;
        boolean z = n1.a;
        this.downloadStartTimeInMilliseconds = System.currentTimeMillis();
        HttpURLConnection httpURLConnection = null;
        try {
            HttpURLConnection a = a(new URL(str));
            this.connection = a;
            a.connect();
            if (a.getResponseCode() != 200) {
                y0.a("File not loaded completely not going forward. URL was: " + str);
                com.clevertap.android.sdk.network.f fVar = com.clevertap.android.sdk.network.f.a;
                e.a aVar = e.a.DOWNLOAD_FAILED;
                fVar.getClass();
                com.clevertap.android.sdk.network.e a2 = com.clevertap.android.sdk.network.f.a(aVar);
                HttpURLConnection httpURLConnection2 = this.connection;
                if (httpURLConnection2 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("connection");
                } else {
                    httpURLConnection = httpURLConnection2;
                }
                httpURLConnection.disconnect();
                return a2;
            }
            y0.j("Downloading " + str + "....");
            int contentLength = a.getContentLength();
            Pair<Boolean, Integer> pair = this.sizeConstrainedPair;
            boolean booleanValue = ((Boolean) pair.a()).booleanValue();
            int intValue = ((Number) pair.b()).intValue();
            if (!booleanValue || contentLength <= intValue) {
                k kVar = this.bitmapInputStreamReader;
                InputStream inputStream = a.getInputStream();
                Intrinsics.checkNotNullExpressionValue(inputStream, "inputStream");
                com.clevertap.android.sdk.network.e a3 = kVar.a(inputStream, a, this.downloadStartTimeInMilliseconds);
                HttpURLConnection httpURLConnection3 = this.connection;
                if (httpURLConnection3 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("connection");
                } else {
                    httpURLConnection = httpURLConnection3;
                }
                httpURLConnection.disconnect();
                return a3;
            }
            y0.j("Image size is larger than " + intValue + " bytes. Cancelling download!");
            com.clevertap.android.sdk.network.f fVar2 = com.clevertap.android.sdk.network.f.a;
            e.a aVar2 = e.a.SIZE_LIMIT_EXCEEDED;
            fVar2.getClass();
            com.clevertap.android.sdk.network.e a4 = com.clevertap.android.sdk.network.f.a(aVar2);
            HttpURLConnection httpURLConnection4 = this.connection;
            if (httpURLConnection4 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("connection");
            } else {
                httpURLConnection = httpURLConnection4;
            }
            httpURLConnection.disconnect();
            return a4;
        } catch (Throwable th) {
            try {
                y0.j("Couldn't download the notification icon. URL was: " + str);
                th.printStackTrace();
                com.clevertap.android.sdk.network.f fVar3 = com.clevertap.android.sdk.network.f.a;
                e.a aVar3 = e.a.DOWNLOAD_FAILED;
                fVar3.getClass();
                return com.clevertap.android.sdk.network.f.a(aVar3);
            } finally {
                try {
                    HttpURLConnection httpURLConnection5 = this.connection;
                    if (httpURLConnection5 == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("connection");
                    } else {
                        httpURLConnection = httpURLConnection5;
                    }
                    httpURLConnection.disconnect();
                } catch (Throwable th2) {
                    y0.m("Couldn't close connection!", th2);
                }
            }
        }
    }

    public e(i iVar, k kVar, Pair pair, int i, DefaultConstructorMarker defaultConstructorMarker) {
        this(iVar, kVar, (i & 4) != 0 ? new Pair(Boolean.FALSE, 0) : pair);
    }
}