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

import X.0Bt;
import X.1Bn;
import X.AnonymousClass2UX;
import X.AnonymousClass2cN;
import X.AnonymousClass49E;
import X.AnonymousClass49K;
import X.AnonymousClass49L;
import X.AnonymousClass49O;
import X.AnonymousClass49P;
import X.AnonymousClass49Q;
import X.AnonymousClass49R;
import X.AnonymousClass49V;
import X.AnonymousClass49X;
import X.AnonymousClass49Y;
import X.C03012Pr;
import X.C12422nK;
import X.C34683i8;
import X.C474046i;
import X.C481149b;
import X.Ls2;
import X.M12;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.bytedance.covode.number.Covode;
import com.bytedance.router.SmartRoute;
import com.bytedance.router.SmartRouter;
import com.ss.android.ugc.aweme.IAccountUserService;
import com.ss.android.ugc.aweme.compliance.api.model.AppealStatusResponse;
import java.util.List;
import kotlin.h.b.n;

public final class NewAppealDialogViewModel extends 0Bt {
    public static final C481149b LJFF = new C481149b((byte) 0);
    public final 1Bn<AnonymousClass49E> LIZ = new 1Bn<>();
    public boolean LIZIZ;
    public AnonymousClass2cN LIZJ;
    public final Context LIZLLL;
    public final AppealStatusResponse LJ;
    public final Ls2<C03012Pr> LJI;

    static {
        Covode.recordClassIndex(60749);
    }

    public final int LIZ() {
        if (this.LJ.getAppealType() != 12) {
            return 0;
        }
        return 1;
    }

    public final void onCleared() {
        AnonymousClass2cN r0 = this.LIZJ;
        if (r0 != null) {
            r0.dispose();
        }
        NewAppealDialogViewModel.super.onCleared();
    }

    public final void LIZIZ(String str) {
        SmartRoute buildRoute = SmartRouter.buildRoute(this.LIZLLL, "//webview");
        buildRoute.withParam(Uri.parse(str));
        buildRoute.open(17);
    }

    public final void LIZ(String str) {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
        intent.addFlags(268435456);
        intent.addCategory("android.intent.category.BROWSABLE");
        try {
            Context context = this.LIZLLL;
            C34683i8.LIZ(intent, context);
            context.startActivity(intent);
            this.LJI.invoke();
        } catch (ActivityNotFoundException unused) {
            SmartRoute buildRoute = SmartRouter.buildRoute(this.LIZLLL, "//webview");
            buildRoute.withParam(Uri.parse(str));
            buildRoute.open(17);
        }
    }

    public final void LIZJ(String str) {
        AnonymousClass2UX r2 = new AnonymousClass2UX();
        r2.LIZ("appeal_type", str);
        r2.LIZ("ban_appeal_type", LIZ());
        IAccountUserService LJFF2 = C474046i.LJFF();
        n.LIZIZ(LJFF2, "");
        r2.LIZ("user_id", LJFF2.getCurUserId());
        C12422nK.LIZ("pop_appeal", r2.LIZ);
    }

    public final AppealStatusResponse LIZ(AppealStatusResponse appealStatusResponse) {
        int status;
        AppealStatusResponse appealStatusResponse2 = appealStatusResponse;
        M12.LIZ(appealStatusResponse2);
        if (appealStatusResponse2.getStatus() != 5) {
            status = appealStatusResponse2.getStatus();
        } else if (appealStatusResponse2.getBanType() == 4) {
            status = 8;
        } else if (appealStatusResponse2.getBanType() == 1 && appealStatusResponse2.getBanTime() < 31536000) {
            status = 7;
        } else if (appealStatusResponse2.getBanTime() > 31536000) {
            status = 6;
        } else {
            status = appealStatusResponse2.getStatus();
        }
        return AppealStatusResponse.copy$default(appealStatusResponse2, status, 0, 0, 0, (String) null, (String) null, (String) null, (List) null, 254, (Object) null);
    }

    private final AnonymousClass49V LIZ(AnonymousClass49Y r4) {
        if (r4 == null) {
            return null;
        }
        Integer num = r4.LIZJ;
        int ordinal = AnonymousClass49X.EXTERNAL_WEB.ordinal();
        if (num != null && num.intValue() == ordinal) {
            return new AnonymousClass49V(r4.LIZ, new AnonymousClass49Q(this, r4));
        }
        int ordinal2 = AnonymousClass49X.LOGOUT.ordinal();
        if (num != null && num.intValue() == ordinal2) {
            return new AnonymousClass49V(r4.LIZ, new AnonymousClass49L(this));
        }
        int ordinal3 = AnonymousClass49X.INTERNAL_WEB.ordinal();
        if (num != null && num.intValue() == ordinal3) {
            return new AnonymousClass49V(r4.LIZ, new AnonymousClass49R(this, r4));
        }
        int ordinal4 = AnonymousClass49X.EXTERNAL_APPEAL_WEB.ordinal();
        if (num != null && num.intValue() == ordinal4) {
            return new AnonymousClass49V(r4.LIZ, new AnonymousClass49O(this, r4));
        }
        int ordinal5 = AnonymousClass49X.INTERNAL_APPEAL_WEB.ordinal();
        if (num != null && num.intValue() == ordinal5) {
            return new AnonymousClass49V(r4.LIZ, new AnonymousClass49P(this, r4));
        }
        return new AnonymousClass49V(r4.LIZ, new AnonymousClass49K(this, r4));
    }

    /* JADX WARNING: Code restructure failed: missing block: B:23:0x005f, code lost:
        if (r2.intValue() != r1) goto L_0x0052;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final X.AnonymousClass49E LIZ(int r19, boolean r20) {
        /*
            r18 = this;
            r3 = r18
            r3 = r3
            com.ss.android.ugc.aweme.compliance.api.model.AppealStatusResponse r0 = r3.LJ
            java.util.List r0 = r0.getButtonList()
            r9 = 0
            r7 = 1
            if (r0 == 0) goto L_0x0013
            boolean r0 = r0.isEmpty()
            if (r0 == 0) goto L_0x006c
        L_0x0013:
            r0 = 1
        L_0x0014:
            r13 = 0
            if (r0 != 0) goto L_0x006e
            com.ss.android.ugc.aweme.compliance.api.model.AppealStatusResponse r0 = r3.LJ
            java.util.List r0 = r0.getButtonList()
            if (r0 != 0) goto L_0x0022
            kotlin.h.b.n.LIZIZ()
        L_0x0022:
            java.util.Iterator r8 = r0.iterator()
            r5 = r13
            r4 = r5
        L_0x0028:
            boolean r0 = r8.hasNext()
            if (r0 == 0) goto L_0x0070
            java.lang.Object r6 = r8.next()
            X.49Y r6 = (X.AnonymousClass49Y) r6
            java.lang.Integer r2 = r6.LIZJ
            X.49X r0 = X.AnonymousClass49X.LOGOUT
            int r1 = r0.ordinal()
            if (r2 != 0) goto L_0x0064
        L_0x003e:
            java.lang.Integer r2 = r6.LIZJ
            X.49X r0 = X.AnonymousClass49X.EXTERNAL_APPEAL_WEB
            int r1 = r0.ordinal()
            if (r2 != 0) goto L_0x0054
        L_0x0048:
            java.lang.Integer r2 = r6.LIZJ
            X.49X r0 = X.AnonymousClass49X.INTERNAL_APPEAL_WEB
            int r1 = r0.ordinal()
            if (r2 != 0) goto L_0x005b
        L_0x0052:
            r4 = r6
            goto L_0x0028
        L_0x0054:
            int r0 = r2.intValue()
            if (r0 == r1) goto L_0x0061
            goto L_0x0048
        L_0x005b:
            int r0 = r2.intValue()
            if (r0 != r1) goto L_0x0052
        L_0x0061:
            r3.LIZIZ = r7
            goto L_0x0052
        L_0x0064:
            int r0 = r2.intValue()
            if (r0 != r1) goto L_0x003e
            r5 = r6
            goto L_0x0028
        L_0x006c:
            r0 = 0
            goto L_0x0014
        L_0x006e:
            r5 = r13
            r4 = r5
        L_0x0070:
            X.49E r10 = new X.49E
            com.ss.android.ugc.aweme.compliance.api.model.AppealStatusResponse r0 = r3.LJ
            java.lang.String r11 = r0.getPopTitle()
            com.ss.android.ugc.aweme.compliance.api.model.AppealStatusResponse r0 = r3.LJ
            java.lang.String r12 = r0.getPopContent()
            java.lang.String r6 = ""
            if (r12 != 0) goto L_0x0083
            r12 = r6
        L_0x0083:
            if (r20 != 0) goto L_0x009c
        L_0x0085:
            X.49V r14 = r3.LIZ((X.AnonymousClass49Y) r5)
            X.49V r15 = r3.LIZ((X.AnonymousClass49Y) r4)
            X.49W r0 = new X.49W
            r1 = r19
            r0.<init>(r3, r1)
            r17 = 32
            r16 = r0
            r10.<init>(r11, r12, r13, r14, r15, r16, r17)
            return r10
        L_0x009c:
            X.49I r13 = new X.49I
            android.content.Context r2 = r3.LIZLLL
            r1 = 2131824150(0x7f110e16, float:1.928112E38)
            java.lang.Object[] r0 = new java.lang.Object[r7]
            r0[r9] = r6
            java.lang.String r2 = r2.getString(r1, r0)
            kotlin.h.b.n.LIZIZ(r2, r6)
            android.content.Context r1 = r3.LIZLLL
            r0 = 2131824148(0x7f110e14, float:1.9281116E38)
            java.lang.String r1 = r1.getString(r0)
            kotlin.h.b.n.LIZIZ(r1, r6)
            X.2zp r0 = new X.2zp
            r0.<init>(r3)
            r13.<init>(r2, r1, r0)
            goto L_0x0085
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.compliance.business.banappeal.viewmodel.NewAppealDialogViewModel.LIZ(int, boolean):X.49E");
    }

    public final void LIZ(String str, int i) {
        AnonymousClass2UX r2 = new AnonymousClass2UX();
        r2.LIZ("ban_appeal_type", i);
        IAccountUserService LJFF2 = C474046i.LJFF();
        n.LIZIZ(LJFF2, "");
        r2.LIZ("user_id", LJFF2.getCurUserId());
        C12422nK.LIZ(str, r2.LIZ);
    }

    public NewAppealDialogViewModel(Context context, AppealStatusResponse appealStatusResponse, Ls2<C03012Pr> ls2) {
        M12.LIZ(context, appealStatusResponse, ls2);
        this.LIZLLL = context;
        this.LJ = appealStatusResponse;
        this.LJI = ls2;
    }
}
