151 lines
5.6 KiB
Java
151 lines
5.6 KiB
Java
package io.fabric.sdk.android;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageManager;
|
|
import io.fabric.sdk.android.services.common.ApiKey;
|
|
import io.fabric.sdk.android.services.common.CommonUtils;
|
|
import io.fabric.sdk.android.services.common.DeliveryMechanism;
|
|
import io.fabric.sdk.android.services.network.DefaultHttpRequestFactory;
|
|
import io.fabric.sdk.android.services.network.HttpRequestFactory;
|
|
import io.fabric.sdk.android.services.settings.AppRequestData;
|
|
import io.fabric.sdk.android.services.settings.AppSettingsData;
|
|
import io.fabric.sdk.android.services.settings.CreateAppSpiCall;
|
|
import io.fabric.sdk.android.services.settings.IconRequest;
|
|
import io.fabric.sdk.android.services.settings.Settings;
|
|
import io.fabric.sdk.android.services.settings.SettingsData;
|
|
import io.fabric.sdk.android.services.settings.UpdateAppSpiCall;
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.concurrent.Future;
|
|
|
|
/* loaded from: classes2.dex */
|
|
class Onboarding extends Kit<Boolean> {
|
|
private final HttpRequestFactory g = new DefaultHttpRequestFactory();
|
|
private PackageManager h;
|
|
private String i;
|
|
private PackageInfo j;
|
|
private String k;
|
|
private String l;
|
|
private String m;
|
|
private String n;
|
|
private String o;
|
|
private final Future<Map<String, KitInfo>> p;
|
|
private final Collection<Kit> q;
|
|
|
|
public Onboarding(Future<Map<String, KitInfo>> future, Collection<Kit> collection) {
|
|
this.p = future;
|
|
this.q = collection;
|
|
}
|
|
|
|
private boolean b(String str, AppSettingsData appSettingsData, Collection<KitInfo> collection) {
|
|
return new CreateAppSpiCall(this, p(), appSettingsData.b, this.g).a(a(IconRequest.a(d(), str), collection));
|
|
}
|
|
|
|
private SettingsData q() {
|
|
try {
|
|
Settings d = Settings.d();
|
|
d.a(this, this.e, this.g, this.k, this.l, p());
|
|
d.b();
|
|
return Settings.d().a();
|
|
} catch (Exception e) {
|
|
Fabric.g().b("Fabric", "Error dealing with settings", e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
Map<String, KitInfo> a(Map<String, KitInfo> map, Collection<Kit> collection) {
|
|
for (Kit kit : collection) {
|
|
if (!map.containsKey(kit.g())) {
|
|
map.put(kit.g(), new KitInfo(kit.g(), kit.i(), "binary"));
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@Override // io.fabric.sdk.android.Kit
|
|
public String g() {
|
|
return "io.fabric.sdk.android:fabric";
|
|
}
|
|
|
|
@Override // io.fabric.sdk.android.Kit
|
|
public String i() {
|
|
return "1.3.17.dev";
|
|
}
|
|
|
|
@Override // io.fabric.sdk.android.Kit
|
|
protected boolean o() {
|
|
try {
|
|
this.m = f().g();
|
|
this.h = d().getPackageManager();
|
|
this.i = d().getPackageName();
|
|
this.j = this.h.getPackageInfo(this.i, 0);
|
|
this.k = Integer.toString(this.j.versionCode);
|
|
this.l = this.j.versionName == null ? "0.0" : this.j.versionName;
|
|
this.n = this.h.getApplicationLabel(d().getApplicationInfo()).toString();
|
|
this.o = Integer.toString(d().getApplicationInfo().targetSdkVersion);
|
|
return true;
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
Fabric.g().b("Fabric", "Failed init", e);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
String p() {
|
|
return CommonUtils.a(d(), "com.crashlytics.ApiEndpoint");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // io.fabric.sdk.android.Kit
|
|
public Boolean c() {
|
|
boolean a;
|
|
String a2 = CommonUtils.a(d());
|
|
SettingsData q = q();
|
|
if (q != null) {
|
|
try {
|
|
Map<String, KitInfo> hashMap = this.p != null ? this.p.get() : new HashMap<>();
|
|
a(hashMap, this.q);
|
|
a = a(a2, q.a, hashMap.values());
|
|
} catch (Exception e) {
|
|
Fabric.g().b("Fabric", "Error performing auto configuration.", e);
|
|
}
|
|
return Boolean.valueOf(a);
|
|
}
|
|
a = false;
|
|
return Boolean.valueOf(a);
|
|
}
|
|
|
|
private boolean a(String str, AppSettingsData appSettingsData, Collection<KitInfo> collection) {
|
|
if ("new".equals(appSettingsData.a)) {
|
|
if (b(str, appSettingsData, collection)) {
|
|
return Settings.d().c();
|
|
}
|
|
Fabric.g().b("Fabric", "Failed to create app with Crashlytics service.", null);
|
|
return false;
|
|
}
|
|
if ("configured".equals(appSettingsData.a)) {
|
|
return Settings.d().c();
|
|
}
|
|
if (appSettingsData.c) {
|
|
Fabric.g().d("Fabric", "Server says an update is required - forcing a full App update.");
|
|
c(str, appSettingsData, collection);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private boolean c(String str, AppSettingsData appSettingsData, Collection<KitInfo> collection) {
|
|
return a(appSettingsData, IconRequest.a(d(), str), collection);
|
|
}
|
|
|
|
private boolean a(AppSettingsData appSettingsData, IconRequest iconRequest, Collection<KitInfo> collection) {
|
|
return new UpdateAppSpiCall(this, p(), appSettingsData.b, this.g).a(a(iconRequest, collection));
|
|
}
|
|
|
|
private AppRequestData a(IconRequest iconRequest, Collection<KitInfo> collection) {
|
|
Context d = d();
|
|
return new AppRequestData(new ApiKey().c(d), f().d(), this.l, this.k, CommonUtils.a(CommonUtils.g(d)), this.n, DeliveryMechanism.determineFrom(this.m).getId(), this.o, "0", iconRequest, collection);
|
|
}
|
|
}
|