From 5fc9567cfa6b6beee4f52a9f835f304865d693e1 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 10 四月 2025 18:13:58 +0800
Subject: [PATCH] add: 消息提醒后版本
---
app/src/main/java/com/example/firstapp/utils/PreferencesManager.kt | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/app/src/main/java/com/example/firstapp/utils/PreferencesManager.kt b/app/src/main/java/com/example/firstapp/utils/PreferencesManager.kt
index 1b08dec..b9636a9 100644
--- a/app/src/main/java/com/example/firstapp/utils/PreferencesManager.kt
+++ b/app/src/main/java/com/example/firstapp/utils/PreferencesManager.kt
@@ -8,6 +8,8 @@
private const val KEY_TOKEN = "user_token"
private const val KEY_PHONE = "user_phone"
private const val KEY_FIRST_INSTALL = "first_install"
+ private const val LAST_LOGIN_PHONE = "last_login_phone"
+ private const val PREF_LAST_CHECK_TIME_PREFIX = "last_check_time_"
private lateinit var preferences: SharedPreferences
@@ -46,4 +48,20 @@
fun setFirstInstall(isFirst: Boolean) {
preferences.edit().putBoolean(KEY_FIRST_INSTALL, isFirst).apply()
}
+
+ fun saveLastLoginPhone(phone: String) {
+ preferences.edit().putString(LAST_LOGIN_PHONE, phone).apply()
+ }
+
+ fun getLastLoginPhone(): String {
+ return preferences.getString(LAST_LOGIN_PHONE, "") ?: ""
+ }
+
+ fun getLastCheckTime(categoryId: Int): Long {
+ return preferences.getLong(PREF_LAST_CHECK_TIME_PREFIX + categoryId, 0)
+ }
+
+ fun setLastCheckTime(categoryId: Int, time: Long) {
+ preferences.edit().putLong(PREF_LAST_CHECK_TIME_PREFIX + categoryId, time).apply()
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3