🐛 Fix iOS picker dismiss issue when swiping before full load #412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #138 - No event generated on iOS when dismissing selection dialog
Problem
When users quickly dismissed iOS file/photo pickers by swiping down before the picker was fully loaded/animated, no dismiss event was generated. This affected both
UIDocumentPickerViewControllerandPHPickerViewController. Only normal cancellation (via Cancel button or full sheet dismissal) worked properly.Root Cause
presentationControllerDidDismiss, not the standard picker delegate methodsUIAdaptivePresentationControllerDelegateProtocolSolution
1. Enhanced DocumentPickerDelegate
UIAdaptivePresentationControllerDelegateProtocolimplementationpresentationControllerDidDismiss()to catch early dismissalshasFinishedflag to prevent race conditions between delegate methods2. Enhanced PhPickerDelegate
UIAdaptivePresentationControllerDelegateProtocolimplementationhasFinishedflag for race condition prevention3. Removed PhPickerDismissDelegate
PhPickerDelegatefor cleaner architecture4. Updated FileKit.ios.kt
PhPickerDismissDelegateFiles Changed
DocumentPickerDelegate.kt- Added presentation controller delegate protocolPhPickerDelegate.kt- Added presentation controller delegate and consolidated functionalityPhPickerDismissDelegate.kt- Consolidated into PhPickerDelegateFileKit.ios.kt- Updated delegate assignments and removed references to deleted classWhy PhPickerDismissDelegate was Deleted
The
PhPickerDismissDelegate.ktfile was removed because:Testing
Result
All dismissal scenarios now properly trigger the dismiss callback, including early swipe-to-dismiss gestures.
Type of Change
Platform Impact
Checklist
Fixes #138