package com.ss.android.ugc.aweme.compliance.privacy.settings.account.pages.commentfilter.subadapters.dislike;

import X.C30053af;
import X.JMC;
import X.M12;
import X.PgU;
import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.base.api.BaseResponse;
import com.ss.android.ugc.aweme.compliance.common.api.ComplianceApi;
import com.ss.android.ugc.aweme.compliance.privacy.settings.base.BasePrivacySettingViewModel;
import java.lang.ref.WeakReference;
import kotlin.h.b.n;

public final class PermissionSettingItemViewModel extends BasePrivacySettingViewModel {
    public WeakReference<Fragment> LIZ;
    public final String LIZIZ;

    static {
        Covode.recordClassIndex(61666);
    }

    public PermissionSettingItemViewModel(String str) {
        M12.LIZ(str);
        this.LIZIZ = str;
    }

    public final PgU<BaseResponse> LIZ(int i) {
        return ComplianceApi.LIZ.LIZ().setUserSetting(this.LIZIZ, i);
    }

    public final void LIZ(int i, BaseResponse baseResponse) {
        Fragment fragment;
        M12.LIZ(baseResponse);
        super.LIZ(i, baseResponse);
        WeakReference<Fragment> weakReference = this.LIZ;
        if (weakReference != null && (fragment = (Fragment) weakReference.get()) != null) {
            n.LIZIZ(fragment, "");
            C30053af r1 = new C30053af(fragment);
            r1.LJ(2131822851);
            C30053af.LIZ(r1);
        }
    }

    public final void LIZ(int i, Throwable th) {
        Fragment fragment;
        String str;
        M12.LIZ(th);
        super.LIZ(i, th);
        WeakReference<Fragment> weakReference = this.LIZ;
        if (weakReference != null && (fragment = (Fragment) weakReference.get()) != null) {
            if (th instanceof JMC) {
                str = ((JMC) th).getErrorMsg();
            } else {
                str = "";
            }
            if (!TextUtils.isEmpty(str)) {
                n.LIZIZ(fragment, "");
                C30053af r0 = new C30053af(fragment);
                r0.LIZ((CharSequence) str);
                C30053af.LIZ(r0);
                return;
            }
            n.LIZIZ(fragment, "");
            C30053af r1 = new C30053af(fragment);
            r1.LJ(2131822850);
            C30053af.LIZ(r1);
        }
    }
}
