mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-20 00:56:31 +08:00
revert: toSet (#941)
This commit is contained in:
committed by
GitHub
parent
80a4c8c24d
commit
9f33488248
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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}')
|
||||||
|
|||||||
@@ -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()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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!}')
|
||||||
|
|||||||
@@ -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(','),
|
||||||
|
|||||||
Reference in New Issue
Block a user