package com.epson.mobilephone.common;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.MutableLiveData;

import android.support.annotation.VisibleForTesting;
import java.util.Locale;

public class ReviewInvitationViewModel extends AndroidViewModel {
    private final MutableLiveData<Boolean> mShowStoreInvitation = new MutableLiveData<>();
    private StoreReview mStoreReview = new StoreReview();

    public ReviewInvitationViewModel(@NonNull Application application) {
        super(application);
        mShowStoreInvitation.setValue(false);
    }

    /* access modifiers changed from: package-private */
    @VisibleForTesting
    public void setStoreReviewObject(StoreReview storeReview) {
        mStoreReview = storeReview;
    }

    public MutableLiveData<Boolean> getShowInvitationLiveData() {
        return mShowStoreInvitation;
    }

    public void setStartStoreEnd() {
        mShowStoreInvitation.setValue(false);
    }

    public void onPrintEnd(boolean z) {
        if (z && checkLanguage() && mStoreReview.checkPrintSuccessCount(getApplication())) {
            mShowStoreInvitation.setValue(true);
        }
    }

    /* access modifiers changed from: package-private */
    @VisibleForTesting
    public boolean checkLanguage() {
        String languageString = getLanguageString();
        return Locale.ENGLISH.getLanguage().equals(languageString) || Locale.JAPANESE.getLanguage().equals(languageString);
    }

    /* access modifiers changed from: package-private */
    @VisibleForTesting
    public String getLanguageString() {
        return Locale.getDefault().getLanguage();
    }
}
