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_ACC_SUCCESS = "is_first_acc_success"
    private val IS_AGREE_PRIVACY_KEY = "is_agree_privacy_key"
    private val IS_SMART_ACC_OPEN = "is_smart_acc_open"
    private val LAST_APP_SRART_TIME = "LAST_APP_SRART_TIME"


    /**
     * 设置是否是第一次启动加速
     */
    var isFirstAccSuccess: Boolean
        get() = MMKV.defaultMMKV().decodeBool(IS_FIRST_ACC_SUCCESS, true)
        set(isFirstOpen) {
            MMKV.defaultMMKV().putBoolean(IS_FIRST_ACC_SUCCESS, isFirstOpen)
        }

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

    var lastAPPOpenReportTime: Long
        get() =  MMKV.defaultMMKV().decodeLong(LAST_APP_SRART_TIME, 0L)
        set(lastAPPOpenReportTime) {
            MMKV.defaultMMKV().putLong(LAST_APP_SRART_TIME, lastAPPOpenReportTime)
        }


}