|
@@ -297,35 +297,74 @@ extension TSAIRintoneHistoryCell {
|
|
|
|
|
|
guard let targetVC = targetVC else { return }
|
|
guard let targetVC = targetVC else { return }
|
|
|
|
|
|
-// if let model = model {
|
|
|
|
|
|
+ if let model = model {
|
|
// _ = kPurchaseToolShared.kshareBand(needVip: model.response.vip, vc: targetVC, urlString: model.response.musicUrl, fileName: model.response.title)
|
|
// _ = kPurchaseToolShared.kshareBand(needVip: model.response.vip, vc: targetVC, urlString: model.response.musicUrl, fileName: model.response.title)
|
|
-// }else if let ringModel = ringModel {
|
|
|
|
|
|
+ setShareBand(infoModel: model)
|
|
|
|
+ }else if let ringModel = ringModel {
|
|
// _ = kPurchaseToolShared.kshareBand(needVip: ringModel.vip, vc: targetVC, urlString: ringModel.audioUrl, fileName: ringModel.title)
|
|
// _ = kPurchaseToolShared.kshareBand(needVip: ringModel.vip, vc: targetVC, urlString: ringModel.audioUrl, fileName: ringModel.title)
|
|
// { success in
|
|
// { success in
|
|
// if success {
|
|
// if success {
|
|
// TSMineRintoneHistory.shared.saveModel(model: ringModel)
|
|
// TSMineRintoneHistory.shared.saveModel(model: ringModel)
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
-// }
|
|
|
|
|
|
+ setShareBand(ringModel: ringModel)
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ TSBusinessAudioPlayer.shared.stop()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func setShareBand(infoModel:TSActionInfoModel){
|
|
|
|
+ guard let targetVC = targetVC else { return }
|
|
|
|
+ let needVip = infoModel.response.vip
|
|
|
|
+ let urlString = infoModel.response.musicUrl
|
|
|
|
+ let fileName = infoModel.response.title
|
|
|
|
|
|
-// if let path = TSDownloadManager.getRingLocalURL(urlString: model.ringtone) {
|
|
|
|
-// _ = kPurchaseToolShared.kshareBand(needVip: getNeedVip, vc: self, fileURL: path, fileName: model.name)
|
|
|
|
-// }else{
|
|
|
|
-// TSRingLoadingView.shared.showWindow()
|
|
|
|
-// _ = TSDownloadManager.downloadFile(urlString: model.ringtone,missingEx: "mp3") {[weak self] url, error in
|
|
|
|
-// guard let self = self else { return }
|
|
|
|
-// if let path = url {
|
|
|
|
-//// let savePath = TSBusinessFileManager.saveRingPathURL.appendingPathComponent(path.lastPathComponent)
|
|
|
|
-//// TSFileManagerTool.copyFileWithOverwrite(from: path, to: savePath)
|
|
|
|
-// _ = kPurchaseToolShared.kshareBand(needVip: getNeedVip, vc: self, fileURL: path, fileName:model.name)
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// 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){
|
|
|
|
+ guard let targetVC = targetVC else { return }
|
|
|
|
+ let needVip = ringModel.vip
|
|
|
|
+ let urlString = ringModel.audioUrl
|
|
|
|
+ let fileName = ringModel.title
|
|
|
|
|
|
- TSBusinessAudioPlayer.shared.stop()
|
|
|
|
|
|
+ let kshareBand:(URL)->Void = { path in
|
|
|
|
+ _ = kPurchaseToolShared.kshareBand(needVip: needVip, vc: targetVC, fileURL: path, fileName: fileName){ success in
|
|
|
|
+ if success {
|
|
|
|
+ var documentPath = path.path
|
|
|
|
+ if path.path.isDocumentPath{
|
|
|
|
+ let savePath = TSBusinessFileManager.saveRingPathURL.appendingPathComponent(path.lastPathComponent)
|
|
|
|
+ TSFileManagerTool.copyFileWithOverwrite(from: path, to: savePath)
|
|
|
|
+ documentPath = savePath.path
|
|
|
|
+ }
|
|
|
|
+ ringModel.documentPath = documentPath.documentLastURLString
|
|
|
|
+ TSMineRintoneHistory.shared.saveModel(model: ringModel)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@objc func clickEidtBtn(){
|
|
@objc func clickEidtBtn(){
|