18034727885
2026-05-14 dad2ded3e9e9d2edf55c7ce10e791588b526961f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.example.smart.util
 
import com.example.basecore.util.SPUtils
 
object StatusProvider {
 
 
    /**
     * 登录状态
     */
    private const val login_status = "app_has_login"
    fun hasLogin(): Boolean = SPUtils.getBoolean(login_status, false)
 
    fun loginApp(uid: String, token:String) {
        SPUtils.putValue(login_status, true)
        putUid(uid)
        putToken(token)
    }
 
    fun loginOut() {
        SPUtils.putValue(login_status, false)
        SPUtils.putValue(userId, "")
        SPUtils.putValue(token, "")
    }
 
    private const val userId = "user_uid"
    fun getUid(): String = SPUtils.getString(userId, "")
 
    private fun putUid(uid: String) = SPUtils.putValue(this.userId, uid)
 
 
 
    private const val token = "user_token"
    fun getToken(): String = SPUtils.getString(token, "")
 
    private fun putToken(token: String) = SPUtils.putValue(this.token, token)
 
 
    /**
     * 是否已经显示过权限提示弹窗
     */
    private const val permission_guide = "permission_guide"
    fun isShownPermission(): Boolean {
        return SPUtils.getBoolean(permission_guide, false)
    }
 
    fun setPermissionShown() {
        SPUtils.putValue(permission_guide, true)
    }
 
}