From fd5b15f4768dc0b1b1cd1b377db45b903f42c79a Mon Sep 17 00:00:00 2001 From: HI-chehsing Date: Tue, 16 Aug 2022 17:21:32 +0800 Subject: [PATCH] Add dismiss listener for DocumentPicker --- src/ios/Chooser.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ios/Chooser.swift b/src/ios/Chooser.swift index 24ece6e..2bda96a 100755 --- a/src/ios/Chooser.swift +++ b/src/ios/Chooser.swift @@ -14,6 +14,7 @@ class Chooser : CDVPlugin { func callPicker (includeData: Bool, utis: [String]) { let picker = ChooserUIDocumentPickerViewController(documentTypes: utis, in: .import) picker.delegate = self + picker.presentationController?.delegate = self picker.includeData = includeData self.viewController.present(picker, animated: true, completion: nil) } @@ -174,3 +175,9 @@ extension Chooser : UIDocumentPickerDelegate { self.send("RESULT_CANCELED") } } + +extension Chooser : UIAdaptivePresentationControllerDelegate { + func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + self.send("RESULT_CANCELED") + } +}