Skip to content

Commit

Permalink
release 2.0.8
Browse files Browse the repository at this point in the history
- added preview at force touch
  • Loading branch information
wade-hawk committed Jan 27, 2020
1 parent 2e2f928 commit b46004e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ TLPhotoPicker enables application to pick images and videos from multiple smart
- custom display and selection rules
- reload of changes that occur in the Photos library.
- support iCloud Photo Library
- adds long press preview to images. ( to @smeshko ) [Preview](https://github.com/tilltue/TLPhotoPicker/pull/252#issue-362005178)

| Smart album collection | LivePhotoCell | VideoPhotoCell | PhotoCell | CustomCell(instagram) |
| ------------- | ------------- | ------------- | ------------- | ------------- |
Expand Down Expand Up @@ -281,6 +282,7 @@ public struct TLPhotosPickerConfigure {
public var emptyImage: UIImage? = nil
public var usedCameraButton = true
public var usedPrefetch = false
public var previewAtForceTouch = false
public var allowedLivePhotos = true
public var allowedVideo = true
public var allowedAlbumCloudShared = false
Expand Down
2 changes: 1 addition & 1 deletion TLPhotoPicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'TLPhotoPicker'
s.version = '2.0.6'
s.version = '2.0.8'
s.summary = 'multiple phassets picker for iOS lib. like facebook'

# This description is used to generate tags and improve search results.
Expand Down
16 changes: 9 additions & 7 deletions TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public struct TLPhotosPickerConfigure {
public var emptyImage: UIImage? = nil
public var usedCameraButton = true
public var usedPrefetch = false
public var previewAtForceTouch = false
public var startplayBack: PHLivePhotoViewPlaybackStyle = .hint
public var allowedLivePhotos = true
public var allowedVideo = true
Expand Down Expand Up @@ -148,14 +149,13 @@ open class TLPhotosPickerViewController: UIViewController {
public var customDataSouces: TLPhotopickerDataSourcesProtocol? = nil

private var usedCameraButton: Bool {
get {
return self.configure.usedCameraButton
}
return self.configure.usedCameraButton
}
private var previewAtForceTouch: Bool {
return self.configure.previewAtForceTouch
}
private var allowedVideo: Bool {
get {
return self.configure.allowedVideo
}
return self.configure.allowedVideo
}
private var usedPrefetch: Bool {
get {
Expand Down Expand Up @@ -225,7 +225,7 @@ open class TLPhotosPickerViewController: UIViewController {
open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

if traitCollection.forceTouchCapability == .available {
if traitCollection.forceTouchCapability == .available && self.previewAtForceTouch {
registerForPreviewing(with: self, sourceView: collectionView)
}

Expand Down Expand Up @@ -1148,6 +1148,7 @@ extension TLPhotosPickerViewController: UITableViewDelegate, UITableViewDataSour
// MARK: - UIViewControllerPreviewingDelegate
extension TLPhotosPickerViewController: UIViewControllerPreviewingDelegate {
public func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard self.previewAtForceTouch == true else { return nil }
guard let pressingIndexPath = collectionView.indexPathForItem(at: location) else { return nil }
guard let pressingCell = collectionView.cellForItem(at: pressingIndexPath) as? TLPhotoCollectionViewCell else { return nil }

Expand All @@ -1162,6 +1163,7 @@ extension TLPhotosPickerViewController: UIViewControllerPreviewingDelegate {

@available(iOS 13.0, *)
public func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {
guard self.previewAtForceTouch == true else { return nil }
guard let cell = collectionView.cellForItem(at: indexPath) as? TLPhotoCollectionViewCell else { return nil }

return UIContextMenuConfiguration(identifier: nil, previewProvider: {
Expand Down
2 changes: 1 addition & 1 deletion TLPhotoPicker/TLPhotoPicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
189E996C21F8BA7F00A754E4 /* TLPhotopickerDataSourcesProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TLPhotopickerDataSourcesProtocol.swift; path = Classes/TLPhotopickerDataSourcesProtocol.swift; sourceTree = SOURCE_ROOT; };
189E996D21F8BA7F00A754E4 /* TLAssetCollection+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "TLAssetCollection+Extension.swift"; path = "Classes/TLAssetCollection+Extension.swift"; sourceTree = SOURCE_ROOT; };
18A3E62C224FADAD009A9567 /* SynchronizedDictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SynchronizedDictionary.swift; path = Classes/SynchronizedDictionary.swift; sourceTree = SOURCE_ROOT; };
B8E49AB123CC5FE900626917 /* TLAssetPreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TLAssetPreviewViewController.swift; sourceTree = "<group>"; };
B8E49AB123CC5FE900626917 /* TLAssetPreviewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = TLAssetPreviewViewController.swift; path = ../Classes/TLAssetPreviewViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down

0 comments on commit b46004e

Please sign in to comment.