diff --git a/lib/src/screens/settings/mweb_logs_page.dart b/lib/src/screens/settings/mweb_logs_page.dart index eedb3bc4c..3c5470214 100644 --- a/lib/src/screens/settings/mweb_logs_page.dart +++ b/lib/src/screens/settings/mweb_logs_page.dart @@ -102,7 +102,8 @@ class MwebLogsPage extends BasePage { Future share(BuildContext context) async { final filePath = (await getAppDir()).path + "/debug.log"; - await mwebSettingsViewModelBase.saveLogsLocally(filePath); + bool success = await mwebSettingsViewModelBase.saveLogsLocally(filePath); + if (!success) return; await ShareUtil.shareFile(filePath: filePath, fileName: "debug.log", context: context); await mwebSettingsViewModelBase.removeLogsLocally(filePath); } diff --git a/lib/view_model/settings/mweb_settings_view_model.dart b/lib/view_model/settings/mweb_settings_view_model.dart index a07b62d5a..11e4c8177 100644 --- a/lib/view_model/settings/mweb_settings_view_model.dart +++ b/lib/view_model/settings/mweb_settings_view_model.dart @@ -47,7 +47,7 @@ abstract class MwebSettingsViewModelBase with Store { _settingsStore.mwebAlwaysScan = value; } - Future saveLogsLocally(String filePath) async { + Future saveLogsLocally(String filePath) async { try { final appSupportPath = (await getApplicationSupportDirectory()).path; final logsFile = File("$appSupportPath/logs/debug.log"); @@ -55,12 +55,14 @@ abstract class MwebSettingsViewModelBase with Store { throw Exception('Logs file does not exist'); } await logsFile.copy(filePath); + return true; } catch (e, s) { ExceptionHandler.onError(FlutterErrorDetails( exception: e, stack: s, library: "Export Logs", )); + return false; } }