package com.ccwangluo.cc_quickly.utils

import com.tencent.mmkv.MMKV

/**
 * SharedPreferences管理工具基类
 *
 * @author xuexiang
 * @since 2018/11/27 下午5:16
 */
object SettingSPUtils {
    private val IS_FIRST_OPEN_KEY = "is_first_open_key"
    private val IS_AGREE_PRIVACY_KEY = "is_agree_privacy_key"
    /**
     * 是否是第一次启动
     */
    /**
     * 设置是否是第一次启动
     */
    var isFirstOpen: Boolean
        get() = MMKV.defaultMMKV().decodeBool(IS_FIRST_OPEN_KEY, true)
        set(isFirstOpen) {
            MMKV.defaultMMKV().putBoolean(IS_FIRST_OPEN_KEY, isFirstOpen)
        }

    /**
     * @return 是否同意隐私政策
     */
    var isAgreePrivacy: Boolean
        get() = MMKV.defaultMMKV().decodeBool(IS_AGREE_PRIVACY_KEY, false)
        set(isAgreePrivacy) {
            MMKV.defaultMMKV().putBoolean(IS_AGREE_PRIVACY_KEY, isAgreePrivacy)
        }
}