package com.jishisongfu.duobibi.util

import android.content.Context

/** 首启 onboarding 是否已完成。隐私同意之后、进入主界面之前播一次。 */
object OnboardingPrefs {

    private const val PREFS = "onboarding_prefs"
    private const val KEY_COMPLETED = "completed"

    fun completed(ctx: Context): Boolean =
        ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(KEY_COMPLETED, false)

    fun setCompleted(ctx: Context, value: Boolean) {
        ctx.getSharedPreferences(PREFS, Context.MODE_PRIVATE)
            .edit()
            .putBoolean(KEY_COMPLETED, value)
            .apply()
    }
}
