Browse Source

3.6.2(6)为生成中的任务,增加长按删除功能

100Years 2 months ago
parent
commit
c68690ad8a

+ 2 - 2
TSLiveWallpaper.xcodeproj/project.pbxproj

@@ -1273,7 +1273,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 5;
+				CURRENT_PROJECT_VERSION = 6;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_APP_SANDBOX = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1313,7 +1313,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 5;
+				CURRENT_PROJECT_VERSION = 6;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_APP_SANDBOX = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;

+ 5 - 0
TSLiveWallpaper/Business/TSAIListVC/TSAIListHistoryVC/TSAIListHistoryVC.swift

@@ -197,6 +197,11 @@ extension TSAIListHistoryVC{
                     TSRMShared.aiListDB.deleteListModel(id: currentActionInfoModel.id)
                     updateDataView()
                 })
+            }else if cmd == "delete" {
+                showCustomAlert(message: "Are you sure to delete?".localized, rightActionString: "Delete".localized ,deleteHandler:  { [weak self]  in
+                    guard let self = self else { return }
+                    removeDelete(index: indexPath.row)
+                })
             }
         }
     }

+ 5 - 0
TSLiveWallpaper/Business/TSAIListVC/TSAIListHistoryVC/View/TSAIListHistoryCell.swift

@@ -54,6 +54,11 @@ class TSAIListHistoryCell: TSBaseCollectionCell {
                 }
             }
         }
+        
+        generateView.longPressHandel = { [weak self]  in
+            guard let self = self else { return }
+            buttonTapped?("delete")
+        }
         return generateView
     }()
     

+ 16 - 1
TSLiveWallpaper/Business/TSAIListVC/TSAIListHistoryVC/View/TSGennerateCellView.swift

@@ -8,6 +8,7 @@
 class TSGennerateCellView: TSBaseView {
     
     var refreshHandel:(()->Void)?
+    var longPressHandel:(()->Void)?
     lazy var infoLabel: UILabel = {
         let infoLabel = UILabel.createLabel(font: .font(size: 12),textColor: .themeColor,textAlignment: .center,numberOfLines: 0)
         return infoLabel
@@ -37,9 +38,14 @@ class TSGennerateCellView: TSBaseView {
     override func creatUI() {
         backgroundColor = "#1D1812".uiColor
 
-    
         contentView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickContentView)))
+        
 
+        let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress(_:)))
+        longPressRecognizer.minimumPressDuration = 0.5 // 设置最小长按时间(秒)
+        contentView.addGestureRecognizer(longPressRecognizer)
+        
+        
         contentView.addSubview(infoLabel)
         infoLabel.snp.makeConstraints { make in
 //            make.top.equalTo(titleTop)
@@ -62,12 +68,21 @@ class TSGennerateCellView: TSBaseView {
             make.centerY.equalToSuperview().offset(refreshBtn.isHidden ? 0 : -14.0)
         }
     }
+    
     private var isCanClick:Bool = false
+    
     @objc func clickContentView() {
         if isCanClick{
             refreshHandel?()
         }
     }
+    
+    @objc func handleLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
+        // 确保只在手势开始时触发一次
+        guard gestureRecognizer.state == .began else { return }
+        longPressHandel?()
+    }
+    
     func setProgress(progress:Float) {
         refreshBtn.isHidden = true
         isCanClick = false

+ 3 - 3
TSLiveWallpaper/Data/Model/TSActionInfoModel.swift

@@ -89,9 +89,9 @@ extension TSActionInfoModel {
             return true
         }
         //86400=24小时
-//        if Date.timestampInt - request.imageUrlTimestamp > 86400 {
-//            return true
-//        }
+        if Date.timestampInt - request.imageUrlTimestamp > 86400 {
+            return true
+        }
         
         return false
     }

+ 1 - 1
TSLiveWallpaper/Data/OperationQueue/TSGenerateBaseOperation/TSGenerateBaseOperation.swift

@@ -234,7 +234,7 @@ class TSGenerateBaseOperation: TSBaseOperation , @unchecked Sendable{
      }
      
     func getGeneratingProgressText()->String{
-        return "Working on your ringtone \(generatingProgress)%..."
+        return "Processing \(generatingProgress)%..."
     }