package com.ss.android.ugc.aweme.favorites.service;

import X.1hK;
import X.2eQ;
import X.C2383ArT;
import X.C2400Ark;
import X.C2466Aso;
import X.C2601Auz;
import X.C2606Av4;
import X.C2607Av5;
import X.C2608Av6;
import X.C2609Av7;
import X.CqM;
import X.D0R;
import X.Lel;
import X.Lnj;
import X.M12;
import android.view.View;
import android.view.Window;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.favorites.api.VideoCollectionApi;
import com.ss.android.ugc.aweme.favorites.ui.ProfileUserFavoritesFragment;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import java.util.List;
import kotlin.h.b.n;

public final class FavoriteServiceImpl implements IFavoriteService {
    static {
        Covode.recordClassIndex(75735);
    }

    public final Fragment LJIIIZ() {
        return new ProfileUserFavoritesFragment();
    }

    public final boolean LIZIZ() {
        if (C2606Av4.LIZIZ.LIZ() == 0) {
            return true;
        }
        return false;
    }

    public final boolean LIZJ() {
        if (C2607Av5.LIZ.LIZ() == 2) {
            return true;
        }
        return false;
    }

    public final boolean LJ() {
        int LIZ = C2601Auz.LIZ.LIZ();
        if (4 <= LIZ && 6 >= LIZ) {
            return true;
        }
        return false;
    }

    public final boolean LJII() {
        int LIZ = C2601Auz.LIZ.LIZ();
        if (1 <= LIZ && 3 >= LIZ) {
            return true;
        }
        return false;
    }

    public final boolean LJFF() {
        int LIZ = C2601Auz.LIZ.LIZ();
        if (7 <= LIZ && 9 >= LIZ) {
            return true;
        }
        return false;
    }

    public final int LJI() {
        int LIZ = C2601Auz.LIZ.LIZ();
        if (1 <= LIZ && 9 >= LIZ) {
            return ((LIZ - 1) % 3) + 1;
        }
        return 0;
    }

    public final boolean LJIIIIZZ() {
        int LIZ = C2601Auz.LIZ.LIZ();
        if (LIZ == 1 || LIZ == 4 || LIZ == 7) {
            return false;
        }
        return true;
    }

    public final boolean LIZLLL() {
        if (C2608Av6.LIZ.LIZ() != 0) {
            if (C2608Av6.LIZ.LIZ() == 2) {
                return true;
            }
            return false;
        } else if (C2607Av5.LIZ.LIZ() == 2 || C2607Av5.LIZ.LIZ() == 3) {
            return true;
        } else {
            return false;
        }
    }

    public static IFavoriteService LJIIJ() {
        MethodCollector.i(2101);
        IFavoriteService iFavoriteService = (IFavoriteService) Lnj.LIZ(IFavoriteService.class, false);
        if (iFavoriteService != null) {
            MethodCollector.o(2101);
            return iFavoriteService;
        }
        Object LIZIZ = Lnj.LIZIZ(IFavoriteService.class, false);
        if (LIZIZ != null) {
            IFavoriteService iFavoriteService2 = (IFavoriteService) LIZIZ;
            MethodCollector.o(2101);
            return iFavoriteService2;
        }
        if (Lnj.LLJLLL == null) {
            synchronized (IFavoriteService.class) {
                try {
                    if (Lnj.LLJLLL == null) {
                        Lnj.LLJLLL = new FavoriteServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(2101);
                    throw th;
                }
            }
        }
        FavoriteServiceImpl favoriteServiceImpl = (FavoriteServiceImpl) Lnj.LLJLLL;
        MethodCollector.o(2101);
        return favoriteServiceImpl;
    }

    public final boolean LIZ() {
        if (C2609Av7.LIZ() != 1) {
            return true;
        }
        return false;
    }

    public final void LIZ(String str) {
        M12.LIZ(str);
        CqM.LIZ(new C2400Ark(new C2383ArT(3, (String) null, (String) null, (String) null, (String) null, (List) null, (List) null, (List) null, 254)));
    }

    public final D0R<List<Aweme>, Boolean, Long> LIZ(String str, long j) {
        int i;
        List list;
        boolean z;
        Long l;
        Boolean bool;
        String str2 = str;
        M12.LIZ(str2);
        VideoCollectionApi LIZ = VideoCollectionApi.LIZ.LIZ();
        long j2 = 0;
        long j3 = j;
        if (j3 == 0) {
            i = 1;
        } else {
            i = 2;
        }
        2eQ r4 = (2eQ) LIZ.syncCollectionContent(str2, j3, 30, i).execute().LIZIZ;
        if (r4 == null || (list = r4.LIZ) == null) {
            list = Lel.INSTANCE;
        }
        if (r4 == null || (bool = r4.LIZJ) == null) {
            z = false;
        } else {
            z = bool.booleanValue();
        }
        Boolean valueOf = Boolean.valueOf(z);
        if (!(r4 == null || (l = r4.LIZIZ) == null)) {
            j2 = l.longValue();
        }
        return new D0R<>(list, valueOf, Long.valueOf(j2));
    }

    public final void LIZ(1hK r4, String str, String str2) {
        M12.LIZ(r4, str, str2);
        C2466Aso aso = new C2466Aso(r4, str, str2);
        Window window = aso.LIZ.getWindow();
        n.LIZIZ(window, "");
        View findViewById = window.getDecorView().findViewById(2131372992);
        if (findViewById != null) {
            aso.LIZ(findViewById);
        }
    }

    public final void LIZ(1hK r2, String str, String str2, View view) {
        M12.LIZ(r2, str, str2, view);
        new C2466Aso(r2, str, str2).LIZ(view);
    }
}
