导航菜单

页面标题

页面副标题

Moneyman v2.316.0.0 - ExponeaProjectFactory.java 源代码

正在查看: Moneyman v2.316.0.0 应用的 ExponeaProjectFactory.java JAVA 源代码文件

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


package com.exponea.sdk.services;

import B.AbstractC0151g;
import Eh.A;
import Eh.y;
import android.content.Context;
import android.content.pm.ApplicationInfo;
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.services.inappcontentblock.ContentBlockCarouselViewController;
import com.exponea.sdk.util.Logger;
import kotlin.Metadata;
import kotlin.jvm.internal.i;
import kotlin.jvm.internal.l;

@Metadata(d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0010\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0006\u0010\u0007J\u0015\u0010\n\u001a\u00020\t2\u0006\u0010\b\u001a\u00020\u0004¢\u0006\u0004\b\n\u0010\u000bJ\u0019\u0010\u000f\u001a\u0004\u0018\u00010\f2\u0006\u0010\u0003\u001a\u00020\u0002H\u0000¢\u0006\u0004\b\r\u0010\u000eJ\u0019\u0010\u0013\u001a\u0004\u0018\u00010\u00102\u0006\u0010\u0003\u001a\u00020\u0002H\u0010¢\u0006\u0004\b\u0011\u0010\u0012R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0003\u0010\u0014R\u0016\u0010\u0015\u001a\u00020\u00048\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u0015\u0010\u0016R\u0018\u0010\u0017\u001a\u0004\u0018\u00010\f8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0017\u0010\u0018R\u0011\u0010\u001c\u001a\u00020\u00198F¢\u0006\u0006\u001a\u0004\b\u001a\u0010\u001bR\u0011\u0010\u001e\u001a\u00020\u00198F¢\u0006\u0006\u001a\u0004\b\u001d\u0010\u001b¨\u0006\u001f"}, d2 = {"Lcom/exponea/sdk/services/ExponeaProjectFactory;", ContentBlockCarouselViewController.EMPTY_PLACEHOLDER_ID, "Landroid/content/Context;", "context", "Lcom/exponea/sdk/models/ExponeaConfiguration;", "exponeaConfiguration", "<init>", "(Landroid/content/Context;Lcom/exponea/sdk/models/ExponeaConfiguration;)V", "newConfiguration", "LVf/A;", "reset", "(Lcom/exponea/sdk/models/ExponeaConfiguration;)V", "Lcom/exponea/sdk/services/AuthorizationProvider;", "tryLoadAuthorizationProvider$sdk_release", "(Landroid/content/Context;)Lcom/exponea/sdk/services/AuthorizationProvider;", "tryLoadAuthorizationProvider", ContentBlockCarouselViewController.EMPTY_PLACEHOLDER_ID, "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", "sdk_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public class ExponeaProjectFactory {
    private ExponeaConfiguration configuration;
    private final Context context;
    private AuthorizationProvider customAuthProvider;

    public ExponeaProjectFactory(Context context, ExponeaConfiguration exponeaConfiguration) {
        i.g(context, "context");
        i.g(exponeaConfiguration, "exponeaConfiguration");
        this.context = context;
        reset(exponeaConfiguration);
    }

    public final ExponeaProject getMainExponeaProject() {
        ExponeaConfiguration exponeaConfiguration = this.configuration;
        if (exponeaConfiguration == null) {
            i.o("configuration");
            throw null;
        }
        String baseURL = exponeaConfiguration.getBaseURL();
        ExponeaConfiguration exponeaConfiguration2 = this.configuration;
        if (exponeaConfiguration2 == null) {
            i.o("configuration");
            throw null;
        }
        String projectToken = exponeaConfiguration2.getProjectToken();
        ExponeaConfiguration exponeaConfiguration3 = this.configuration;
        if (exponeaConfiguration3 == null) {
            i.o("configuration");
            throw null;
        }
        String authorization = exponeaConfiguration3.getAuthorization();
        ExponeaConfiguration exponeaConfiguration4 = this.configuration;
        if (exponeaConfiguration4 != null) {
            return new ExponeaProject(baseURL, projectToken, authorization, exponeaConfiguration4.getInAppContentBlockPlaceholdersAutoLoad());
        }
        i.o("configuration");
        throw null;
    }

    public final ExponeaProject getMutualExponeaProject() {
        AuthorizationProvider authorizationProvider = this.customAuthProvider;
        if (authorizationProvider == null) {
            return getMainExponeaProject();
        }
        String authorizationToken = authorizationProvider.getAuthorizationToken();
        if (authorizationToken != null && (!A.F(authorizationToken))) {
            ExponeaConfiguration.Companion companion = ExponeaConfiguration.INSTANCE;
            if (!y.v(authorizationToken, companion.getBEARER_AUTH_PREFIX(), false)) {
                authorizationToken = AbstractC0151g.D(companion.getBEARER_AUTH_PREFIX(), authorizationToken);
            }
        }
        ExponeaConfiguration exponeaConfiguration = this.configuration;
        if (exponeaConfiguration == null) {
            i.o("configuration");
            throw null;
        }
        String baseURL = exponeaConfiguration.getBaseURL();
        ExponeaConfiguration exponeaConfiguration2 = this.configuration;
        if (exponeaConfiguration2 == null) {
            i.o("configuration");
            throw null;
        }
        String projectToken = exponeaConfiguration2.getProjectToken();
        ExponeaConfiguration exponeaConfiguration3 = this.configuration;
        if (exponeaConfiguration3 != null) {
            return new ExponeaProject(baseURL, projectToken, authorizationToken, exponeaConfiguration3.getInAppContentBlockPlaceholdersAutoLoad());
        }
        i.o("configuration");
        throw null;
    }

    public String readAuthorizationProviderName$sdk_release(Context context) {
        i.g(context, "context");
        ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128);
        i.f(applicationInfo, "getApplicationInfo(...)");
        Bundle bundle = applicationInfo.metaData;
        if (bundle == null) {
            return null;
        }
        return (String) bundle.get("ExponeaAuthProvider");
    }

    public final void reset(ExponeaConfiguration newConfiguration) {
        i.g(newConfiguration, "newConfiguration");
        this.configuration = newConfiguration;
        if (newConfiguration.getAdvancedAuthEnabled()) {
            AuthorizationProvider tryLoadAuthorizationProvider$sdk_release = tryLoadAuthorizationProvider$sdk_release(this.context);
            this.customAuthProvider = tryLoadAuthorizationProvider$sdk_release;
            if (tryLoadAuthorizationProvider$sdk_release != null) {
                return;
            }
            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/main/Documentation/AUTHORIZATION.md");
        }
    }

    public final AuthorizationProvider tryLoadAuthorizationProvider$sdk_release(Context context) {
        i.g(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, AbstractC0151g.n("Registered ", readAuthorizationProviderName$sdk_release, " class has to implement", l.a.b(AuthorizationProvider.class).c()));
            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/main/Documentation/AUTHORIZATION.md");
        } catch (ClassNotFoundException e4) {
            Logger.INSTANCE.e(this, Z.l.p("Registered ", readAuthorizationProviderName$sdk_release, " class has not been found"), e4);
            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/main/Documentation/AUTHORIZATION.md");
        }
    }
}