mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 添加启动时清除缓存设置
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:PiliPalaX/utils/cache_manage.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
@@ -29,6 +30,9 @@ void main() async {
|
|||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
MediaKit.ensureInitialized();
|
MediaKit.ensureInitialized();
|
||||||
await GStrorage.init();
|
await GStrorage.init();
|
||||||
|
if (GStrorage.setting.get(SettingBoxKey.autoClearCache, defaultValue: false)) {
|
||||||
|
await CacheManage.clearLibraryCache();
|
||||||
|
}
|
||||||
if (GStrorage.setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
if (GStrorage.setting.get(SettingBoxKey.horizontalScreen, defaultValue: false)) {
|
||||||
await SystemChrome.setPreferredOrientations(
|
await SystemChrome.setPreferredOrientations(
|
||||||
//支持竖屏与横屏
|
//支持竖屏与横屏
|
||||||
|
|||||||
@@ -284,6 +284,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '自动清除缓存',
|
||||||
|
subTitle: '每次启动时清除缓存',
|
||||||
|
setKey: SettingBoxKey.autoClearCache,
|
||||||
|
defaultVal: false,
|
||||||
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '检查更新',
|
title: '检查更新',
|
||||||
subTitle: '每次启动时检查是否需要更新',
|
subTitle: '每次启动时检查是否需要更新',
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ class SettingBoxKey {
|
|||||||
|
|
||||||
/// 其他
|
/// 其他
|
||||||
autoUpdate = 'autoUpdate',
|
autoUpdate = 'autoUpdate',
|
||||||
|
autoClearCache = 'autoClearCache',
|
||||||
replySortType = 'replySortType',
|
replySortType = 'replySortType',
|
||||||
defaultDynamicType = 'defaultDynamicType',
|
defaultDynamicType = 'defaultDynamicType',
|
||||||
enableHotKey = 'enableHotKey',
|
enableHotKey = 'enableHotKey',
|
||||||
|
|||||||
Reference in New Issue
Block a user