From 99e6abdad93da78daed1bc54c50a8b6c5ee8ba58 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Mon, 11 Mar 2024 23:31:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=9B=B8=E5=85=B3=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=BC=80=E5=85=B3=20issues=20#585?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/setting/extra_setting.dart | 6 ++++++ lib/pages/video/detail/controller.dart | 4 +++- lib/pages/video/detail/view.dart | 5 ++++- lib/utils/storage.dart | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/pages/setting/extra_setting.dart b/lib/pages/setting/extra_setting.dart index 0a4dd2bf..aaaa8b84 100644 --- a/lib/pages/setting/extra_setting.dart +++ b/lib/pages/setting/extra_setting.dart @@ -173,6 +173,12 @@ class _ExtraSettingState extends State { setKey: SettingBoxKey.enableAi, defaultVal: true, ), + const SetSwitchItem( + title: '相关视频推荐', + subTitle: '视频详情页推荐相关视频', + setKey: SettingBoxKey.enableRelatedVideo, + defaultVal: true, + ), ListTile( dense: false, title: Text('评论展示', style: titleStyle), diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index b4005b5a..65f844ab 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -91,6 +91,7 @@ class VideoDetailController extends GetxController late int cacheAudioQa; PersistentBottomSheetController? replyReplyBottomSheetCtr; + late bool enableRelatedVideo; @override void onInit() { @@ -113,7 +114,8 @@ class VideoDetailController extends GetxController autoPlay.value = setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true); enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true); - + enableRelatedVideo = + setting.get(SettingBoxKey.enableRelatedVideo, defaultValue: true); if (userInfo == null || localCache.get(LocalCacheKey.historyPause) == true) { enableHeart = false; diff --git a/lib/pages/video/detail/view.dart b/lib/pages/video/detail/view.dart index 04d41b2e..04c50804 100644 --- a/lib/pages/video/detail/view.dart +++ b/lib/pages/video/detail/view.dart @@ -521,7 +521,10 @@ class _VideoDetailPageState extends State .withOpacity(0.06), ), ), - const RelatedVideoPanel(), + if (videoDetailController.videoType == + SearchType.video && + videoDetailController.enableRelatedVideo) + const RelatedVideoPanel(), ], ); }, diff --git a/lib/utils/storage.dart b/lib/utils/storage.dart index 6283299b..835848cd 100644 --- a/lib/utils/storage.dart +++ b/lib/utils/storage.dart @@ -131,7 +131,8 @@ class SettingBoxKey { enableSearchWord = 'enableSearchWord', enableSystemProxy = 'enableSystemProxy', enableAi = 'enableAi', - defaultHomePage = 'defaultHomePage'; + defaultHomePage = 'defaultHomePage', + enableRelatedVideo = 'enableRelatedVideo'; /// 外观 static const String themeMode = 'themeMode',