正在查看: Hopscotch v9.7.2 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hopscotch v9.7.2 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.hopscotch.android.remote.config;
import android.content.Context;
import android.os.Build;
import com.chuckerteam.chucker.api.b;
import in.hopscotch.android.common.util.t;
import in.hopscotch.android.common.util.u;
import in.hopscotch.android.core.model.OrderAttributionData;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
import java.util.UUID;
import kotlin.collections.CollectionsKt;
import kotlin.collections.h0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import kotlin.text.r;
import okhttp3.Headers;
import org.jetbrains.annotations.NotNull;
@SourceDebugExtension({"SMAP\nApiConfigProvider.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ApiConfigProvider.kt\nin/hopscotch/android/remote/config/ApiConfigProvider\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 3 ArraysJVM.kt\nkotlin/collections/ArraysKt__ArraysJVMKt\n*L\n1#1,232:1\n731#2,9:233\n37#3,2:242\n*S KotlinDebug\n*F\n+ 1 ApiConfigProvider.kt\nin/hopscotch/android/remote/config/ApiConfigProvider\n*L\n156#1:233,9\n156#1:242,2\n*E\n"})
public final class b {
@NotNull
private static final String HEADER_DEEP_LINK_KEY = "deeplink";
@NotNull
private static final String HEADER_UTM_CAMPAIGN_KEY = "utm-campaign";
@NotNull
private static final String HEADER_UTM_CONTENT_KEY = "utm-content";
@NotNull
private static final String HEADER_UTM_GENDER_KEY = "utm-gender";
@NotNull
private static final String HEADER_UTM_MEDIUM_KEY = "utm-medium";
@NotNull
private static final String HEADER_UTM_PRODUCT_KEY = "utm-product";
@NotNull
private static final String HEADER_UTM_PROMO_KEY = "utm-promo";
@NotNull
private static final String HEADER_UTM_SECTION_KEY = "utm-section";
@NotNull
private static final String HEADER_UTM_SOURCE_KEY = "utm-source";
@NotNull
private static final String HEADER_UTM_TERM_KEY = "utm-term";
public in.hopscotch.android.core.util.d a;
@NotNull
private final c apiHeaders;
private final in.hopscotch.android.core.store.a apiPreferencesDB;
@NotNull
private final in.hopscotch.android.core.providers.b buildTypeProvider;
@NotNull
private final Context context;
@NotNull
private final in.hopscotch.android.remote.cookies.a cookiesAddInterceptor;
@NotNull
private final in.hopscotch.android.remote.cookies.c cookiesReceiverInterceptor;
private final in.hopscotch.android.core.repository.a orderAttributionDataRepository;
private final in.hopscotch.android.core.repository.b utmHeadersRepository;
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
static {
new a(null);
}
public b(@NotNull Context context, @NotNull c apiHeaders, in.hopscotch.android.core.store.a aVar, in.hopscotch.android.core.repository.b bVar, in.hopscotch.android.core.repository.a aVar2, @NotNull in.hopscotch.android.remote.cookies.a cookiesAddInterceptor, @NotNull in.hopscotch.android.remote.cookies.c cookiesReceiverInterceptor, @NotNull in.hopscotch.android.core.providers.b buildTypeProvider) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(apiHeaders, "apiHeaders");
Intrinsics.checkNotNullParameter(cookiesAddInterceptor, "cookiesAddInterceptor");
Intrinsics.checkNotNullParameter(cookiesReceiverInterceptor, "cookiesReceiverInterceptor");
Intrinsics.checkNotNullParameter(buildTypeProvider, "buildTypeProvider");
this.context = context;
this.apiHeaders = apiHeaders;
this.apiPreferencesDB = aVar;
this.utmHeadersRepository = bVar;
this.orderAttributionDataRepository = aVar2;
this.cookiesAddInterceptor = cookiesAddInterceptor;
this.cookiesReceiverInterceptor = cookiesReceiverInterceptor;
this.buildTypeProvider = buildTypeProvider;
}
public final void a(Headers.Builder builder, String str, String str2) {
if (str2 != null) {
try {
if (t.a(str2)) {
builder.set(str, str2);
}
} catch (Exception e) {
in.hopscotch.android.core.util.d dVar = this.a;
if (dVar == null) {
Intrinsics.throwUninitializedPropertyAccessException("logger");
dVar = null;
}
dVar.d(e);
}
}
}
@NotNull
public final com.chuckerteam.chucker.api.b b() {
Context context = this.context;
com.chuckerteam.chucker.api.a collector = new com.chuckerteam.chucker.api.a(context, true, com.chuckerteam.chucker.api.c.ONE_HOUR);
b.a aVar = new b.a(context);
Intrinsics.checkNotNullParameter(collector, "collector");
return new com.chuckerteam.chucker.api.b(aVar, (DefaultConstructorMarker) null);
}
@NotNull
public final in.hopscotch.android.remote.cookies.a c() {
return this.cookiesAddInterceptor;
}
@NotNull
public final in.hopscotch.android.remote.cookies.c d() {
return this.cookiesReceiverInterceptor;
}
@NotNull
public final String e() {
in.hopscotch.android.core.store.a aVar;
this.apiHeaders.getClass();
if (!this.buildTypeProvider.b() || (aVar = this.apiPreferencesDB) == null || !t.a(aVar.a())) {
return "https://www.hopscotch.in/api";
}
this.apiHeaders.getClass();
return androidx.privacysandbox.ads.adservices.java.internal.a.o("https://", aVar.a());
}
@NotNull
public final Headers f() {
boolean z;
OrderAttributionData attributionData;
Collection collection;
Headers.Builder builder = new Headers.Builder();
in.hopscotch.android.core.util.d dVar = null;
if (this.apiHeaders != null) {
a(builder, "client-id", "android-client/9.7.2");
this.apiHeaders.getClass();
a(builder, "client-auth-method", "v1");
a(builder, "secret-key", this.apiHeaders.h());
this.apiHeaders.getClass();
a(builder, "api-version", "v2.0");
a(builder, "device-id", this.apiHeaders.b());
a(builder, "install-id", this.apiHeaders.d());
this.apiHeaders.getClass();
a(builder, "os", "android_" + Build.VERSION.RELEASE);
this.apiHeaders.getClass();
a(builder, "appBuild", String.valueOf(2025072909));
this.apiHeaders.getClass();
a(builder, "appVersion", "9.7.2");
a(builder, "Accept", this.apiHeaders.a());
try {
a(builder, "device-type", this.apiHeaders.b());
} catch (Exception e) {
in.hopscotch.android.core.util.d dVar2 = this.a;
if (dVar2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("logger");
dVar2 = null;
}
dVar2.d(e);
}
this.apiHeaders.getClass();
a(builder, "User-Agent", System.getProperty("http.agent"));
a(builder, "device-profile", this.apiHeaders.c());
this.apiHeaders.getClass();
String uuid = UUID.randomUUID().toString();
Intrinsics.checkNotNullExpressionValue(uuid, "toString(...)");
a(builder, "X-Request-ID", uuid);
}
in.hopscotch.android.core.store.a aVar = this.apiPreferencesDB;
String b = aVar != null ? aVar.b() : null;
if (b != null && t.a(b)) {
builder.set("hs-persistent-ticket", b);
}
String str = "";
if (this.utmHeadersRepository != null) {
in.hopscotch.android.core.store.a aVar2 = this.apiPreferencesDB;
String str2 = (aVar2 == null || aVar2.c()) ? "" : "last-";
Ref.ObjectRef objectRef = new Ref.ObjectRef();
?? h = this.utmHeadersRepository.h();
objectRef.element = h;
if (h != 0) {
try {
List e2 = new Regex("//").e(h);
if (!e2.isEmpty()) {
ListIterator listIterator = e2.listIterator(e2.size());
while (listIterator.hasPrevious()) {
if (((String) listIterator.previous()).length() != 0) {
collection = CollectionsKt.T(e2, listIterator.nextIndex() + 1);
break;
}
}
}
collection = h0.a;
objectRef.element = ((String[]) collection.toArray(new String[0]))[1];
} catch (Exception e3) {
in.hopscotch.android.core.util.d dVar3 = this.a;
if (dVar3 != null) {
dVar = dVar3;
} else {
Intrinsics.throwUninitializedPropertyAccessException("logger");
}
dVar.d(e3);
}
}
a(builder, str2.concat(HEADER_UTM_SOURCE_KEY), this.utmHeadersRepository.j());
a(builder, str2.concat(HEADER_UTM_MEDIUM_KEY), this.utmHeadersRepository.i());
a(builder, str2.concat(HEADER_UTM_CAMPAIGN_KEY), this.utmHeadersRepository.f());
a(builder, str2.concat(HEADER_UTM_SECTION_KEY), this.utmHeadersRepository.d());
a(builder, str2.concat(HEADER_UTM_CONTENT_KEY), this.utmHeadersRepository.b());
a(builder, str2.concat(HEADER_DEEP_LINK_KEY), (String) objectRef.element);
a(builder, str2.concat(HEADER_UTM_PROMO_KEY), this.utmHeadersRepository.e());
a(builder, str2.concat(HEADER_UTM_PRODUCT_KEY), this.utmHeadersRepository.a());
a(builder, str2.concat(HEADER_UTM_TERM_KEY), this.utmHeadersRepository.g());
a(builder, str2.concat(HEADER_UTM_GENDER_KEY), this.utmHeadersRepository.c());
}
in.hopscotch.android.core.repository.a aVar3 = this.orderAttributionDataRepository;
if (aVar3 != null && (attributionData = aVar3.getAttributionData()) != null) {
a(builder, "funnel", attributionData.getFunnel());
a(builder, "funnel-section", attributionData.getFunnelSection());
a(builder, "section", attributionData.getSection());
a(builder, "gender", attributionData.getSortBar());
a(builder, "age-group", attributionData.getSortBarGroup());
a(builder, "funnel-tile", attributionData.getFunnelTile());
u.a aVar4 = u.a;
List subsections = attributionData.getSubsections();
aVar4.getClass();
if (!r.i("~") && subsections != null) {
str = CollectionsKt.G(subsections, "~", null, null, null, 62);
}
a(builder, "sub-section", str);
}
if (StringsKt.E(e(), "qa.", false)) {
a(builder, "x-nv", "true");
a(builder, "x-nv-security-magic", this.apiHeaders.e());
}
e.a.getClass();
z = e.isN7HumanDetectorFeatureEnabled;
if (z) {
a(builder, "x-nv-hd-hl-key", this.apiHeaders.f());
a(builder, "x-nv-security-key", this.apiHeaders.g());
String str3 = e.hdToken;
if (str3 != null) {
a(builder, "x-nv-hd-token", str3);
}
}
return builder.build();
}
}