From 82e09772b34e3165f9c258279d945863d4353f49 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 | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/services/patcher_api.dart b/lib/services/patcher_api.dart index 4266a88032..65f5ecc095 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 d1dbfd7eb0..29368425d6 100644 --- a/lib/ui/views/settings/settings_viewmodel.dart +++ b/lib/ui/views/settings/settings_viewmodel.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_file_dialog/flutter_file_dialog.dart' hide SaveFileDialogParams; import 'package:flutter_file_dialog/flutter_file_dialog.dart'; import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:logcat/logcat.dart'; @@ -210,7 +211,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 +262,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', ),