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.
Purpose
Adds long press preview to images.
Details
This PR adds support for long press previews of photos/videos.
On iOS versions <13.0 it only shows a preview of the selected asset, while on iOS 13+ it also adds a contextual menu with the option to select/deselect the previewed photo.
The previews support static photos, live photos and videos.
Changes
In order to achieve this, a new read-only property was added to
TLPhotoCollectionViewCell
:open internal(set) var asset: PHAsset?
as well as 2 delegate callbacks toTLPhotosPickerViewController
.public func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController?
is used for iOS <13 devices and only shows a preview of the photo on a force touch.public func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration?
is used for iOS 13+ devices and shows the context menu to select/deselect the photo.Screenshots