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

import X.0Gf;
import X.0Gp;
import X.2Pr;
import X.2Qa;
import X.4eX;
import X.8Zb;
import X.BaX;
import X.C1446DZq;
import X.C2735Dud;
import X.C3070E0c;
import X.C3181E4j;
import X.C3250E7a;
import X.C3374EBu;
import X.C3443EEl;
import X.C3445EEn;
import X.C3490EGg;
import X.C3531EHv;
import X.C4053Ean;
import X.C4060Eau;
import X.C4068Eb2;
import X.C4146EcI;
import X.C5059Er1;
import X.C5096Erc;
import X.C5140EsK;
import X.Cdt;
import X.E4K;
import X.E92;
import X.EE3;
import X.EG3;
import X.EGC;
import X.EGE;
import X.EGJ;
import X.EGL;
import X.EGO;
import X.EI0;
import X.EI4;
import X.ENB;
import X.END;
import X.FNZ;
import X.Lnj;
import X.Ls2;
import X.M12;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.base.api.BaseResponse;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import com.ss.android.ugc.aweme.inbox.InboxFollowerFragment;
import com.ss.android.ugc.aweme.inbox.InboxFragment;
import com.ss.android.ugc.aweme.inbox.NotificationContainer;
import com.ss.android.ugc.aweme.notice.api.services.INoticeService;
import com.ss.android.ugc.aweme.notification.MusNewNotificationFragment;
import com.ss.android.ugc.aweme.notification.MusNotificationDetailActivity;
import com.ss.android.ugc.aweme.notification.NotificationFragment;
import com.ss.android.ugc.aweme.notification.followrequest.api.FollowRequestApiManager;
import com.ss.android.ugc.aweme.notification.followrequest.model.ApproveResponse;
import com.ss.android.ugc.aweme.notification.followrequest.model.RejectResponse;
import com.ss.android.ugc.aweme.profile.model.User;
import kotlin.h.b.n;

public final class NoticeServiceImpl implements INoticeService {
    static {
        Covode.recordClassIndex(95736);
    }

    public final C5096Erc LJFF() {
        return C4060Eau.LIZ;
    }

    public final Object LJI() {
        return C4053Ean.LIZLLL;
    }

    public final E92 LJII() {
        return C3250E7a.LIZ;
    }

    public final C3181E4j LJIIIZ() {
        return EI0.LIZ;
    }

    public final boolean LIZ(BaseResponse baseResponse) {
        M12.LIZ(baseResponse);
        if (!(baseResponse instanceof ApproveResponse) || ((ApproveResponse) baseResponse).approve_status != 0) {
            return false;
        }
        return true;
    }

    public final boolean LIZ(Context context, User user, String str, String str2, boolean z) {
        return E4K.LIZ(E4K.LIZ, context, user, str, str2, z, 16);
    }

    public final void LIZ(String str, C4068Eb2 eb2) {
        M12.LIZ(str, eb2);
        M12.LIZ(str);
        if (eb2 != null) {
            0Gp.LIZ(new 2Qa(eb2, str), 0Gp.LIZ, (0Gf) null);
        }
    }

    public final void LIZ(Handler handler, String str) {
        M12.LIZ(handler, str);
        FollowRequestApiManager.LIZ(handler, str, 0);
    }

    public final void LIZLLL() {
        C3374EBu.LIZ((Ls2<2Pr>) C3445EEn.LIZ);
    }

    public final 8Zb LJIIIIZZ() {
        return new EG3();
    }

    public final BaX LIZIZ() {
        END LIZIZ = ENB.LIZIZ();
        if (LIZIZ != null) {
            return LIZIZ;
        }
        return new EGL();
    }

    public final void LIZJ() {
        C3374EBu.LIZIZ(EGC.LIZ);
        0Gp.LIZ(EGJ.LIZ);
    }

    public final int LJ() {
        EE3 ee3 = EE3.LIZIZ;
        if (!EGO.LIZ.LIZIZ()) {
            return 0;
        }
        if (ee3.LIZ().LIZLLL || ee3.LIZ().LJI) {
            return 4;
        }
        if (ee3.LIZ().LJ) {
            return 3;
        }
        if (ee3.LIZ().LJFF) {
            return 2;
        }
        if (ee3.LIZ().LIZJ) {
            return 1;
        }
        return 0;
    }

    public static INoticeService LJIIJ() {
        MethodCollector.i(7992);
        INoticeService iNoticeService = (INoticeService) Lnj.LIZ(INoticeService.class, false);
        if (iNoticeService != null) {
            MethodCollector.o(7992);
            return iNoticeService;
        }
        Object LIZIZ = Lnj.LIZIZ(INoticeService.class, false);
        if (LIZIZ != null) {
            INoticeService iNoticeService2 = (INoticeService) LIZIZ;
            MethodCollector.o(7992);
            return iNoticeService2;
        }
        if (Lnj.J == null) {
            synchronized (INoticeService.class) {
                try {
                    if (Lnj.J == null) {
                        Lnj.J = new NoticeServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(7992);
                    throw th;
                }
            }
        }
        NoticeServiceImpl noticeServiceImpl = (NoticeServiceImpl) Lnj.J;
        MethodCollector.o(7992);
        return noticeServiceImpl;
    }

    public final <T extends AmeBaseFragment> Class<? extends T> LIZ() {
        if (C4146EcI.LIZ.LIZIZ()) {
            if (C2735Dud.LIZ.LIZ()) {
                return NotificationContainer.class;
            }
            return InboxFragment.class;
        } else if (!EGO.LIZ.LIZIZ() || C4146EcI.LIZ.LIZ() != 0) {
            return MusNewNotificationFragment.class;
        } else {
            return NotificationFragment.class;
        }
    }

    public final String LIZ(User user) {
        return 4eX.LIZ.LIZ((Context) null, user);
    }

    public final C1446DZq LIZ(Cdt cdt) {
        M12.LIZ(cdt);
        return new C3490EGg(cdt);
    }

    public final Intent LIZLLL(Context context) {
        M12.LIZ(context);
        return new Intent(context, MusNotificationDetailActivity.class);
    }

    public final View.OnClickListener LJ(Context context) {
        M12.LIZ(context);
        return new C3531EHv(context);
    }

    public final C5059Er1 LIZ(Activity activity) {
        M12.LIZ(activity);
        return new C5140EsK(activity);
    }

    public final boolean LIZIZ(Context context) {
        M12.LIZ(context);
        return EI4.LIZ.LIZIZ(context);
    }

    public final void LIZJ(Context context) {
        M12.LIZ(context);
        EI4.LIZ.LIZ(context);
    }

    public final boolean LIZIZ(BaseResponse baseResponse) {
        M12.LIZ(baseResponse);
        if (!(baseResponse instanceof RejectResponse) || ((RejectResponse) baseResponse).reject_status != 0) {
            return false;
        }
        return true;
    }

    public final void LIZ(int i) {
        C3374EBu.LIZ((Ls2<2Pr>) new C3443EEl(i));
    }

    /* JADX WARNING: Removed duplicated region for block: B:53:0x00e1 A[Catch:{ Exception -> 0x0107 }] */
    /* JADX WARNING: Removed duplicated region for block: B:62:? A[RETURN, SYNTHETIC] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(android.content.Context r15) {
        /*
            r14 = this;
            X.M12.LIZ(r15)
            X.M12.LIZ(r15)
            X.9Y3 r1 = X.9Y3.LIZ()
            r8 = 1
            java.lang.String r0 = "show_notification_guide_dialog"
            r3 = 0
            boolean r0 = X.9Y3.LIZ(r1, r8, r0, r3)
            r13 = 0
            if (r0 != 0) goto L_0x0018
            X.EGE.LIZ = r13
            return
        L_0x0018:
            android.os.Bundle r5 = X.EGE.LIZ
            if (r5 == 0) goto L_0x010d
            boolean r0 = X.FE1.LIZ(r15)
            if (r0 != 0) goto L_0x010b
            X.EGE r2 = X.EGE.LJFF
            long r0 = r2.LIZ((android.content.Context) r15)
            long r11 = r2.LIZIZ((android.content.Context) r15)
            long r9 = java.lang.System.currentTimeMillis()
            long r9 = r9 - r0
            int r0 = X.EGE.LIZJ
            long r1 = (long) r0
            r6 = 86400000(0x5265c00, double:4.2687272E-316)
            long r1 = r1 * r6
            int r0 = (r9 > r1 ? 1 : (r9 == r1 ? 0 : -1))
            if (r0 <= 0) goto L_0x010b
            int r0 = X.EGE.LIZIZ
            long r1 = (long) r0
            int r0 = (r11 > r1 ? 1 : (r11 == r1 ? 0 : -1))
            if (r0 >= 0) goto L_0x010b
            boolean r0 = X.EGE.LJ
            if (r0 == 0) goto L_0x010b
            java.lang.String r0 = "from_where"
            r6 = -1
            int r4 = r5.getInt(r0, r6)
            r2 = r15
        L_0x004f:
            if (r2 == 0) goto L_0x0066
            boolean r0 = r2 instanceof android.app.Activity     // Catch:{ Exception -> 0x0107 }
            if (r0 == 0) goto L_0x0058
            android.app.Activity r2 = (android.app.Activity) r2     // Catch:{ Exception -> 0x0107 }
            goto L_0x0063
        L_0x0058:
            boolean r0 = r2 instanceof android.content.ContextWrapper     // Catch:{ Exception -> 0x0107 }
            if (r0 == 0) goto L_0x0066
            android.content.ContextWrapper r2 = (android.content.ContextWrapper) r2     // Catch:{ Exception -> 0x0107 }
            android.content.Context r2 = r2.getBaseContext()     // Catch:{ Exception -> 0x0107 }
            goto L_0x004f
        L_0x0063:
            if (r2 != 0) goto L_0x006a
            goto L_0x0067
        L_0x0066:
            r2 = r13
        L_0x0067:
            kotlin.h.b.n.LIZIZ()     // Catch:{ Exception -> 0x0107 }
        L_0x006a:
            X.EGH r9 = new X.EGH     // Catch:{ Exception -> 0x0107 }
            r9.<init>(r4, r15)     // Catch:{ Exception -> 0x0107 }
            X.EGD r7 = new X.EGD     // Catch:{ Exception -> 0x0107 }
            r7.<init>(r4, r15)     // Catch:{ Exception -> 0x0107 }
            X.4EW r1 = new X.4EW     // Catch:{ Exception -> 0x0107 }
            r1.<init>(r2)     // Catch:{ Exception -> 0x0107 }
            X.EI6 r0 = new X.EI6     // Catch:{ Exception -> 0x0107 }
            r0.<init>(r9, r7)     // Catch:{ Exception -> 0x0107 }
            X.3QV.LIZ(r1, r0)     // Catch:{ Exception -> 0x0107 }
            r0 = 2131831215(0x7f1129af, float:1.929545E38)
            r1.LIZJ(r0)     // Catch:{ Exception -> 0x0107 }
            boolean r7 = X.S9B.LIZJ()     // Catch:{ Exception -> 0x0107 }
            r0 = 2131831213(0x7f1129ad, float:1.9295445E38)
            r0 = 2131831212(0x7f1129ac, float:1.9295443E38)
            r0 = 2131831211(0x7f1129ab, float:1.9295441E38)
            r0 = 2131831214(0x7f1129ae, float:1.9295447E38)
            if (r7 == 0) goto L_0x00a4
            if (r4 == 0) goto L_0x00bd
            if (r4 == r8) goto L_0x00b9
            r0 = 2
            if (r4 == r0) goto L_0x00c5
            r0 = 3
            if (r4 == r0) goto L_0x00c1
            goto L_0x00c8
        L_0x00a4:
            r0 = 21
            if (r4 == r0) goto L_0x00c5
            r0 = 31
            if (r4 == r0) goto L_0x00c1
            r0 = 33
            if (r4 == r0) goto L_0x00bd
            r0 = 41
            if (r4 == r0) goto L_0x00b9
            r0 = 45
            if (r4 == r0) goto L_0x00c5
            goto L_0x00c8
        L_0x00b9:
            r6 = 2131831213(0x7f1129ad, float:1.9295445E38)
            goto L_0x00c8
        L_0x00bd:
            r6 = 2131831212(0x7f1129ac, float:1.9295443E38)
            goto L_0x00c8
        L_0x00c1:
            r6 = 2131831211(0x7f1129ab, float:1.9295441E38)
            goto L_0x00c8
        L_0x00c5:
            r6 = 2131831214(0x7f1129ae, float:1.9295447E38)
        L_0x00c8:
            r1.LIZLLL(r6)     // Catch:{ Exception -> 0x0107 }
            X.EGE r0 = X.EGE.LJFF     // Catch:{ Exception -> 0x0107 }
            android.view.View r0 = r0.LIZ((android.content.Context) r15, (android.os.Bundle) r5)     // Catch:{ Exception -> 0x0107 }
            X.3QS.LIZ(r1, r0)     // Catch:{ Exception -> 0x0107 }
            r1.LIZ(r3)     // Catch:{ Exception -> 0x0107 }
            X.4EV r1 = r1.LIZ()     // Catch:{ Exception -> 0x0107 }
            boolean r0 = r2.isFinishing()     // Catch:{ Exception -> 0x0107 }
            if (r0 != 0) goto L_0x010d
            android.app.Dialog r0 = r1.LIZJ()     // Catch:{ Exception -> 0x0107 }
            X.4FQ.LIZ(r0)     // Catch:{ Exception -> 0x0107 }
            X.EGE r3 = X.EGE.LJFF     // Catch:{ Exception -> 0x0107 }
            X.2UX r2 = new X.2UX     // Catch:{ Exception -> 0x0107 }
            r2.<init>()     // Catch:{ Exception -> 0x0107 }
            java.lang.String r1 = "scene_id"
            java.lang.String r0 = "1001"
            r2.LIZ(r1, r0)     // Catch:{ Exception -> 0x0107 }
            java.lang.String r1 = "trigger_method"
            java.lang.String r0 = r3.LIZIZ((int) r4)     // Catch:{ Exception -> 0x0107 }
            r2.LIZ(r1, r0)     // Catch:{ Exception -> 0x0107 }
            java.util.Map r1 = r2.LIZ     // Catch:{ Exception -> 0x0107 }
            java.lang.String r0 = "push_pre_permission_show"
            X.2nK.LIZ(r0, r1)     // Catch:{ Exception -> 0x0107 }
            goto L_0x010b
        L_0x0107:
            r0 = move-exception
            X.0HH.LIZ(r0)
        L_0x010b:
            X.EGE.LIZ = r13
        L_0x010d:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.notification.service.NoticeServiceImpl.LIZ(android.content.Context):void");
    }

    public final void LIZIZ(Handler handler, String str) {
        M12.LIZ(handler, str);
        FollowRequestApiManager.LIZ(handler, str);
    }

    public final Intent LIZ(Context context, String str) {
        Class cls;
        M12.LIZ(context);
        if (C3070E0c.LIZJ.LJI() && n.LIZ(str, "follow")) {
            cls = InboxFollowerFragment.class;
        } else if (EGO.LIZ.LIZIZ()) {
            cls = NotificationFragment.class;
        } else {
            cls = MusNewNotificationFragment.class;
        }
        return FNZ.LIZ.LIZ(context, cls, (Bundle) null);
    }

    public final void LIZ(Bundle bundle, int i) {
        EGE.LJFF.LIZ(bundle, i);
    }

    public final void LIZ(Context context, String str, String str2) {
        M12.LIZ(context, str, str2);
        EI4.LIZ.LIZ(context, str, str2);
    }
}
