diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index 85aa65267..86daf704b 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -259,7 +259,7 @@ class DefaultUser extends StatelessWidget { } } -Widget msgBadge(mainController) { +Widget msgBadge(MainController mainController) { void toWhisper() { mainController.msgUnReadCount.value = ''; mainController.lastCheckUnreadAt = DateTime.now().millisecondsSinceEpoch; diff --git a/lib/pages/main/controller.dart b/lib/pages/main/controller.dart index cc42ef5b2..943b63fa6 100644 --- a/lib/pages/main/controller.dart +++ b/lib/pages/main/controller.dart @@ -33,7 +33,7 @@ class MainController extends GetxController { late int homeIndex = -1; late DynamicBadgeMode msgBadgeMode = GStorage.msgBadgeMode; - late Set msgUnReadTypes = GStorage.msgUnReadTypeV2.toSet(); + late Set msgUnReadTypes = GStorage.msgUnReadTypeV2; late final RxString msgUnReadCount = ''.obs; late int lastCheckUnreadAt = 0; diff --git a/lib/pages/search/controller.dart b/lib/pages/search/controller.dart index 79afa8a06..09b80f2fa 100644 --- a/lib/pages/search/controller.dart +++ b/lib/pages/search/controller.dart @@ -1,7 +1,5 @@ import 'package:PiliPlus/common/widgets/dialog.dart'; import 'package:PiliPlus/http/loading_state.dart'; -import 'package:PiliPlus/pages/mine/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:PiliPlus/http/search.dart'; @@ -94,7 +92,7 @@ class SSearchController extends GetxController { validateUid(); } - if (MineController.anonymity.value.not && recordSearchHistory.value) { + if (recordSearchHistory.value) { historyList.remove(controller.text); historyList.insert(0, controller.text); GStorage.historyWord.put('cacheList', historyList); diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 892c2df7e..82e30a40f 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -112,11 +112,11 @@ class GStorage { defaultValue: DynamicBadgeMode.number.index, )]; - static List get msgUnReadTypeV2 => List.from(setting.get( - SettingBoxKey.msgUnReadTypeV2, - defaultValue: - List.generate(MsgUnReadType.values.length, (index) => index), - )).map((index) => MsgUnReadType.values[index]).toList(); + static Set get msgUnReadTypeV2 => + (setting.get(SettingBoxKey.msgUnReadTypeV2) as List?) + ?.map((index) => MsgUnReadType.values[index]) + .toSet() ?? + MsgUnReadType.values.toSet(); static int get defaultHomePage => setting.get(SettingBoxKey.defaultHomePage, defaultValue: 0);