chore: update cr_file_saver (#668)

Co-authored-by: Ushie <github@ushie.dev>
This commit is contained in:
Mipirakas 2023-01-30 13:11:31 +01:00 committed by GitHub
parent 40888c07f3
commit 8591bc4d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 15 deletions

View File

@ -259,16 +259,8 @@ class PatcherAPI {
try { try {
if (_outFile != null) { if (_outFile != null) {
String newName = _getFileName(appName, version); String newName = _getFileName(appName, version);
// This is temporary workaround to populate initial file name
// ref: https://github.com/Cleveroad/cr_file_saver/issues/7
int lastSeparator = _outFile!.path.lastIndexOf('/');
String newSourcePath =
_outFile!.path.substring(0, lastSeparator + 1) + newName;
_outFile!.copySync(newSourcePath);
CRFileSaver.saveFileWithDialog(SaveFileDialogParams( CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
sourceFilePath: newSourcePath, destinationFileName: newName)); sourceFilePath: _outFile!.path, destinationFileName: newName));
} }
} on Exception catch (e, s) { } on Exception catch (e, s) {
Sentry.captureException(e, stackTrace: s); Sentry.captureException(e, stackTrace: s);

View File

@ -74,12 +74,8 @@ class SettingsViewModel extends BaseViewModel {
if (outFile.existsSync()) { if (outFile.existsSync()) {
String dateTime = String dateTime =
DateTime.now().toString().replaceAll(' ', '_').split('.').first; DateTime.now().toString().replaceAll(' ', '_').split('.').first;
String tempFilePath =
'${outFile.path.substring(0, outFile.path.lastIndexOf('/') + 1)}selected_patches_$dateTime.json';
outFile.copySync(tempFilePath);
await CRFileSaver.saveFileWithDialog(SaveFileDialogParams( await CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
sourceFilePath: tempFilePath, destinationFileName: '')); sourceFilePath: outFile.path, destinationFileName: 'selected_patches_$dateTime.json'));
File(tempFilePath).delete();
_toast.showBottom('settingsView.exportedPatches'); _toast.showBottom('settingsView.exportedPatches');
} else { } else {
_toast.showBottom('settingsView.noExportFileFound'); _toast.showBottom('settingsView.noExportFileFound');

View File

@ -15,7 +15,7 @@ dependencies:
app_installer: ^1.1.0 app_installer: ^1.1.0
collection: ^1.16.0 collection: ^1.16.0
cross_connectivity: ^3.0.5 cross_connectivity: ^3.0.5
cr_file_saver: ^0.0.1+2 cr_file_saver: ^0.0.2
device_apps: device_apps:
git: git:
url: https://github.com/ponces/flutter_plugin_device_apps url: https://github.com/ponces/flutter_plugin_device_apps