Skip to content

Commit

Permalink
feat: option to delete manager logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aunali321 committed Oct 16, 2022
1 parent 56e715c commit 2d73228
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions lib/ui/views/settings/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions lib/ui/views/settings/settings_viewmodel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 2d73228

Please sign in to comment.