Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/file_picker_darwin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.1.4

- Fixed a partial swipe down on the iOS picker sheet completing the pick as cancelled while the picker stayed open, which dropped the files selected afterwards. [#2243](https://github.com/vicajilau/flutter_file_picker/issues/2243)

## 2.1.3

- Fixed `saveFile()` on macOS appending a second, lowercased extension to file names with a custom extension, such as `j.nme2mbAllpreset`. [#2238](https://github.com/vicajilau/flutter_file_picker/issues/2238)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,27 @@ final class IOSFilePickerHandler: NSObject,
finishCurrentRequest(nil)
}

func presentationControllerWillDismiss(_: UIPresentationController) {
finishCurrentRequest(nil)
func presentationControllerWillDismiss(
_ presentationController: UIPresentationController
) {
// UIKit calls this as soon as the user starts pulling the sheet down,
// even if they let it spring back, so finishing right away would
// report a cancellation while the picker is still open and drop the
// later selection. Wait for the dismissal to end instead. A fast swipe
// may never reach presentationControllerDidDismiss, so this still
// finishes the request when the dismissal completes.
guard
let coordinator = presentationController.presentedViewController
.transitionCoordinator
else {
finishCurrentRequest(nil)
return
}
coordinator.animate(alongsideTransition: nil) { [weak self] context in
if !context.isCancelled {
self?.finishCurrentRequest(nil)
}
}
}

func presentationControllerDidDismiss(
Expand Down
2 changes: 1 addition & 1 deletion packages/file_picker_darwin/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: file_picker_darwin
description: Darwin (iOS and macOS) implementation of the file_picker plugin, supporting native file picking, saving, and directory selection.
version: 2.1.3
version: 2.1.4
homepage: https://github.com/vicajilau/flutter_file_picker/tree/main/packages/file_picker_darwin
repository: https://github.com/vicajilau/flutter_file_picker/tree/main/packages/file_picker_darwin
topics:
Expand Down
Loading