Browse Source

feat:3.6.4(3)提审

100Years 2 months ago
parent
commit
f025630564

+ 2 - 2
TSLiveWallpaper.xcodeproj/project.pbxproj

@@ -1313,7 +1313,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_APP_SANDBOX = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1353,7 +1353,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_APP_SANDBOX = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;

+ 4 - 4
TSLiveWallpaper/Business/BusinessView/TSGeneratorView/TSGeneratorErrorView.swift

@@ -89,7 +89,7 @@ extension TSGeneratorErrorView {
     
     func sensitiveErrorView() {
         submitBtn.setTitle(isUploadImage ? "Reselect photos".localized : "Got it".localized, for: .normal)
-        errorImageView.image = UIImage(named: "generator_sensitive_error")?.mirrored
+        errorImageView.image = UIImage(named: "generator_sensitive_error")
         
 
         textLabel.text = "Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again.".localized
@@ -98,7 +98,7 @@ extension TSGeneratorErrorView {
     
     func generalErrorView() {
         submitBtn.setTitle("Got it".localized, for: .normal)
-        errorImageView.image = UIImage(named: "generator_failed")?.mirrored
+        errorImageView.image = UIImage(named: "generator_failed")
         
 
         textLabel.text = "Sorry there was a slight problem with the image processing, please try again later.".localized
@@ -107,7 +107,7 @@ extension TSGeneratorErrorView {
     
     func netWorkErrorView() {
         submitBtn.setTitle("Try Again".localized, for: .normal)
-        errorImageView.image = UIImage(named: "generator_network_error")?.mirrored
+        errorImageView.image = UIImage(named: "generator_network_error")
         
 
         textLabel.text = "No network, please check your network and try again.".localized
@@ -115,7 +115,7 @@ extension TSGeneratorErrorView {
     
     func generateTooMuchView() {
         submitBtn.setTitle("Got it".localized, for: .normal)
-        errorImageView.image = UIImage(named: "generator_failed")?.mirrored
+        errorImageView.image = UIImage(named: "generator_failed")
         
         textLabel.text = "Your photo may contain nudity, gore or violence that does not comply with the health policy, please replace the photo and try again.".localized
     }

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

@@ -182,6 +182,23 @@ extension TSAIListHistoryVC: UICollectionViewDataSource ,UICollectionViewDelegat
                 removeDelete(index: indexPath.row)
             }
             kPresentModalVC(target: self, modelVC: vc)
+            
+//            var dataModelArray: [TSActionInfoModel] = []
+//            for itemModel in listModelArray {
+//                if itemModel.status == "success" || itemModel.modelType == .example {
+//                    dataModelArray.append(itemModel)
+//                }
+//            }
+//            
+//            let vc = TSAIPhotoDetailsBrowserVC()
+//            vc.currentIndex = indexPath.item
+//            vc.dataModelArray = dataModelArray
+//            vc.deleteBlock = { [weak self]  index in
+//                guard let self = self else { return }
+//                removeDelete(index: index)
+//            }
+//            kPresentModalVC(target: self, modelVC: vc)
+            
         }
     }
 }

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

@@ -88,7 +88,7 @@ class TSGennerateCellView: TSBaseView {
         isCanClick = false
         let progressInt = Int(progress*100)
 
-        infoLabel.text = "Processing you photo".localized + "..." + "\n\n\(progressInt)%"
+        infoLabel.text = "Processing you photo".localized + "..." + "\n\n" + kPercentlocalized(progressInt)
         infoLabel.textColor = .themeColor
 
         updateInfoLabelCenterY()

+ 47 - 4
TSLiveWallpaper/Business/TSAIListVC/TSAIPhotoDetailsVC/TSAIPhotoDetailsBrowserCell.swift

@@ -9,15 +9,58 @@ class TSAIPhotoDetailsBrowserCell: TSBaseCollectionCell {
     var model:TSActionInfoModel = TSActionInfoModel(){
         didSet{
             dePrint("TSAIPhotoDetailsBrowserCell didSet model")
-
-            
+            uploadPanComparisonView()
         }
     }
     
+    
+    
+    lazy var panComparisonView : TSImageIPanComparisonView = {
+        let panComparisonView = TSImageIPanComparisonView()
+        return panComparisonView
+    }()
+    
+    
     override func creatUI() {
-        
-        
+        contentView.addSubview(panComparisonView)
+        panComparisonView.snp.makeConstraints { make in
+            make.height.equalTo(k_ScreenHeight)
+            make.leading.trailing.equalTo(0)
+            make.centerY.equalToSuperview()
+        }
     }
     
     
+    func uploadPanComparisonView(){
+        let infoModel = model
+        DispatchQueue.global(qos: .userInitiated).async {
+            var oldImage:UIImage?
+            var newImage:UIImage?
+            let grounp = DispatchGroup()
+            grounp.enter()
+            TSImageStoreTool.downloadImageWithProgress(urlString: infoModel.request.imageUrl) { image in
+                grounp.leave()
+                oldImage = image
+                
+            }
+            
+            grounp.enter()
+            TSImageStoreTool.downloadImageWithProgress(urlString: infoModel.response.resultUrl) { image in
+                grounp.leave()
+                newImage = image
+            }
+            
+            grounp.notify(queue: .main) {
+                if let oldImage = oldImage,let newImage = newImage {
+                    let size = oldImage.size.height > newImage.size.height ? oldImage.size : newImage.size
+                    self.panComparisonView.snp.updateConstraints { make in
+                        make.height.equalTo(kGetUIWdith(designSize: size, currentW: k_ScreenWidth))
+                    }
+                }
+                
+                self.panComparisonView.configure(oldImage: oldImage, newImage: newImage)
+            }
+        }
+    }
+    
 }

+ 55 - 22
TSLiveWallpaper/Business/TSAIListVC/TSAIPhotoDetailsVC/TSAIPhotoDetailsBrowserVC.swift

@@ -40,36 +40,54 @@ class TSAIPhotoDetailsBrowserVC: TSBaseVC {
         if let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
             flowLayout.minimumInteritemSpacing = 0
             flowLayout.minimumLineSpacing = 0
-            flowLayout.scrollDirection = .horizontal
+            flowLayout.scrollDirection = .vertical
             flowLayout.itemSize = CGSize(width: k_ScreenWidth, height: k_ScreenHeight)
         }
         return collectionView
     }()
 
-    lazy var bottomViewH = 60+k_Height_safeAreaInsetsBottom()
-    lazy var bottomView: UIView = {
-        let bottom = 60+k_Height_safeAreaInsetsBottom()
-        let bottomView = UIView(frame: CGRectMake(0, k_ScreenHeight-bottomViewH, k_ScreenWidth, bottomViewH))
-        bottomView.backgroundColor = "#111111".uiColor
-        
-        let colorView = UIView.creatColor(color: "#222222".uiColor)
-        colorView.frame = bottomView.bounds
-        colorView.cornersRound(radius: 20, corner: [.topLeft,.topRight])
-        bottomView.addSubview(colorView)
 
-        return bottomView
+    lazy var saveBtn: UIButton = {
+        let saveBtn = kCreateNormalSubmitBtn(title: "Save".localized) { [weak self]  in
+            guard let self = self else { return }
+            clickSaveBtn()
+        }
+        saveBtn.setTitleImageSpace(spacing: 0)
+        return saveBtn
     }()
-    
+    var navRightBtn:UIButton = UIButton()
     
     override func createView() {
         super.createView()
         
-  
+        let imageView = UIImageView.createImageView(image: .navShadow,contentMode: .scaleToFill)
+        navBarContentView.addSubview(imageView)
+        imageView.snp.makeConstraints { make in
+            make.edges.equalToSuperview()
+        }
+        
+        addNormalNavBarView()
+        setPageTitle("Result".localized)
+        
+        navRightBtn = setNavigationItem("", imageName: "ai_delete", direction: .right, action: #selector(clickNavRight))
+        contentView.snp.updateConstraints { make in
+            make.top.equalTo(0)
+        }
+        
         contentView.addSubview(collectionView)
         collectionView.snp.makeConstraints { make in
             make.edges.equalTo(0)
         }
         
+        contentView.addSubview(saveBtn)
+        saveBtn.snp.makeConstraints { make in
+            make.centerX.equalToSuperview()
+            make.width.equalTo(250*kDesignScale)
+            make.height.equalTo(48)
+            make.bottom.equalTo(-12-k_Height_safeAreaInsetsBottom())
+        }
+        
+
         DispatchQueue.main.async {
             self.collectionView.isHidden = false
             self.collectionView.reloadData()
@@ -81,15 +99,15 @@ class TSAIPhotoDetailsBrowserVC: TSBaseVC {
         }
     }
     
-    
-    @objc func clickSubmitBtn(){
-        guard let currentModel = currentModel else { return }
-        let urlString = currentModel.response.resultUrl
-        TSImageStoreTool.downloadImageWithProgress(urlString: urlString) { image in
-            if let image = image{
-                PhotoManagerShared.saveImageToAlbum(image) { success, error in
+    //保存功能
+    @objc func clickSaveBtn(){
+        guard let infoModel = currentModel else { return }
+        TSImageStoreTool.downloadImageWithProgress(urlString: infoModel.response.resultUrl) { image in
+            if let image = image {
+                PhotoManagerShared.saveImageToAlbum(image) { [weak self] success, error in
+                    guard let self = self else { return }
                     if success {
-                        kSaveSuccesswShared.show(atView: self.view)
+                        kSaveSuccesswShared.show(atView:self.view)
                     }else{
                         debugPrint(error)
                     }
@@ -98,6 +116,21 @@ class TSAIPhotoDetailsBrowserVC: TSBaseVC {
         }
     }
     
+    @objc func clickNavRight() {
+
+        TSCustomAlertController.show(in: self, config: TSCustomAlertController.AlertConfig(
+            message: "Are you sure to delete?".localized,
+            cancelTitle: "Delete".localized,
+            cancelColor: .red,
+            confirmTitle: "Retain".localized,
+            confirmColor: .white,
+            cancelAction: { [weak self]  in
+                guard let self = self else { return }
+                self.deleteBlock?(currentIndex)
+                self.navBarClickLeftAction()
+            }
+        ))
+    }
 }
 
 //MARK: UICollectionViewDataSource

+ 1 - 2
TSLiveWallpaper/Business/TSAIListVC/TSAIPhotoGeneratorVC/TSAIListPhotoGeneratorVC.swift

@@ -278,8 +278,7 @@ extension TSAIListPhotoGeneratorVC {
     }
     
     func showLoading(){
-        generateInView.updateShowLoading(text: "Processing".localized + " 0%")
-
+        generateInView.updateShowLoading(text: "Processing".localized + " " + kPercentlocalized(0))
     }
     
     func showError(text:String,code:Int = 0){

+ 3 - 3
TSLiveWallpaper/Common/Purchase/TSPurchaseEnum.swift

@@ -28,13 +28,13 @@ public enum PremiumPeriod: String, CaseIterable {
             return 30
         }
     }
-
+    
     var saveString: String {
         switch self {
         case .none:
-            return String(format: "%d%".localized, 90)
+            return kPercentlocalized(90)
         default:
-            return String(format: "%d%".localized, 90)
+            return kPercentlocalized(90)
         }
     }
     

+ 3 - 0
TSLiveWallpaper/Common/Tool/TSCommonTool/TSCommonTool.swift

@@ -216,6 +216,9 @@ func kMainAsync(_ block: @escaping () -> Void) {
     }
 }
 
+func kPercentlocalized(_ num:Int)-> String{
+    return String(format: "%d%".localized, num)
+}
 
 func kPresentModalVC(target:UIViewController,modelVC:UIViewController,style:UIModalPresentationStyle = .overFullScreen){
     let navi = TSBaseNavigationC(rootViewController: modelVC)

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

@@ -208,7 +208,7 @@ class TSGenerateBaseOperation: TSBaseOperation , @unchecked Sendable{
             guard let self = self else { return }
     
             let progressInt = Int(progress*10.0)
-            let progressString = "Processing".localized + " \(90 + progressInt)%"
+            let progressString = "Processing".localized + " " + kPercentlocalized(90 + progressInt)
             stateDatauPblished = (.progressString(progressString),currentActionInfoModel)
             dePrint("生成后图片下载进度: \(progress)")
         } completion: { image in

+ 2 - 2
TSLiveWallpaper/Data/OperationQueue/TSGenerateBaseOperation/TSGenerateBasePhotoOperation.swift

@@ -247,7 +247,7 @@ class TSGenerateBasePhotoOperation: TSGenerateBaseOperation , @unchecked Sendabl
         }
         
         generatingProgress = progressInt
-        return "Processing".localized + " \(progressInt)%"
+        return "Processing".localized + " " + kPercentlocalized(progressInt)
     }
 
     var imageMaxKb:Int{
@@ -260,7 +260,7 @@ class TSGenerateBasePhotoOperation: TSGenerateBaseOperation , @unchecked Sendabl
         if progressInt > 99 {
             progressInt = 99
         }
-        return "Uploading Photo".localized + " \(progressInt)%"
+        return "Uploading Photo".localized + " " + kPercentlocalized(progressInt)
     }
     
     

+ 3 - 0
TSLiveWallpaper/ar.lproj/Localizable.strings

@@ -121,3 +121,6 @@
 "Payment Failed" = "فشل الدفع";
 "The subscription was canceled" = "تم إلغاء الاشتراك";
 "%d%" = "%%%d";
+"Your photo may contain copyright infringement, nudity, gore or violence that does not comply with the Health Policy, please replace the photo and try again." = "قد تحتوي صورتك على انتهاك لحقوق الطبع والنشر أو عُري أو دم أو عنف لا يتوافق مع سياسة الصحة، يرجى استبدال الصورة والمحاولة مرة أخرى.";
+"There's nothing here yet" = "لا يوجد شيء هنا حتى الآن";
+"Try Again" = "حاول ثانية";

+ 3 - 0
TSLiveWallpaper/en.lproj/Localizable.strings

@@ -119,3 +119,6 @@
 "Payment Failed" = "Payment Failed";
 "The subscription was canceled" = "The subscription was canceled";
 "%d%" = "%d%%";
+"Your photo may contain copyright infringement, nudity, gore or violence that does not comply with the Health Policy, please replace the photo and try again." = "Your photo may contain copyright infringement, nudity, gore or violence that does not comply with the Health Policy, please replace the photo and try again.";
+"There's nothing here yet" = "There's nothing here yet";
+"Try Again" = "Try Again";

+ 3 - 0
TSLiveWallpaper/es.lproj/Localizable.strings

@@ -120,3 +120,6 @@
 "Payment Failed" = "Pago fallido";
 "The subscription was canceled" = "La suscripción fue cancelada";
 "%d%" = "%d%%";
+"Your photo may contain copyright infringement, nudity, gore or violence that does not comply with the Health Policy, please replace the photo and try again." = "Su foto puede contener violaciones de derechos de autor, desnudez, sangre o violencia que no cumple con la Política de salud; reemplace la foto y vuelva a intentarlo.";
+"There's nothing here yet" = "No hay nada aquí todavía";
+"Try Again" = "Intentar otra vez";