feat: option to delete manager logs.

This commit is contained in:
Aunali321 2022-10-17 01:58:50 +05:30
parent 56e715cd3c
commit 2d732288a7
3 changed files with 29 additions and 1 deletions

View File

@ -142,7 +142,10 @@
"deletedKeystore": "Keystore deleted",
"deleteTempDirLabel": "Delete temp directory",
"deleteTempDirHint": "Delete the temporary directory used to store temporary files",
"deletedTempDir": "Temp directory deleted"
"deletedTempDir": "Temp directory deleted",
"deleteLogsLabel": "Delete logs",
"deleteLogsHint": "Delete collected manager logs",
"deletedLogs": "Logs deleted"
},
"appInfoView": {
"widgetTitle": "App Info",

View File

@ -168,6 +168,22 @@ class SettingsView extends StatelessWidget {
subtitle: I18nText('settingsView.deleteTempDirHint'),
onTap: () => model.deleteTempDir(),
),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.deleteLogsLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: I18nText('settingsView.deleteLogsHint'),
onTap: () => model.deleteLogs(),
),
],
),
_settingsDivider,

View File

@ -354,6 +354,15 @@ class SettingsViewModel extends BaseViewModel {
return info.version.sdkInt ?? -1;
}
Future<void> deleteLogs() async {
Directory appCacheDir = await getTemporaryDirectory();
Directory logsDir = Directory('${appCacheDir.path}/logs');
if (logsDir.existsSync()) {
logsDir.deleteSync(recursive: true);
}
_toast.showBottom('settingsView.deletedLogs');
}
Future<void> exportLogcatLogs() async {
Directory appCache = await getTemporaryDirectory();
Directory logDir = Directory('${appCache.path}/logs');