mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
limit cache size
This commit is contained in:
@@ -129,7 +129,10 @@
|
||||
"Move favorite after reading": "阅读后移动收藏",
|
||||
"Are you sure you want to delete this folder?" : "确定要删除这个收藏夹吗?",
|
||||
"Import from file": "从文件导入",
|
||||
"Failed to import": "导入失败"
|
||||
"Failed to import": "导入失败",
|
||||
"Cache Limit": "缓存限制",
|
||||
"Set Cache Limit": "设置缓存限制",
|
||||
"Size in MB": "大小(MB)"
|
||||
},
|
||||
"zh_TW": {
|
||||
"Home": "首頁",
|
||||
@@ -261,6 +264,9 @@
|
||||
"Move favorite after reading": "閱讀後移動收藏",
|
||||
"Are you sure you want to delete this folder?" : "確定要刪除這個收藏夾嗎?",
|
||||
"Import from file": "從文件匯入",
|
||||
"Failed to import": "匯入失敗"
|
||||
"Failed to import": "匯入失敗",
|
||||
"Cache Limit": "緩存限制",
|
||||
"Set Cache Limit": "設置緩存限制",
|
||||
"Size in MB": "大小(MB)"
|
||||
}
|
||||
}
|
@@ -108,6 +108,7 @@ class _Settings {
|
||||
'enableTapToTurnPages': true,
|
||||
'enablePageAnimation': true,
|
||||
'language': 'system', // system, zh-CN, zh-TW, en-US
|
||||
'cacheSize': 2048, // in MB
|
||||
};
|
||||
|
||||
operator [](String key) {
|
||||
|
@@ -22,5 +22,5 @@ Future<void> init() async {
|
||||
await ComicSource.init();
|
||||
await LocalManager().init();
|
||||
await TagsTranslation.readData();
|
||||
CacheManager();
|
||||
CacheManager().setLimitSize(appdata.settings['cacheSize']);
|
||||
}
|
@@ -25,8 +25,8 @@ class _AppSettingsState extends State<AppSettings> {
|
||||
title: "Set New Storage Path".tl,
|
||||
actionTitle: "Set".tl,
|
||||
callback: () async {
|
||||
if(App.isIOS) {
|
||||
context.showMessage(message: "Not supported on iOS".tl);
|
||||
if (App.isMobile) {
|
||||
context.showMessage(message: "Not supported".tl);
|
||||
return;
|
||||
}
|
||||
var result = await selectDirectory();
|
||||
@@ -65,6 +65,27 @@ class _AppSettingsState extends State<AppSettings> {
|
||||
setState(() {});
|
||||
},
|
||||
).toSliver(),
|
||||
_CallbackSetting(
|
||||
title: "Cache Limit".tl,
|
||||
subtitle: "${appdata.settings['cacheSize']} MB",
|
||||
callback: () {
|
||||
showInputDialog(
|
||||
context: context,
|
||||
title: "Set Cache Limit".tl,
|
||||
hintText: "Size in MB".tl,
|
||||
inputValidator: RegExp(r"^\d+$"),
|
||||
onConfirm: (value) {
|
||||
appdata.settings['cacheSize'] = int.parse(value);
|
||||
appdata.saveData();
|
||||
setState(() {});
|
||||
CacheManager()
|
||||
.setLimitSize(appdata.settings['cacheSize'] * 1024 * 1024);
|
||||
return null;
|
||||
},
|
||||
);
|
||||
},
|
||||
actionTitle: 'Set'.tl,
|
||||
).toSliver(),
|
||||
_SettingPartTitle(
|
||||
title: "Log".tl,
|
||||
icon: Icons.error_outline,
|
||||
|
Reference in New Issue
Block a user