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

import X.2Ew;
import X.2OR;
import X.4Ek;
import X.C2497Ktk;
import X.C2553Kue;
import X.C2560Kul;
import X.C2640Kw3;
import X.C2652KwF;
import X.C2698Kwz;
import X.C2700Kx1;
import X.C3236LDn;
import X.C3290LFp;
import X.CqM;
import X.FMQ;
import X.FMR;
import X.Hns;
import X.LHK;
import X.LHO;
import X.LHS;
import X.M12;
import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.widget.FrameLayout;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.commercialize.profile.AdNewFakeUserProfileFragment;
import com.ss.android.ugc.aweme.commercialize.profile.AdProfilePopUpWebPageWidget;
import com.ss.android.ugc.aweme.commercialize.profile.FakeUserProfileFragment;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;

public class AdUtilsServiceImpl implements LHS {
    static {
        Covode.recordClassIndex(105004);
    }

    public LHO getAdFlutterLandPageUtil() {
        return C2700Kx1.LIZ;
    }

    public C2698Kwz getAdLynxLandPageUtil() {
        return C2497Ktk.LIZ;
    }

    public LHK createFakeUserProfileFragment() {
        return new FakeUserProfileFragment();
    }

    public LHK createNewFakeUserProfileFragment() {
        return new AdNewFakeUserProfileFragment();
    }

    public boolean shouldShowBioEmail() {
        try {
            return 2OR.LIZ.LIZIZ.getBioSettings().getEnableBioEmail().booleanValue();
        } catch (4Ek unused) {
            return false;
        }
    }

    public boolean shouldShowBioUrl() {
        try {
            return 2OR.LIZ.LIZIZ.getBioSettings().getEnableBioUrl().booleanValue();
        } catch (4Ek unused) {
            return false;
        }
    }

    public boolean shouldShowFakeUserProfile(Aweme aweme) {
        return C3290LFp.LJJIIZI(aweme);
    }

    public boolean shouldShowAdBrowser(Aweme aweme) {
        if (aweme == null || !aweme.isAd() || !C3290LFp.LJJIIZ(aweme) || TextUtils.isEmpty(C3290LFp.LIZIZ(aweme))) {
            return false;
        }
        return true;
    }

    public void closeProfilePopUpWebPage(Activity activity) {
        C2652KwF kwF = AdProfilePopUpWebPageWidget.LJIILIIL;
        M12.LIZ((Object) activity);
        C2640Kw3 LIZIZ = kwF.LIZIZ(activity);
        if (LIZIZ != null && LIZIZ.LJII()) {
            LIZIZ.LIZ(true);
            FrameLayout LIZ = kwF.LIZ(activity);
            if (LIZ != null) {
                LIZ.setVisibility(8);
            }
        }
    }

    public void logFeedRawAdOpenUrlH5(Context context, Aweme aweme) {
        C3236LDn.LJI(context, aweme);
    }

    public void logFeedRawLynxAdOpenUrlH5(Context context, Aweme aweme) {
        C3236LDn.LJII(context, aweme);
    }

    public void logFeedRawFlutterAdOpenUrlH5(Context context, Aweme aweme) {
        HashMap hashMap = new HashMap();
        hashMap.put("render_type", "flutter");
        C3236LDn.LIZIZ(context, "open_url_h5", aweme, C3236LDn.LIZ(context, aweme, false, C3236LDn.LIZ((Map<String, Object>) hashMap)));
    }

    public void feedLiveProfileAvatarOpen(Context context, Aweme aweme, int i) {
        Hns.LIZ(context, aweme, i);
    }

    public JSONObject getExtJson(Context context, Aweme aweme, String str) {
        return C3236LDn.LIZ(context, aweme, false, (Map<String, String>) null);
    }

    public boolean openProfilePopUpWebPageInSixTwoMode(Context context, Aweme aweme, String str) {
        return openProfilePopUpWebPage(context, aweme, str, 5, false);
    }

    public boolean openProfilePopUpWebPageInTwoExpandMode(Context context, Aweme aweme, String str) {
        return openProfilePopUpWebPage(context, aweme, str, 6, false);
    }

    public boolean openProfilePopUpWebPageInTwoMode(Context context, Aweme aweme, String str) {
        return openProfilePopUpWebPage(context, aweme, str, 1, false);
    }

    public void onProfileWebPageHide(Context context, Aweme aweme, String str) {
        if (context != null) {
            CqM.LIZ(new 2Ew(context.hashCode(), 2, aweme, str));
        }
    }

    public void onProfileWebPageShow(Context context, Aweme aweme, String str) {
        if (context != null) {
            CqM.LIZ(new 2Ew(context.hashCode(), 1, aweme, str));
        }
    }

    public boolean openTopViewLive(Context context, Aweme aweme, int i, FMR fmr) {
        return FMQ.LIZ(context, aweme, i, fmr);
    }

    public boolean openProfilePopUpWebPageInTwoMode(Context context, Aweme aweme, String str, boolean z) {
        return openProfilePopUpWebPage(context, aweme, str, 4, z);
    }

    public boolean openAdWebUrl(Context context, String str, String str2, boolean z, Map<String, String> map) {
        return C2553Kue.LIZ(context, str, str2, z, map);
    }

    public boolean openProfilePopUpWebPage(Context context, Aweme aweme, String str, int i, boolean z) {
        if (aweme == null || !aweme.isAd()) {
            return false;
        }
        C2560Kul kul = new C2560Kul();
        kul.LIZ(context);
        kul.LIZ(aweme.getAwemeRawAd());
        kul.LIZ(i);
        kul.LIZJ(str);
        kul.LIZ(aweme);
        return C2553Kue.LIZ(kul, z);
    }
}
