diff --git a/lib/models/dynamics/result.dart b/lib/models/dynamics/result.dart index 423dd3fb6..1e8ed47f2 100644 --- a/lib/models/dynamics/result.dart +++ b/lib/models/dynamics/result.dart @@ -170,6 +170,9 @@ class ItemModulesModel { ModuleBlocked? moduleBlocked; ModuleFold? moduleFold; + static bool showArgueMsg = Pref.showArgueMsg; + static bool showDynInteraction = Pref.showDynInteraction; + ItemModulesModel.fromJson(Map json) { moduleAuthor = json['module_author'] != null ? ModuleAuthorModel.fromJson(json['module_author']) @@ -186,12 +189,16 @@ class ItemModulesModel { moduleFold = json['module_fold'] != null ? ModuleFold.fromJson(json['module_fold']) : null; - moduleInteraction = json['module_interaction'] != null - ? ModuleInteraction.fromJson(json['module_interaction']) - : null; - moduleDispute = json['module_dispute'] != null - ? ModuleDispute.fromJson(json['module_dispute']) - : null; + if (showDynInteraction) { + moduleInteraction = json['module_interaction'] != null + ? ModuleInteraction.fromJson(json['module_interaction']) + : null; + } + if (showArgueMsg) { + moduleDispute = json['module_dispute'] != null + ? ModuleDispute.fromJson(json['module_dispute']) + : null; + } } ItemModulesModel.fromOpusJson(List json) { diff --git a/lib/pages/setting/models/extra_settings.dart b/lib/pages/setting/models/extra_settings.dart index 17a2c1fcc..2b33a24f4 100644 --- a/lib/pages/setting/models/extra_settings.dart +++ b/lib/pages/setting/models/extra_settings.dart @@ -15,7 +15,8 @@ import 'package:PiliPlus/models/common/member/tab_type.dart'; import 'package:PiliPlus/models/common/reply/reply_sort_type.dart'; import 'package:PiliPlus/models/common/sponsor_block/skip_type.dart'; import 'package:PiliPlus/models/common/super_resolution_type.dart'; -import 'package:PiliPlus/models/dynamics/result.dart'; +import 'package:PiliPlus/models/dynamics/result.dart' + show DynamicsDataModel, ItemModulesModel; import 'package:PiliPlus/pages/common/slide/common_slide_page.dart'; import 'package:PiliPlus/pages/home/controller.dart'; import 'package:PiliPlus/pages/hot/controller.dart'; @@ -404,11 +405,12 @@ List get extraSettings => [ ); }, ), - const SwitchModel( + SwitchModel( title: '显示视频警告/争议信息', - leading: Icon(Icons.warning_amber_rounded), + leading: const Icon(Icons.warning_amber_rounded), setKey: SettingBoxKey.showArgueMsg, defaultVal: true, + onChanged: (val) => ItemModulesModel.showArgueMsg = val, ), const SwitchModel( title: '分P/合集:倒序播放从首集开始播放', @@ -973,6 +975,14 @@ List get extraSettings => [ } }, ), + SwitchModel( + title: '显示动态互动内容', + subtitle: '开启后则在动态卡片底部显示互动内容(如关注的人点赞、热评等)', + leading: const Icon(Icons.quickreply_outlined), + setKey: SettingBoxKey.showDynInteraction, + defaultVal: true, + onChanged: (val) => ItemModulesModel.showDynInteraction = val, + ), NormalModel( title: '用户页默认展示TAB', leading: const Icon(Icons.tab), diff --git a/lib/utils/storage_key.dart b/lib/utils/storage_key.dart index c089fb2c7..9568301c1 100644 --- a/lib/utils/storage_key.dart +++ b/lib/utils/storage_key.dart @@ -57,6 +57,7 @@ abstract final class SettingBoxKey { defaultShowComment = 'defaultShowComment', replySortType = 'replySortType', defaultDynamicType = 'defaultDynamicType', + showDynInteraction = 'showDynInteraction', enableHotKey = 'enableHotKey', enableSearchRcmd = 'enableSearchRcmd', enableQuickFav = 'enableQuickFav', diff --git a/lib/utils/storage_pref.dart b/lib/utils/storage_pref.dart index be717a1c2..ed83e1c4a 100644 --- a/lib/utils/storage_pref.dart +++ b/lib/utils/storage_pref.dart @@ -270,6 +270,9 @@ abstract final class Pref { static int get defaultDynamicType => _setting.get(SettingBoxKey.defaultDynamicType, defaultValue: 0); + static bool get showDynInteraction => + _setting.get(SettingBoxKey.showDynInteraction, defaultValue: true); + static double get blockLimit => _setting.get(SettingBoxKey.blockLimit, defaultValue: 0.0);