Warkop v5.73.0版本的 MD5 值为:a4330ec2d6f5e146f59fc7622f3cdb45
以下内容为反编译后的 ExponeaProjectFactory.java 源代码,内容仅作参考
package com.exponea.sdk.services;
import android.content.Context;
import android.os.Bundle;
import com.exponea.sdk.exceptions.InvalidConfigurationException;
import com.exponea.sdk.models.ExponeaConfiguration;
import com.exponea.sdk.models.ExponeaProject;
import com.exponea.sdk.util.Logger;
import kotlin.Metadata;
import kotlin.jvm.internal.p0;
import kotlin.text.v;
import org.jetbrains.annotations.NotNull;
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\t\b\u0010\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0007\u001a\u00020\u0006\u0012\u0006\u0010\u001b\u001a\u00020\u0002¢\u0006\u0004\b\u001c\u0010\u001dJ\u000e\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002J\u0019\u0010\u000b\u001a\u0004\u0018\u00010\b2\u0006\u0010\u0007\u001a\u00020\u0006H\u0000¢\u0006\u0004\b\t\u0010\nJ\u0019\u0010\u000f\u001a\u0004\u0018\u00010\f2\u0006\u0010\u0007\u001a\u00020\u0006H\u0010¢\u0006\u0004\b\r\u0010\u000eR\u0014\u0010\u0007\u001a\u00020\u00068\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0007\u0010\u0010R\u0016\u0010\u0011\u001a\u00020\u00028\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0011\u0010\u0012R\u0018\u0010\u0013\u001a\u0004\u0018\u00010\b8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0013\u0010\u0014R\u0011\u0010\u0018\u001a\u00020\u00158F¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0017R\u0011\u0010\u001a\u001a\u00020\u00158F¢\u0006\u0006\u001a\u0004\b\u0019\u0010\u0017¨\u0006\u001e"}, d2 = {"Lcom/exponea/sdk/services/ExponeaProjectFactory;", "", "Lcom/exponea/sdk/models/ExponeaConfiguration;", "newConfiguration", "Lco/g0;", "reset", "Landroid/content/Context;", "context", "Lcom/exponea/sdk/services/AuthorizationProvider;", "tryLoadAuthorizationProvider$sdk_release", "(Landroid/content/Context;)Lcom/exponea/sdk/services/AuthorizationProvider;", "tryLoadAuthorizationProvider", "", "readAuthorizationProviderName$sdk_release", "(Landroid/content/Context;)Ljava/lang/String;", "readAuthorizationProviderName", "Landroid/content/Context;", "configuration", "Lcom/exponea/sdk/models/ExponeaConfiguration;", "customAuthProvider", "Lcom/exponea/sdk/services/AuthorizationProvider;", "Lcom/exponea/sdk/models/ExponeaProject;", "getMainExponeaProject", "()Lcom/exponea/sdk/models/ExponeaProject;", "mainExponeaProject", "getMutualExponeaProject", "mutualExponeaProject", "exponeaConfiguration", "<init>", "(Landroid/content/Context;Lcom/exponea/sdk/models/ExponeaConfiguration;)V", "sdk_release"}, k = 1, mv = {1, 7, 1})
public class ExponeaProjectFactory {
@NotNull
private ExponeaConfiguration configuration;
@NotNull
private final Context context;
private AuthorizationProvider customAuthProvider;
public ExponeaProjectFactory(@NotNull Context context, @NotNull ExponeaConfiguration exponeaConfiguration) {
this.context = context;
this.configuration = exponeaConfiguration;
if (exponeaConfiguration.getAdvancedAuthEnabled()) {
AuthorizationProvider tryLoadAuthorizationProvider$sdk_release = tryLoadAuthorizationProvider$sdk_release(context);
this.customAuthProvider = tryLoadAuthorizationProvider$sdk_release;
if (tryLoadAuthorizationProvider$sdk_release == null) {
Logger.INSTANCE.e(this, "Advanced auth has been enabled but provider has not been found");
throw new InvalidConfigurationException("Customer token authorization provider is enabled but cannot be found.\nPlease check your configuration against https://github.com/exponea/exponea-android-sdk/blob/develop/Documentation/AUTHORIZATION.md");
}
}
}
@NotNull
public final ExponeaProject getMainExponeaProject() {
return new ExponeaProject(this.configuration.getBaseURL(), this.configuration.getProjectToken(), this.configuration.getAuthorization(), this.configuration.getInAppContentBlockPlaceholdersAutoLoad());
}
@NotNull
public final ExponeaProject getMutualExponeaProject() {
boolean I;
boolean V;
AuthorizationProvider authorizationProvider = this.customAuthProvider;
if (authorizationProvider == null) {
return getMainExponeaProject();
}
String authorizationToken = authorizationProvider.getAuthorizationToken();
if (authorizationToken != null) {
I = v.I(authorizationToken);
if (!I) {
ExponeaConfiguration.Companion companion = ExponeaConfiguration.INSTANCE;
V = v.V(authorizationToken, companion.getBEARER_AUTH_PREFIX(), false, 2, null);
if (!V) {
authorizationToken = companion.getBEARER_AUTH_PREFIX() + authorizationToken;
}
}
}
return new ExponeaProject(this.configuration.getBaseURL(), this.configuration.getProjectToken(), authorizationToken, this.configuration.getInAppContentBlockPlaceholdersAutoLoad());
}
public String readAuthorizationProviderName$sdk_release(@NotNull Context context) {
Bundle bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData;
if (bundle == null) {
return null;
}
return (String) bundle.get("ExponeaAuthProvider");
}
public final void reset(@NotNull ExponeaConfiguration exponeaConfiguration) {
this.configuration = exponeaConfiguration;
this.customAuthProvider = tryLoadAuthorizationProvider$sdk_release(this.context);
}
public final AuthorizationProvider tryLoadAuthorizationProvider$sdk_release(@NotNull Context context) {
String readAuthorizationProviderName$sdk_release = readAuthorizationProviderName$sdk_release(context);
if (readAuthorizationProviderName$sdk_release == null) {
Logger.INSTANCE.i(this, "CustomerID auth provider is not registered");
return null;
}
try {
Object newInstance = Class.forName(readAuthorizationProviderName$sdk_release).newInstance();
if (newInstance instanceof AuthorizationProvider) {
return (AuthorizationProvider) newInstance;
}
Logger.INSTANCE.e(this, "Registered " + readAuthorizationProviderName$sdk_release + " class has to implement" + p0.c(AuthorizationProvider.class).d());
throw new InvalidConfigurationException("Customer token authorization provider is registered but mismatches implementation requirements.\nPlease check your configuration against https://github.com/exponea/exponea-android-sdk/blob/develop/Documentation/AUTHORIZATION.md");
} catch (ClassNotFoundException e15) {
Logger.INSTANCE.e(this, "Registered " + readAuthorizationProviderName$sdk_release + " class has not been found", e15);
throw new InvalidConfigurationException("Customer token authorization provider is registered but cannot be found.\nPlease check your configuration against https://github.com/exponea/exponea-android-sdk/blob/develop/Documentation/AUTHORIZATION.md");
}
}
}