CamScanner.apk(点击下载) / SchoolSeasonGiftViewModel.java


package com.intsig.camscanner.gift.school;

import android.app.Application;
import android.content.Intent;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.MutableLiveData;
import com.intsig.camscanner.gift.lottery.LotteryActivityRequest;
import com.intsig.camscanner.gift.lottery.LotteryMethod;
import com.intsig.camscanner.gift.lottery.SchoolSeasonLotteryPrize;
import com.intsig.camscanner.gift.lottery.SchoolSeasonPrizeEntity;
import com.intsig.camscanner.log.LogAgentData;
import com.intsig.camscanner.tsapp.sync.SyncUtil;
import com.intsig.log.LogUtils;
import com.intsig.utils.ApplicationHelper;
import com.intsig.utils.ToastUtils;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;

/* compiled from: SchoolSeasonGiftViewModel.kt */
public final class SchoolSeasonGiftViewModel extends AndroidViewModel {

    /* renamed from: f  reason: collision with root package name */
    public static final Companion f20249f = new Companion(null);

    /* renamed from: a  reason: collision with root package name */
    private SchoolSeasonPrizeEntity f20250a;

    /* renamed from: b  reason: collision with root package name */
    private final MutableLiveData<SchoolSeasonLotteryPrize> f20251b = new MutableLiveData<>();

    /* renamed from: c  reason: collision with root package name */
    private final MutableLiveData<String> f20252c = new MutableLiveData<>();

    /* renamed from: d  reason: collision with root package name */
    private final MutableLiveData<Integer> f20253d = new MutableLiveData<>();

    /* renamed from: e  reason: collision with root package name */
    private final MutableLiveData<String> f20254e = new MutableLiveData<>();

    /* compiled from: SchoolSeasonGiftViewModel.kt */
    public static final class Companion {
        private Companion() {
        }

        public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        private final SchoolSeasonLotteryPrize b(String str) {
            if (str != null) {
                switch (str.hashCode()) {
                    case -1930294453:
                        if (!str.equals("cs_printer")) {
                            break;
                        } else {
                            return SchoolSeasonLotteryPrize.SCHOOL_SEASON_PRIZE_PRINTER;
                        }
                    case -1133027925:
                        if (!str.equals("vip_lifetime")) {
                            break;
                        } else {
                            return SchoolSeasonLotteryPrize.SCHOOL_SEASON_PRIZE_LIFE_LONG_PREMIUM;
                        }
                    case -894536279:
                        if (!str.equals("img2word_count")) {
                            break;
                        } else {
                            return SchoolSeasonLotteryPrize.SCHOOL_SEASON_PRIZE_2_TIMES_TO_WORD;
                        }
                    case 223316095:
                        if (!str.equals("qyi_discount")) {
                            break;
                        } else {
                            return SchoolSeasonLotteryPrize.SCHOOL_SEASON_PRIZE_IQIYI;
                        }
                    case 1487732455:
                        if (!str.equals("vip_7day")) {
                            break;
                        } else {
                            return SchoolSeasonLotteryPrize.SCHOOL_SEASON_PRIZE_7_DAY_PREMIUM;
                        }
                }
            }
            return SchoolSeasonLotteryPrize.SCHOOL_SEASON_PRIZE_IQIYI;
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public SchoolSeasonGiftViewModel(Application application) {
        super(application);
        Intrinsics.f(application, "app");
    }

    public static final /* synthetic */ void j(SchoolSeasonGiftViewModel schoolSeasonGiftViewModel, SchoolSeasonPrizeEntity schoolSeasonPrizeEntity) {
        schoolSeasonGiftViewModel.o(schoolSeasonPrizeEntity);
    }

    public static final /* synthetic */ SchoolSeasonPrizeEntity l(SchoolSeasonGiftViewModel schoolSeasonGiftViewModel) {
        return schoolSeasonGiftViewModel.f20250a;
    }

    private final void o(SchoolSeasonPrizeEntity schoolSeasonPrizeEntity) {
        int prizeType = schoolSeasonPrizeEntity.b().getPrizeType();
        if (prizeType != 1) {
            if (prizeType == 2) {
                this.f20254e.postValue("premiumFeature");
            } else if (prizeType == 3) {
                this.f20254e.postValue("https://www.wjx.top/vm/PivUnUV.aspx");
            } else if (prizeType != 4) {
            }
            this.f20252c.postValue("");
        }
        ToastUtils.o(ApplicationHelper.f39907a.e(), "领取成功,已自动发放到账号");
        this.f20252c.postValue("");
    }

    public final void C() {
        LotteryActivityRequest.f20237a.a(LotteryMethod.DRAW_AWARD, "school_open", null, new SchoolSeasonGiftViewModel$startLottery$1(this));
    }

    /* JADX WARNING: Removed duplicated region for block: B:17:0x0057  */
    /* JADX WARNING: Removed duplicated region for block: B:18:0x0059  */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x0068  */
    /* JADX WARNING: Removed duplicated region for block: B:28:0x008f  */
    /* JADX WARNING: Removed duplicated region for block: B:38:0x00a7  */
    /* JADX WARNING: Removed duplicated region for block: B:39:0x00a9  */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x00b6  */
    /* JADX WARNING: Removed duplicated region for block: B:48:0x00c4  */
    public final void D() {
        boolean z10;
        LogUtils.a("SchoolSeasonGiftViewModel", "tryToAcceptAwardWithLogin gift=" + this.f20250a);
        SchoolSeasonPrizeEntity schoolSeasonPrizeEntity = this.f20250a;
        Integer num = null;
        if (schoolSeasonPrizeEntity != null) {
            SchoolSeasonLotteryPrize b10 = schoolSeasonPrizeEntity.b();
            if (b10 != null) {
                num = Integer.valueOf(b10.getPrizeType());
            }
        }
        boolean z11 = false;
        if (num == null) {
            if (num == null) {
                if (num.intValue() == 4) {
                }
            }
            z10 = false;
            if (!z10) {
                if (num == null) {
                    if (num == null) {
                        if (num.intValue() == 3) {
                        }
                    }
                    if (z11) {
                        SchoolSeasonPrizeEntity schoolSeasonPrizeEntity2 = this.f20250a;
                        if (schoolSeasonPrizeEntity2 != null) {
                            o(schoolSeasonPrizeEntity2);
                            return;
                        }
                        return;
                    }
                    h();
                    return;
                } else if (num.intValue() != 2) {
                    if (num == null) {
                    }
                    if (z11) {
                    }
                }
                z11 = true;
                if (z11) {
                }
            } else if (!SyncUtil.t1(ApplicationHelper.f39907a.e())) {
                this.f20253d.postValue(1001);
                return;
            } else {
                h();
                return;
            }
        } else if (num.intValue() != 1) {
            if (num == null) {
            }
            z10 = false;
            if (!z10) {
            }
        }
        z10 = true;
        if (!z10) {
        }
    }

    public final void h() {
        SchoolSeasonPrizeEntity schoolSeasonPrizeEntity = this.f20250a;
        Unit unit = null;
        if (schoolSeasonPrizeEntity != null) {
            String a10 = schoolSeasonPrizeEntity.a();
            if (a10 != null) {
                if (!(!StringsKt__StringsJVMKt.s(a10))) {
                    a10 = null;
                }
                if (a10 != null) {
                    LogAgentData.b("CSBackSchoolReceivePop", "receive_prize", "prize_id", a10);
                    LotteryActivityRequest.f20237a.a(LotteryMethod.GET_AWARD, "school_open", a10, new SchoolSeasonGiftViewModel$acceptAward$2$1(this));
                    unit = Unit.f48405a;
                }
            }
        }
        if (unit == null) {
            LogUtils.c("SchoolSeasonGiftViewModel", "acceptAward but currentGift=" + this.f20250a);
        }
    }

    public final MutableLiveData<String> p() {
        return this.f20252c;
    }

    public final MutableLiveData<String> r() {
        return this.f20254e;
    }

    public final MutableLiveData<Integer> t() {
        return this.f20253d;
    }

    public final MutableLiveData<SchoolSeasonLotteryPrize> w() {
        return this.f20251b;
    }

    public final void x(int i10, int i11, Intent intent) {
        if (i10 == 1001 && SyncUtil.t1(ApplicationHelper.f39907a.e())) {
            h();
        }
    }
}