feat: 汉化缓存支持清理启动器汉化缓存

This commit is contained in:
xkeyC 2024-10-07 12:48:11 +08:00
parent 6df16058ac
commit 72cdf77a74
2 changed files with 10 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View File

@ -128,9 +128,11 @@ class SettingsUIModel extends _$SettingsUIModel {
}
_loadLocationCacheSize() async {
final len = await SystemHelper.getDirLen(
final len1 = await SystemHelper.getDirLen(
"${appGlobalState.applicationSupportDir}/Localizations");
final locationCacheSize = len;
final len2 = await SystemHelper.getDirLen(
"${appGlobalState.applicationSupportDir}/launcher_enhance_data");
final locationCacheSize = len1 + len2;
state = state.copyWith(locationCacheSize: locationCacheSize);
}
@ -140,10 +142,14 @@ class SettingsUIModel extends _$SettingsUIModel {
S.current.setting_action_info_confirm_clear_cache,
Text(S.current.setting_action_info_clear_cache_warning));
if (ok == true) {
final dir =
final dir1 =
Directory("${appGlobalState.applicationSupportDir}/Localizations");
final dir2 = Directory(
"${appGlobalState.applicationSupportDir}/launcher_enhance_data");
if (!context.mounted) return;
await dir.delete(recursive: true).unwrap(context: context);
await dir1.delete(recursive: true).unwrap(context: context);
if (!context.mounted) return;
await dir2.delete(recursive: true).unwrap(context: context);
_initState();
}
}