From bd7949643350a9769ce539bfb5939e00f8c420a7 Mon Sep 17 00:00:00 2001 From: aAbed <39409020+TheAabedKhan@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:33:04 +0545 Subject: [PATCH] fix: Don't show toasts when export cancelled (#2230) --- lib/ui/views/settings/settings_viewmodel.dart | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ui/views/settings/settings_viewmodel.dart b/lib/ui/views/settings/settings_viewmodel.dart index 1323aaacba..2e4ab55765 100644 --- a/lib/ui/views/settings/settings_viewmodel.dart +++ b/lib/ui/views/settings/settings_viewmodel.dart @@ -228,13 +228,15 @@ class SettingsViewModel extends BaseViewModel { if (outFile.existsSync()) { final String dateTime = DateTime.now().toString().replaceAll(' ', '_').split('.').first; - await FlutterFileDialog.saveFile( + final status = await FlutterFileDialog.saveFile( params: SaveFileDialogParams( sourceFilePath: outFile.path, fileName: 'selected_patches_$dateTime.json', ), ); - _toast.showBottom(t.settingsView.exportedPatches); + if (status != null) { + _toast.showBottom(t.settingsView.exportedPatches); + } } else { _toast.showBottom(t.settingsView.noExportFileFound); } @@ -279,13 +281,15 @@ class SettingsViewModel extends BaseViewModel { if (outFile.existsSync()) { final String dateTime = DateTime.now().toString().replaceAll(' ', '_').split('.').first; - await FlutterFileDialog.saveFile( + final status = await FlutterFileDialog.saveFile( params: SaveFileDialogParams( sourceFilePath: outFile.path, fileName: 'keystore_$dateTime.keystore', ), ); - _toast.showBottom(t.settingsView.exportedKeystore); + if (status != null) { + _toast.showBottom(t.settingsView.exportedKeystore); + } } else { _toast.showBottom(t.settingsView.noKeystoreExportFileFound); }