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> mixin DeleteItemMixin<R, T extends MultiSelectData>
on CommonListController<R, T>, CommonMultiSelectMixin<T> { 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!; final list = loadingState.value.data!;
if (removeList.length == list.length) { if (removeList.length == list.length) {
list.clear(); list.clear();
} else if (removeList.length == 1) { } else if (removeList.length == 1) {
list.remove(removeList.single); list.remove(removeList.first);
} else { } else {
list.removeWhere(removeList.contains); list.removeWhere(removeList.contains);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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