package com.ss.android.ugc.aweme.live.livehostimpl;

import X.0AA;
import X.0cm;
import X.1hK;
import X.1oX;
import X.2W1;
import X.2cN;
import X.3wo;
import X.5gM;
import X.874;
import X.C1473PgU;
import X.C3000QCf;
import X.C3136QHl;
import X.C3168QIr;
import X.C3198QJv;
import X.C3507QVs;
import X.C3508QVt;
import X.C3509QVu;
import X.C3510QVv;
import X.C3511QVw;
import X.C3512QVx;
import X.C3513QVy;
import X.C3514QVz;
import X.FET;
import X.Gbk;
import X.Ghy;
import X.GiQ;
import X.GiR;
import X.GiS;
import X.GiT;
import X.Gji;
import X.GlX;
import X.NB4;
import X.NB6;
import X.NBC;
import X.OCa;
import X.QDE;
import X.QDF;
import X.QHV;
import X.QKG;
import X.QW0;
import X.QW1;
import X.QW2;
import X.QW3;
import X.S9B;
import X.SfZ;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.view.View;
import android.widget.FrameLayout;
import com.bytedance.android.livesdkapi.host.IHostApp;
import com.bytedance.apm.core.ActivityLifeObserver;
import com.bytedance.covode.number.Covode;
import com.facebook.imagepipeline.common.ImageDecodeOptionsBuilder;
import com.ss.android.ugc.aweme.compliance.api.services.banappeal.IBanAppealService;
import com.ss.android.ugc.aweme.compliance.business.serviceimpl.BanAppealServiceImpl;
import com.ss.android.ugc.aweme.framework.services.IStickerService;
import com.ss.android.ugc.aweme.live.ILiveHostOuterService;
import com.ss.android.ugc.aweme.live.ILiveInnerService;
import com.ss.android.ugc.aweme.live.LiveHostOuterService;
import com.ss.android.ugc.aweme.out.AVExternalServiceImpl;
import com.ss.android.ugc.aweme.profile.IProfileService;
import com.ss.android.ugc.aweme.profile.ProfileServiceImpl;
import com.ss.android.ugc.aweme.services.draft.ISaveVideoToDraftListener;
import com.ss.android.ugc.aweme.services.external.IAVDraftService;
import com.ss.android.ugc.aweme.services.external.ui.EditConfig;
import com.ss.android.ugc.aweme.services.external.ui.VideoMedia;
import com.ss.android.ugc.aweme.sticker.IStickerViewService;
import com.ss.android.ugc.aweme.tools.live.sticker.StickerViewServiceImpl;
import com.ss.android.ugc.aweme.utils.ActivityStack;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.json.JSONObject;

public class LiveHostApp implements IHostApp {
    public int LIZ = -1;

    static {
        Covode.recordClassIndex(91202);
    }

    public GiQ avatarBorderController() {
        return null;
    }

    public void checkAndShowGuide(1hK r1, String str, String str2) {
    }

    public void checkBindHelpShow(1hK r1, String str) {
    }

    public void enterRecorderActivity(Activity activity) {
    }

    public String getBgBroadcastServiceName() {
        return "com.ss.android.ugc.aweme.live.livehostimpl.BgBroadcastService";
    }

    public Uri getUriForFile(Context context, File file) {
        return null;
    }

    public void initImageLib() {
    }

    public GiR liveCircleView(Context context) {
        return null;
    }

    public void onInit() {
    }

    public Dialog showDialog(Context context, CharSequence charSequence, CharSequence charSequence2, CharSequence charSequence3, GiT giT, CharSequence charSequence4, GiT giT2, GiS giS) {
        return null;
    }

    public void startBindMobileFullFragment(Activity activity, String str, String str2, Ghy ghy) {
    }

    public void startBindPhoneDialogFragment(Activity activity, String str, String str2, Ghy ghy) {
    }

    public boolean startVideoRecordActivity(Activity activity, String str) {
        return true;
    }

    public void transCloudControlCommand(JSONObject jSONObject) {
    }

    public int getCurrentPage() {
        return this.LIZ;
    }

    public Activity getTopActivity() {
        return ActivityStack.getTopActivity();
    }

    public boolean initPitayaEnv() {
        return 2W1.LIZ.initPitaya((3wo) null);
    }

    public boolean getPushLiveState() {
        IProfileService LJJIIJ = ProfileServiceImpl.LJJIIJ();
        if (LJJIIJ != null) {
            return LJJIIJ.LIZLLL();
        }
        return true;
    }

    public boolean hasLiveEventPermission() {
        return ProfileServiceImpl.LJJIIJ().LJJII();
    }

    public void hideStickerView() {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.hideStickerView();
        }
    }

    public boolean isAppForeground() {
        return ActivityLifeObserver.getInstance().isForeground();
    }

    public boolean isInMusicallyRegion() {
        if (!S9B.LIZJ()) {
            return true;
        }
        return false;
    }

    public boolean isShowStickerView() {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            return createIStickerViewServicebyMonsterPlugin.isShowStickerView();
        }
        return false;
    }

    public void releaseGalleryModule() {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.releaseGalleryModule();
        }
    }

    public void releaseStickerView() {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.release();
            createIStickerViewServicebyMonsterPlugin.setPixelLoopStickerPresenterSupplier((5gM<NBC>) null);
        }
    }

    public void scanPhotoList() {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.scanPhotoList();
        }
    }

    public void selectFromGallery() {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.selectFromGallery();
        }
    }

    public List<Class> getLiveActivityClass() {
        ArrayList arrayList = new ArrayList();
        arrayList.add(874.LIZIZ(ILiveInnerService.class).LIZIZ().LIZ());
        return arrayList;
    }

    public void setCurrentPage(int i) {
        this.LIZ = i;
    }

    public void tryDownloadGiftImage(String str) {
        OCa.LIZIZ(str);
    }

    public void tryDownloadImage(String str) {
        OCa.LIZIZ(str);
    }

    public Class getHostActivity(int i) {
        return 0cm.LIZ(ILiveInnerService.class).LIZ(i);
    }

    public boolean isNotificationEnabled(Context context) {
        IProfileService LJJIIJ = ProfileServiceImpl.LJJIIJ();
        if (LJJIIJ != null) {
            return LJJIIJ.LIZIZ(context);
        }
        return false;
    }

    public void openWallet(Activity activity) {
        ILiveHostOuterService LJIILLIIL = LiveHostOuterService.LJIILLIIL();
        if (LJIILLIIL != null) {
            LJIILLIIL.LIZIZ(activity, "page_charge");
        }
    }

    public 2cN registerAppEnterForeBackgroundCallback(QW2 qw2) {
        return SfZ.LJIJ.LJII().LIZLLL(new QW1(qw2));
    }

    /* JADX WARNING: Code restructure failed: missing block: B:4:0x0009, code lost:
        if (r4 != 3) goto L_0x000b;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public android.graphics.Typeface getHostTypeface(int r4) {
        /*
            r3 = this;
            r2 = 3
            r1 = 2
            r0 = 1
            if (r4 == 0) goto L_0x000b
            if (r4 == r0) goto L_0x0017
            if (r4 == r1) goto L_0x0015
            if (r4 == r2) goto L_0x000c
        L_0x000b:
            r2 = 1
        L_0x000c:
            X.NuU r0 = X.NuU.LIZ()
            android.graphics.Typeface r0 = r0.LIZ(r2)
            return r0
        L_0x0015:
            r2 = 4
            goto L_0x000c
        L_0x0017:
            r2 = 2
            goto L_0x000c
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.live.livehostimpl.LiveHostApp.getHostTypeface(int):android.graphics.Typeface");
    }

    public void registerLifeCycleCallback(QW3 qw3) {
        qw3.LIZ(SfZ.LJIIJJI);
        SfZ.LJIJ.LIZ().LIZLLL(new FET(qw3));
        C1473PgU LIZIZ = SfZ.LJIJ.LIZIZ();
        qw3.getClass();
        LIZIZ.LIZLLL(new C3509QVu(qw3));
        C1473PgU LIZJ = SfZ.LJIJ.LIZJ();
        qw3.getClass();
        LIZJ.LIZLLL(new C3510QVv(qw3));
        C1473PgU LIZLLL = SfZ.LJIJ.LIZLLL();
        qw3.getClass();
        LIZLLL.LIZLLL(new C3511QVw(qw3));
        C1473PgU LJ = SfZ.LJIJ.LJ();
        qw3.getClass();
        LJ.LIZLLL(new C3512QVx(qw3));
        C1473PgU LJFF = SfZ.LJIJ.LJFF();
        qw3.getClass();
        LJFF.LIZLLL(new C3513QVy(qw3));
        SfZ.LJIJ.LJII().LIZLLL(new QW0(qw3));
    }

    public Intent createStartBroadcastIntent(1hK r2, int i) {
        return 0cm.LIZ(ILiveInnerService.class).LIZ(r2, i);
    }

    public void initGalleryModule(Activity activity, final C3507QVs qVs) {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.initGalleryModule(activity, new NB6() {
                static {
                    Covode.recordClassIndex(91206);
                }

                public final void LIZ(String str) {
                    qVs.LIZ(str);
                }

                public final void LIZ(List<String> list) {
                    qVs.LIZ(list);
                }

                public final void LIZ(String str, String str2) {
                    qVs.LIZ(str, str2);
                }
            });
        }
    }

    public void jumpToAgsStatusPage(Context context, String str) {
        IBanAppealService LJIIIIZZ = BanAppealServiceImpl.LJIIIIZZ();
        if (LJIIIIZZ != null) {
            LJIIIIZZ.LIZ(context, str);
        }
    }

    public void resizePhoto(String str, String str2) {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.resizePhoto(str, str2);
        }
    }

    public void saveHighLightToDraft(ArrayList<String> arrayList, final C3514QVz qVz) {
        AVExternalServiceImpl.LIZ().draftService().saveDraft(new IAVDraftService.SaveDraftByPathParam(arrayList, UUID.randomUUID().toString(), "live_highlight", new ISaveVideoToDraftListener() {
            static {
                Covode.recordClassIndex(91209);
            }

            public final void onSuccess() {
                C3514QVz qVz = qVz;
                if (qVz != null) {
                    qVz.LIZ();
                }
            }

            public final void onFailed(Exception exc) {
                C3514QVz qVz = qVz;
                if (qVz != null && exc != null) {
                    qVz.LIZ(exc);
                }
            }
        }));
    }

    public void openShortVideoEditPage(Context context, String str, String str2) {
        EditConfig.Builder builder = new EditConfig.Builder();
        builder.mediaInfo(new VideoMedia(str));
        builder.shootWay(str2);
        AVExternalServiceImpl.LIZ().asyncService(context, "upload", new 5(this, context, builder.build()));
    }

    public void bindGifImage(View view, String str, Bitmap.Config config) {
        if (view instanceof C3198QJv) {
            QKG qkg = (QKG) view;
            QDE qde = null;
            if (str != null && !str.isEmpty()) {
                ImageDecodeOptionsBuilder imageDecodeOptionsBuilder = new ImageDecodeOptionsBuilder();
                imageDecodeOptionsBuilder.setBitmapConfig(config);
                imageDecodeOptionsBuilder.LIZ(1);
                C3168QIr LIZ2 = imageDecodeOptionsBuilder.LIZ();
                QDF LIZ3 = QDF.LIZ(Uri.parse(str));
                LIZ3.LJ = C3000QCf.LIZLLL;
                LIZ3.LJFF = LIZ2;
                qde = LIZ3.LIZ();
            }
            C3136QHl LIZIZ = QHV.LIZIZ();
            LIZIZ.LIZJ(true);
            LIZIZ.LIZIZ(qde);
            qkg.setController(LIZIZ.LJ());
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:12:0x0036, code lost:
        if (r1 == null) goto L_0x0038;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public android.util.Pair<java.lang.String, android.graphics.drawable.Drawable> getBreathShareAnimShareRes(android.content.Context r5, java.lang.String r6, java.lang.String r7) {
        /*
            r4 = this;
            r3 = 0
            if (r5 != 0) goto L_0x0004
            return r3
        L_0x0004:
            android.app.Activity r2 = X.3jJ.LIZ(r5)
            if (r2 == 0) goto L_0x0044
            com.ss.android.ugc.aweme.share.ShareExtService r0 = com.ss.android.ugc.aweme.share.ShareExtServiceImpl.LJIILJJIL()
            android.graphics.drawable.Drawable r1 = r0.LIZ(r2, r6)
            if (r1 != 0) goto L_0x0041
            com.ss.android.ugc.aweme.share.ShareExtService r0 = com.ss.android.ugc.aweme.share.ShareExtServiceImpl.LJIILJJIL()
            android.graphics.drawable.Drawable r1 = r0.LIZ(r2)
            java.lang.String r6 = X.4b1.LIZJ()
            X.JOF r0 = X.JOU.LIZ(r6, r2)
            if (r0 != 0) goto L_0x003e
            java.lang.String r0 = "other"
            boolean r0 = X.86a.LIZ(r6, r0)
            if (r0 != 0) goto L_0x003e
        L_0x002e:
            com.ss.android.ugc.aweme.share.ShareExtService r0 = com.ss.android.ugc.aweme.share.ShareExtServiceImpl.LJIILJJIL()
            android.graphics.drawable.Drawable r1 = r0.LIZ(r2, r7)
            if (r1 != 0) goto L_0x0042
        L_0x0038:
            android.util.Pair r0 = new android.util.Pair
            r0.<init>(r3, r1)
            return r0
        L_0x003e:
            if (r1 != 0) goto L_0x0041
            goto L_0x002e
        L_0x0041:
            r7 = r6
        L_0x0042:
            r3 = r7
            goto L_0x0038
        L_0x0044:
            return r3
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.live.livehostimpl.LiveHostApp.getBreathShareAnimShareRes(android.content.Context, java.lang.String, java.lang.String):android.util.Pair");
    }

    public void showStickerView(1oX r8, 0AA r9, String str, FrameLayout frameLayout, final C3508QVt qVt) {
        IStickerViewService createIStickerViewServicebyMonsterPlugin = StickerViewServiceImpl.createIStickerViewServicebyMonsterPlugin(false);
        if (createIStickerViewServicebyMonsterPlugin != null) {
            createIStickerViewServicebyMonsterPlugin.setPixelLoopStickerPresenterSupplier(new 5gM<NBC>() {
                public NBC LIZJ;

                static {
                    Covode.recordClassIndex(91203);
                }

                public final /* synthetic */ Object LIZIZ() {
                    if (this.LIZJ == null) {
                        this.LIZJ = new NBC() {
                            static {
                                Covode.recordClassIndex(91204);
                            }

                            public final int LIZ(String str, String str2) {
                                return qVt.LIZ(str, str2);
                            }
                        };
                    }
                    return this.LIZJ;
                }
            });
            final String str2 = str;
            1oX r2 = r8;
            createIStickerViewServicebyMonsterPlugin.showStickerView(r2, r9, str2, frameLayout, new NB4() {
                static {
                    Covode.recordClassIndex(91205);
                }

                public final void LIZ() {
                    qVt.LIZ(str2);
                }

                public final void LIZIZ() {
                    qVt.LIZIZ(str2);
                }

                public final void LIZ(IStickerService.FaceSticker faceSticker) {
                    qVt.LIZ(Gbk.LIZ(faceSticker));
                }

                public final void LIZIZ(IStickerService.FaceSticker faceSticker) {
                    qVt.LIZIZ(Gbk.LIZ(faceSticker));
                }

                public final void LIZ(String str, String str2) {
                    qVt.LIZIZ(str, str2);
                }
            });
        }
    }

    public void showNotificationTipDialog(String str, String str2, String str3, int i, View view, String str4, Gji gji, boolean z, GlX glX) {
        IProfileService LJJIIJ = ProfileServiceImpl.LJJIIJ();
        if (LJJIIJ != null) {
            boolean z2 = z;
            String str5 = str;
            String str6 = str2;
            String str7 = str3;
            int i2 = i;
            LJJIIJ.LIZ(str5, str6, str7, i2, z2, view, new 4(this, gji, glX, str4));
        }
    }
}
