mod: quick fav bangumi

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-14 20:30:24 +08:00
parent d8c23a3d8c
commit 229901de96
4 changed files with 47 additions and 5 deletions

View File

@@ -62,6 +62,9 @@ class BangumiIntroController extends CommonController {
List delMediaIdsNew = [];
dynamic userInfo;
late final enableQuickFav =
GStorage.setting.get(SettingBoxKey.enableQuickFav, defaultValue: false);
@override
void onInit() {
super.onInit();
@@ -281,7 +284,29 @@ class BangumiIntroController extends CommonController {
}
// (取消)收藏 bangumi
Future actionFavVideo() async {
Future actionFavVideo({type = 'choose'}) async {
// 收藏至默认文件夹
if (type == 'default') {
SmartDialog.showLoading(msg: '请求中');
await queryVideoInFolder();
int defaultFolderId = favFolderData.value.list!.first.id!;
int favStatus = favFolderData.value.list!.first.favState!;
var result = await VideoHttp.favVideo(
aid: epId,
type: 24,
addIds: favStatus == 0 ? '$defaultFolderId' : '',
delIds: favStatus == 1 ? '$defaultFolderId' : '',
);
SmartDialog.dismiss();
if (result['status']) {
// 重新获取收藏状态
await queryBangumiLikeCoinFav();
SmartDialog.showToast('✅ 快速收藏/取消收藏成功');
} else {
SmartDialog.showToast(result['msg']);
}
return;
}
try {
for (var i in favFolderData.value.list!.toList()) {
if (i.favState == 1) {