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