package com.ss.android.ugc.aweme.relation.authcard.vm;

import X.2Pr;
import X.2YN;
import X.2cN;
import X.46i;
import X.4Dd;
import X.7AW;
import X.Ane;
import X.C1347DVv;
import X.C1370DWs;
import X.C1377DWz;
import X.C5285Euf;
import X.DW3;
import X.DW4;
import X.DWS;
import X.DX0;
import X.DX6;
import X.DX7;
import X.DX9;
import X.F1O;
import X.F6Z;
import X.LsC;
import X.M12;
import X.Mjy;
import X.Mk2;
import X.Mk3;
import X.PgU;
import X.PgX;
import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.bytedance.keva.Keva;
import com.ss.android.ugc.aweme.IAccountUserService;
import com.ss.android.ugc.aweme.relation.base.list.cell.BaseCellVM;
import com.ss.android.ugc.aweme.relation.usercard.vm.RelationUserCardListVM;
import java.util.Map;
import kotlin.h.b.n;

public final class AuthCellVM extends BaseCellVM<DW4, RelationUserCardListVM> {
    public final Mjy compositeDisposable = new Mjy();

    static {
        Covode.recordClassIndex(102658);
    }

    public final void onCleared() {
        AuthCellVM.super.onCleared();
        this.compositeDisposable.LIZ();
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public AuthCellVM(RelationUserCardListVM relationUserCardListVM) {
        super(relationUserCardListVM);
        M12.LIZ(relationUserCardListVM);
    }

    public final void onShow(int i, DW4 dw4) {
        M12.LIZ(dw4);
        ((RelationUserCardListVM) getListVM()).LIZ(new DX7(this, i, dw4));
    }

    public final void remove(int i, DW4 dw4) {
        M12.LIZ(dw4);
        ((RelationUserCardListVM) getListVM()).LIZ(new DX6(this, i, dw4));
    }

    public final void onAuthorizeClick(Context context, DW4 dw4, int i) {
        Class<? extends F1O> LJII;
        Context context2 = context;
        M12.LIZ(context2, dw4);
        this.compositeDisposable.LIZ();
        DW3 dw3 = dw4.LIZ;
        Keva repo = Keva.getRepo("social_permission_card_freq_" + DX9.LIZ());
        n.LIZIZ(repo, "");
        M12.LIZ(dw3, repo);
        repo.storeInt(DX9.LIZ(dw3, "key_exp_count_"), 0);
        repo.storeInt(DX9.LIZ(dw3, "key_delete_count_"), 0);
        repo.storeLong(DX9.LIZ(dw3, "key_delete_hide_ts_"), -1);
        repo.storeLong(DX9.LIZ(dw3, "key_auto_hide_ts_"), -1);
        int i2 = C1347DVv.LIZ[dw4.LIZ.LIZ.ordinal()];
        if (i2 == 1) {
            LJII = C5285Euf.LIZ.LJII();
        } else if (i2 == 2) {
            LJII = C5285Euf.LIZ.LJ();
        } else {
            throw new 7AW();
        }
        DWS dws = (DWS) ((RelationUserCardListVM) getListVM()).LIZ(C1370DWs.LIZ);
        F6Z f6z = F6Z.LIZ;
        IAccountUserService LJFF = 46i.LJFF();
        n.LIZIZ(LJFF, "");
        String curUserId = LJFF.getCurUserId();
        if (curUserId == null) {
            curUserId = "";
        }
        PgU LIZ = f6z.LIZ(context2, LJII, curUserId, dws.LIZ, "click", true, false, (Map<String, String>) null).LIZ(Mk2.LIZ(Mk3.LIZ));
        2YN r0 = PgX.LIZLLL;
        2cN LIZ2 = LIZ.LIZ(r0, r0);
        n.LIZIZ(LIZ2, "");
        4Dd.LIZ(LIZ2, this.compositeDisposable);
        new Ane(dws.LIZ, dws.LIZIZ, dws.LIZLLL, dws.LIZJ, dw4.LIZ.LIZ).LIZJ();
        ((RelationUserCardListVM) getListVM()).LIZIZ((LsC<? super C1377DWz, 2Pr>) new DX0(dw4, i));
    }
}
