Skip to content

Commit

Permalink
Merge pull request #290 from 5stralia/master
Browse files Browse the repository at this point in the history
Check canSelect(phAsset:)
  • Loading branch information
tilltue authored Nov 1, 2020
2 parents b055857 + f283345 commit f8714a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TLPhotoPicker/Classes/TLPhotosPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,8 @@ extension TLPhotosPickerViewController: UIImagePickerControllerDelegate, UINavig
}, completionHandler: { [weak self] (success, error) in
guard self?.maxCheck() == false else { return }
if success, let `self` = self, let identifier = placeholderAsset?.localIdentifier {
guard let asset = PHAsset.fetchAssets(withLocalIdentifiers: [identifier], options: nil).firstObject else { return }
guard let asset = PHAsset.fetchAssets(withLocalIdentifiers: [identifier], options: nil).firstObject,
self.canSelect(phAsset: asset) else { return }
var result = TLPHAsset(asset: asset)
result.selectedOrder = self.selectedAssets.count + 1
result.isSelectedFromCamera = true
Expand All @@ -693,7 +694,8 @@ extension TLPhotosPickerViewController: UIImagePickerControllerDelegate, UINavig
}) { [weak self] (sucess, error) in
guard self?.maxCheck() == false else { return }
if sucess, let `self` = self, let identifier = placeholderAsset?.localIdentifier {
guard let asset = PHAsset.fetchAssets(withLocalIdentifiers: [identifier], options: nil).firstObject else { return }
guard let asset = PHAsset.fetchAssets(withLocalIdentifiers: [identifier], options: nil).firstObject,
self.canSelect(phAsset: asset) else { return }
var result = TLPHAsset(asset: asset)
result.selectedOrder = self.selectedAssets.count + 1
result.isSelectedFromCamera = true
Expand Down

0 comments on commit f8714a8

Please sign in to comment.