package com.ss.android.ugc.aweme.commercialize.e_commerce.service;

import X.0AA;
import X.1hK;
import X.7Yj;
import X.7Yk;
import X.C0665KCq;
import X.C0754KGb;
import X.C3023L5i;
import X.C3739LWw;
import X.C4097LeS;
import X.C4672Lnj;
import X.CwZ;
import X.Cwu;
import X.KT7;
import X.M12;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import com.ss.android.ugc.aweme.bullet.bridge.BaseBridgeMethod;
import com.ss.android.ugc.aweme.commercialize.e_commerce.pdp.ui.PdpBulletBottomSheetFragment;
import com.ss.android.ugc.aweme.commercialize.e_commerce.wishlist.jsb.GetSharedMemoryItemMethod;
import com.ss.android.ugc.aweme.commercialize.e_commerce.wishlist.jsb.OpenHybridMethod;
import com.ss.android.ugc.aweme.commercialize.e_commerce.wishlist.jsb.SetSharedMemoryItemMethod;
import com.ss.android.ugc.aweme.commercialize.e_commerce.wishlist.ui.WishListFragment;
import java.util.List;
import java.util.Map;

public final class ShoppingAdsServiceImpl implements IShoppingAdsService {
    static {
        Covode.recordClassIndex(58461);
    }

    public final boolean LIZIZ() {
        return 7Yj.LIZIZ.LIZ();
    }

    public final boolean LIZ() {
        return 7Yk.LIZIZ.LIZ();
    }

    public final Map<String, Class<?>> LIZJ() {
        return C3739LWw.LIZ((Cwu<? extends K, ? extends V>[]) new Cwu[]{CwZ.LIZ("setSharedMemoryItem", SetSharedMemoryItemMethod.class), CwZ.LIZ("getSharedMemoryItem", GetSharedMemoryItemMethod.class), CwZ.LIZ("openHybrid", OpenHybridMethod.class)});
    }

    public static IShoppingAdsService LIZLLL() {
        MethodCollector.i(10238);
        IShoppingAdsService iShoppingAdsService = (IShoppingAdsService) C4672Lnj.LIZ(IShoppingAdsService.class, false);
        if (iShoppingAdsService != null) {
            MethodCollector.o(10238);
            return iShoppingAdsService;
        }
        Object LIZIZ = C4672Lnj.LIZIZ(IShoppingAdsService.class, false);
        if (LIZIZ != null) {
            IShoppingAdsService iShoppingAdsService2 = (IShoppingAdsService) LIZIZ;
            MethodCollector.o(10238);
            return iShoppingAdsService2;
        }
        if (C4672Lnj.LJLJLJ == null) {
            synchronized (IShoppingAdsService.class) {
                try {
                    if (C4672Lnj.LJLJLJ == null) {
                        C4672Lnj.LJLJLJ = new ShoppingAdsServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(10238);
                    throw th;
                }
            }
        }
        ShoppingAdsServiceImpl shoppingAdsServiceImpl = (ShoppingAdsServiceImpl) C4672Lnj.LJLJLJ;
        MethodCollector.o(10238);
        return shoppingAdsServiceImpl;
    }

    public final /* synthetic */ AmeBaseFragment LIZ(String str) {
        WishListFragment wishListFragment = new WishListFragment();
        wishListFragment.LIZLLL = str;
        return wishListFragment;
    }

    public final List<C0665KCq> LIZ(KT7 kt7) {
        M12.LIZ((Object) kt7);
        return C4097LeS.LIZIZ((T[]) new BaseBridgeMethod[]{new SetSharedMemoryItemMethod(kt7), new GetSharedMemoryItemMethod(kt7), new OpenHybridMethod(kt7)});
    }

    public final boolean LIZ(Context context) {
        DialogFragment LIZ;
        if (context != null && (context instanceof Activity) && (context instanceof 1hK)) {
            1hK r4 = (1hK) context;
            if (!r4.isFinishing() && (LIZ = r4.getSupportFragmentManager().LIZ("BulletBottomSheetFragment")) != null && (LIZ instanceof DialogFragment)) {
                DialogFragment dialogFragment = LIZ;
                if (dialogFragment.isVisible()) {
                    dialogFragment.dismiss();
                    return true;
                }
            }
        }
        return false;
    }

    public final void LIZ(0AA r5, C3023L5i l5i, C0754KGb kGb) {
        M12.LIZ((Object) kGb);
        M12.LIZ((Object) kGb);
        PdpBulletBottomSheetFragment pdpBulletBottomSheetFragment = new PdpBulletBottomSheetFragment();
        Bundle bundle = new Bundle();
        bundle.putSerializable("PDP_AD_INFO", kGb);
        bundle.putFloat("PEEK_HEIGHT_RATIO", l5i.LIZ);
        bundle.putFloat("MAX_HEIGHT_RATIO", l5i.LIZIZ);
        String str = l5i.LIZJ;
        if (str == null) {
            str = "";
        }
        bundle.putString("SCHEMA", str);
        pdpBulletBottomSheetFragment.LIZJ = l5i.LJ;
        pdpBulletBottomSheetFragment.LIZLLL = l5i.LIZLLL;
        pdpBulletBottomSheetFragment.setArguments(bundle);
        if (r5 != null) {
            pdpBulletBottomSheetFragment.show(r5, "BulletBottomSheetFragment");
        }
    }
}
