mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-30 15:25:47 +08:00
opt multi del
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_pgc/data.dart';
|
||||
import 'package:PiliPlus/models_new/fav/fav_pgc/list.dart';
|
||||
import 'package:PiliPlus/pages/common/multi_select_controller.dart';
|
||||
import 'package:PiliPlus/pages/common/multi_select/multi_select_controller.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -66,29 +66,29 @@ class FavPgcController
|
||||
}
|
||||
|
||||
@override
|
||||
void onConfirm() {
|
||||
void onRemove() {
|
||||
assert(false, 'call onUpdateList');
|
||||
}
|
||||
|
||||
Future<void> onUpdateList(int followStatus) async {
|
||||
final updateList = allChecked.toSet();
|
||||
final removeList = allChecked;
|
||||
final res = await VideoHttp.pgcUpdate(
|
||||
seasonId: updateList.map((item) => item.seasonId).toList(),
|
||||
seasonId: removeList.map((item) => item.seasonId).join(','),
|
||||
status: followStatus,
|
||||
);
|
||||
if (res['status']) {
|
||||
afterDelete(updateList);
|
||||
try {
|
||||
final ctr = Get.find<FavPgcController>(tag: '$type$followStatus');
|
||||
if (ctr.loadingState.value.isSuccess) {
|
||||
ctr.loadingState
|
||||
..value.data!.insertAll(
|
||||
0,
|
||||
updateList.map((item) => item..checked = null),
|
||||
removeList.map((item) => item..checked = null),
|
||||
)
|
||||
..refresh();
|
||||
ctr.allSelected.value = false;
|
||||
}
|
||||
afterDelete(removeList);
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('fav pgc onUpdate: $e');
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class FavPgcController
|
||||
|
||||
Future<void> onUpdate(int index, int followStatus, int? seasonId) async {
|
||||
var result = await VideoHttp.pgcUpdate(
|
||||
seasonId: [seasonId],
|
||||
seasonId: seasonId.toString(),
|
||||
status: followStatus,
|
||||
);
|
||||
if (result['status']) {
|
||||
|
||||
Reference in New Issue
Block a user