package com.ss.android.ugc.aweme.compliance.business.banappeal;

import X.0Gi;
import X.7he;
import X.8eL;
import X.9Fh;
import X.9Fi;
import X.AnonymousClass2GO;
import X.AnonymousClass2HZ;
import X.AnonymousClass456;
import X.AnonymousClass46V;
import X.AnonymousClass46W;
import X.AnonymousClass46X;
import X.AnonymousClass46Y;
import X.AnonymousClass48U;
import X.C30053af;
import X.C42353uV;
import X.C473246a;
import X.C473946h;
import X.C474046i;
import X.C49124Cy;
import X.Crj;
import X.EnQ;
import X.ISm;
import X.Rc9;
import X.SNU;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.IAccountUserService;
import com.ss.android.ugc.aweme.compliance.api.a;
import com.ss.android.ugc.aweme.compliance.api.model.AppealStatusResponse;
import com.ss.android.ugc.aweme.compliance.api.services.banappeal.IBanAppealService;
import com.ss.android.ugc.aweme.compliance.common.hydrogen.InitHydrogenTask;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public final class ComplianceBusinessActivityAssem extends EnQ implements AnonymousClass2HZ, AnonymousClass2GO {
    public static final AnonymousClass46Y LJIIIIZZ = new AnonymousClass46Y((byte) 0);
    public AnonymousClass46X LJFF;
    public boolean LJI;
    public final AtomicBoolean LJII = new AtomicBoolean(false);
    public final Crj LJIIIZ = 7he.LIZ(new AnonymousClass46W(this));
    public boolean LJIIJ;
    public boolean LJIIJJI = true;

    static {
        Covode.recordClassIndex(60708);
    }

    private final SNU LJIJJ() {
        return (SNU) this.LJIIIZ.getValue();
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(420, new Rc9(ComplianceBusinessActivityAssem.class, "onUserBannedEvent", C473946h.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    public final void LJIIL() {
        ComplianceBusinessActivityAssem.super.LJIIL();
        this.LJI = false;
    }

    private final void LJIJJLI() {
        C474046i.LIZIZ().logout("user_banned", "user_banned");
    }

    public final void LJIILLIIL() {
        ComplianceBusinessActivityAssem.super.LJIILLIIL();
        EventBus.LIZ().LIZIZ(this);
    }

    public final void LJIIJ() {
        ComplianceBusinessActivityAssem.super.LJIIJ();
        this.LJI = true;
        AnonymousClass46X r2 = this.LJFF;
        if (r2 != null) {
            if (r2.LIZ()) {
                AnonymousClass48U LJIJJ = LJIJJ();
                Objects.requireNonNull(LJIJJ, "null cannot be cast to non-null type com.ss.android.ugc.aweme.main.IMainActivityService");
                if (!LJIJJ.isADShowing()) {
                    r2.LIZLLL();
                }
            }
            if (r2.LIZJ()) {
                IAccountUserService LJFF2 = C474046i.LJFF();
                n.LIZIZ(LJFF2, "");
                if (LJFF2.isLogin()) {
                    LJIJJLI();
                }
            }
        }
    }

    public final void LIZ(Bundle bundle) {
        long uptimeMillis = SystemClock.uptimeMillis();
        EventBus.LIZ(EventBus.LIZ(), this);
        8eL.LIZ().execute(AnonymousClass456.LIZ);
        if (C473246a.LIZ().LIZ) {
            9Fh r0 = 9Fh.LJIILIIL;
            9Fi r1 = new 9Fi();
            r1.LIZ(new InitHydrogenTask());
            r1.LIZ();
        }
        C49124Cy.LIZ(getClass().getCanonicalName(), SystemClock.uptimeMillis() - uptimeMillis, "ON_CREATE_WITH_BUNDLE", (String) null);
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onUserBannedEvent(C473946h r7) {
        AnonymousClass46X r0 = this.LJFF;
        if ((r0 == null || !r0.LJ()) && this.LJI) {
            AnonymousClass48U LJIJJ = LJIJJ();
            Objects.requireNonNull(LJIJJ, "null cannot be cast to non-null type com.ss.android.ugc.aweme.main.IMainActivityService");
            if (!LJIJJ.isADShowing() && this.LJII.compareAndSet(false, true)) {
                SNU LJIJJ2 = LJIJJ();
                try {
                    IBanAppealService LIZJ = a.LIZJ();
                    IAccountUserService LJFF2 = C474046i.LJFF();
                    n.LIZIZ(LJFF2, "");
                    String curUserId = LJFF2.getCurUserId();
                    n.LIZIZ(curUserId, "");
                    LIZJ.LIZ(curUserId, (0Gi<AppealStatusResponse, Void>) new AnonymousClass46V(this, LJIJJ2));
                } catch (Exception unused) {
                    this.LJII.set(false);
                }
            }
        }
    }

    public final void LIZ(boolean z, boolean z2) {
        this.LJIIJ = false;
        if (z) {
            a.LJII().LIZIZ();
            if (this.LJIIJJI) {
                this.LJIIJJI = false;
                this.LJIIJ = true;
            }
        }
        if (!this.LJIIJ) {
            a.LJI().LIZ(LJIJJ(), new C42353uV());
        }
    }

    public final boolean LIZ(int i, int i2, Intent intent) {
        if (i2 == 10) {
            if (intent == null) {
                return false;
            }
            if (intent.getIntExtra("result", -1) == 0) {
                C30053af r1 = new C30053af((Activity) LJIJJ());
                r1.LJ(2131830845);
                C30053af.LIZ(r1);
            }
            return true;
        } else if (i != 17) {
            return false;
        } else {
            LJIJJLI();
            return true;
        }
    }
}
