导航菜单

页面标题

页面副标题

Barstool v5.21.2 - SpotIm.java 源代码

正在查看: Barstool v5.21.2 应用的 SpotIm.java JAVA 源代码文件

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


package spotIm.sdk;

import android.content.Context;
import android.content.Intent;
import androidx.fragment.app.Fragment;
import java.util.List;
import java.util.Map;
import kotlin.Deprecated;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.HttpUrl;
import spotIm.common.SPViewActionsCallbacks;
import spotIm.common.SpotButtonOnlyMode;
import spotIm.common.SpotCallback;
import spotIm.common.SpotException;
import spotIm.common.SpotLayoutListener;
import spotIm.common.SpotSSOStartLoginFlowMode;
import spotIm.common.SpotVoidCallback;
import spotIm.common.UserStatus;
import spotIm.common.ads.SPGoogleAdsProvider;
import spotIm.common.analytics.AnalyticsEventDelegate;
import spotIm.common.configuration.AdditionalConfiguration;
import spotIm.common.customui.CustomUIDelegate;
import spotIm.common.gif.SpotGiphyProvider;
import spotIm.common.login.LoginDelegate;
import spotIm.common.model.ConversationCounters;
import spotIm.common.model.SsoWithJwtResponse;
import spotIm.common.model.StartSSOResponse;
import spotIm.common.model.UserStatusResponse;
import spotIm.common.options.ConversationOptions;
import spotIm.core.SpotImSdkManager;
import spotIm.core.android.configuration.AdditionalConfigurationImpl;
import spotIm.core.data.remote.model.responses.SpotImResponse;
import spotIm.core.domain.model.config.Config;

@Metadata(d1 = {"\u0000Ä\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0010$\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0003\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001c\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\f0\u000eJ\b\u0010\u000f\u001a\u00020\u0010H\u0002J\b\u0010\u0011\u001a\u00020\u0012H\u0007J4\u0010\u0013\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\f2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000eJ>\u0010\u0013\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\f2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ.\u0010\u001c\u001a\u00020\n2\f\u0010\u001d\u001a\b\u0012\u0004\u0012\u00020\f0\u001e2\u0018\u0010\r\u001a\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u00020 0\u001f0\u000eJ\u001c\u0010!\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000eJ.\u0010!\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ$\u0010#\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000eJ.\u0010#\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ,\u0010#\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000eJ6\u0010#\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ$\u0010$\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000eJ.\u0010$\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ,\u0010$\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000eJ6\u0010$\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\u00190\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ\u0006\u0010%\u001a\u00020\u0004J\u0006\u0010&\u001a\u00020\u0004J\u001c\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000eJ&\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ&\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010(\u001a\u0004\u0018\u00010)J0\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010(\u001a\u0004\u0018\u00010)2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ$\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000eJ.\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ.\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010(\u001a\u0004\u0018\u00010)J8\u0010'\u001a\u00020\n2\u0006\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0018\u001a\u00020\u00102\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020\"0\u000e2\b\u0010(\u001a\u0004\u0018\u00010)2\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bJ\u0006\u0010*\u001a\u00020+J\u0014\u0010,\u001a\u00020\n2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020-0\u000eJ\u0016\u0010.\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010/\u001a\u00020\fJ \u0010.\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010/\u001a\u00020\f2\b\u0010\r\u001a\u0004\u0018\u000100J\u000e\u00101\u001a\u00020\n2\u0006\u0010\r\u001a\u000200J\u0014\u00102\u001a\u00020\n2\f\u00103\u001a\b\u0012\u0004\u0012\u0002040\u001eJ\u000e\u00105\u001a\u00020\n2\u0006\u00106\u001a\u000207J\u0010\u00108\u001a\u00020\n2\u0006\u00109\u001a\u00020\u0012H\u0007J\u001a\u0010:\u001a\u00020\n2\u0012\u0010;\u001a\u000e\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u00020\f0\u001fJ\u000e\u0010<\u001a\u00020\n2\u0006\u0010=\u001a\u00020>J\u000e\u0010?\u001a\u00020\n2\u0006\u0010@\u001a\u00020\u0004J\u000e\u0010A\u001a\u00020\n2\u0006\u0010@\u001a\u00020\u0004J\u000e\u0010B\u001a\u00020\n2\u0006\u0010C\u001a\u00020DJ\u0010\u0010E\u001a\u00020\n2\b\u0010F\u001a\u0004\u0018\u00010GJ\u000e\u0010H\u001a\u00020\n2\u0006\u0010I\u001a\u00020JJ\u000e\u0010K\u001a\u00020\n2\u0006\u00109\u001a\u00020+J\u000e\u0010L\u001a\u00020\n2\u0006\u0010M\u001a\u00020\u0004J\u001e\u0010N\u001a\u00020\n2\b\u0010O\u001a\u0004\u0018\u00010\f2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020P0\u000eJ\u0014\u0010Q\u001a\u00020\n2\f\u0010\r\u001a\b\u0012\u0004\u0012\u00020R0\u000eJ\u0010\u0010S\u001a\u00020T2\u0006\u0010U\u001a\u00020VH\u0002R\u001a\u0010\u0003\u001a\u00020\u0004X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\b¨\u0006W"}, d2 = {"LspotIm/sdk/SpotIm;", HttpUrl.FRAGMENT_ENCODE_SET, "()V", "reInit", HttpUrl.FRAGMENT_ENCODE_SET, "getReInit", "()Z", "setReInit", "(Z)V", "completeSSO", HttpUrl.FRAGMENT_ENCODE_SET, "codeB", HttpUrl.FRAGMENT_ENCODE_SET, "callback", "LspotIm/common/SpotCallback;", "createDefaultOptions", "LspotIm/common/options/ConversationOptions;", "getButtonOnlyMode", "LspotIm/common/SpotButtonOnlyMode;", "getCommentThreadIntent", "context", "Landroid/content/Context;", "threadCommentId", "conversationId", "conversationOptions", "Landroid/content/Intent;", "viewActionsCallbacks", "LspotIm/common/SPViewActionsCallbacks;", "getConversationCounters", "conversationIds", HttpUrl.FRAGMENT_ENCODE_SET, HttpUrl.FRAGMENT_ENCODE_SET, "LspotIm/common/model/ConversationCounters;", "getConversationFragment", "Landroidx/fragment/app/Fragment;", "getConversationIntent", "getCreateCommentIntent", "getEnableCreateCommentNewDesign", "getEnableLandscape", "getPreConversationFragment", "layoutListener", "LspotIm/common/SpotLayoutListener;", "getSsoStartLoginFlowMode", "LspotIm/common/SpotSSOStartLoginFlowMode;", "getUserLoginStatus", "LspotIm/common/UserStatus;", "init", "spotId", "LspotIm/common/SpotVoidCallback;", "logout", "setAdditionalConfigurations", "configurations", "LspotIm/common/configuration/AdditionalConfiguration;", "setAnalyticsEventDelegate", "delegate", "LspotIm/common/analytics/AnalyticsEventDelegate;", "setButtonOnlyMode", "mode", "setCustomBIData", "dataMap", "setCustomUIDelegate", "customUIDelegate", "LspotIm/common/customui/CustomUIDelegate;", "setEnableCreateCommentNewDesign", "isEnable", "setEnableLandscape", "setGiphyProvider", "giphyProvider", "LspotIm/common/gif/SpotGiphyProvider;", "setGoogleAdsProvider", "provider", "LspotIm/common/ads/SPGoogleAdsProvider;", "setLoginDelegate", "loginDelegate", "LspotIm/common/login/LoginDelegate;", "setSsoStartLoginFlowMode", "setUseWhiteNavigationColor", "useWhiteNavigationColor", "ssoWithJwt", "jwt", "LspotIm/common/model/SsoWithJwtResponse;", "startSSO", "LspotIm/common/model/StartSSOResponse;", "toSpotException", "LspotIm/common/SpotException;", "error", HttpUrl.FRAGMENT_ENCODE_SET, "spotim-sdk_betaSDKRelease"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class SpotIm {
    public static final SpotIm INSTANCE = new SpotIm();
    private static boolean reInit;

    private SpotIm() {
    }

    public final boolean getReInit() {
        return reInit;
    }

    public final void setReInit(boolean z) {
        reInit = z;
    }

    public final synchronized void init(Context context, String spotId) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(spotId, "spotId");
        init(context, spotId, null);
    }

    public final synchronized void init(Context context, String spotId, final SpotVoidCallback callback) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(spotId, "spotId");
        SpotImSdkManager.INSTANCE.getInstance().init(context, spotId, reInit, new Function1<SpotImResponse<Config>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Config>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Config> spotImResponse) {
                SpotException spotException;
                SpotException spotException2;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                SpotVoidCallback spotVoidCallback = SpotVoidCallback.this;
                if (spotVoidCallback != null) {
                    try {
                        if (spotImResponse instanceof SpotImResponse.Success) {
                            spotVoidCallback.onSuccess();
                        } else if (spotImResponse instanceof SpotImResponse.Error) {
                            spotException2 = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                            spotVoidCallback.onFailure(spotException2);
                        }
                    } catch (Exception e) {
                        SpotVoidCallback spotVoidCallback2 = SpotVoidCallback.this;
                        spotException = SpotIm.INSTANCE.toSpotException(e);
                        spotVoidCallback2.onFailure(spotException);
                    }
                }
            }
        });
        reInit = false;
    }

    public final void startSSO(final SpotCallback<StartSSOResponse> callback) {
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().startSSO(HttpUrl.FRAGMENT_ENCODE_SET, new Function1<SpotImResponse<StartSSOResponse>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<StartSSOResponse>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<StartSSOResponse> spotImResponse) {
                SpotException spotException;
                SpotException spotException2;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                try {
                    if (spotImResponse instanceof SpotImResponse.Success) {
                        callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                    } else if (spotImResponse instanceof SpotImResponse.Error) {
                        SpotCallback<StartSSOResponse> spotCallback = callback;
                        spotException2 = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                        spotCallback.onFailure(spotException2);
                    }
                } catch (Exception e) {
                    SpotCallback<StartSSOResponse> spotCallback2 = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(e);
                    spotCallback2.onFailure(spotException);
                }
            }
        });
    }

    public final void ssoWithJwt(String jwt, final SpotCallback<SsoWithJwtResponse> callback) {
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().startSSO(jwt, new Function1<SpotImResponse<StartSSOResponse>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<StartSSOResponse>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<StartSSOResponse> spotImResponse) {
                SpotException spotException;
                SpotException spotException2;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                try {
                    if (spotImResponse instanceof SpotImResponse.Success) {
                        callback.onSuccess(new SsoWithJwtResponse(((StartSSOResponse) ((SpotImResponse.Success) spotImResponse).getData()).getAutoComplete()));
                    } else if (spotImResponse instanceof SpotImResponse.Error) {
                        SpotCallback<SsoWithJwtResponse> spotCallback = callback;
                        spotException2 = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                        spotCallback.onFailure(spotException2);
                    }
                } catch (Exception e) {
                    SpotCallback<SsoWithJwtResponse> spotCallback2 = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(e);
                    spotCallback2.onFailure(spotException);
                }
            }
        });
    }

    public final void completeSSO(String codeB, final SpotCallback<String> callback) {
        Intrinsics.checkNotNullParameter(codeB, "codeB");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().completeSSO(codeB, new Function1<SpotImResponse<String>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<String>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<String> spotImResponse) {
                SpotException spotException;
                SpotException spotException2;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                try {
                    if (spotImResponse instanceof SpotImResponse.Success) {
                        callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                    } else if (spotImResponse instanceof SpotImResponse.Error) {
                        SpotCallback<String> spotCallback = callback;
                        spotException2 = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                        spotCallback.onFailure(spotException2);
                    }
                } catch (Exception e) {
                    SpotCallback<String> spotCallback2 = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(e);
                    spotCallback2.onFailure(spotException);
                }
            }
        });
    }

    public final void getPreConversationFragment(String conversationId, ConversationOptions conversationOptions, SpotCallback<Fragment> callback) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, conversationOptions, callback, (SPViewActionsCallbacks) null);
    }

    public final void getPreConversationFragment(String conversationId, ConversationOptions conversationOptions, SpotCallback<Fragment> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, conversationOptions, callback, null, viewActionsCallbacks);
    }

    public final void getPreConversationFragment(String conversationId, ConversationOptions conversationOptions, SpotCallback<Fragment> callback, SpotLayoutListener layoutListener) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, conversationOptions, callback, layoutListener, null);
    }

    public final void getPreConversationFragment(String conversationId, ConversationOptions conversationOptions, final SpotCallback<Fragment> callback, SpotLayoutListener layoutListener, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().setViewActionsCallback(viewActionsCallbacks);
        SpotImSdkManager.INSTANCE.getInstance().getPreConversationFragment(conversationId, conversationOptions, layoutListener, new Function1<SpotImResponse<Fragment>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Fragment>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Fragment> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<Fragment> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void getPreConversationFragment(String conversationId, SpotCallback<Fragment> callback) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, callback, (SpotLayoutListener) null);
    }

    public final void getPreConversationFragment(String conversationId, SpotCallback<Fragment> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, callback, (SpotLayoutListener) null, viewActionsCallbacks);
    }

    public final void getPreConversationFragment(String conversationId, SpotCallback<Fragment> callback, SpotLayoutListener layoutListener) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, callback, layoutListener, (SPViewActionsCallbacks) null);
    }

    public final void getPreConversationFragment(String conversationId, SpotCallback<Fragment> callback, SpotLayoutListener layoutListener, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getPreConversationFragment(conversationId, createDefaultOptions(), callback, layoutListener, viewActionsCallbacks);
    }

    public final void getConversationFragment(String conversationId, ConversationOptions conversationOptions, final SpotCallback<Fragment> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().setViewActionsCallback(viewActionsCallbacks);
        SpotImSdkManager.INSTANCE.getInstance().getConversationFragment(conversationId, conversationOptions, new Function1<SpotImResponse<Fragment>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Fragment>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Fragment> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<Fragment> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void getConversationFragment(String conversationId, SpotCallback<Fragment> callback) {
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getConversationFragment(conversationId, createDefaultOptions(), callback, null);
    }

    public final void getConversationIntent(Context context, String conversationId, ConversationOptions conversationOptions, SpotCallback<Intent> callback) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getConversationIntent(context, conversationId, conversationOptions, callback, null);
    }

    public final void getConversationIntent(Context context, String conversationId, ConversationOptions conversationOptions, final SpotCallback<Intent> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().setViewActionsCallback(viewActionsCallbacks);
        SpotImSdkManager.INSTANCE.getInstance().getConversationIntent(context, conversationId, conversationOptions, new Function1<SpotImResponse<Intent>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Intent>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Intent> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<Intent> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void getConversationIntent(Context context, String conversationId, SpotCallback<Intent> callback) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getConversationIntent(context, conversationId, callback, (SPViewActionsCallbacks) null);
    }

    public final void getConversationIntent(Context context, String conversationId, SpotCallback<Intent> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getConversationIntent(context, conversationId, createDefaultOptions(), callback, viewActionsCallbacks);
    }

    public final void getCreateCommentIntent(Context context, String conversationId, ConversationOptions conversationOptions, SpotCallback<Intent> callback) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getCreateCommentIntent(context, conversationId, conversationOptions, callback, null);
    }

    public final void getCreateCommentIntent(Context context, String conversationId, ConversationOptions conversationOptions, final SpotCallback<Intent> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().setViewActionsCallback(viewActionsCallbacks);
        SpotImSdkManager.INSTANCE.getInstance().getCreateCommentIntent(context, conversationId, conversationOptions, new Function1<SpotImResponse<Intent>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Intent>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Intent> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<Intent> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void getCreateCommentIntent(Context context, String conversationId, SpotCallback<Intent> callback) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getCreateCommentIntent(context, conversationId, callback, (SPViewActionsCallbacks) null);
    }

    public final void getCreateCommentIntent(Context context, String conversationId, SpotCallback<Intent> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getCreateCommentIntent(context, conversationId, createDefaultOptions(), callback, viewActionsCallbacks);
    }

    public final void getCommentThreadIntent(Context context, String threadCommentId, String conversationId, ConversationOptions conversationOptions, SpotCallback<Intent> callback) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(threadCommentId, "threadCommentId");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        getCommentThreadIntent(context, threadCommentId, conversationId, conversationOptions, callback, null);
    }

    public final void getCommentThreadIntent(Context context, String threadCommentId, String conversationId, ConversationOptions conversationOptions, final SpotCallback<Intent> callback, SPViewActionsCallbacks viewActionsCallbacks) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(threadCommentId, "threadCommentId");
        Intrinsics.checkNotNullParameter(conversationId, "conversationId");
        Intrinsics.checkNotNullParameter(conversationOptions, "conversationOptions");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().setViewActionsCallback(viewActionsCallbacks);
        SpotImSdkManager.INSTANCE.getInstance().getCommentThreadIntent(context, threadCommentId, conversationId, conversationOptions, new Function1<SpotImResponse<Intent>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Intent>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Intent> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<Intent> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void getUserLoginStatus(final SpotCallback<UserStatus> callback) {
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().userStatus(new Function1<SpotImResponse<UserStatusResponse>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<UserStatusResponse>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<UserStatusResponse> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((UserStatusResponse) ((SpotImResponse.Success) spotImResponse).getData()).getUserStatus());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<UserStatus> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void setLoginDelegate(LoginDelegate loginDelegate) {
        Intrinsics.checkNotNullParameter(loginDelegate, "loginDelegate");
        SpotImSdkManager.INSTANCE.getInstance().setLoginDelegate(loginDelegate);
    }

    @Deprecated(message = "pre-conversation style", replaceWith = @ReplaceWith(expression = "setPreConversationStyle", imports = {}))
    public final void setButtonOnlyMode(SpotButtonOnlyMode mode) {
        Intrinsics.checkNotNullParameter(mode, "mode");
        SpotImSdkManager.INSTANCE.getInstance().setButtonOnlyMode(mode);
    }

    @Deprecated(message = "pre-conversation style", replaceWith = @ReplaceWith(expression = "getPreConversationStyle", imports = {}))
    public final SpotButtonOnlyMode getButtonOnlyMode() {
        return SpotImSdkManager.INSTANCE.getInstance().getButtonOnlyMode();
    }

    public final void setCustomUIDelegate(CustomUIDelegate customUIDelegate) {
        Intrinsics.checkNotNullParameter(customUIDelegate, "customUIDelegate");
        SpotImSdkManager.INSTANCE.getInstance().setCustomUIDelegate(customUIDelegate);
    }

    public final void setAnalyticsEventDelegate(AnalyticsEventDelegate delegate) {
        Intrinsics.checkNotNullParameter(delegate, "delegate");
        SpotImSdkManager.INSTANCE.getInstance().setAnalyticsEventDelegate(delegate);
    }

    public final void setGiphyProvider(SpotGiphyProvider giphyProvider) {
        Intrinsics.checkNotNullParameter(giphyProvider, "giphyProvider");
        SpotImSdkManager.INSTANCE.getInstance().setGiphyProvider(giphyProvider);
    }

    public final void setCustomBIData(Map<String, String> dataMap) {
        Intrinsics.checkNotNullParameter(dataMap, "dataMap");
        SpotImSdkManager.INSTANCE.getInstance().setCustomBIData(dataMap);
    }

    public final void setUseWhiteNavigationColor(boolean useWhiteNavigationColor) {
        SpotImSdkManager.INSTANCE.getInstance().setUseWhiteNavigationColor(useWhiteNavigationColor);
    }

    public final void logout(final SpotVoidCallback callback) {
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().logout(new Function1<SpotImResponse<Unit>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Unit>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Unit> spotImResponse) {
                SpotException spotException;
                SpotException spotException2;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                try {
                    if (spotImResponse instanceof SpotImResponse.Success) {
                        SpotVoidCallback.this.onSuccess();
                    } else if (spotImResponse instanceof SpotImResponse.Error) {
                        SpotVoidCallback spotVoidCallback = SpotVoidCallback.this;
                        spotException2 = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                        spotVoidCallback.onFailure(spotException2);
                    }
                } catch (Exception e) {
                    SpotVoidCallback spotVoidCallback2 = SpotVoidCallback.this;
                    spotException = SpotIm.INSTANCE.toSpotException(e);
                    spotVoidCallback2.onFailure(spotException);
                }
            }
        });
    }

    public final void getConversationCounters(List<String> conversationIds, final SpotCallback<Map<String, ConversationCounters>> callback) {
        Intrinsics.checkNotNullParameter(conversationIds, "conversationIds");
        Intrinsics.checkNotNullParameter(callback, "callback");
        SpotImSdkManager.INSTANCE.getInstance().getConversationCounters(conversationIds, new Function1<SpotImResponse<Map<String, ? extends ConversationCounters>>, Unit>() {
            {
                super(1);
            }

            public Object invoke(Object obj) {
                invoke((SpotImResponse<Map<String, ConversationCounters>>) obj);
                return Unit.INSTANCE;
            }

            public final void invoke(SpotImResponse<Map<String, ConversationCounters>> spotImResponse) {
                SpotException spotException;
                Intrinsics.checkNotNullParameter(spotImResponse, "response");
                if (spotImResponse instanceof SpotImResponse.Success) {
                    callback.onSuccess(((SpotImResponse.Success) spotImResponse).getData());
                } else if (spotImResponse instanceof SpotImResponse.Error) {
                    SpotCallback<Map<String, ConversationCounters>> spotCallback = callback;
                    spotException = SpotIm.INSTANCE.toSpotException(((SpotImResponse.Error) spotImResponse).getError());
                    spotCallback.onFailure(spotException);
                }
            }
        });
    }

    public final void setEnableLandscape(boolean isEnable) {
        SpotImSdkManager.INSTANCE.getInstance().setEnableLandscape(isEnable);
    }

    public final boolean getEnableLandscape() {
        return SpotImSdkManager.INSTANCE.getInstance().getEnableLandscape();
    }

    public final void setEnableCreateCommentNewDesign(boolean isEnable) {
        SpotImSdkManager.INSTANCE.getInstance().setEnableCreateCommentNewDesign(isEnable);
    }

    public final boolean getEnableCreateCommentNewDesign() {
        return SpotImSdkManager.INSTANCE.getInstance().getEnableCreateCommentNewDesign();
    }

    public final void setSsoStartLoginFlowMode(SpotSSOStartLoginFlowMode mode) {
        Intrinsics.checkNotNullParameter(mode, "mode");
        SpotImSdkManager.INSTANCE.getInstance().setSsoStartLoginFlowMode(mode);
    }

    public final SpotSSOStartLoginFlowMode getSsoStartLoginFlowMode() {
        return SpotImSdkManager.INSTANCE.getInstance().getSsoStartLoginFlowMode();
    }

    public final void setAdditionalConfigurations(List<? extends AdditionalConfiguration> configurations) {
        Intrinsics.checkNotNullParameter(configurations, "configurations");
        AdditionalConfigurationImpl.INSTANCE.getInstance().setConfigurations(configurations);
    }

    public final SpotException toSpotException(Throwable error) {
        if (error instanceof SpotException) {
            return (SpotException) error;
        }
        return new SpotException(error);
    }

    public final void setGoogleAdsProvider(SPGoogleAdsProvider provider) {
        SpotImSdkManager.INSTANCE.getInstance().setGoogleAdsProvider(provider);
    }

    private final ConversationOptions createDefaultOptions() {
        return new ConversationOptions.Builder(null, 0, null, null, null, null, false, null, null, null, 1023, null).build();
    }
}