package com.ss.android.ugc.aweme.feed.motivatelogin;

import X.1hK;
import X.AnonymousClass2UX;
import X.AnonymousClass3PM;
import X.AnonymousClass46G;
import X.AnonymousClass46H;
import X.AnonymousClass46O;
import X.C12422nK;
import X.C472345r;
import X.C474046i;
import X.JtV;
import X.Lnj;
import X.M12;
import X.T25;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.keva.Keva;
import com.ss.android.ugc.aweme.IAccountUserService;
import com.ss.android.ugc.aweme.social.service.IMotivateLoginService;
import kotlin.h.b.n;

public final class MotivateLoginPopupManager implements IMotivateLoginService {
    public static final AnonymousClass46O LIZ = new AnonymousClass46O((byte) 0);

    static {
        Covode.recordClassIndex(79097);
    }

    public static IMotivateLoginService LIZ() {
        MethodCollector.i(1708);
        IMotivateLoginService iMotivateLoginService = (IMotivateLoginService) Lnj.LIZ(IMotivateLoginService.class, false);
        if (iMotivateLoginService != null) {
            MethodCollector.o(1708);
            return iMotivateLoginService;
        }
        Object LIZIZ = Lnj.LIZIZ(IMotivateLoginService.class, false);
        if (LIZIZ != null) {
            IMotivateLoginService iMotivateLoginService2 = (IMotivateLoginService) LIZIZ;
            MethodCollector.o(1708);
            return iMotivateLoginService2;
        }
        if (Lnj.LLJZIJLIL == null) {
            synchronized (IMotivateLoginService.class) {
                try {
                    if (Lnj.LLJZIJLIL == null) {
                        Lnj.LLJZIJLIL = new MotivateLoginPopupManager();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(1708);
                    throw th;
                }
            }
        }
        MotivateLoginPopupManager motivateLoginPopupManager = (MotivateLoginPopupManager) Lnj.LLJZIJLIL;
        MethodCollector.o(1708);
        return motivateLoginPopupManager;
    }

    public final void LIZ(String str) {
        AnonymousClass2UX r2 = new AnonymousClass2UX();
        r2.LIZ("enter_from", "homepage_hot");
        r2.LIZ("action_type", str);
        C12422nK.LIZ("signup_login_popup", r2.LIZ);
    }

    /* JADX WARNING: type inference failed for: r1v6, types: [X.3hc, X.45r] */
    public final void LIZ(1hK r8) {
        int i;
        int i2;
        int i3;
        M12.LIZ(r8);
        if (((Boolean) JtV.LIZIZ.getValue()).booleanValue()) {
            AnonymousClass46H r3 = AnonymousClass46H.LIZIZ;
            IAccountUserService LJFF = C474046i.LJFF();
            String str = "";
            n.LIZIZ(LJFF, str);
            String curUserId = LJFF.getCurUserId();
            if (curUserId != null) {
                str = curUserId;
            }
            if (!n.LIZ(str, AnonymousClass46H.LIZ)) {
                AnonymousClass46H.LIZ = str;
            }
            Keva LIZ2 = r3.LIZ();
            int i4 = LIZ2.getInt("key_per_round_show_count", 0);
            Integer num = AnonymousClass46H.LIZIZ.LIZIZ().LIZIZ;
            if (num != null) {
                i = num.intValue();
            } else {
                i = 3;
            }
            if (i4 >= i) {
                long currentTimeMillis = (System.currentTimeMillis() - LIZ2.getLong("key_last_show_time", 0)) / 86400000;
                AnonymousClass3PM.LIZIZ("motivate login", String.valueOf(currentTimeMillis));
                Integer num2 = AnonymousClass46H.LIZIZ.LIZIZ().LIZJ;
                if (num2 != null) {
                    i3 = num2.intValue();
                } else {
                    i3 = 7;
                }
                if (currentTimeMillis < ((long) i3)) {
                    return;
                }
            } else {
                long currentTimeMillis2 = (System.currentTimeMillis() - LIZ2.getLong("key_last_show_time", 0)) / 3600000;
                AnonymousClass3PM.LIZIZ("motivate login", String.valueOf(currentTimeMillis2));
                Integer num3 = AnonymousClass46H.LIZIZ.LIZIZ().LIZ;
                if (num3 != null) {
                    i2 = num3.intValue();
                } else {
                    i2 = 24;
                }
                if (currentTimeMillis2 < ((long) i2)) {
                    return;
                }
            }
            T25.LIZIZ(new C472345r(r8, new AnonymousClass46G(this)));
        }
    }
}
