mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 16:46:22 +08:00
126
lib/pages/setting/models/recommend_settings.dart
Normal file
126
lib/pages/setting/models/recommend_settings.dart
Normal file
@@ -0,0 +1,126 @@
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/settings_type.dart';
|
||||
import 'package:PiliPlus/pages/rcmd/controller.dart';
|
||||
import 'package:PiliPlus/pages/setting/models/model.dart';
|
||||
import 'package:PiliPlus/utils/recommend_filter.dart';
|
||||
import 'package:PiliPlus/utils/storage_key.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
List<SettingsModel> get recommendSettings => [
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '首页使用app端推荐',
|
||||
subtitle: '若web端推荐不太符合预期,可尝试切换至app端推荐',
|
||||
leading: const Icon(Icons.model_training_outlined),
|
||||
setKey: SettingBoxKey.appRcmd,
|
||||
defaultVal: true,
|
||||
needReboot: true,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '推荐动态',
|
||||
subtitle: '是否在推荐内容中展示动态(仅app端)',
|
||||
leading: const Icon(Icons.motion_photos_on_outlined),
|
||||
setKey: SettingBoxKey.enableRcmdDynamic,
|
||||
defaultVal: true,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '保留首页推荐刷新',
|
||||
subtitle: '下拉刷新时保留上次内容',
|
||||
leading: const Icon(Icons.refresh),
|
||||
setKey: SettingBoxKey.enableSaveLastData,
|
||||
defaultVal: false,
|
||||
onChanged: (value) {
|
||||
try {
|
||||
Get.find<RcmdController>().enableSaveLastData = value;
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('$e');
|
||||
}
|
||||
},
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '显示上次看到位置提示',
|
||||
subtitle: '保留上次推荐时,在上次刷新位置显示提示',
|
||||
leading: const Icon(Icons.tips_and_updates_outlined),
|
||||
setKey: SettingBoxKey.savedRcmdTip,
|
||||
defaultVal: true,
|
||||
onChanged: (value) {
|
||||
try {
|
||||
RcmdController ctr = Get.find<RcmdController>()
|
||||
..savedRcmdTip = value;
|
||||
if (!value) {
|
||||
ctr.lastRefreshAt = null;
|
||||
}
|
||||
} catch (e) {
|
||||
if (kDebugMode) debugPrint('$e');
|
||||
}
|
||||
},
|
||||
),
|
||||
getVideoFilterSelectModel(
|
||||
context: Get.context!,
|
||||
title: '点赞率',
|
||||
suffix: '%',
|
||||
key: SettingBoxKey.minLikeRatioForRecommend,
|
||||
values: [0, 1, 2, 3, 4],
|
||||
onChanged: (value) => RecommendFilter.minLikeRatioForRecommend = value,
|
||||
),
|
||||
getBanwordModel(
|
||||
context: Get.context!,
|
||||
title: '标题关键词过滤',
|
||||
key: SettingBoxKey.banWordForRecommend,
|
||||
callback: (value) {
|
||||
RecommendFilter.rcmdRegExp = value;
|
||||
RecommendFilter.enableFilter = value.pattern.isNotEmpty;
|
||||
},
|
||||
),
|
||||
getBanwordModel(
|
||||
context: Get.context!,
|
||||
title: 'App推荐/热门/排行榜: 视频分区关键词过滤',
|
||||
key: SettingBoxKey.banWordForZone,
|
||||
callback: (value) {
|
||||
VideoHttp.zoneRegExp = value;
|
||||
VideoHttp.enableFilter = value.pattern.isNotEmpty;
|
||||
},
|
||||
),
|
||||
getVideoFilterSelectModel(
|
||||
context: Get.context!,
|
||||
title: '视频时长',
|
||||
suffix: 's',
|
||||
key: SettingBoxKey.minDurationForRcmd,
|
||||
values: [0, 30, 60, 90, 120],
|
||||
onChanged: (value) => RecommendFilter.minDurationForRcmd = value,
|
||||
),
|
||||
getVideoFilterSelectModel(
|
||||
context: Get.context!,
|
||||
title: '播放量',
|
||||
key: SettingBoxKey.minPlayForRcmd,
|
||||
values: [0, 50, 100, 500, 1000],
|
||||
onChanged: (value) => RecommendFilter.minPlayForRcmd = value,
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '已关注UP豁免推荐过滤',
|
||||
subtitle: '推荐中已关注用户发布的内容不会被过滤',
|
||||
leading: const Icon(Icons.favorite_border_outlined),
|
||||
setKey: SettingBoxKey.exemptFilterForFollowed,
|
||||
defaultVal: true,
|
||||
onChanged: (value) {
|
||||
RecommendFilter.exemptFilterForFollowed = value;
|
||||
},
|
||||
),
|
||||
SettingsModel(
|
||||
settingsType: SettingsType.sw1tch,
|
||||
title: '过滤器也应用于相关视频',
|
||||
subtitle: '视频详情页的相关视频也进行过滤¹',
|
||||
leading: const Icon(Icons.explore_outlined),
|
||||
setKey: SettingBoxKey.applyFilterToRelatedVideos,
|
||||
defaultVal: true,
|
||||
onChanged: (value) {
|
||||
RecommendFilter.applyFilterToRelatedVideos = value;
|
||||
},
|
||||
),
|
||||
];
|
||||
Reference in New Issue
Block a user