|
@@ -130,6 +130,11 @@ class TSAIRintoneHistoryCell: SwipeCollectionViewCell {
|
|
|
func setTargetVC(targetVC:UIViewController?,indexPath:IndexPath) {
|
|
|
self.targetVC = targetVC
|
|
|
self.indexPath = indexPath
|
|
|
+
|
|
|
+ if let vc = targetVC as? any SwipeCollectionViewCellDelegate {
|
|
|
+ self.delegate = vc
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
func dealThings(){
|
|
@@ -318,19 +323,24 @@ extension TSAIRintoneHistoryCell {
|
|
|
let needVip = infoModel.response.vip
|
|
|
let urlString = infoModel.response.musicUrl
|
|
|
let fileName = infoModel.response.title
|
|
|
-
|
|
|
|
|
|
- if let path = TSDownloadManager.getRingLocalURL(urlString: urlString) {
|
|
|
+ TSDownloadManager.getDownLoadRing(urlString: urlString){ url,downLoad in
|
|
|
+ if let path = url {
|
|
|
_ = kPurchaseToolShared.kshareBand(needVip: needVip, vc: targetVC, fileURL: path, fileName: fileName)
|
|
|
- }else{
|
|
|
- TSRingLoadingView.shared.showWindow()
|
|
|
- _ = TSDownloadManager.downloadFile(urlString:urlString,missingEx: "mp3") { url, error in
|
|
|
- if let path = url {
|
|
|
- _ = kPurchaseToolShared.kshareBand(needVip: needVip, vc: targetVC, fileURL: path, fileName: fileName)
|
|
|
- }
|
|
|
- TSRingLoadingView.shared.remove()
|
|
|
- }
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+// if let path = TSDownloadManager.getRingLocalURL(urlString: urlString) {
|
|
|
+// _ = kPurchaseToolShared.kshareBand(needVip: needVip, vc: targetVC, fileURL: path, fileName: fileName)
|
|
|
+// }else{
|
|
|
+// TSRingLoadingView.shared.showWindow()
|
|
|
+// _ = TSDownloadManager.downloadFile(urlString:urlString,missingEx: "mp3") { url, error in
|
|
|
+// if let path = url {
|
|
|
+// _ = kPurchaseToolShared.kshareBand(needVip: needVip, vc: targetVC, fileURL: path, fileName: fileName)
|
|
|
+// }
|
|
|
+// TSRingLoadingView.shared.remove()
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
func setShareBand(ringModel:TSRingModel){
|
|
@@ -343,7 +353,7 @@ extension TSAIRintoneHistoryCell {
|
|
|
_ = kPurchaseToolShared.kshareBand(needVip: needVip, vc: targetVC, fileURL: path, fileName: fileName){ success in
|
|
|
if success {
|
|
|
var documentPath = path.path
|
|
|
- if path.path.isDocumentPath{
|
|
|
+ if path.path.isDocumentPath == false{
|
|
|
let savePath = TSBusinessFileManager.saveRingPathURL.appendingPathComponent(path.lastPathComponent)
|
|
|
TSFileManagerTool.copyFileWithOverwrite(from: path, to: savePath)
|
|
|
documentPath = savePath.path
|
|
@@ -353,16 +363,10 @@ extension TSAIRintoneHistoryCell {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if let path = TSDownloadManager.getRingLocalURL(ringModel: ringModel) {
|
|
|
- kshareBand(path)
|
|
|
- }else{
|
|
|
- TSRingLoadingView.shared.showWindow()
|
|
|
- _ = TSDownloadManager.downloadFile(urlString:urlString,missingEx: "mp3") { url, error in
|
|
|
- if let path = url {
|
|
|
- kshareBand(path)
|
|
|
- }
|
|
|
- TSRingLoadingView.shared.remove()
|
|
|
+
|
|
|
+ TSDownloadManager.getDownLoadRing(ringModel: ringModel) { url, downLoad in
|
|
|
+ if let path = url {
|
|
|
+ kshareBand(path)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -379,27 +383,20 @@ extension TSAIRintoneHistoryCell {
|
|
|
|
|
|
if let editRingModel = editRingModel{
|
|
|
let urlString = editRingModel.audioUrl
|
|
|
- if let url = TSDownloadManager.getRingLocalURL(urlString: urlString) {
|
|
|
- kPushVC(target: targetVC, modelVC: TSEditAudioVideoBaseVC(ringModel: editRingModel, editOriginalURL: url))
|
|
|
- TSBusinessAudioPlayer.shared.stop()
|
|
|
- }else{
|
|
|
- TSRingLoadingView.shared.showWindow()
|
|
|
- _ = TSDownloadManager.downloadFile(urlString: urlString,missingEx: "mp3") {[weak self] url, error in
|
|
|
- guard let self = self else { return }
|
|
|
- TSRingLoadingView.shared.remove()
|
|
|
- if let url = url {
|
|
|
-
|
|
|
- }else{
|
|
|
- kShowToastDataMissing()
|
|
|
- }
|
|
|
+
|
|
|
+ TSDownloadManager.getDownLoadRing(urlString: urlString) { [weak self] url, downLoad in
|
|
|
+ guard let self = self else { return }
|
|
|
+ if let path = url {
|
|
|
+ pushVCTSEditAudioVideo(targetVC: targetVC, modelVC: TSEditAudioVideoBaseVC(ringModel: editRingModel, editOriginalURL: path))
|
|
|
+ }else{
|
|
|
+ kShowToastDataMissing()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func pushVCTSEditAudioVideo(targetVC:UIViewController,modelVC:TSEditAudioVideoBaseVC){
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if let fileInfo = TSBusinessAudioPlayer.getAudioFileInfo(path: modelVC.editOriginalURL.path) {
|
|
|
if let size = fileInfo.sizeInBytes {
|
|
|
modelVC.ringModel.size = Int(size)
|
|
@@ -410,9 +407,7 @@ extension TSAIRintoneHistoryCell {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- kPushVC(target: targetVC, modelVC: modelVC)
|
|
|
TSBusinessAudioPlayer.shared.stop()
|
|
|
-
|
|
|
+ kPushVC(target: targetVC, modelVC: modelVC)
|
|
|
}
|
|
|
-
|
|
|
}
|