diff --git a/lib/pages/bangumi/introduction/controller.dart b/lib/pages/bangumi/introduction/controller.dart index 95f1c5ae..89a96192 100644 --- a/lib/pages/bangumi/introduction/controller.dart +++ b/lib/pages/bangumi/introduction/controller.dart @@ -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) { diff --git a/lib/pages/bangumi/introduction/view.dart b/lib/pages/bangumi/introduction/view.dart index d617b0db..f15340e4 100644 --- a/lib/pages/bangumi/introduction/view.dart +++ b/lib/pages/bangumi/introduction/view.dart @@ -173,11 +173,26 @@ class _BangumiInfoState extends State } // 收藏 - showFavBottomSheet() { + showFavBottomSheet({type = 'tap'}) { if (bangumiIntroController.userInfo == null) { SmartDialog.showToast('账号未登录'); return; } + // 快速收藏 & + // 点按 收藏至默认文件夹 + // 长按选择文件夹 + if (bangumiIntroController.enableQuickFav) { + if (type == 'tap') { + bangumiIntroController.actionFavVideo(type: 'default'); + } else { + _showFavBottomSheet(); + } + } else if (type != 'longPress') { + _showFavBottomSheet(); + } + } + + _showFavBottomSheet() { showModalBottomSheet( context: context, useSafeArea: true, @@ -522,6 +537,7 @@ class _BangumiInfoState extends State icon: const Icon(FontAwesomeIcons.star), selectIcon: const Icon(FontAwesomeIcons.solidStar), onTap: () => showFavBottomSheet(), + onLongPress: () => showFavBottomSheet(type: 'longPress'), selectStatus: bangumiIntroController.hasFav.value, loadingStatus: false, semanticsLabel: '收藏', @@ -592,6 +608,7 @@ class _BangumiInfoState extends State () => ActionRowItem( icon: const Icon(FontAwesomeIcons.heart), onTap: () => showFavBottomSheet(), + onLongPress: () => showFavBottomSheet(type: 'longPress'), selectStatus: videoIntroController.hasFav.value, loadingStatus: widget.isLoading, text: !widget.isLoading diff --git a/lib/pages/video/detail/introduction/controller.dart b/lib/pages/video/detail/introduction/controller.dart index 51b58cd4..e4b22d0f 100644 --- a/lib/pages/video/detail/introduction/controller.dart +++ b/lib/pages/video/detail/introduction/controller.dart @@ -83,6 +83,8 @@ class VideoIntroController extends GetxController late final showArgueMsg = GStorage.showArgueMsg; late final enableAi = GStorage.setting.get(SettingBoxKey.enableAi, defaultValue: false); + late final enableQuickFav = + GStorage.setting.get(SettingBoxKey.enableQuickFav, defaultValue: false); @override void onInit() { diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index de0a2c2f..20ee09b6 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -277,12 +277,10 @@ class _VideoInfoState extends State with TickerProviderStateMixin { SmartDialog.showToast('账号未登录'); return; } - final bool enableDragQuickFav = - GStorage.setting.get(SettingBoxKey.enableQuickFav, defaultValue: false); // 快速收藏 & // 点按 收藏至默认文件夹 // 长按选择文件夹 - if (enableDragQuickFav) { + if (videoIntroController.enableQuickFav) { if (type == 'tap') { videoIntroController.actionFavVideo(type: 'default'); } else {