Warkop v5.73.0版本的 MD5 值为:a4330ec2d6f5e146f59fc7622f3cdb45
以下内容为反编译后的 VersionChecker.java 源代码,内容仅作参考
package com.exponea.sdk.util;
import android.content.Context;
import com.exponea.sdk.BuildConfig;
import com.exponea.sdk.network.NetworkHandler;
import com.exponea.sdk.util.VersionChecker;
import com.google.firebase.perf.network.FirebasePerfOkHttpClient;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.u0;
import kotlin.text.w;
import ns.d0;
import ns.e;
import ns.e0;
import ns.f;
import org.jetbrains.annotations.NotNull;
import sinet.startup.inDriver.core.data.data.ReasonData;
import wo.p;
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\b\u0000\u0018\u00002\u00020\u0001:\u0001\u0013B\u0017\u0012\u0006\u0010\n\u001a\u00020\t\u0012\u0006\u0010\r\u001a\u00020\f¢\u0006\u0004\b\u0011\u0010\u0012J\u0018\u0010\u0006\u001a\u00020\u00052\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0004\u001a\u00020\u0002H\u0002J\u0006\u0010\b\u001a\u00020\u0007R\u0014\u0010\n\u001a\u00020\t8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\n\u0010\u000bR\u0014\u0010\r\u001a\u00020\f8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\r\u0010\u000eR\u0014\u0010\u000f\u001a\u00020\u00028\u0002X\u0082D¢\u0006\u0006\n\u0004\b\u000f\u0010\u0010¨\u0006\u0014"}, d2 = {"Lcom/exponea/sdk/util/VersionChecker;", "", "", "version1", "version2", "", "compareVersions", "Lco/g0;", "warnIfNotLatestSDKVersion", "Lcom/exponea/sdk/network/NetworkHandler;", "networkManager", "Lcom/exponea/sdk/network/NetworkHandler;", "Landroid/content/Context;", "context", "Landroid/content/Context;", "baseUrl", "Ljava/lang/String;", "<init>", "(Lcom/exponea/sdk/network/NetworkHandler;Landroid/content/Context;)V", "GitHubReleaseResponse", "sdk_release"}, k = 1, mv = {1, 7, 1})
public final class VersionChecker {
@NotNull
private final String baseUrl = "https://api.github.com/repos/exponea/%s/releases/latest";
@NotNull
private final Context context;
@NotNull
private final NetworkHandler networkManager;
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\b\u0082\b\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\t\u0010\u0007\u001a\u00020\u0003HÆ\u0003J\u0013\u0010\b\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u0003HÆ\u0001J\u0013\u0010\t\u001a\u00020\n2\b\u0010\u000b\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\f\u001a\u00020\rHÖ\u0001J\t\u0010\u000e\u001a\u00020\u0003HÖ\u0001R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u000f"}, d2 = {"Lcom/exponea/sdk/util/VersionChecker$GitHubReleaseResponse;", "", "tag_name", "", "(Ljava/lang/String;)V", "getTag_name", "()Ljava/lang/String;", "component1", "copy", "equals", "", ReasonData.TYPE_OTHER, "hashCode", "", "toString", "sdk_release"}, k = 1, mv = {1, 7, 1}, xi = 48)
public static final class GitHubReleaseResponse {
@NotNull
private final String tag_name;
public GitHubReleaseResponse(@NotNull String str) {
this.tag_name = str;
}
public static GitHubReleaseResponse copy$default(GitHubReleaseResponse gitHubReleaseResponse, String str, int i15, Object obj) {
if ((i15 & 1) != 0) {
str = gitHubReleaseResponse.tag_name;
}
return gitHubReleaseResponse.copy(str);
}
@NotNull
public final String getTag_name() {
return this.tag_name;
}
@NotNull
public final GitHubReleaseResponse copy(@NotNull String tag_name) {
return new GitHubReleaseResponse(tag_name);
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
return (other instanceof GitHubReleaseResponse) && Intrinsics.g(this.tag_name, ((GitHubReleaseResponse) other).tag_name);
}
@NotNull
public final String getTag_name() {
return this.tag_name;
}
public int hashCode() {
return this.tag_name.hashCode();
}
@NotNull
public String toString() {
return "GitHubReleaseResponse(tag_name=" + this.tag_name + ')';
}
}
public VersionChecker(@NotNull NetworkHandler networkHandler, @NotNull Context context) {
this.networkManager = networkHandler;
this.context = context;
}
public final int compareVersions(String version1, String version2) {
List T0;
List T02;
int e15;
int i15;
int i16;
T0 = w.T0(version1, new String[]{"."}, false, 0, 6, null);
String[] strArr = (String[]) T0.toArray(new String[0]);
T02 = w.T0(version2, new String[]{"."}, false, 0, 6, null);
String[] strArr2 = (String[]) T02.toArray(new String[0]);
e15 = p.e(strArr.length, strArr2.length);
for (int i17 = 0; i17 < e15; i17++) {
if (i17 < strArr.length) {
i15 = Integer.parseInt(strArr[i17]);
} else {
i15 = 0;
}
if (i17 < strArr2.length) {
i16 = Integer.parseInt(strArr2[i17]);
} else {
i16 = 0;
}
int h15 = Intrinsics.h(i15, i16);
if (h15 != 0) {
return h15;
}
}
return 0;
}
public final void warnIfNotLatestSDKVersion() {
final String str;
final String str2;
if (ExtensionsKt.isReactNativeSDK(this.context)) {
str = ExtensionsKt.getReactNativeSDKVersion(this.context);
str2 = "exponea-react-native-sdk";
} else if (ExtensionsKt.isFlutterSDK(this.context)) {
str = ExtensionsKt.getFlutterSDKVersion(this.context);
str2 = "exponea-flutter-sdk";
} else if (ExtensionsKt.isXamarinSDK(this.context)) {
str = ExtensionsKt.getXamarinSDKVersion(this.context);
str2 = "exponea-xamarin-sdk";
} else if (ExtensionsKt.isMauiSDK(this.context)) {
str = ExtensionsKt.getMauiSDKVersion(this.context);
str2 = "bloomreach-maui-sdk";
} else {
str = BuildConfig.EXPONEA_VERSION_NAME;
str2 = "exponea-android-sdk";
}
u0 u0Var = u0.f85785a;
String format = String.format(this.baseUrl, Arrays.copyOf(new Object[]{str2}, 1));
if (str != null) {
FirebasePerfOkHttpClient.enqueue(NetworkHandler.DefaultImpls.get$default(this.networkManager, format, null, 2, null), new f() {
@Override
public void onFailure(@NotNull e eVar, @NotNull IOException iOException) {
String localizedMessage = iOException.getLocalizedMessage();
if (localizedMessage == null) {
localizedMessage = "Unknown error";
}
Logger.INSTANCE.e(this, "Failed to retrieve last Exponea SDK version: " + localizedMessage);
}
@Override
public void onResponse(@NotNull e eVar, @NotNull d0 d0Var) {
String str3;
int compareVersions;
try {
try {
if (d0Var.isSuccessful()) {
Gson companion = ExponeaGson.INSTANCE.getInstance();
e0 body = d0Var.getBody();
if (body != null) {
str3 = body.s2();
} else {
str3 = null;
}
String tag_name = ((VersionChecker.GitHubReleaseResponse) companion.m(str3, VersionChecker.GitHubReleaseResponse.class)).getTag_name();
compareVersions = VersionChecker.this.compareVersions(tag_name, str);
if (compareVersions > 0) {
Logger.INSTANCE.e("EXPONEA", "####\n#### A newer version of the Exponea SDK is available!\n#### Your version: " + str + " Last version: " + tag_name + "\n#### Upgrade to the latest version to benefit from the new features and better stability:\n#### https://github.com/exponea/" + str2 + "/releases\n####");
}
}
} catch (Exception e15) {
String localizedMessage = e15.getLocalizedMessage();
if (localizedMessage == null) {
localizedMessage = "Unknown error";
}
Logger.INSTANCE.e(this, "Failed to retrieve last Exponea SDK version: " + localizedMessage);
}
d0Var.close();
} catch (Throwable th4) {
d0Var.close();
throw th4;
}
}
});
}
}
}