From de51fbd7bee532be020bb7bfe5c672742dd93ced Mon Sep 17 00:00:00 2001 From: Dhruvan Bhalara <53393418+dhruvanbhalara@users.noreply.github.com> Date: Fri, 1 Dec 2023 17:54:00 +0530 Subject: [PATCH] fix: Incorrect duplicate filename handling when exporting files (#1541) --- lib/services/patcher_api.dart | 5 +++-- lib/ui/views/settings/settings_viewmodel.dart | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index 4266a880..65f5ecc0 100644 --- a/lib/services/patcher_api.dart +++ b/lib/services/patcher_api.dart @@ -237,9 +237,10 @@ void exportPatchedFile(String appName, String version) { if (outFile != null) { final String newName = _getFileName(appName, version); FlutterFileDialog.saveFile( - params: SaveFileDialogParams( + params: SaveFileDialogParams( sourceFilePath: outFile!.path, fileName: newName, + mimeTypesFilter: ['application/vnd.android.package-archive'], ), ); } @@ -287,7 +288,7 @@ Future exportPatcherLog(String logs) async { final File log = File('${logDir.path}/$fileName'); log.writeAsStringSync(logs); FlutterFileDialog.saveFile( - params: SaveFileDialogParams( + params:SaveFileDialogParams( sourceFilePath: log.path, fileName: fileName, ), diff --git a/lib/ui/views/settings/settings_viewmodel.dart b/lib/ui/views/settings/settings_viewmodel.dart index d1dbfd7e..e51b1382 100644 --- a/lib/ui/views/settings/settings_viewmodel.dart +++ b/lib/ui/views/settings/settings_viewmodel.dart @@ -210,7 +210,7 @@ class SettingsViewModel extends BaseViewModel { final String dateTime = DateTime.now().toString().replaceAll(' ', '_').split('.').first; await FlutterFileDialog.saveFile( - params: SaveFileDialogParams( + params: SaveFileDialogParams( sourceFilePath: outFile.path, fileName: 'selected_patches_$dateTime.json', ), @@ -261,7 +261,7 @@ class SettingsViewModel extends BaseViewModel { final String dateTime = DateTime.now().toString().replaceAll(' ', '_').split('.').first; await FlutterFileDialog.saveFile( - params: SaveFileDialogParams( + params: SaveFileDialogParams( sourceFilePath: outFile.path, fileName: 'keystore_$dateTime.keystore', ),