|
@@ -22,7 +22,7 @@ import Photos
|
|
|
@objc optional func mediaPicker(_ mediaPicker: KSMediaPickerController, didFinishSelected outputArray: [KSMediaPickerOutputModel])
|
|
|
}
|
|
|
|
|
|
-open class KSMediaPickerController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UITableViewDelegate, UITableViewDataSource {
|
|
|
+open class KSMediaPickerController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
|
|
|
|
|
|
@objc public enum mediaType : Int {
|
|
|
case all = 0
|
|
@@ -81,8 +81,6 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
|
|
|
let nav = view.albumNavigationView
|
|
|
nav.closeButton.addTarget(self, action: #selector(_didClick(closeButton:)), for: .touchUpInside)
|
|
|
nav.nextButton.addTarget(self, action: #selector(_didClick(nextButton:)), for: .touchUpInside)
|
|
|
- //FIXME: disable
|
|
|
-// nav.centerButton.addTarget(self, action: #selector(_chengedAlbumListStatus(_:)), for: .touchUpInside)
|
|
|
|
|
|
let classObj = KSMediaPickerController.self
|
|
|
let collectionView = view.collectionView
|
|
@@ -91,10 +89,6 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
|
|
|
collectionView.delegate = self
|
|
|
collectionView.dataSource = self
|
|
|
|
|
|
- let tableView = view.albumTableView
|
|
|
- tableView.delegate = self
|
|
|
- tableView.dataSource = self
|
|
|
-
|
|
|
let cameraView = view.cameraView
|
|
|
cameraView.didTakePhotoCallback = {[weak self] (cameraView, image) in
|
|
|
self?._didTakePhotoFinish(cameraView: cameraView, image: image)
|
|
@@ -151,8 +145,6 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
|
|
|
private var _selectedAlbum: KSMediaPickerAlbumModel? {
|
|
|
didSet {
|
|
|
let view = self.view as! KSMediaPickerView
|
|
|
- //FIXME: disable
|
|
|
-// view.albumNavigationView.title = _selectedAlbum?.albumTitle
|
|
|
_updateHighlightedItemStatus()
|
|
|
if let itemModel = _selectedAlbum?.assetList.first {
|
|
|
let isStandard = _selectedAssetArray.count == 0 || itemModel == (_selectedAssetArray.firstObject as! KSMediaPickerItemModel)
|
|
@@ -165,16 +157,9 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
|
|
|
}
|
|
|
|
|
|
private func _loadAssetDataFinish() {
|
|
|
- (view as! KSMediaPickerView).albumTableView.reloadData()
|
|
|
_selectedAlbum = _albumList?.first
|
|
|
}
|
|
|
|
|
|
- //FIXME: disable
|
|
|
-// @objc private func _chengedAlbumListStatus(_ button: KSTriangleIndicatorButton) {
|
|
|
-// let isShow = (view as! KSMediaPickerView).chengedAlbumListStatus()
|
|
|
-// button.rotationDirection = isShow ? .down : .up
|
|
|
-// }
|
|
|
-
|
|
|
@objc private func _didClick(closeButton: UIButton?) {
|
|
|
// navigationController?.dismiss(animated: true, completion: nil)
|
|
|
|
|
@@ -474,32 +459,6 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
|
|
|
highlightedItemModel.isHighlight = false
|
|
|
}
|
|
|
|
|
|
- public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
- return _albumList?.count ?? 0
|
|
|
- }
|
|
|
-
|
|
|
- private static let k_iden = "KSMediaPickerViewAlbumCell"
|
|
|
-
|
|
|
- public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
- let iden = KSMediaPickerController.k_iden
|
|
|
- var cell = tableView.dequeueReusableCell(withIdentifier: iden) as? KSMediaPickerViewAlbumCell
|
|
|
- if cell == nil {
|
|
|
- cell = KSMediaPickerViewAlbumCell(style: .subtitle, reuseIdentifier: iden)
|
|
|
- }
|
|
|
- cell?.albumModel = _albumList?[indexPath.row]
|
|
|
- return cell!
|
|
|
- }
|
|
|
-
|
|
|
- public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
|
- let cell = tableView.cellForRow(at: indexPath) as? KSMediaPickerViewAlbumCell
|
|
|
- tableView.deselectRow(at: indexPath, animated: true)
|
|
|
- guard cell != nil, let albumModel = cell?.albumModel else {
|
|
|
- return
|
|
|
- }
|
|
|
- _selectedAlbum = albumModel
|
|
|
- //FIXME: disable
|
|
|
-// _chengedAlbumListStatus((view as! KSMediaPickerView).albumNavigationView.centerButton)
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
extension KSMediaPickerController {
|