package com.adealink.weparty.room.datasource.local

import android.content.Context
import com.adealink.frame.storage.sp.TypeDelegationPrefs
import com.adealink.frame.util.AppUtil
import com.adealink.weparty.module.profile.ProfileModule
import com.adealink.weparty.storage.PREF_ROOM
import com.adealink.weparty.util.isSameDay

object RoomLocalService : TypeDelegationPrefs(
    prefs = {
        AppUtil.appContext.getSharedPreferences(PREF_ROOM, Context.MODE_PRIVATE)
    },
    userId = {
        ProfileModule.getMyUid()
    }
) {

    var lastEnterRoomId: String by PrefKey("key_last_enter_room", "")

    /**
     * 上一次钻石不足提示提醒的时间
     */
    var lastDiamondRemindTs: Long by PrefKey("key_last_diamond_remind_ts", 0)

    fun showDiamondRemind(): Boolean {
        return !isSameDay(lastDiamondRemindTs, System.currentTimeMillis())
    }

}