fix: Incorrect duplicate filename handling when exporting files (#1541)

This commit is contained in:
Dhruvan Bhalara 2023-12-01 17:54:00 +05:30 committed by aAbed
parent c9412a97d0
commit de51fbd7be
No known key found for this signature in database
GPG key ID: F26611AB3F996827
2 changed files with 5 additions and 4 deletions

View file

@ -237,9 +237,10 @@ void exportPatchedFile(String appName, String version) {
if (outFile != null) { if (outFile != null) {
final String newName = _getFileName(appName, version); final String newName = _getFileName(appName, version);
FlutterFileDialog.saveFile( FlutterFileDialog.saveFile(
params: SaveFileDialogParams( params: SaveFileDialogParams(
sourceFilePath: outFile!.path, sourceFilePath: outFile!.path,
fileName: newName, fileName: newName,
mimeTypesFilter: ['application/vnd.android.package-archive'],
), ),
); );
} }
@ -287,7 +288,7 @@ Future<void> exportPatcherLog(String logs) async {
final File log = File('${logDir.path}/$fileName'); final File log = File('${logDir.path}/$fileName');
log.writeAsStringSync(logs); log.writeAsStringSync(logs);
FlutterFileDialog.saveFile( FlutterFileDialog.saveFile(
params: SaveFileDialogParams( params:SaveFileDialogParams(
sourceFilePath: log.path, sourceFilePath: log.path,
fileName: fileName, fileName: fileName,
), ),

View file

@ -210,7 +210,7 @@ class SettingsViewModel extends BaseViewModel {
final String dateTime = final String dateTime =
DateTime.now().toString().replaceAll(' ', '_').split('.').first; DateTime.now().toString().replaceAll(' ', '_').split('.').first;
await FlutterFileDialog.saveFile( await FlutterFileDialog.saveFile(
params: SaveFileDialogParams( params: SaveFileDialogParams(
sourceFilePath: outFile.path, sourceFilePath: outFile.path,
fileName: 'selected_patches_$dateTime.json', fileName: 'selected_patches_$dateTime.json',
), ),
@ -261,7 +261,7 @@ class SettingsViewModel extends BaseViewModel {
final String dateTime = final String dateTime =
DateTime.now().toString().replaceAll(' ', '_').split('.').first; DateTime.now().toString().replaceAll(' ', '_').split('.').first;
await FlutterFileDialog.saveFile( await FlutterFileDialog.saveFile(
params: SaveFileDialogParams( params: SaveFileDialogParams(
sourceFilePath: outFile.path, sourceFilePath: outFile.path,
fileName: 'keystore_$dateTime.keystore', fileName: 'keystore_$dateTime.keystore',
), ),