|
@@ -167,6 +167,16 @@ extension APMyRingVC{
|
|
|
var dbHistory:ASDBHistory{
|
|
|
return ASRMShared.ringDBHistory
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ func modleOperation(model:ASActionInfoModel)->ASGenerateBaseOperation?{
|
|
|
+ if model.modelType == .ttr {
|
|
|
+ return ASGenerateTextToRingOperationQueue.shared.findOperation(uuid: model.uuid)
|
|
|
+ }else if model.modelType == .rtr {
|
|
|
+ return ASGenerateRingToRingOperationQueue.shared.findOperation(uuid: model.uuid)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
extension APMyRingVC: SwipeCollectionViewCellDelegate {
|
|
@@ -179,13 +189,13 @@ extension APMyRingVC: SwipeCollectionViewCellDelegate {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if let model = listModelArray.safeObj(At: indexPath.item) {
|
|
|
- switch model.actionStatus {
|
|
|
- case .pending,.running:
|
|
|
- return nil
|
|
|
- default:break
|
|
|
- }
|
|
|
- }
|
|
|
+// if let model = listModelArray.safeObj(At: indexPath.item) {
|
|
|
+// switch model.actionStatus {
|
|
|
+// case .pending,.running:
|
|
|
+// return nil
|
|
|
+// default:break
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
// 删除操作
|
|
|
let deleteAction = SwipeAction(style: .destructive, title: nil) {[weak self] action, indexPath in
|
|
@@ -193,6 +203,15 @@ extension APMyRingVC: SwipeCollectionViewCellDelegate {
|
|
|
showCustomAlert(message: "Are you sure to delete".localized, deleteHandler: { [weak self] in
|
|
|
guard let self = self else { return }
|
|
|
if let model = listModelArray.safeObj(At: indexPath.item) {
|
|
|
+
|
|
|
+ switch model.actionStatus {
|
|
|
+ case .pending,.running:
|
|
|
+ if let operation = modleOperation(model: model) {
|
|
|
+ operation.cancel()
|
|
|
+ }
|
|
|
+ default:break
|
|
|
+ }
|
|
|
+
|
|
|
dbHistory.deleteListModel(id: model.id)
|
|
|
updateListView()
|
|
|
TSBusinessAudioPlayer.shared.stop()
|