From 6403ddc78af1190995fa4f6335b57b3820fa2fc6 Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 22 四月 2025 14:20:10 +0800
Subject: [PATCH] add: 消息提醒图片,code工具类
---
app/src/main/java/com/example/firstapp/ui/home/HomeViewModel.kt | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/app/src/main/java/com/example/firstapp/ui/home/HomeViewModel.kt b/app/src/main/java/com/example/firstapp/ui/home/HomeViewModel.kt
index b367f26..1507d6e 100644
--- a/app/src/main/java/com/example/firstapp/ui/home/HomeViewModel.kt
+++ b/app/src/main/java/com/example/firstapp/ui/home/HomeViewModel.kt
@@ -192,17 +192,37 @@
loadDataByType("火车票")
}
+
+ fun loadAllCategoryData() {
+ getFullCategories().forEach { category ->
+ loadDataByType(category.name)
+ }
+ }
+
+
+ fun getFullCategories(): List<CategoryConfig> {
+ return listOf(
+ CategoryConfig(1, "快递", 0, true),
+ CategoryConfig(2, "还款", 1, true),
+ CategoryConfig(3, "收入", 2, true),
+ CategoryConfig(4, "航班", 3, true),
+ CategoryConfig(5, "火车票", 4, true)
+ )
+ }
+
private fun loadCategories() {
viewModelScope.launch {
try {
// 默认完整分类列表
- val fullCategories = listOf(
- CategoryConfig(1, "快递", 0, true),
- CategoryConfig(2, "还款", 1, true),
- CategoryConfig(3, "收入", 2, true),
- CategoryConfig(4, "航班", 3, true),
- CategoryConfig(5, "火车票", 4, true)
- )
+// val fullCategories = listOf(
+// CategoryConfig(1, "快递", 0, true),
+// CategoryConfig(2, "还款", 1, true),
+// CategoryConfig(3, "收入", 2, true),
+// CategoryConfig(4, "航班", 3, true),
+// CategoryConfig(5, "火车票", 4, true)
+// )
+
+ val fullCategories=getFullCategories()
// 基础分类(非会员可见)
val basicCategories = listOf(
@@ -359,6 +379,8 @@
// 只清除内存中的数据
_categories.value = emptyList()
categoriesLoaded = false
+ // 删除token
+ PreferencesManager.clearUserData()
}
}
\ No newline at end of file
--
Gitblit v1.9.3