revert: toSet (#941)

This commit is contained in:
My-Responsitories
2025-08-05 21:36:21 +08:00
committed by GitHub
parent 80a4c8c24d
commit 9f33488248
7 changed files with 12 additions and 12 deletions

View File

@@ -72,12 +72,12 @@ mixin CommonMultiSelectMixin<T extends MultiSelectData>
mixin DeleteItemMixin<R, T extends MultiSelectData>
on CommonListController<R, T>, CommonMultiSelectMixin<T> {
Future<void> afterDelete(Iterable<T> removeList) async {
Future<void> afterDelete(Set<T> removeList) async {
final list = loadingState.value.data!;
if (removeList.length == list.length) {
list.clear();
} else if (removeList.length == 1) {
list.remove(removeList.single);
list.remove(removeList.first);
} else {
list.removeWhere(removeList.contains);
}

View File

@@ -36,7 +36,7 @@ class FavNoteController
@override
Future<void> onRemove() async {
final removeList = allChecked;
final removeList = allChecked.toSet();
final res = await FavHttp.delNote(
isPublish: isPublish,
noteIds: removeList

View File

@@ -71,7 +71,7 @@ class FavPgcController
}
Future<void> onUpdateList(int followStatus) async {
final removeList = allChecked;
final removeList = allChecked.toSet();
final res = await VideoHttp.pgcUpdate(
seasonId: removeList.map((item) => item.seasonId).join(','),
status: followStatus,

View File

@@ -51,7 +51,7 @@ mixin BaseFavController
content: '确认删除所选收藏吗?',
title: '提示',
onConfirm: () async {
final removeList = allChecked;
final removeList = allChecked.toSet();
var result = await FavHttp.favVideo(
resources: removeList
.map((item) => '${item.id}:${item.type}')

View File

@@ -91,9 +91,9 @@ class HistoryController
// 删除已看历史记录
void onDelViewedHistory() {
if (loadingState.value.isSuccess) {
final viewedList = loadingState.value.data!.where(
(e) => e.progress == -1,
);
final viewedList = loadingState.value.data!
.where((e) => e.progress == -1)
.toSet();
if (viewedList.isNotEmpty) {
_onDelete(viewedList);
} else {
@@ -102,7 +102,7 @@ class HistoryController
}
}
Future<void> _onDelete(Iterable<HistoryItemModel> removeList) async {
Future<void> _onDelete(Set<HistoryItemModel> removeList) async {
SmartDialog.showLoading(msg: '请求中');
final response = await UserHttp.delHistory(
removeList
@@ -123,7 +123,7 @@ class HistoryController
context: Get.context!,
content: '确认删除所选历史记录吗?',
title: '提示',
onConfirm: () => _onDelete(allChecked),
onConfirm: () => _onDelete(allChecked.toSet()),
);
}

View File

@@ -40,7 +40,7 @@ class HistorySearchController
title: '提示',
onConfirm: () async {
SmartDialog.showLoading(msg: '请求中');
final removeList = allChecked;
final removeList = allChecked.toSet();
var response = await UserHttp.delHistory(
removeList
.map((item) => '${item.history.business!}_${item.kid!}')

View File

@@ -31,7 +31,7 @@ mixin BaseLaterController
content: '确认删除所选稍后再看吗?',
title: '提示',
onConfirm: () async {
final removeList = allChecked;
final removeList = allChecked.toSet();
SmartDialog.showLoading(msg: '请求中');
final res = await UserHttp.toViewDel(
aids: removeList.map((item) => item.aid).join(','),