Procházet zdrojové kódy

活照片修改了一些 bug

100Years před 21 hodinami
rodič
revize
584b63555d

+ 4 - 0
AIEmoji.xcodeproj/project.pbxproj

@@ -90,6 +90,7 @@
 		A80EDE022D6F1CCD003CD332 /* TSPTPGeneratorVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A80EDE012D6F1CCB003CD332 /* TSPTPGeneratorVC.swift */; };
 		A80EDE062D6F3491003CD332 /* TSPTPBrowseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A80EDE052D6F3490003CD332 /* TSPTPBrowseVC.swift */; };
 		A80EDE082D700395003CD332 /* rotatingAnimation.gif in Resources */ = {isa = PBXBuildFile; fileRef = A80EDE072D700395003CD332 /* rotatingAnimation.gif */; };
+		A82D60812DB7A1E600596190 /* activePhoto.gif in Resources */ = {isa = PBXBuildFile; fileRef = A82D60802DB7A1E600596190 /* activePhoto.gif */; };
 		A83404C82D9BEC0E00C140E4 /* UIFont+TSEx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83404C72D9BEC0700C140E4 /* UIFont+TSEx.swift */; };
 		A83404CC2D9BEED800C140E4 /* Poppins-BlackItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A83404CB2D9BEED800C140E4 /* Poppins-BlackItalic.ttf */; };
 		A83404D12D9D16FA00C140E4 /* TSAIPhotoGeneratorBaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83404D02D9D16F800C140E4 /* TSAIPhotoGeneratorBaseVC.swift */; };
@@ -323,6 +324,7 @@
 		A80EDE012D6F1CCB003CD332 /* TSPTPGeneratorVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSPTPGeneratorVC.swift; sourceTree = "<group>"; };
 		A80EDE052D6F3490003CD332 /* TSPTPBrowseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSPTPBrowseVC.swift; sourceTree = "<group>"; };
 		A80EDE072D700395003CD332 /* rotatingAnimation.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = rotatingAnimation.gif; sourceTree = "<group>"; };
+		A82D60802DB7A1E600596190 /* activePhoto.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = activePhoto.gif; sourceTree = "<group>"; };
 		A83404C72D9BEC0700C140E4 /* UIFont+TSEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+TSEx.swift"; sourceTree = "<group>"; };
 		A83404CB2D9BEED800C140E4 /* Poppins-BlackItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Poppins-BlackItalic.ttf"; sourceTree = "<group>"; };
 		A83404D02D9D16F800C140E4 /* TSAIPhotoGeneratorBaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSAIPhotoGeneratorBaseVC.swift; sourceTree = "<group>"; };
@@ -1825,6 +1827,7 @@
 				A83404D72D9D34ED00C140E4 /* Kelsi-Regular.otf */,
 				A83404CB2D9BEED800C140E4 /* Poppins-BlackItalic.ttf */,
 				A83404DA2D9D382200C140E4 /* AccentURW-Reg.ttf */,
+				A82D60802DB7A1E600596190 /* activePhoto.gif */,
 				A80EDE072D700395003CD332 /* rotatingAnimation.gif */,
 				A89EA6972D5B19F0000EB181 /* Butterfly🦋.json */,
 				A80E723E2D3F4D3000C64288 /* Universe🌍.json */,
@@ -1945,6 +1948,7 @@
 				A83404CC2D9BEED800C140E4 /* Poppins-BlackItalic.ttf in Resources */,
 				A87587162D81734300286A66 /* text_to_photo_style.json in Resources */,
 				A8EEADD42D3E6C660032C5A0 /* Flower💐.json in Resources */,
+				A82D60812DB7A1E600596190 /* activePhoto.gif in Resources */,
 				A8EEADE92D3E76D90032C5A0 /* Beauty👸.json in Resources */,
 				A89EA6982D5B1A01000EB181 /* Butterfly🦋.json in Resources */,
 				A8EEADE02D3E75900032C5A0 /* Crystal🔮.json in Resources */,

+ 2 - 2
AIEmoji/Assets.xcassets/PTP/ptp_example_image0.imageset/Contents.json

@@ -5,12 +5,12 @@
       "scale" : "1x"
     },
     {
-      "filename" : "ptp_example_image0@2x.png",
+      "filename" : "壁纸 4@2x.png",
       "idiom" : "universal",
       "scale" : "2x"
     },
     {
-      "filename" : "ptp_example_image0@3x.png",
+      "filename" : "壁纸 4@3x.png",
       "idiom" : "universal",
       "scale" : "3x"
     }

binární
AIEmoji/Assets.xcassets/PTP/ptp_example_image0.imageset/ptp_example_image0@2x.png


binární
AIEmoji/Assets.xcassets/PTP/ptp_example_image0.imageset/ptp_example_image0@3x.png


binární
AIEmoji/Assets.xcassets/PTP/ptp_example_image0.imageset/壁纸 4@2x.png


binární
AIEmoji/Assets.xcassets/PTP/ptp_example_image0.imageset/壁纸 4@3x.png


+ 52 - 48
AIEmoji/Business/TSAILIstVC/TSAILIstVC/TSAILIstCell.swift

@@ -5,15 +5,42 @@
 //  Created by 100Years on 2025/4/8.
 //
 
-
+import Kingfisher
 class TSAILIstCell: TSBaseCollectionCell {
     
     static let cellID = "TSAILIstCell"
     var itemModel:TSBasicItemModel = TSBasicItemModel(){
         didSet{
-            bgImageView.image = UIImage(named: itemModel.leftImageName ?? "")
+            
+            if let imageNamed = itemModel.leftImageName{
+                if imageNamed.contains("gif") {
+                    
+                    if let gifURL = Bundle.main.url(forResource: imageNamed, withExtension: nil) {
+                        animatedImageView.kf.setImage(with: gifURL, options: [.cacheOriginalImage]) { result in
+                            switch result {
+                            case .success(let value):
+                                print("GIF 加载成功: \(value.source.url?.absoluteString ?? "")")
+                            case .failure(let error):
+                                print("GIF 加载失败: \(error.localizedDescription)")
+                            }
+                        }
+                    }
+                    
+                    kDelayMainShort {
+                        self.animatedImageView.startAnimating()
+                    }
+                    
+                    animatedImageView.isHidden = false
+                    shadowImageView.isHidden = false
+                    
+                }else{
+                    animatedImageView.isHidden = true
+                    shadowImageView.isHidden = true
+                    bgImageView.image = UIImage(named: itemModel.leftImageName ?? "")
+                }
+
+            }
             titleLab.text = itemModel.leftTitle
-//            leftSubLab.text = itemModel.leftSubTitle
         }
     }
     
@@ -23,66 +50,43 @@ class TSAILIstCell: TSBaseCollectionCell {
         return bgImageView
     }()
     
+    lazy var animatedImageView: AnimatedImageView = {
+        let animatedImageView = AnimatedImageView()
+        animatedImageView.autoPlayAnimatedImage = false
+        animatedImageView.isHidden = true
+        return animatedImageView
+    }()
     
-//    lazy var shadowImageView: UIImageView = {
-//        let shadowImageView = UIImageView.createImageView(imageName: "alList_shadow",contentMode: .scaleToFill)
-//        shadowImageView.alpha = 0.7
-//        return shadowImageView
-//    }()
+    lazy var shadowImageView: UIImageView = {
+        let shadowImageView = UIImageView.createImageView(imageName: "alList_shadow",contentMode: .scaleToFill)
+        shadowImageView.alpha = 0.8
+        shadowImageView.isHidden = true
+        return shadowImageView
+    }()
     
     lazy var titleLab: UILabel = {
         let titleLab = UILabel.createLabel(font: .font(size: 16,weight: .medium),textColor: .fromHex("FFFFFF"),numberOfLines: 0)
         return titleLab
     }()
     
-//    lazy var leftSubLab: UILabel = {
-//        return UILabel.createLabel(font: .font(size: 14),textColor: .white.withAlphaComponent(0.8),numberOfLines: 0)
-//    }()
-
-//    lazy var submitBtn: UIButton = {
-//        let submitBtn = UIButton.createButton(title: "Try Now".localized,backgroundColor: .themeColor,font: .font(size: 12),titleColor: "#111111".uiColor)
-//        submitBtn.contentEdgeInsets = UIEdgeInsets(top: 0, left: 12, bottom: 0, right: 12)
-//        submitBtn.cornerRadius = 12
-//        submitBtn.isUserInteractionEnabled = false
-//        return submitBtn
-//    }()
-    
-
     override func creatUI() {
         bgContentView.clipsToBounds = true
         bgContentView.addSubview(bgImageView)
         bgImageView.snp.makeConstraints { make in
             make.top.bottom.leading.trailing.equalTo(0)
         }
+        
+        bgContentView.addSubview(animatedImageView)
+        animatedImageView.snp.makeConstraints { make in
+            make.top.bottom.leading.trailing.equalTo(0)
+        }
 
-//        bgContentView.addSubview(shadowImageView)
-//        shadowImageView.snp.makeConstraints { make in
-//            make.bottom.leading.trailing.equalTo(0)
-//            make.height.equalTo(90*kDesignScale)
-//        }
+        bgContentView.addSubview(shadowImageView)
+        shadowImageView.snp.makeConstraints { make in
+            make.bottom.leading.trailing.equalTo(0)
+            make.height.equalTo(90*kDesignScale)
+        }
 
-//        bgContentView.addSubview(submitBtn)
-//        submitBtn.snp.makeConstraints { make in
-//            make.trailing.equalTo(-16)
-//            make.bottom.equalTo(-27)
-//            make.height.equalTo(24)
-//            make.width.equalTo(submitBtn.intrinsicContentSize.width)
-//        }
-        
-//        bgContentView.addSubview(leftSubLab)
-//        leftSubLab.snp.makeConstraints { make in
-//            make.trailing.equalTo(submitBtn.snp.leading).offset(-15)
-//            make.leading.equalTo(16)
-//            make.bottom.equalTo(-12)
-//        }
-//        
-//        bgContentView.addSubview(titleLab)
-//        titleLab.snp.makeConstraints { make in
-//            make.trailing.equalTo(leftSubLab.snp.trailing)
-//            make.leading.equalTo(leftSubLab.snp.leading)
-//            make.bottom.equalTo(leftSubLab.snp.top).offset(-8)
-//        }
-        
         bgContentView.addSubview(titleLab)
         titleLab.snp.makeConstraints { make in
             make.trailing.equalTo(14)

+ 1 - 1
AIEmoji/Business/TSAILIstVC/TSAILIstVC/TSAILIstVC.swift

@@ -26,7 +26,7 @@ class TSAILIstVC: TSBaseVC {
         
         sectionModel.addSubItemModel(
             createItemModel(
-                leftImageName:"aiList_livePhoto",
+                leftImageName:"activePhoto.gif",
                 leftTitle: "Make photo live".localized,
                 leftSubTitle: "".localized,
                 rightViewStyle: 0,

+ 1 - 1
AIEmoji/Business/TSAILIstVC/TSAIListHistoryBaseVC/TSAIListHistoryBaseVC.swift

@@ -87,7 +87,7 @@ class TSAIListHistoryBaseVC: TSBaseVC {
             titleString = title
         }
         setPageTitle(titleString)
-        navRightBtn = setNavigationItem("", imageName: "delete_white", direction: .right, action: #selector(clickNavRight))
+        navRightBtn = setNavigationItem("", imageName: "delete", direction: .right, action: #selector(clickNavRight))
    
         contentView.addSubview(pageNullView)
         contentView.addSubview(collectionComponent.collectionView)

+ 66 - 1
AIEmoji/Business/TSAILIstVC/TSAIListVideoPlayerVC/TSAIListVideoPlayerVC.swift

@@ -10,6 +10,71 @@ import UIKit
 import AVKit
 import SnapKit
 
+
+class VideoProgressSlider: UISlider {
+    // 增加触摸区域的范围(比可视区域大)
+    private let touchAreaPadding: CGFloat = 20
+    
+    // 增加点击响应区域
+    override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
+        let width = self.bounds.size.width
+        let tapPoint = touch.location(in: self)
+        let tapValue = Float(tapPoint.x / width)
+        
+        self.setValue(tapValue, animated: true)
+        self.sendActions(for: .valueChanged)
+        
+        return true
+    }
+    
+    // 扩大触摸区域
+    override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
+        let bounds = self.bounds.insetBy(dx: -touchAreaPadding, dy: -touchAreaPadding)
+        return bounds.contains(point)
+    }
+    
+    // 扩大滑块的实际触摸区域(不影响视觉大小)
+    override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect {
+        let visualThumbSize: CGFloat = 10 // 视觉上的大小
+        let touchThumbSize: CGFloat = 20  // 实际触摸区域大小
+        
+        let defaultRect = super.thumbRect(forBounds: bounds, trackRect: rect, value: value)
+        
+        // 视觉上保持15x15大小
+        let visualRect = CGRect(
+            x: defaultRect.origin.x + (defaultRect.width - visualThumbSize)/2,
+            y: defaultRect.origin.y + (defaultRect.height - visualThumbSize)/2,
+            width: visualThumbSize,
+            height: visualThumbSize
+        )
+        
+        // 实际触摸区域更大(30x30)
+        let touchRect = CGRect(
+            x: defaultRect.origin.x + (defaultRect.width - touchThumbSize)/2,
+            y: defaultRect.origin.y + (defaultRect.height - touchThumbSize)/2,
+            width: touchThumbSize,
+            height: touchThumbSize
+        )
+        
+        // 保存实际触摸区域用于点击检测
+        self.touchThumbRect = touchRect
+        
+        return visualRect
+    }
+    
+    // 存储实际触摸区域
+    private var touchThumbRect: CGRect = .zero
+    
+    // 轨道高度
+    private let trackHeight: CGFloat = 3
+    
+    override func trackRect(forBounds bounds: CGRect) -> CGRect {
+        var rect = super.trackRect(forBounds: bounds)
+        rect.size.height = trackHeight
+        return rect
+    }
+}
+
 class TSAIListVideoPlayerVC: UIViewController {
     
     // MARK: - Properties
@@ -75,7 +140,7 @@ class TSAIListVideoPlayerVC: UIViewController {
     }
     
     required init?(coder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
+        fatalError("init(coder:) has not been 344444444444implemented")
     }
     
     // MARK: - Lifecycle

+ 1 - 1
AIEmoji/Business/TSPTPGeneratorVC/TSAIPhotoGeneratorBaseVC/TSAIPhotoGeneratorBaseVC.swift

@@ -80,7 +80,7 @@ class TSAIPhotoGeneratorBaseVC: TSBaseVC {
     var isClickTheBlankClosePage = true
     
     override func createView() {
-        view.backgroundColor = .black
+        view.backgroundColor = .clear
         setNavBarViewHidden(true)
 
         contentView.addSubview(netWorkImageView)

+ 0 - 17
AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/TSPTPGeneratorVC.swift

@@ -171,11 +171,6 @@ extension TSPTPGeneratorVC {
     }
     
     func showProgress(text:String) {
-//        generateInView.isHidden = false
-//        generateInView.showLoading(text: text)
-//        generateInView.isRotating = true
-//        generateInView.timeLabel.isHidden = false
-//        generateInView.infoLabel.isHidden = false
         generateInView.updateShowProgress(text: text)
         
         isClickTheBlankClosePage = false
@@ -185,11 +180,6 @@ extension TSPTPGeneratorVC {
     }
     
     func showLoading(){
-//        generateInView.isHidden = false
-//        generateInView.showLoading(text: "Generating".localized + " ...")
-//        generateInView.isRotating = true
-//        generateInView.timeLabel.isHidden = false
-//        generateInView.infoLabel.isHidden = false
         generateInView.updateShowLoading(text: "Generating".localized + " ...")
 
         isClickTheBlankClosePage = false
@@ -200,11 +190,6 @@ extension TSPTPGeneratorVC {
     
     func showError(text:String?){
         let msg = "Failed to generate, please try later".localized
-//        generateInView.isHidden = false
-//        generateInView.showError(text: msg)
-//        generateInView.isRotating = false
-//        generateInView.timeLabel.isHidden = true
-//        generateInView.infoLabel.isHidden = true
         generateInView.updateShowError(text: msg)
 
         isClickTheBlankClosePage = true
@@ -217,8 +202,6 @@ extension TSPTPGeneratorVC {
     }
     
     func showSuccess(model:TSActionInfoModel){
-//        generateInView.isHidden = true
-//        generateInView.isRotating = false
         generateInView.updateShowSuccess()
         
         imageModel = model

+ 1 - 2
AIEmoji/Business/TSPTPGeneratorVC/TSPTPImageHintVC/TSPTPImageHintVC.swift

@@ -31,8 +31,7 @@ class TSPTPImageHintVC: TSBaseVC {
     override func createView() {
         setNavBarViewHidden(true)
         view.backgroundColor = .black.withAlphaComponent(0.7)
-        
-        
+
         view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickView)))
         
         contentView.addSubview(popupContentView)

+ 1 - 1
AIEmoji/Business/TSPurchaseMembershipVC/TSPurchaseVC.swift

@@ -508,7 +508,7 @@ struct TSVipRecView: View {
     
         HStack(spacing: 4) {
             Image("upvote_black").resizable().frame(width: 16, height: 16)
-            Text("Save-Vip".localized + "60%").font(.font(size: 12,weight: .medium)).foregroundColor(.hex("#111111"))
+            Text("Save-Vip".localized + "80%").font(.font(size: 12,weight: .medium)).foregroundColor(.hex("#111111"))
         }
         .padding(EdgeInsets(top: 6, leading: 6, bottom: 6, trailing: 6))
         .background(Color.hex("#FECB34"))

+ 0 - 1
AIEmoji/Business/VIewTool/TSCommonloadingView.swift

@@ -28,7 +28,6 @@ class TSCommonloadingView: TSBaseView {
                 }
             }
         }
-        
         return animatedImageView
     }()
     

+ 14 - 15
AIEmoji/Business/VIewTool/TSGeneratorloadingView.swift

@@ -98,7 +98,6 @@ class TSGeneratorloadingView: TSBaseView {
             make.top.equalTo(250.0)
         }
   
-        
         contentView.addSubview(cusStackView)
         cusStackView.snp.makeConstraints { make in
             make.top.equalTo(imageView.snp.bottom).offset(-20)
@@ -157,20 +156,20 @@ class TSGeneratorloadingView: TSBaseView {
     }
 
     override func dealThings() {
-//        // 监听应用生命周期事件
-//        NotificationCenter.default.addObserver(
-//            self,
-//            selector: #selector(handleAppDidEnterBackground),
-//            name: UIApplication.didEnterBackgroundNotification,
-//            object: nil
-//        )
-//        
-//        NotificationCenter.default.addObserver(
-//            self,
-//            selector: #selector(handleAppWillEnterForeground),
-//            name: UIApplication.willEnterForegroundNotification,
-//            object: nil
-//        )
+        // 监听应用生命周期事件
+        NotificationCenter.default.addObserver(
+            self,
+            selector: #selector(handleAppDidEnterBackground),
+            name: UIApplication.didEnterBackgroundNotification,
+            object: nil
+        )
+        
+        NotificationCenter.default.addObserver(
+            self,
+            selector: #selector(handleAppWillEnterForeground),
+            name: UIApplication.willEnterForegroundNotification,
+            object: nil
+        )
     }
     
     

binární
AIEmoji/Res/activePhoto.gif