feat: SponsorBlock switch
This commit is contained in:
@ -199,6 +199,15 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
GlobalDataCache.enableDlna = val;
|
GlobalDataCache.enableDlna = val;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SetSwitchItem(
|
||||||
|
title: 'Sponsor Block',
|
||||||
|
subTitle: '自动跳过视频中赞助片段',
|
||||||
|
setKey: SettingBoxKey.enableSponsorBlock,
|
||||||
|
defaultVal: false,
|
||||||
|
callFn: (bool val) {
|
||||||
|
GlobalDataCache.enableSponsorBlock = val;
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('评论展示', style: titleStyle),
|
title: Text('评论展示', style: titleStyle),
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import 'package:pilipala/models/video/play/url.dart';
|
|||||||
import 'package:pilipala/models/video/reply/item.dart';
|
import 'package:pilipala/models/video/reply/item.dart';
|
||||||
import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
|
import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||||
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/utils/utils.dart';
|
import 'package:pilipala/utils/utils.dart';
|
||||||
import 'package:pilipala/utils/video_utils.dart';
|
import 'package:pilipala/utils/video_utils.dart';
|
||||||
@ -198,7 +199,7 @@ class VideoDetailController extends GetxController
|
|||||||
});
|
});
|
||||||
|
|
||||||
/// 仅投稿视频skip
|
/// 仅投稿视频skip
|
||||||
if (videoType == SearchType.video) {
|
if (videoType == SearchType.video && GlobalDataCache.enableSponsorBlock) {
|
||||||
querySkipSegments();
|
querySkipSegments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,8 @@ class GlobalDataCache {
|
|||||||
static late bool enableDynamicSwitch;
|
static late bool enableDynamicSwitch;
|
||||||
// 投屏开关
|
// 投屏开关
|
||||||
static bool enableDlna = false;
|
static bool enableDlna = false;
|
||||||
|
// sponsorBlock开关
|
||||||
|
static bool enableSponsorBlock = false;
|
||||||
|
|
||||||
// 私有构造函数
|
// 私有构造函数
|
||||||
GlobalDataCache._();
|
GlobalDataCache._();
|
||||||
@ -123,5 +125,7 @@ class GlobalDataCache {
|
|||||||
enableDynamicSwitch =
|
enableDynamicSwitch =
|
||||||
setting.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
setting.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
enableDlna = setting.get(SettingBoxKey.enableDlna, defaultValue: false);
|
enableDlna = setting.get(SettingBoxKey.enableDlna, defaultValue: false);
|
||||||
|
enableSponsorBlock =
|
||||||
|
setting.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,7 +116,8 @@ class SettingBoxKey {
|
|||||||
enableAutoExpand = 'enableAutoExpand',
|
enableAutoExpand = 'enableAutoExpand',
|
||||||
defaultHomePage = 'defaultHomePage',
|
defaultHomePage = 'defaultHomePage',
|
||||||
enableRelatedVideo = 'enableRelatedVideo',
|
enableRelatedVideo = 'enableRelatedVideo',
|
||||||
enableDlna = 'enableDlna';
|
enableDlna = 'enableDlna',
|
||||||
|
enableSponsorBlock = 'enableSponsorBlock';
|
||||||
|
|
||||||
/// 外观
|
/// 外观
|
||||||
static const String themeMode = 'themeMode',
|
static const String themeMode = 'themeMode',
|
||||||
|
|||||||
Reference in New Issue
Block a user