opt: blacklist (#501)

This commit is contained in:
My-Responsitories
2025-03-23 19:13:07 +08:00
committed by GitHub
parent a8428e52d2
commit edf84fcc8f
7 changed files with 58 additions and 29 deletions

View File

@@ -26,11 +26,12 @@ class _BlackListPageState extends State<BlackListPage> {
@override
void dispose() {
List list = _blackListController.loadingState.value is Success
? (_blackListController.loadingState.value as Success).response
final list = _blackListController.loadingState.value is Success
? ((_blackListController.loadingState.value as Success).response
as List)
.cast<BlackListItem>()
: <BlackListItem>[];
GStorage.setBlackMidsList(
list.isNotEmpty ? list.map((e) => e.mid!).toList() : <int>[]);
GStorage.blackMids = list.map((e) => e.mid!).toSet();
super.dispose();
}

View File

@@ -32,10 +32,10 @@ class RcmdController extends CommonController {
bool shouldSaveLast =
enableSaveLastData && currentPage == 0 && currentList.isNotEmpty;
if (shouldSaveLast && currentList.length > 500) {
currentList = currentList.sublist(0, 50);
currentList.removeRange(50, currentList.length);
}
lastRefreshAt = shouldSaveLast && savedRcmdTip ? dataList.length : null;
return shouldSaveLast ? dataList + currentList : null;
return shouldSaveLast ? (dataList..addAll(currentList)) : null;
}
@override