package com.ss.android.ugc.aweme.compliance.protection.serviceimpl;

import X.AnonymousClass3BB;
import X.AnonymousClass40F;
import X.AnonymousClass40I;
import X.AnonymousClass40J;
import X.AnonymousClass40L;
import X.AnonymousClass40M;
import X.AnonymousClass40S;
import X.AnonymousClass40W;
import X.C23293Bp;
import X.Lnj;
import X.LsP;
import X.M12;
import android.app.Activity;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.router.interceptor.IInterceptor;
import com.ss.android.ugc.aweme.compliance.api.services.familypairing.IFamilyPairingService;
import com.ss.android.ugc.aweme.compliance.protection.familypairing.ChatSetRouter;
import com.ss.android.ugc.aweme.compliance.protection.familypairing.FamilyPairingRouter;
import com.ss.android.ugc.aweme.compliance.protection.familypairing.FamilyPiaringManager;

public final class FamilyPairingServiceImpl implements IFamilyPairingService {
    static {
        Covode.recordClassIndex(62127);
    }

    public final AnonymousClass40W LIZ() {
        return FamilyPiaringManager.LIZIZ.LIZ();
    }

    public final LsP LIZIZ() {
        return new FamilyPairingRouter();
    }

    public final LsP LIZJ() {
        return new ChatSetRouter();
    }

    public final IInterceptor LIZLLL() {
        return new ChatSetRouter();
    }

    public final boolean LJ() {
        AnonymousClass40L r0;
        Integer num;
        AnonymousClass40M r02 = FamilyPiaringManager.LIZ;
        if (r02 == null || (r0 = r02.LIZIZ) == null || (num = r0.LIZJ) == null || num.intValue() != 2) {
            return false;
        }
        return true;
    }

    public static IFamilyPairingService LJFF() {
        MethodCollector.i(14201);
        IFamilyPairingService iFamilyPairingService = (IFamilyPairingService) Lnj.LIZ(IFamilyPairingService.class, false);
        if (iFamilyPairingService != null) {
            MethodCollector.o(14201);
            return iFamilyPairingService;
        }
        Object LIZIZ = Lnj.LIZIZ(IFamilyPairingService.class, false);
        if (LIZIZ != null) {
            IFamilyPairingService iFamilyPairingService2 = (IFamilyPairingService) LIZIZ;
            MethodCollector.o(14201);
            return iFamilyPairingService2;
        }
        if (Lnj.LLIL == null) {
            synchronized (IFamilyPairingService.class) {
                try {
                    if (Lnj.LLIL == null) {
                        Lnj.LLIL = new FamilyPairingServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(14201);
                    throw th;
                }
            }
        }
        FamilyPairingServiceImpl familyPairingServiceImpl = (FamilyPairingServiceImpl) Lnj.LLIL;
        MethodCollector.o(14201);
        return familyPairingServiceImpl;
    }

    public final boolean LIZ(String str) {
        return FamilyPiaringManager.LIZIZ.LIZ(str);
    }

    public final void LIZ(Activity activity) {
        AnonymousClass40F r2 = AnonymousClass40F.LIZIZ;
        if (activity == null) {
            return;
        }
        if (!AnonymousClass40F.LJFF()) {
            AnonymousClass3BB r1 = new AnonymousClass3BB(activity);
            r1.LIZ((CharSequence) activity.getString(2131824770));
            r1.LIZIZ();
            return;
        }
        C23293Bp r12 = new C23293Bp(activity);
        AnonymousClass40F.LIZ(r12);
        r2.LIZ((AnonymousClass40S) new AnonymousClass40J(r12, activity));
    }

    public final void LIZ(Activity activity, String str) {
        M12.LIZ(str);
        AnonymousClass40F r2 = AnonymousClass40F.LIZIZ;
        if (activity == null) {
            return;
        }
        if (!AnonymousClass40F.LJFF()) {
            AnonymousClass3BB r1 = new AnonymousClass3BB(activity);
            r1.LIZ((CharSequence) activity.getString(2131824770));
            r1.LIZIZ();
            return;
        }
        C23293Bp r12 = new C23293Bp(activity);
        AnonymousClass40F.LIZ(r12);
        r2.LIZ((AnonymousClass40S) new AnonymousClass40I(r12, activity, str));
    }
}
