TikTok.apk(点击下载) / AnonymousClass1GW.java


package X;

import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.profile.model.User;
import java.util.Objects;
import kotlin.g.b.m;

/* renamed from: X.1GW  reason: invalid class name */
public final class AnonymousClass1GW implements WeakHandler.IHandler {
    public static final String LJIIIIZZ = "https://api-va.tiktokv.com/aweme/v1/check/in/";
    public static final String LJIIIZ = "https://api-va.tiktokv.com/tiktok/v1/kids/check/in/";
    public static final AnonymousClass1GW LJIIJ = new AnonymousClass1GW();
    public static final C20330rO LJIIJJI = new C20330rO((byte) 0);
    public boolean LIZ;
    public boolean LIZIZ;
    public long LIZJ = -1;
    public final WeakHandler LIZLLL = new WeakHandler(Looper.getMainLooper(), this);
    public String LJ;
    public User LJFF;
    public C20370rS LJI;
    public String LJII;

    static {
        Covode.recordClassIndex(109011);
    }

    public static void LIZ(AnonymousClass1GW r5, String str) {
        if (!AnonymousClass0VL.LIZ().LIZ(true, "tiktok_iskidnow_opt_settings", false)) {
            r5.LIZLLL(str);
            return;
        }
        synchronized (C16390l2.LIZJ) {
            try {
                C16390l2.LIZ = null;
                C16390l2.LIZIZ = false;
            } catch (Throwable th) {
                throw th;
            }
        }
        r5.LIZLLL(str);
    }

    public static boolean LIZ(AnonymousClass1GW r5) {
        if (!AnonymousClass0VL.LIZ().LIZ(true, "tiktok_iskidnow_opt_settings", false)) {
            return r5.LIZLLL();
        }
        synchronized (C16390l2.LIZJ) {
            try {
                if (C16390l2.LIZ == null || !C16390l2.LIZ.equals(LJIIJ.LJ())) {
                    return r5.LIZLLL();
                }
                return C16390l2.LIZIZ;
            } finally {
            }
        }
    }

    private final String LJFF() {
        String str = this.LJ;
        if (str == null) {
            str = C20440rZ.LIZLLL.LJ();
        }
        this.LJ = str;
        return str;
    }

    public final synchronized User LIZ() {
        User user;
        user = this.LJFF;
        if (user == null) {
            user = C20440rZ.LIZLLL.LJIIIIZZ();
        }
        this.LJFF = user;
        if (user == null) {
            m.LIZIZ();
        }
        return user;
    }

    public final void LIZ(C20370rS r3) {
        C21090sc.LIZ(r3);
        if (m.LIZ((Object) r3.LIZ, (Object) LJ())) {
            this.LJI = null;
        }
        C20440rZ.LIZLLL.LIZ(r3);
    }

    public final void LIZ(String str) {
        if (str != null) {
            this.LJII = str;
            C20440rZ.LIZLLL.LIZJ(str);
        }
    }

    public final boolean LIZ(User user) {
        return user != null && !TextUtils.isEmpty(user.getUid());
    }

    public final void LIZIZ(User user) {
        if (LIZ(user)) {
            User LIZ2 = LIZ();
            this.LIZIZ = false;
            this.LIZJ = -1;
            this.LIZ = true;
            if (user == null) {
                m.LIZIZ();
            }
            LIZ(user.getUid());
            String secUid = user.getSecUid();
            if (secUid == null) {
                secUid = "";
            }
            C20440rZ.LIZLLL(secUid);
            C15570ji.LIZ(4, LIZ2, user);
            this.LJFF = user;
            C20440rZ.LIZLLL.LIZ(user);
            String uid = user.getUid();
            m.LIZIZ(uid, "");
            LIZ(this, uid);
            LIZJ();
            C20440rZ.LIZLLL.LJ();
        }
    }

    public final void LIZIZ(String str) {
        if (!TextUtils.equals(LIZ().getUniqueId(), str)) {
            LIZ().setUniqueId(str);
            this.LIZ = true;
            C20440rZ.LIZLLL.LIZ(LIZ());
        }
    }

    public final boolean LIZIZ() {
        return C20440rZ.LIZLLL.LIZ(LJFF());
    }

    public final void LIZJ() {
        C20440rZ.LIZLLL.LJIIJ();
        C15570ji.LIZ(5, null, LIZ());
        C15570ji.LIZ.LIZ();
    }

    public final void LIZJ(String str) {
        if (str != null && !C20440rZ.LIZLLL.LJII(str)) {
            if (m.LIZ((Object) str, (Object) LJFF())) {
                this.LJ = null;
                this.LJFF = null;
                this.LJI = null;
            }
            C20440rZ.LIZLLL.LJI(str);
        }
    }

    public final void LIZLLL(String str) {
        C21090sc.LIZ(str);
        if (!m.LIZ((Object) str, (Object) LJFF())) {
            this.LJFF = null;
            this.LJ = str;
            this.LJI = null;
            C20440rZ.LIZLLL.LIZIZ(str);
        }
    }

    public final boolean LIZLLL() {
        if (LIZ().getAgeGatePostAction() == 1) {
            return true;
        }
        C20370rS r0 = this.LJI;
        if (r0 == null) {
            r0 = C20440rZ.LIZLLL.LJ(LJ());
        }
        this.LJI = r0;
        if (r0 == null) {
            return false;
        }
        if (r0 == null) {
            m.LIZIZ();
        }
        return r0.LJI;
    }

    public final C20300rL LJ(String str) {
        C21090sc.LIZ(str);
        return C20440rZ.LIZLLL.LJFF(str);
    }

    public final String LJ() {
        String LJFF2 = LJFF();
        if (LJFF2 == null) {
            m.LIZIZ();
        }
        return LJFF2;
    }

    public final C20370rS LJFF(String str) {
        C21090sc.LIZ(str);
        return C20440rZ.LIZLLL.LJ(str);
    }

    @Override // com.bytedance.common.utility.collection.WeakHandler.IHandler
    public final void handleMsg(Message message) {
        C21090sc.LIZ(message);
        if (!(message.obj instanceof Exception)) {
            int i2 = message.what;
            if (i2 != 112) {
                if (i2 == 113) {
                    C15570ji.LIZ(11, null, null);
                }
            } else if (message.obj != null && (message.obj instanceof User)) {
                if (!C15900kF.LIZ) {
                    Object obj = message.obj;
                    Objects.requireNonNull(obj, "null cannot be cast to non-null type com.ss.android.ugc.aweme.profile.model.User");
                    LIZIZ((User) obj);
                    return;
                }
                Object obj2 = message.obj;
                Objects.requireNonNull(obj2, "null cannot be cast to non-null type com.ss.android.ugc.aweme.profile.model.User");
                C14740iN.LIZJ().execute(new RunnableC20340rP(this, (User) obj2));
            }
        }
    }
}