package com.ss.android.ugc.aweme.services;

import X.46i;
import X.AnonymousClass9DY;
import X.C43769Jf;
import X.Lnj;
import android.app.Activity;
import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.sdk.webview.di.IMainServiceForJsb;
import com.ss.android.ugc.aweme.crossplatform.activity.CrossPlatformActivity;
import org.json.JSONObject;

public class MainServiceForJsb implements IMainServiceForJsb {
    public static final String JS_SDK_CONFIG_URL = AnonymousClass9DY.LIZ("/client_auth/js_sdk/config/v1/");

    public String getSSLocalScheme() {
        return "sslocal";
    }

    public String getJSSDKConfigUrl() {
        return JS_SDK_CONFIG_URL;
    }

    public String getPlayNameMobile() {
        return C43769Jf.LIZ.LIZLLL();
    }

    public boolean hasPlatformBinded() {
        return C43769Jf.LIZ.LIZ();
    }

    static {
        Covode.recordClassIndex(105118);
    }

    public long getUserId() {
        return Long.parseLong(46i.LJFF().getCurUserId());
    }

    public boolean isLogin() {
        return 46i.LJFF().isLogin();
    }

    public boolean isBrowserActivity(Context context) {
        return CrossPlatformActivity.class.isInstance(context);
    }

    public boolean isPlatformBinded(String str) {
        return C43769Jf.LIZ.LIZ(str);
    }

    public boolean isApiSuccess(JSONObject jSONObject) {
        if (jSONObject == null || !"success".equals(jSONObject.optString("message"))) {
            return false;
        }
        return true;
    }

    public static IMainServiceForJsb createIMainServiceForJsbbyMonsterPlugin(boolean z) {
        MethodCollector.i(3544);
        IMainServiceForJsb iMainServiceForJsb = (IMainServiceForJsb) Lnj.LIZ(IMainServiceForJsb.class, z);
        if (iMainServiceForJsb != null) {
            MethodCollector.o(3544);
            return iMainServiceForJsb;
        }
        Object LIZIZ = Lnj.LIZIZ(IMainServiceForJsb.class, z);
        if (LIZIZ != null) {
            IMainServiceForJsb iMainServiceForJsb2 = (IMainServiceForJsb) LIZIZ;
            MethodCollector.o(3544);
            return iMainServiceForJsb2;
        }
        if (Lnj.as == null) {
            synchronized (IMainServiceForJsb.class) {
                try {
                    if (Lnj.as == null) {
                        Lnj.as = new MainServiceForJsb();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(3544);
                    throw th;
                }
            }
        }
        MainServiceForJsb mainServiceForJsb = (MainServiceForJsb) Lnj.as;
        MethodCollector.o(3544);
        return mainServiceForJsb;
    }

    public void startAdsAppActivity(Activity activity, String str) {
        MainServiceImpl.createIMainServicebyMonsterPlugin(false).startAdsAppActivity(activity, str, "");
    }
}
