From a4d5478669fdbc7cfc1e7982e666b940f49ab390 Mon Sep 17 00:00:00 2001 From: Miguel Ruivo Date: Mon, 19 Oct 2020 21:04:37 +0100 Subject: [PATCH] Fixes #431 Fixes an issue on iOS 14, where canceling with swipe gestures, could result in cancel event not being dispatched. --- CHANGELOG.md | 3 +++ example/lib/src/file_picker_demo.dart | 2 +- ios/Classes/FilePickerPlugin.m | 6 +++++- pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 117ba48..6b8e6cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.8 +Fixes an issue on iOS 14, where canceling with swipe gestures, could result in cancel event not being dispatched. ([#431](https://github.com/miguelpruivo/flutter_file_picker/issues/431)). + ## 2.0.7 Fixes [#425](https://github.com/miguelpruivo/flutter_file_picker/issues/425) and updates iOS to use NSDocumentDirectory on iOS 12 or lower. Thanks @allanwolski. diff --git a/example/lib/src/file_picker_demo.dart b/example/lib/src/file_picker_demo.dart index c67d222..a050141 100644 --- a/example/lib/src/file_picker_demo.dart +++ b/example/lib/src/file_picker_demo.dart @@ -126,7 +126,7 @@ class _FilePickerDemoState extends State { child: _pickingType == FileType.custom ? TextFormField( maxLength: 15, - autovalidate: true, + autovalidateMode: AutovalidateMode.always, controller: _controller, decoration: InputDecoration(labelText: 'File extension'), diff --git a/ios/Classes/FilePickerPlugin.m b/ios/Classes/FilePickerPlugin.m index 9c2737b..b9bb17d 100644 --- a/ios/Classes/FilePickerPlugin.m +++ b/ios/Classes/FilePickerPlugin.m @@ -148,7 +148,11 @@ PHPickerViewController *pickerViewController = [[PHPickerViewController alloc] initWithConfiguration:config]; pickerViewController.delegate = self; - [self.viewController presentViewController:pickerViewController animated:YES completion:nil]; + [self.viewController presentViewController:pickerViewController animated:YES completion:^{ + Log(@"Media picker canceled"); + self->_result(nil); + self->_result = nil; + }]; return; } #endif diff --git a/pubspec.yaml b/pubspec.yaml index cde0c56..bd07a93 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: file_picker description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support. homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker -version: 2.0.7 +version: 2.0.8 dependencies: flutter: