基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
refactor(storage): extract SettingsKeys to dedicated file (#2206)
wqnmlgb15184a94da77b67
diff --git a/lib/services/storage/settings_keys.dart b/lib/services/storage/settings_keys.dartnew file mode 100644index 00000000..c00d670c--- /dev/null+++ b/lib/services/storage/settings_keys.dart@@ -0,0 +1,687 @@+enum SettingGroup {+ player,+ danmaku,+ theme,+ interface,+ proxy,+ webdav,+ download,+ bangumi,+ collect,+ sync,+ update,+ misc,+}++class SettingContext {+ const SettingContext({this.compactLayout = false});++ final bool compactLayout;+}++class SettingKey<T> {+ const SettingKey(+ this.name,+ this.defaultValue, {+ required this.group,+ this.defaultResolver,+ });++ final String name;+ final T defaultValue;+ final SettingGroup group;+ final T Function(SettingContext context)? defaultResolver;++ T resolveDefault(SettingContext context) {+ return defaultResolver?.call(context) ?? defaultValue;+ }+}++// Add new settings here. SettingsKeys is the public typed registry used by+// callers; new keys can use literal string names directly.+class SettingsKeys {+ static const hAenable = SettingKey<bool>(+ _SettingBoxKey.hAenable,+ true,+ group: SettingGroup.player,+ );+ static const hardwareDecoder = SettingKey<String>(+ _SettingBoxKey.hardwareDecoder,+ 'auto-safe',+ group: SettingGroup.player,+ );+ static const searchEnhanceEnable = SettingKey<bool>(+ _SettingBoxKey.searchEnhanceEnable,+ true,+ group: SettingGroup.misc,+ );+ static const autoUpdate = SettingKey<bool>(+ _SettingBoxKey.autoUpdate,+ true,+ group: SettingGroup.update,+ );+ static const alwaysOntop = SettingKey<bool>(+ _SettingBoxKey.alwaysOntop,+ false,+ group: SettingGroup.misc,+ );+ static const defaultPlaySpeed = SettingKey<double>(+ _SettingBoxKey.defaultPlaySpeed,+ 1.0,+ group: SettingGroup.player,+ );+ static const defaultShortcutForwardPlaySpeed = SettingKey<double>(+ _SettingBoxKey.defaultShortcutForwardPlaySpeed,+ 2.0,+ group: SettingGroup.player,+ );+ static const defaultAspectRatioType = SettingKey<int>(+ _SettingBoxKey.defaultAspectRatioType,+ 1,+ group: SettingGroup.player,+ );+ static const buttonSkipTime = SettingKey<int>(+ _SettingBoxKey.buttonSkipTime,+ 80,+ group: SettingGroup.player,+ );+ static const arrowKeySkipTime = SettingKey<int>(+ _SettingBoxKey.arrowKeySkipTime,+ 10,+ group: SettingGroup.player,+ );+ static const danmakuEnhance = SettingKey<bool>(+ _SettingBoxKey.danmakuEnhance,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuBorder = SettingKey<bool>(+ _SettingBoxKey.danmakuBorder,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuBorderSize = SettingKey<double>(+ _SettingBoxKey.danmakuBorderSize,+ 1.5,+ group: SettingGroup.danmaku,+ );+ static const danmakuOpacity = SettingKey<double>(+ _SettingBoxKey.danmakuOpacity,+ 1.0,+ group: SettingGroup.danmaku,+ );+ static final danmakuFontSize = SettingKey<double>(+ _SettingBoxKey.danmakuFontSize,+ 25.0,+ group: SettingGroup.danmaku,+ defaultResolver: (context) => context.compactLayout ? 16.0 : 25.0,+ );+ static const danmakuTop = SettingKey<bool>(+ _SettingBoxKey.danmakuTop,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuScroll = SettingKey<bool>(+ _SettingBoxKey.danmakuScroll,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuBottom = SettingKey<bool>(+ _SettingBoxKey.danmakuBottom,+ false,+ group: SettingGroup.danmaku,+ );+ static const danmakuMassive = SettingKey<bool>(+ _SettingBoxKey.danmakuMassive,+ false,+ group: SettingGroup.danmaku,+ );+ static const danmakuDeduplication = SettingKey<bool>(+ _SettingBoxKey.danmakuDeduplication,+ false,+ group: SettingGroup.danmaku,+ );+ static const danmakuArea = SettingKey<double>(+ _SettingBoxKey.danmakuArea,+ 1.0,+ group: SettingGroup.danmaku,+ );+ static const danmakuColor = SettingKey<bool>(+ _SettingBoxKey.danmakuColor,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuDuration = SettingKey<double>(+ _SettingBoxKey.danmakuDuration,+ 8.0,+ group: SettingGroup.danmaku,+ );+ static const danmakuLineHeight = SettingKey<double>(+ _SettingBoxKey.danmakuLineHeight,+ 1.6,+ group: SettingGroup.danmaku,+ );+ static const danmakuTimeOffset = SettingKey<double>(+ _SettingBoxKey.danmakuTimeOffset,+ 0.0,+ group: SettingGroup.danmaku,+ );+ static const danmakuEnabledByDefault = SettingKey<bool>(+ _SettingBoxKey.danmakuEnabledByDefault,+ false,+ group: SettingGroup.danmaku,+ );+ static const danmakuBiliBiliSource = SettingKey<bool>(+ _SettingBoxKey.danmakuBiliBiliSource,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuGamerSource = SettingKey<bool>(+ _SettingBoxKey.danmakuGamerSource,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuDanDanSource = SettingKey<bool>(+ _SettingBoxKey.danmakuDanDanSource,+ true,+ group: SettingGroup.danmaku,+ );+ static const danmakuFontWeight = SettingKey<int>(+ _SettingBoxKey.danmakuFontWeight,+ 4,+ group: SettingGroup.danmaku,+ );+ static const danmakuFollowSpeed = SettingKey<bool>(+ _SettingBoxKey.danmakuFollowSpeed,+ true,+ group: SettingGroup.danmaku,+ );+ static const themeMode = SettingKey<String>(+ _SettingBoxKey.themeMode,+ 'system',+ group: SettingGroup.theme,+ );+ static const themeColor = SettingKey<String>(+ _SettingBoxKey.themeColor,+ 'default',+ group: SettingGroup.theme,+ );+ static const privateMode = SettingKey<bool>(+ _SettingBoxKey.privateMode,+ false,+ group: SettingGroup.player,+ );+ static const autoPlay = SettingKey<bool>(+ _SettingBoxKey.autoPlay,+ true,+ group: SettingGroup.player,+ );+ static const autoPlayNext = SettingKey<bool>(+ _SettingBoxKey.autoPlayNext,+ true,+ group: SettingGroup.player,+ );+ static const playResume = SettingKey<bool>(+ _SettingBoxKey.playResume,+ true,+ group: SettingGroup.player,+ );+ static const showPlayerError = SettingKey<bool>(+ _SettingBoxKey.showPlayerError,+ true,+ group: SettingGroup.player,+ );+ static const oledEnhance = SettingKey<bool>(+ _SettingBoxKey.oledEnhance,+ false,+ group: SettingGroup.theme,+ );+ static const displayMode = SettingKey<String?>(+ _SettingBoxKey.displayMode,+ null,+ group: SettingGroup.interface,+ );+ static const enableGitProxy = SettingKey<bool>(+ _SettingBoxKey.enableGitProxy,+ false,+ group: SettingGroup.proxy,+ );+ static const enableBangumiProxy = SettingKey<bool>(+ _SettingBoxKey.enableBangumiProxy,+ false,+ group: SettingGroup.proxy,+ );+ static const enableSystemProxy = SettingKey<bool>(+ _SettingBoxKey.enableSystemProxy,+ false,+ group: SettingGroup.proxy,+ );+ static const defaultStartupPage = SettingKey<String>(+ _SettingBoxKey.defaultStartupPage,+ '/tab/popular/',+ group: SettingGroup.interface,+ );+ static const isWideScreen = SettingKey<bool>(+ _SettingBoxKey.isWideScreen,+ false,+ group: SettingGroup.interface,+ );+ static const webDavEnable = SettingKey<bool>(+ _SettingBoxKey.webDavEnable,+ false,+ group: SettingGroup.webdav,+ );+ static const webDavEnableHistory = SettingKey<bool>(+ _SettingBoxKey.webDavEnableHistory,+ false,+ group: SettingGroup.webdav,+ );+ static const webDavEnableCollect = SettingKey<bool>(+ _SettingBoxKey.webDavEnableCollect,+ false,+ group: SettingGroup.webdav,+ );+ static const webDavURL = SettingKey<String>(+ _SettingBoxKey.webDavURL,+ '',+ group: SettingGroup.webdav,+ );+ static const webDavUsername = SettingKey<String>(+ _SettingBoxKey.webDavUsername,+ '',+ group: SettingGroup.webdav,+ );+ static const webDavPassword = SettingKey<String>(+ _SettingBoxKey.webDavPassword,+ '',+ group: SettingGroup.webdav,+ );+ static const lowMemoryMode = SettingKey<bool>(+ _SettingBoxKey.lowMemoryMode,+ false,+ group: SettingGroup.player,+ );+ static const showWindowButton = SettingKey<bool>(+ _SettingBoxKey.showWindowButton,+ false,+ group: SettingGroup.theme,+ );+ static const useDynamicColor = SettingKey<bool>(+ _SettingBoxKey.useDynamicColor,+ false,+ group: SettingGroup.theme,+ );+ static const exitBehavior = SettingKey<int>(+ _SettingBoxKey.exitBehavior,+ 2,+ group: SettingGroup.interface,+ );+ static const playerDebugMode = SettingKey<bool>(+ _SettingBoxKey.playerDebugMode,+ false,+ group: SettingGroup.player,+ );+ static const syncPlayEndPoint = SettingKey<String>(+ _SettingBoxKey.syncPlayEndPoint,+ '127.0.0.1:8999',+ group: SettingGroup.player,+ );+ static const androidEnableOpenSLES = SettingKey<bool>(+ _SettingBoxKey.androidEnableOpenSLES,+ true,+ group: SettingGroup.player,+ );+ static const androidVideoRenderer = SettingKey<String>(+ _SettingBoxKey.androidVideoRenderer,+ 'auto',+ group: SettingGroup.player,+ );+ static const androidAutoEnterPIP = SettingKey<bool>(+ _SettingBoxKey.androidAutoEnterPIP,+ false,+ group: SettingGroup.player,+ );+ static const defaultSuperResolutionType = SettingKey<int>(+ _SettingBoxKey.defaultSuperResolutionType,+ 1,+ group: SettingGroup.player,+ );+ static const superResolutionWarn = SettingKey<bool>(+ _SettingBoxKey.superResolutionWarn,+ false,+ group: SettingGroup.player,+ );+ static const playerDisableAnimations = SettingKey<bool>(+ _SettingBoxKey.playerDisableAnimations,+ false,+ group: SettingGroup.player,+ );+ static const playerLogLevel = SettingKey<int>(+ _SettingBoxKey.playerLogLevel,+ 2,+ group: SettingGroup.player,+ );+ static const searchNotShowWatchedBangumis = SettingKey<bool>(+ _SettingBoxKey.searchNotShowWatchedBangumis,+ false,+ group: SettingGroup.collect,+ );+ static const searchNotShowAbandonedBangumis = SettingKey<bool>(+ _SettingBoxKey.searchNotShowAbandonedBangumis,+ false,+ group: SettingGroup.collect,+ );+ static const timelineNotShowAbandonedBangumis = SettingKey<bool>(+ _SettingBoxKey.timelineNotShowAbandonedBangumis,+ false,+ group: SettingGroup.collect,+ );+ static const timelineNotShowWatchedBangumis = SettingKey<bool>(+ _SettingBoxKey.timelineNotShowWatchedBangumis,+ false,+ group: SettingGroup.collect,+ );+ static const timelineOnlyShowWatchingBangumis = SettingKey<bool>(+ _SettingBoxKey.timelineOnlyShowWatchingBangumis,+ false,+ group: SettingGroup.collect,+ );+ static const useSystemFont = SettingKey<bool>(+ _SettingBoxKey.useSystemFont,+ false,+ group: SettingGroup.theme,+ );+ static const forceAdBlocker = SettingKey<bool>(+ _SettingBoxKey.forceAdBlocker,+ false,+ group: SettingGroup.player,+ );+ static const backgroundPlayback = SettingKey<bool>(+ _SettingBoxKey.backgroundPlayback,+ false,+ group: SettingGroup.player,+ );+ static const proxyEnable = SettingKey<bool>(+ _SettingBoxKey.proxyEnable,+ false,+ group: SettingGroup.proxy,+ );+ static const proxyConfigured = SettingKey<bool>(+ _SettingBoxKey.proxyConfigured,+ false,+ group: SettingGroup.proxy,+ );+ static const proxyUrl = SettingKey<String>(+ _SettingBoxKey.proxyUrl,+ '',+ group: SettingGroup.proxy,+ );+ static const proxyTestUrl = SettingKey<String>(+ _SettingBoxKey.proxyTestUrl,+ '',+ group: SettingGroup.proxy,+ );+ static const showRating = SettingKey<bool>(+ _SettingBoxKey.showRating,+ true,+ group: SettingGroup.interface,+ );+ static const downloadParallelEpisodes = SettingKey<int>(+ _SettingBoxKey.downloadParallelEpisodes,+ 2,+ group: SettingGroup.download,+ );+ static const downloadParallelSegments = SettingKey<int>(+ _SettingBoxKey.downloadParallelSegments,+ 3,+ group: SettingGroup.download,+ );+ static const downloadDanmaku = SettingKey<bool>(+ _SettingBoxKey.downloadDanmaku,+ true,+ group: SettingGroup.download,+ );+ static const shortcutDialogShown = SettingKey<bool>(+ _SettingBoxKey.shortcutDialogShown,+ false,+ group: SettingGroup.misc,+ );+ static const bangumiSyncEnable = SettingKey<bool>(+ _SettingBoxKey.bangumiSyncEnable,+ false,+ group: SettingGroup.bangumi,+ );+ static const bangumiAccessToken = SettingKey<String>(+ _SettingBoxKey.bangumiAccessToken,+ '',+ group: SettingGroup.bangumi,+ );+ static const bangumiSyncPriority = SettingKey<int>(+ _SettingBoxKey.bangumiSyncPriority,+ 0,+ group: SettingGroup.bangumi,+ );+ static const bangumiImmediateSyncToastEnable = SettingKey<bool>(+ _SettingBoxKey.bangumiImmediateSyncToastEnable,+ true,+ group: SettingGroup.bangumi,+ );+ static const brightnessVolumeGesture = SettingKey<bool>(+ _SettingBoxKey.brightnessVolumeGesture,+ true,+ group: SettingGroup.player,+ );+ static const historySyncDeviceId = SettingKey<String>(+ _SettingBoxKey.historySyncDeviceId,+ '',+ group: SettingGroup.sync,+ );+ static const historySyncSequence = SettingKey<int>(+ _SettingBoxKey.historySyncSequence,+ 0,+ group: SettingGroup.sync,+ );+ static const historySyncSnapshotInitialized = SettingKey<bool>(+ _SettingBoxKey.historySyncSnapshotInitialized,+ false,+ group: SettingGroup.sync,+ );++ static final List<SettingKey<Object?>> all = [+ hAenable,+ hardwareDecoder,+ searchEnhanceEnable,+ autoUpdate,+ alwaysOntop,+ defaultPlaySpeed,+ defaultShortcutForwardPlaySpeed,+ defaultAspectRatioType,+ buttonSkipTime,+ arrowKeySkipTime,+ danmakuEnhance,+ danmakuBorder,+ danmakuBorderSize,+ danmakuOpacity,+ danmakuFontSize,+ danmakuTop,+ danmakuScroll,+ danmakuBottom,+ danmakuMassive,+ danmakuDeduplication,+ danmakuArea,+ danmakuColor,+ danmakuDuration,+ danmakuLineHeight,+ danmakuTimeOffset,+ danmakuEnabledByDefault,+ danmakuBiliBiliSource,+ danmakuGamerSource,+ danmakuDanDanSource,+ danmakuFontWeight,+ danmakuFollowSpeed,+ themeMode,+ themeColor,+ privateMode,+ autoPlay,+ autoPlayNext,+ playResume,+ showPlayerError,+ oledEnhance,+ displayMode,+ enableGitProxy,+ enableBangumiProxy,+ enableSystemProxy,+ defaultStartupPage,+ isWideScreen,+ webDavEnable,+ webDavEnableHistory,+ webDavEnableCollect,+ webDavURL,+ webDavUsername,+ webDavPassword,+ lowMemoryMode,+ showWindowButton,+ useDynamicColor,+ exitBehavior,+ playerDebugMode,+ syncPlayEndPoint,+ androidEnableOpenSLES,+ androidVideoRenderer,+ androidAutoEnterPIP,+ defaultSuperResolutionType,+ superResolutionWarn,+ playerDisableAnimations,+ playerLogLevel,+ searchNotShowWatchedBangumis,+ searchNotShowAbandonedBangumis,+ timelineNotShowAbandonedBangumis,+ timelineNotShowWatchedBangumis,+ timelineOnlyShowWatchingBangumis,+ useSystemFont,+ forceAdBlocker,+ backgroundPlayback,+ proxyEnable,+ proxyConfigured,+ proxyUrl,+ proxyTestUrl,+ showRating,+ downloadParallelEpisodes,+ downloadParallelSegments,+ downloadDanmaku,+ shortcutDialogShown,+ bangumiSyncEnable,+ bangumiAccessToken,+ bangumiSyncPriority,+ bangumiImmediateSyncToastEnable,+ brightnessVolumeGesture,+ historySyncDeviceId,+ historySyncSequence,+ historySyncSnapshotInitialized,+ ];++ static List<SettingKey<Object?>> byGroup(SettingGroup group) {+ return [+ for (final key in all)+ if (key.group == group) key+ ];+ }++ SettingsKeys._();+}+// Historical Hive key names used by settings created before the typed registry.+// Keep these strings stable so existing users keep their saved settings.+// New settings do not need to be added here unless they intentionally reuse an+// existing persisted key.+class _SettingBoxKey {+ static const String hAenable = 'hAenable',+ hardwareDecoder = 'hardwareDecoder',+ searchEnhanceEnable = 'searchEnhanceEnable',+ autoUpdate = 'autoUpdate',+ alwaysOntop = 'alwaysOntop',+ defaultPlaySpeed = 'defaultPlaySpeed',+ defaultShortcutForwardPlaySpeed = 'defaultShortcutForwardPlaySpeed',+ defaultAspectRatioType = 'defaultAspectRatioType',+ buttonSkipTime = 'buttonSkipTime',+ arrowKeySkipTime = 'arrowKeySkipTime',+ danmakuEnhance = 'danmakuEnhance',+ danmakuBorder = 'danmakuBorder',+ danmakuBorderSize = 'danmakuBorderSize',+ danmakuOpacity = 'danmakuOpacity',+ danmakuFontSize = 'danmakuFontSize',+ danmakuTop = 'danmakuTop',+ danmakuScroll = 'danmakuScroll',+ danmakuBottom = 'danmakuBottom',+ danmakuMassive = 'danmakuMassive',+ danmakuDeduplication = 'danmakuDeduplication',+ danmakuArea = 'danmakuArea',+ danmakuColor = 'danmakuColor',+ danmakuDuration = 'danmakuDuration',+ danmakuLineHeight = 'danmakuLineHeight',+ danmakuTimeOffset = 'danmakuTimeOffset',+ danmakuEnabledByDefault = 'danmakuEnabledByDefault',+ danmakuBiliBiliSource = 'danmakuBiliBiliSource',+ danmakuGamerSource = 'danmakuGamerSource',+ danmakuDanDanSource = 'danmakuDanDanSource',+ danmakuFontWeight = 'danmakuFontWeight',+ danmakuFollowSpeed = 'danmakuFollowSpeed',+ themeMode = 'themeMode',+ themeColor = 'themeColor',+ privateMode = 'privateMode',+ autoPlay = 'autoPlay',+ autoPlayNext = 'autoPlayNext',+ playResume = 'playResume',+ showPlayerError = 'showPlayerError',+ oledEnhance = 'oledEnhance',+ displayMode = 'displayMode',+ enableGitProxy = 'enableGitProxy',+ enableBangumiProxy = 'enableBangumiProxy',+ enableSystemProxy = 'enableSystemProxy',+ defaultStartupPage = 'defaultStartupPage',++ /// Deprecated+ isWideScreen = 'isWideScreen',+ webDavEnable = 'webDavEnable',+ webDavEnableHistory = 'webDavEnableHistory',+ webDavEnableCollect = 'webDavEnableCollect',+ webDavURL = 'webDavURL',+ webDavUsername = 'webDavUsername',+ webDavPassword = 'webDavPasswd',+ lowMemoryMode = 'lowMemoryMode',+ showWindowButton = 'showWindowButton',+ useDynamicColor = 'useDynamicColor',+ exitBehavior = 'exitBehavior',+ playerDebugMode = 'playerDebugMode',+ syncPlayEndPoint = 'syncPlayEndPoint',+ androidEnableOpenSLES = 'androidEnableOpenSLES',+ androidVideoRenderer = 'androidVideoRenderer',+ androidAutoEnterPIP = 'androidAutoEnterPIP',+ defaultSuperResolutionType = 'defaultSuperResolutionType',+ superResolutionWarn = 'superResolutionWarn',+ playerDisableAnimations = 'playerDisableAnimations',+ playerLogLevel = 'playerLogLevel',+ searchNotShowWatchedBangumis = 'searchNotShowWatchedBangumis',+ searchNotShowAbandonedBangumis = 'searchNotShowAbandonedBangumis',+ timelineNotShowAbandonedBangumis = 'timelineNotShowAbandonedBangumis',+ timelineNotShowWatchedBangumis = 'timelineNotShowWatchedBangumis',+ timelineOnlyShowWatchingBangumis = 'timelineOnlyShowWatchingBangumis',+ useSystemFont = 'useSystemFont',+ forceAdBlocker = 'forceAdBlocker',+ backgroundPlayback = 'backgroundPlayback',+ proxyEnable = 'proxyEnable',+ proxyConfigured = 'proxyConfigured',+ proxyUrl = 'proxyUrl',+ proxyTestUrl = 'proxyTestUrl',+ showRating = 'showRating',+ downloadParallelEpisodes = 'downloadParallelEpisodes',+ downloadParallelSegments = 'downloadParallelSegments',+ downloadDanmaku = 'downloadDanmaku',+ shortcutDialogShown = 'shortcutDialogShown',+ bangumiSyncEnable = 'bangumiSyncEnable',+ bangumiAccessToken = 'bangumiAccessToken',+ bangumiSyncPriority = 'bangumiSyncPriority',+ bangumiImmediateSyncToastEnable = 'bangumiImmediateSyncToastEnable',+ brightnessVolumeGesture = 'brightnessVolumeGesture',+ historySyncDeviceId = 'historySyncDeviceId',+ historySyncSequence = 'historySyncSequence',+ historySyncSnapshotInitialized = 'historySyncSnapshotInitialized';+}diff --git a/lib/services/storage/storage.dart b/lib/services/storage/storage.dartindex a26f2cde..4ac16fe1 100644--- a/lib/services/storage/storage.dart+++ b/lib/services/storage/storage.dart@@ -12,596 +12,9 @@ import 'package:kazumi/modules/collect/collect_sync_merger.dart';import 'package:kazumi/modules/search/search_history_module.dart';import 'package:kazumi/modules/download/download_module.dart';-enum SettingGroup {- player,- danmaku,- theme,- interface,- proxy,- webdav,- download,- bangumi,- collect,- sync,- update,- misc,-}--class SettingContext {- const SettingContext({this.compactLayout = false});-- final bool compactLayout;-}--class SettingKey<T> {- const SettingKey(- this.name,- this.defaultValue, {- required this.group,- this.defaultResolver,- });-- final String name;- final T defaultValue;- final SettingGroup group;- final T Function(SettingContext context)? defaultResolver;-- T resolveDefault(SettingContext context) {- return defaultResolver?.call(context) ?? defaultValue;- }-}-// Add new settings here. SettingsKeys is the public typed registry used by-// callers; new keys can use literal string names directly.-class SettingsKeys {- static const hAenable = SettingKey<bool>(- _SettingBoxKey.hAenable,- true,- group: SettingGroup.player,- );- static const hardwareDecoder = SettingKey<String>(- _SettingBoxKey.hardwareDecoder,- 'auto-safe',- group: SettingGroup.player,- );- static const searchEnhanceEnable = SettingKey<bool>(- _SettingBoxKey.searchEnhanceEnable,- true,- group: SettingGroup.misc,- );- static const autoUpdate = SettingKey<bool>(- _SettingBoxKey.autoUpdate,- true,- group: SettingGroup.update,- );- static const alwaysOntop = SettingKey<bool>(- _SettingBoxKey.alwaysOntop,- false,- group: SettingGroup.misc,- );- static const defaultPlaySpeed = SettingKey<double>(- _SettingBoxKey.defaultPlaySpeed,- 1.0,- group: SettingGroup.player,- );- static const defaultShortcutForwardPlaySpeed = SettingKey<double>(- _SettingBoxKey.defaultShortcutForwardPlaySpeed,- 2.0,- group: SettingGroup.player,- );- static const defaultAspectRatioType = SettingKey<int>(- _SettingBoxKey.defaultAspectRatioType,- 1,- group: SettingGroup.player,- );- static const buttonSkipTime = SettingKey<int>(- _SettingBoxKey.buttonSkipTime,- 80,- group: SettingGroup.player,- );- static const arrowKeySkipTime = SettingKey<int>(- _SettingBoxKey.arrowKeySkipTime,- 10,- group: SettingGroup.player,- );- static const danmakuEnhance = SettingKey<bool>(- _SettingBoxKey.danmakuEnhance,- true,- group: SettingGroup.danmaku,- );- static const danmakuBorder = SettingKey<bool>(- _SettingBoxKey.danmakuBorder,- true,- group: SettingGroup.danmaku,- );- static const danmakuBorderSize = SettingKey<double>(- _SettingBoxKey.danmakuBorderSize,- 1.5,- group: SettingGroup.danmaku,- );- static const danmakuOpacity = SettingKey<double>(- _SettingBoxKey.danmakuOpacity,- 1.0,- group: SettingGroup.danmaku,- );- static final danmakuFontSize = SettingKey<double>(- _SettingBoxKey.danmakuFontSize,- 25.0,- group: SettingGroup.danmaku,- defaultResolver: (context) => context.compactLayout ? 16.0 : 25.0,- );- static const danmakuTop = SettingKey<bool>(- _SettingBoxKey.danmakuTop,- true,- group: SettingGroup.danmaku,- );- static const danmakuScroll = SettingKey<bool>(- _SettingBoxKey.danmakuScroll,- true,- group: SettingGroup.danmaku,- );- static const danmakuBottom = SettingKey<bool>(- _SettingBoxKey.danmakuBottom,- false,- group: SettingGroup.danmaku,- );- static const danmakuMassive = SettingKey<bool>(- _SettingBoxKey.danmakuMassive,- false,- group: SettingGroup.danmaku,- );- static const danmakuDeduplication = SettingKey<bool>(- _SettingBoxKey.danmakuDeduplication,- false,- group: SettingGroup.danmaku,- );- static const danmakuArea = SettingKey<double>(- _SettingBoxKey.danmakuArea,- 1.0,- group: SettingGroup.danmaku,- );- static const danmakuColor = SettingKey<bool>(- _SettingBoxKey.danmakuColor,- true,- group: SettingGroup.danmaku,- );- static const danmakuDuration = SettingKey<double>(- _SettingBoxKey.danmakuDuration,- 8.0,- group: SettingGroup.danmaku,- );- static const danmakuLineHeight = SettingKey<double>(- _SettingBoxKey.danmakuLineHeight,- 1.6,- group: SettingGroup.danmaku,- );- static const danmakuTimeOffset = SettingKey<double>(- _SettingBoxKey.danmakuTimeOffset,- 0.0,- group: SettingGroup.danmaku,- );- static const danmakuEnabledByDefault = SettingKey<bool>(- _SettingBoxKey.danmakuEnabledByDefault,- false,- group: SettingGroup.danmaku,- );- static const danmakuBiliBiliSource = SettingKey<bool>(- _SettingBoxKey.danmakuBiliBiliSource,- true,- group: SettingGroup.danmaku,- );- static const danmakuGamerSource = SettingKey<bool>(- _SettingBoxKey.danmakuGamerSource,- true,- group: SettingGroup.danmaku,- );- static const danmakuDanDanSource = SettingKey<bool>(- _SettingBoxKey.danmakuDanDanSource,- true,- group: SettingGroup.danmaku,- );- static const danmakuFontWeight = SettingKey<int>(- _SettingBoxKey.danmakuFontWeight,- 4,- group: SettingGroup.danmaku,- );- static const danmakuFollowSpeed = SettingKey<bool>(- _SettingBoxKey.danmakuFollowSpeed,- true,- group: SettingGroup.danmaku,- );- static const themeMode = SettingKey<String>(- _SettingBoxKey.themeMode,- 'system',- group: SettingGroup.theme,- );- static const themeColor = SettingKey<String>(- _SettingBoxKey.themeColor,- 'default',- group: SettingGroup.theme,- );- static const privateMode = SettingKey<bool>(- _SettingBoxKey.privateMode,- false,- group: SettingGroup.player,- );- static const autoPlay = SettingKey<bool>(- _SettingBoxKey.autoPlay,- true,- group: SettingGroup.player,- );- static const autoPlayNext = SettingKey<bool>(- _SettingBoxKey.autoPlayNext,- true,- group: SettingGroup.player,- );- static const playResume = SettingKey<bool>(- _SettingBoxKey.playResume,- true,- group: SettingGroup.player,- );- static const showPlayerError = SettingKey<bool>(- _SettingBoxKey.showPlayerError,- true,- group: SettingGroup.player,- );- static const oledEnhance = SettingKey<bool>(- _SettingBoxKey.oledEnhance,- false,- group: SettingGroup.theme,- );- static const displayMode = SettingKey<String?>(- _SettingBoxKey.displayMode,- null,- group: SettingGroup.interface,- );- static const enableGitProxy = SettingKey<bool>(- _SettingBoxKey.enableGitProxy,- false,- group: SettingGroup.proxy,- );- static const enableBangumiProxy = SettingKey<bool>(- _SettingBoxKey.enableBangumiProxy,- false,- group: SettingGroup.proxy,- );- static const enableSystemProxy = SettingKey<bool>(- _SettingBoxKey.enableSystemProxy,- false,- group: SettingGroup.proxy,- );- static const defaultStartupPage = SettingKey<String>(- _SettingBoxKey.defaultStartupPage,- '/tab/popular/',- group: SettingGroup.interface,- );- static const isWideScreen = SettingKey<bool>(- _SettingBoxKey.isWideScreen,- false,- group: SettingGroup.interface,- );- static const webDavEnable = SettingKey<bool>(- _SettingBoxKey.webDavEnable,- false,- group: SettingGroup.webdav,- );- static const webDavEnableHistory = SettingKey<bool>(- _SettingBoxKey.webDavEnableHistory,- false,- group: SettingGroup.webdav,- );- static const webDavEnableCollect = SettingKey<bool>(- _SettingBoxKey.webDavEnableCollect,- false,- group: SettingGroup.webdav,- );- static const webDavURL = SettingKey<String>(- _SettingBoxKey.webDavURL,- '',- group: SettingGroup.webdav,- );- static const webDavUsername = SettingKey<String>(- _SettingBoxKey.webDavUsername,- '',- group: SettingGroup.webdav,- );- static const webDavPassword = SettingKey<String>(- _SettingBoxKey.webDavPassword,- '',- group: SettingGroup.webdav,- );- static const lowMemoryMode = SettingKey<bool>(- _SettingBoxKey.lowMemoryMode,- false,- group: SettingGroup.player,- );- static const showWindowButton = SettingKey<bool>(- _SettingBoxKey.showWindowButton,- false,- group: SettingGroup.theme,- );- static const useDynamicColor = SettingKey<bool>(- _SettingBoxKey.useDynamicColor,- false,- group: SettingGroup.theme,- );- static const exitBehavior = SettingKey<int>(- _SettingBoxKey.exitBehavior,- 2,- group: SettingGroup.interface,- );- static const playerDebugMode = SettingKey<bool>(- _SettingBoxKey.playerDebugMode,- false,- group: SettingGroup.player,- );- static const syncPlayEndPoint = SettingKey<String>(- _SettingBoxKey.syncPlayEndPoint,- '127.0.0.1:8999',- group: SettingGroup.player,- );- static const androidEnableOpenSLES = SettingKey<bool>(- _SettingBoxKey.androidEnableOpenSLES,- true,- group: SettingGroup.player,- );- static const androidVideoRenderer = SettingKey<String>(- _SettingBoxKey.androidVideoRenderer,- 'auto',- group: SettingGroup.player,- );- static const androidAutoEnterPIP = SettingKey<bool>(- _SettingBoxKey.androidAutoEnterPIP,- false,- group: SettingGroup.player,- );- static const defaultSuperResolutionType = SettingKey<int>(- _SettingBoxKey.defaultSuperResolutionType,- 1,- group: SettingGroup.player,- );- static const superResolutionWarn = SettingKey<bool>(- _SettingBoxKey.superResolutionWarn,- false,- group: SettingGroup.player,- );- static const playerDisableAnimations = SettingKey<bool>(- _SettingBoxKey.playerDisableAnimations,- false,- group: SettingGroup.player,- );- static const playerLogLevel = SettingKey<int>(- _SettingBoxKey.playerLogLevel,- 2,- group: SettingGroup.player,- );- static const searchNotShowWatchedBangumis = SettingKey<bool>(- _SettingBoxKey.searchNotShowWatchedBangumis,- false,- group: SettingGroup.collect,- );- static const searchNotShowAbandonedBangumis = SettingKey<bool>(- _SettingBoxKey.searchNotShowAbandonedBangumis,- false,- group: SettingGroup.collect,- );- static const timelineNotShowAbandonedBangumis = SettingKey<bool>(- _SettingBoxKey.timelineNotShowAbandonedBangumis,- false,- group: SettingGroup.collect,- );- static const timelineNotShowWatchedBangumis = SettingKey<bool>(- _SettingBoxKey.timelineNotShowWatchedBangumis,- false,- group: SettingGroup.collect,- );- static const timelineOnlyShowWatchingBangumis = SettingKey<bool>(- _SettingBoxKey.timelineOnlyShowWatchingBangumis,- false,- group: SettingGroup.collect,- );- static const useSystemFont = SettingKey<bool>(- _SettingBoxKey.useSystemFont,- false,- group: SettingGroup.theme,- );- static const forceAdBlocker = SettingKey<bool>(- _SettingBoxKey.forceAdBlocker,- false,- group: SettingGroup.player,- );- static const backgroundPlayback = SettingKey<bool>(- _SettingBoxKey.backgroundPlayback,- false,- group: SettingGroup.player,- );- static const proxyEnable = SettingKey<bool>(- _SettingBoxKey.proxyEnable,- false,- group: SettingGroup.proxy,- );- static const proxyConfigured = SettingKey<bool>(- _SettingBoxKey.proxyConfigured,- false,- group: SettingGroup.proxy,- );- static const proxyUrl = SettingKey<String>(- _SettingBoxKey.proxyUrl,- '',- group: SettingGroup.proxy,- );- static const proxyTestUrl = SettingKey<String>(- _SettingBoxKey.proxyTestUrl,- '',- group: SettingGroup.proxy,- );- static const showRating = SettingKey<bool>(- _SettingBoxKey.showRating,- true,- group: SettingGroup.interface,- );- static const downloadParallelEpisodes = SettingKey<int>(- _SettingBoxKey.downloadParallelEpisodes,- 2,- group: SettingGroup.download,- );- static const downloadParallelSegments = SettingKey<int>(- _SettingBoxKey.downloadParallelSegments,- 3,- group: SettingGroup.download,- );- static const downloadDanmaku = SettingKey<bool>(- _SettingBoxKey.downloadDanmaku,- true,- group: SettingGroup.download,- );- static const shortcutDialogShown = SettingKey<bool>(- _SettingBoxKey.shortcutDialogShown,- false,- group: SettingGroup.misc,- );- static const bangumiSyncEnable = SettingKey<bool>(- _SettingBoxKey.bangumiSyncEnable,- false,- group: SettingGroup.bangumi,- );- static const bangumiAccessToken = SettingKey<String>(- _SettingBoxKey.bangumiAccessToken,- '',- group: SettingGroup.bangumi,- );- static const bangumiSyncPriority = SettingKey<int>(- _SettingBoxKey.bangumiSyncPriority,- 0,- group: SettingGroup.bangumi,- );- static const bangumiImmediateSyncToastEnable = SettingKey<bool>(- _SettingBoxKey.bangumiImmediateSyncToastEnable,- true,- group: SettingGroup.bangumi,- );- static const brightnessVolumeGesture = SettingKey<bool>(- _SettingBoxKey.brightnessVolumeGesture,- true,- group: SettingGroup.player,- );- static const historySyncDeviceId = SettingKey<String>(- _SettingBoxKey.historySyncDeviceId,- '',- group: SettingGroup.sync,- );- static const historySyncSequence = SettingKey<int>(- _SettingBoxKey.historySyncSequence,- 0,- group: SettingGroup.sync,- );- static const historySyncSnapshotInitialized = SettingKey<bool>(- _SettingBoxKey.historySyncSnapshotInitialized,- false,- group: SettingGroup.sync,- );-- static final List<SettingKey<Object?>> all = [- hAenable,- hardwareDecoder,- searchEnhanceEnable,- autoUpdate,- alwaysOntop,- defaultPlaySpeed,- defaultShortcutForwardPlaySpeed,- defaultAspectRatioType,- buttonSkipTime,- arrowKeySkipTime,- danmakuEnhance,- danmakuBorder,- danmakuBorderSize,- danmakuOpacity,- danmakuFontSize,- danmakuTop,- danmakuScroll,- danmakuBottom,- danmakuMassive,- danmakuDeduplication,- danmakuArea,- danmakuColor,- danmakuDuration,- danmakuLineHeight,- danmakuTimeOffset,- danmakuEnabledByDefault,- danmakuBiliBiliSource,- danmakuGamerSource,- danmakuDanDanSource,- danmakuFontWeight,- danmakuFollowSpeed,- themeMode,- themeColor,- privateMode,- autoPlay,- autoPlayNext,- playResume,- showPlayerError,- oledEnhance,- displayMode,- enableGitProxy,- enableBangumiProxy,- enableSystemProxy,- defaultStartupPage,- isWideScreen,- webDavEnable,- webDavEnableHistory,- webDavEnableCollect,- webDavURL,- webDavUsername,- webDavPassword,- lowMemoryMode,- showWindowButton,- useDynamicColor,- exitBehavior,- playerDebugMode,- syncPlayEndPoint,- androidEnableOpenSLES,- androidVideoRenderer,- androidAutoEnterPIP,- defaultSuperResolutionType,- superResolutionWarn,- playerDisableAnimations,- playerLogLevel,- searchNotShowWatchedBangumis,- searchNotShowAbandonedBangumis,- timelineNotShowAbandonedBangumis,- timelineNotShowWatchedBangumis,- timelineOnlyShowWatchingBangumis,- useSystemFont,- forceAdBlocker,- backgroundPlayback,- proxyEnable,- proxyConfigured,- proxyUrl,- proxyTestUrl,- showRating,- downloadParallelEpisodes,- downloadParallelSegments,- downloadDanmaku,- shortcutDialogShown,- bangumiSyncEnable,- bangumiAccessToken,- bangumiSyncPriority,- bangumiImmediateSyncToastEnable,- brightnessVolumeGesture,- historySyncDeviceId,- historySyncSequence,- historySyncSnapshotInitialized,- ];-- static List<SettingKey<Object?>> byGroup(SettingGroup group) {- return [- for (final key in all)- if (key.group == group) key- ];- }-- SettingsKeys._();-}+import 'package:kazumi/services/storage/settings_keys.dart';+export 'package:kazumi/services/storage/settings_keys.dart';class GStorage {/// Don't use favorites box, it's replaced by collectibles.@@ -967,101 +380,3 @@ class GStorage {GStorage._();}--// Historical Hive key names used by settings created before the typed registry.-// Keep these strings stable so existing users keep their saved settings.-// New settings do not need to be added here unless they intentionally reuse an-// existing persisted key.-class _SettingBoxKey {- static const String hAenable = 'hAenable',- hardwareDecoder = 'hardwareDecoder',- searchEnhanceEnable = 'searchEnhanceEnable',- autoUpdate = 'autoUpdate',- alwaysOntop = 'alwaysOntop',- defaultPlaySpeed = 'defaultPlaySpeed',- defaultShortcutForwardPlaySpeed = 'defaultShortcutForwardPlaySpeed',- defaultAspectRatioType = 'defaultAspectRatioType',- buttonSkipTime = 'buttonSkipTime',- arrowKeySkipTime = 'arrowKeySkipTime',- danmakuEnhance = 'danmakuEnhance',- danmakuBorder = 'danmakuBorder',- danmakuBorderSize = 'danmakuBorderSize',- danmakuOpacity = 'danmakuOpacity',- danmakuFontSize = 'danmakuFontSize',- danmakuTop = 'danmakuTop',- danmakuScroll = 'danmakuScroll',- danmakuBottom = 'danmakuBottom',- danmakuMassive = 'danmakuMassive',- danmakuDeduplication = 'danmakuDeduplication',- danmakuArea = 'danmakuArea',- danmakuColor = 'danmakuColor',- danmakuDuration = 'danmakuDuration',- danmakuLineHeight = 'danmakuLineHeight',- danmakuTimeOffset = 'danmakuTimeOffset',- danmakuEnabledByDefault = 'danmakuEnabledByDefault',- danmakuBiliBiliSource = 'danmakuBiliBiliSource',- danmakuGamerSource = 'danmakuGamerSource',- danmakuDanDanSource = 'danmakuDanDanSource',- danmakuFontWeight = 'danmakuFontWeight',- danmakuFollowSpeed = 'danmakuFollowSpeed',- themeMode = 'themeMode',- themeColor = 'themeColor',- privateMode = 'privateMode',- autoPlay = 'autoPlay',- autoPlayNext = 'autoPlayNext',- playResume = 'playResume',- showPlayerError = 'showPlayerError',- oledEnhance = 'oledEnhance',- displayMode = 'displayMode',- enableGitProxy = 'enableGitProxy',- enableBangumiProxy = 'enableBangumiProxy',- enableSystemProxy = 'enableSystemProxy',- defaultStartupPage = 'defaultStartupPage',-- /// Deprecated- isWideScreen = 'isWideScreen',- webDavEnable = 'webDavEnable',- webDavEnableHistory = 'webDavEnableHistory',- webDavEnableCollect = 'webDavEnableCollect',- webDavURL = 'webDavURL',- webDavUsername = 'webDavUsername',- webDavPassword = 'webDavPasswd',- lowMemoryMode = 'lowMemoryMode',- showWindowButton = 'showWindowButton',- useDynamicColor = 'useDynamicColor',- exitBehavior = 'exitBehavior',- playerDebugMode = 'playerDebugMode',- syncPlayEndPoint = 'syncPlayEndPoint',- androidEnableOpenSLES = 'androidEnableOpenSLES',- androidVideoRenderer = 'androidVideoRenderer',- androidAutoEnterPIP = 'androidAutoEnterPIP',- defaultSuperResolutionType = 'defaultSuperResolutionType',- superResolutionWarn = 'superResolutionWarn',- playerDisableAnimations = 'playerDisableAnimations',- playerLogLevel = 'playerLogLevel',- searchNotShowWatchedBangumis = 'searchNotShowWatchedBangumis',- searchNotShowAbandonedBangumis = 'searchNotShowAbandonedBangumis',- timelineNotShowAbandonedBangumis = 'timelineNotShowAbandonedBangumis',- timelineNotShowWatchedBangumis = 'timelineNotShowWatchedBangumis',- timelineOnlyShowWatchingBangumis = 'timelineOnlyShowWatchingBangumis',- useSystemFont = 'useSystemFont',- forceAdBlocker = 'forceAdBlocker',- backgroundPlayback = 'backgroundPlayback',- proxyEnable = 'proxyEnable',- proxyConfigured = 'proxyConfigured',- proxyUrl = 'proxyUrl',- proxyTestUrl = 'proxyTestUrl',- showRating = 'showRating',- downloadParallelEpisodes = 'downloadParallelEpisodes',- downloadParallelSegments = 'downloadParallelSegments',- downloadDanmaku = 'downloadDanmaku',- shortcutDialogShown = 'shortcutDialogShown',- bangumiSyncEnable = 'bangumiSyncEnable',- bangumiAccessToken = 'bangumiAccessToken',- bangumiSyncPriority = 'bangumiSyncPriority',- bangumiImmediateSyncToastEnable = 'bangumiImmediateSyncToastEnable',- brightnessVolumeGesture = 'brightnessVolumeGesture',- historySyncDeviceId = 'historySyncDeviceId',- historySyncSequence = 'historySyncSequence',- historySyncSnapshotInitialized = 'historySyncSnapshotInitialized';-}