|
@@ -120,58 +120,49 @@ extension PublishNewMusicListView : UITableViewDelegate, UITableViewDataSource {
|
|
|
PathURLManager.projectDownloadsPath(parentURL:
|
|
|
PathURLManager.projectDocumentPath())))))!
|
|
|
if FileManager.default.fileExists(atPath: pathUrl.path) {
|
|
|
- cell?.isSelected = true
|
|
|
- cell?.activityIndicatorView.stopAnimating()
|
|
|
+
|
|
|
//播放
|
|
|
AliPlayerManager.shared.initAudioPlayer(pathUrl: pathUrl.path,startPlayClosure: {
|
|
|
+ cell?.isSelected = true
|
|
|
cell?.iconImageView.isHidden = false
|
|
|
- cell?.iconImageView.image = kImage(name: "music_btn_pause")
|
|
|
})
|
|
|
} else {
|
|
|
|
|
|
SwiftMoyaNetWorkServiceDownLoad.shared().musicApi(mp3url: mp3url, progressClosure: { progress in
|
|
|
cell?.activityIndicatorView.startAnimating()
|
|
|
cell?.iconImageView.isHidden = true
|
|
|
- cell?.isSelected = false
|
|
|
- }, completion: { [weak cell] (_) -> (Void) in
|
|
|
+
|
|
|
+ }, completion: { [weak self] (_) -> (Void) in
|
|
|
|
|
|
- if publishNewMusicSelectedindexPath == indexPath {
|
|
|
+ if publishNewMusicSelectedindexPath?.row == indexPath.row && publishNewMusicSelectedindexPath?.section == self?.index {
|
|
|
//播放
|
|
|
AliPlayerManager.shared.initAudioPlayer(url: cell?.communityMusicItemModel?.url,startPlayClosure: {
|
|
|
+ cell?.isSelected = true
|
|
|
cell?.activityIndicatorView.stopAnimating()
|
|
|
cell?.iconImageView.isHidden = false
|
|
|
- cell?.isSelected = true
|
|
|
- cell?.iconImageView.image = kImage(name: "music_btn_pause")
|
|
|
})
|
|
|
}else {
|
|
|
- cell?.isSelected = false
|
|
|
- cell?.activityIndicatorView.stopAnimating()
|
|
|
- cell?.iconImageView.isHidden = false
|
|
|
- cell?.iconImageView.image = kImage(name: "music_btn_pause")
|
|
|
+ self?.tableView((self?.tableView)!, didDeselectRowAt: indexPath)
|
|
|
}
|
|
|
|
|
|
- }) { [weak cell] (loadingStatus) in
|
|
|
- cell?.isSelected = false
|
|
|
- cell?.activityIndicatorView.stopAnimating()
|
|
|
- cell?.iconImageView.isHidden = false
|
|
|
- cell?.iconImageView.image = kImage(name: "music_btn_pause")
|
|
|
+ }) { [weak self] (loadingStatus) in
|
|
|
+ self?.tableView((self?.tableView)!, didDeselectRowAt: indexPath)
|
|
|
publishNewMusicSelectedindexPath = nil
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
- //暂停播放
|
|
|
- AliPlayerManager.shared.audioPlayer.pause()
|
|
|
- cell?.iconImageView.image = kImage(name: "music_btn_play")
|
|
|
- cell?.isSelected = false
|
|
|
- publishNewMusicSelectedindexPath = nil
|
|
|
+ //暂停播放
|
|
|
+ AliPlayerManager.shared.audioPlayer.pause()
|
|
|
+ self.tableView(tableView, didDeselectRowAt: indexPath)
|
|
|
+ publishNewMusicSelectedindexPath = nil
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
|
|
|
let cell = tableView.cellForRow(at: indexPath) as? PublishNewMusicListViewTableViewCell
|
|
|
cell?.isSelected = false
|
|
|
- cell?.iconImageView.image = kImage(name: "music_btn_play")
|
|
|
cell?.activityIndicatorView.stopAnimating()
|
|
|
+ cell?.iconImageView.isHidden = false
|
|
|
}
|
|
|
|
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|