Browse Source

feat: 3.6.2(1)提测
1. 移除音乐相关代码
2. 把历史记录放出来作为第二个 tab
3. 图片生成支持后台
4. 新增新用户引导页
5. 支持 Weekly 和 Yearly

100Years 2 months ago
parent
commit
1eba8902ee
33 changed files with 311 additions and 263 deletions
  1. 4 4
      TSLiveWallpaper.xcodeproj/project.pbxproj
  2. 5 1
      TSLiveWallpaper/AppDelegate.swift
  3. 1 1
      TSLiveWallpaper/Assets.xcassets/Boot/boot_new_0.imageset/Contents.json
  4. 1 1
      TSLiveWallpaper/Assets.xcassets/Boot/boot_new_1.imageset/Contents.json
  5. 1 1
      TSLiveWallpaper/Assets.xcassets/Boot/boot_new_2.imageset/Contents.json
  6. 1 1
      TSLiveWallpaper/Assets.xcassets/Boot/boot_old_0.imageset/Contents.json
  7. 1 1
      TSLiveWallpaper/Assets.xcassets/Boot/boot_old_1.imageset/Contents.json
  8. 1 1
      TSLiveWallpaper/Assets.xcassets/Boot/boot_old_2.imageset/Contents.json
  9. BIN
      TSLiveWallpaper/Assets.xcassets/Boot/boot_old_2.imageset/boot_old_2.png
  10. 22 0
      TSLiveWallpaper/Assets.xcassets/Boot/boot_rightArrow.imageset/Contents.json
  11. BIN
      TSLiveWallpaper/Assets.xcassets/Boot/boot_rightArrow.imageset/boot_rightArrow@2x.png
  12. BIN
      TSLiveWallpaper/Assets.xcassets/Boot/boot_rightArrow.imageset/boot_rightArrow@3x.png
  13. 22 0
      TSLiveWallpaper/Assets.xcassets/Purchase/purchase_icon_lock.imageset/Contents.json
  14. BIN
      TSLiveWallpaper/Assets.xcassets/Purchase/purchase_icon_lock.imageset/purchase_icon_lock@2x.png
  15. BIN
      TSLiveWallpaper/Assets.xcassets/Purchase/purchase_icon_lock.imageset/purchase_icon_lock@3x.png
  16. 2 2
      TSLiveWallpaper/Business/TSAIListVC/TSAIAgeImageHintVC/TSAIListHintBaseVC.swift
  17. 7 0
      TSLiveWallpaper/Business/TSAIListVC/TSAIListHistoryVC/TSAIListHistoryVC.swift
  18. 1 0
      TSLiveWallpaper/Business/TSAIListVC/TSAIListHistoryVC/View/TSAIListHistoryCell.swift
  19. 1 1
      TSLiveWallpaper/Business/TSAIListVC/TSAIListHistoryVC/View/TSGennerateCellView.swift
  20. 8 0
      TSLiveWallpaper/Business/TSAIListVC/TSAIListVC/TSAIListVC.swift
  21. 8 1
      TSLiveWallpaper/Business/TSAIListVC/TSAIPhotoGeneratorVC/TSAIListPhotoGeneratorVC.swift
  22. 16 44
      TSLiveWallpaper/Business/TSAIListVC/TSAIUploadPhotoVC/TSAIUploadPhotoVC.swift
  23. 3 4
      TSLiveWallpaper/Business/TSBootVC/TSBootCell.swift
  24. 7 3
      TSLiveWallpaper/Business/TSBootVC/TSBootModel.swift
  25. 6 3
      TSLiveWallpaper/Business/TSBootVC/TSBootVC.swift
  26. 5 5
      TSLiveWallpaper/Business/TSEditLiveVC/TSEditLiveVC.swift
  27. 1 1
      TSLiveWallpaper/Business/TSHomeVC/TSLiveWallpaperBrowseVC/TSLiveWallpaperBrowseVC.swift
  28. 58 70
      TSLiveWallpaper/Business/TSPurchaseMembershipVC/TSPurchaseVC.swift
  29. 98 98
      TSLiveWallpaper/Business/TSPurchaseMembershipVC/TSViewTool/TSViewTool.swift
  30. 1 1
      TSLiveWallpaper/Business/TSRandomWallpaperVC/TSRandomWallpaperBrowseVC/TSRandomWallpaperBrowseVC.swift
  31. 15 14
      TSLiveWallpaper/Business/TSTabBarController/TSTabBarController.swift
  32. 3 3
      TSLiveWallpaper/Common/Purchase/TSPurchaseManager.swift
  33. 12 2
      TSLiveWallpaper/Data/OperationQueue/TSGenerateBaseOperation/TSGenerateBasePhotoOperation.swift

+ 4 - 4
TSLiveWallpaper.xcodeproj/project.pbxproj

@@ -1269,7 +1269,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 3;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_APP_SANDBOX = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1286,7 +1286,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 3.6.1;
+				MARKETING_VERSION = 3.6.2;
 				PRODUCT_BUNDLE_IDENTIFIER = musicplayer.offline.com;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1309,7 +1309,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 3;
+				CURRENT_PROJECT_VERSION = 1;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_APP_SANDBOX = NO;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
@@ -1326,7 +1326,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 3.6.1;
+				MARKETING_VERSION = 3.6.2;
 				PRODUCT_BUNDLE_IDENTIFIER = musicplayer.offline.com;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 5 - 1
TSLiveWallpaper/AppDelegate.swift

@@ -10,6 +10,9 @@ import UIKit
 import Kingfisher
 @main
 class AppDelegate: UIResponder, UIApplicationDelegate {
+    
+    static var tabbar:TSTabBarController?
+    
     var window: UIWindow?
 
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
@@ -32,7 +35,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     }
     
     func goToTab() {
-        window?.rootViewController = TSTabBarController()
+        Self.tabbar = TSTabBarController()
+        window?.rootViewController = Self.tabbar
     }
 
     func JudgmentSkipPage() {

+ 1 - 1
TSLiveWallpaper/Assets.xcassets/Boot/boot_new_0.imageset/Contents.json

@@ -1,11 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "boot_new_0.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
+      "filename" : "boot_new_0.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

+ 1 - 1
TSLiveWallpaper/Assets.xcassets/Boot/boot_new_1.imageset/Contents.json

@@ -1,11 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "boot_new_1.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
+      "filename" : "boot_new_1.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

+ 1 - 1
TSLiveWallpaper/Assets.xcassets/Boot/boot_new_2.imageset/Contents.json

@@ -1,11 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "boot_new_2.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
+      "filename" : "boot_new_2.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

+ 1 - 1
TSLiveWallpaper/Assets.xcassets/Boot/boot_old_0.imageset/Contents.json

@@ -1,11 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "boot_old_0.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
+      "filename" : "boot_old_0.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

+ 1 - 1
TSLiveWallpaper/Assets.xcassets/Boot/boot_old_1.imageset/Contents.json

@@ -1,11 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "boot_old_1.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
+      "filename" : "boot_old_1.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

+ 1 - 1
TSLiveWallpaper/Assets.xcassets/Boot/boot_old_2.imageset/Contents.json

@@ -1,11 +1,11 @@
 {
   "images" : [
     {
-      "filename" : "boot_old_2.png",
       "idiom" : "universal",
       "scale" : "1x"
     },
     {
+      "filename" : "boot_old_2.png",
       "idiom" : "universal",
       "scale" : "2x"
     },

BIN
TSLiveWallpaper/Assets.xcassets/Boot/boot_old_2.imageset/boot_old_2.png


+ 22 - 0
TSLiveWallpaper/Assets.xcassets/Boot/boot_rightArrow.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "boot_rightArrow@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "boot_rightArrow@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
TSLiveWallpaper/Assets.xcassets/Boot/boot_rightArrow.imageset/boot_rightArrow@2x.png


BIN
TSLiveWallpaper/Assets.xcassets/Boot/boot_rightArrow.imageset/boot_rightArrow@3x.png


+ 22 - 0
TSLiveWallpaper/Assets.xcassets/Purchase/purchase_icon_lock.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "purchase_icon_lock@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "purchase_icon_lock@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
TSLiveWallpaper/Assets.xcassets/Purchase/purchase_icon_lock.imageset/purchase_icon_lock@2x.png


BIN
TSLiveWallpaper/Assets.xcassets/Purchase/purchase_icon_lock.imageset/purchase_icon_lock@3x.png


+ 2 - 2
TSLiveWallpaper/Business/TSAIListVC/TSAIAgeImageHintVC/TSAIListHintBaseVC.swift

@@ -248,8 +248,8 @@ class TSAIListHintBaseVC: TSBaseVC {
         }
         
         set {
-            UserDefaults.standard.set(newValue ? nil : "1", forKey: userDefaultsKey)
-            UserDefaults.standard.synchronize()
+//            UserDefaults.standard.set(newValue ? nil : "1", forKey: userDefaultsKey)
+//            UserDefaults.standard.synchronize()
         }
     }
     

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

@@ -189,3 +189,10 @@ extension TSAIListHistoryVC{
         TSRMShared.aiListDB
     }
 }
+extension TSAIListHistoryVC{
+
+    static func showPosition(){
+        AppDelegate.tabbar?.changeSelectedIndex(index: 1)
+    }
+    
+}

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

@@ -160,6 +160,7 @@ extension TSAIListHistoryCell {
                 exampleView.isHidden = false
                 showImageView.image = UIImage(named: model.response.resultUrl)
             }else{
+                exampleView.isHidden = true
                 //                    if dataModel.isVideo {
                 //                        videoIconImageView.isHidden = false
                 //                        self.showImageView.image = UIImage(contentsOfFile: dataModel.videoThumbnailURL.path)

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

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

+ 8 - 0
TSLiveWallpaper/Business/TSAIListVC/TSAIListVC/TSAIListVC.swift

@@ -115,6 +115,14 @@ extension TSAIListVC: UICollectionViewDataSource ,UICollectionViewDelegate {
 
     public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         if let sectionModel = dataArray.safeObj(At: indexPath.section),let itemModel = sectionModel.itemsArray.safeObj(At: indexPath.row){
+            
+            if TSGenerateBasePhotoOperationQueue.shared.isAvailability == false {
+                kSaveSuccesswShared.show(atView: self.view,text: "1 task is processing"){
+                    TSAIListHistoryVC.showPosition()
+                }
+                return
+            }
+
             itemModel.tapBlock?(itemModel,indexPath.row,nil)
         }
     }

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

@@ -50,7 +50,12 @@ class TSAIListPhotoGeneratorVC: TSAIPhotoDetailsVC {
         fatalError("init(coder:) has not been implemented")
     }
     
+    
+    
     var complete:((TSActionInfoModel)->Void)
+    var backstageBlock:(()->Void)?
+    
+    
     var progressState = TSProgressState.none
     
     var uuidString:String = UUID().uuidString
@@ -105,6 +110,7 @@ class TSAIListPhotoGeneratorVC: TSAIPhotoDetailsVC {
     @objc func clickBackstageBtn() {
         self.operation?.backstageGeneration()
         NotificationCenter.default.post(name: .kAIPhotoDataChanged, object: nil)
+        backstageBlock?()
         self.dismiss(animated: true, completion: nil)
     }
     
@@ -175,7 +181,8 @@ class TSAIListPhotoGeneratorVC: TSAIPhotoDetailsVC {
         //判断 vip
         if kJudgeVip(externalBool: true , vc: self){ return }
         
-        viewModel.uploadAndCreatImage()
+//        viewModel.uploadAndCreatImage()
+        generatorOperation()
     }
 
     override func dealThings() {

+ 16 - 44
TSLiveWallpaper/Business/TSAIListVC/TSAIUploadPhotoVC/TSAIUploadPhotoVC.swift

@@ -22,6 +22,11 @@ class TSAIUploadPhotoVC: TSBaseVC {
         fatalError("init(coder:) has not been implemented")
     }
     
+    lazy var viewModel: TSAIListVM = {
+        let viewModel = TSAIListVM(target: self)
+        return viewModel
+    }()
+    
     //#####################################数据区#####################################
     let lineSpacing = 6.0
     lazy var photoPickerManager: TSPhotoPickerManager = {
@@ -296,16 +301,8 @@ extension TSAIUploadPhotoVC {
     }
     
     func pickSinglePhoto()  {
-//        photoPickerManager.pickCustomSinglePhoto() { [weak self] image, errorString in
-//            guard let self = self else { return }
-//            if let errorString = errorString {
-//                TSToastShared.showToast(text: errorString)
-//            }else{
-//                upLoadImage = image
-//            }
-//        }
-        enterSelectPhotos(userDefaultsKey: generatorStyle.userDefaultsKey, maxBitSize: generatorStyle.imageMaxBitSize, config: generatorStyle.config) { [weak self] image in
-                guard let self = self else { return }
+        pickSinglePhoto{ [weak self] image in
+            guard let self = self else { return }
             upLoadImage = image
         }
     }
@@ -322,11 +319,17 @@ extension TSAIUploadPhotoVC {
 //        }
         let gennerateVC = TSAIListPhotoGeneratorVC(generatorModel: TSAIListPhotoGeneratorModel(upLoadImage: upLoadImage, generatorStyle: generatorStyle,additionalPrompt: additionalPrompt)){ [weak self] model in
             guard let self = self else { return }
-            var infoModel = model
-            infoModel.generateStyle = self.generatorStyle.rawValue
+            model.generateStyle = self.generatorStyle.rawValue
             TSRMShared.aiListDB.updateData(model)
         }
         
+        
+        gennerateVC.backstageBlock = { [weak self]  in
+            guard let self = self else { return }
+            TSAIListHistoryVC.showPosition()
+            self.navigationController?.popToRootViewController(animated: false)
+        }
+        
         kPresentModalVC(target: self, modelVC: gennerateVC,transitionStyle: .crossDissolve)
     }
 }
@@ -334,38 +337,7 @@ extension TSAIUploadPhotoVC {
 
 extension TSAIUploadPhotoVC{
     
-    func enterSelectPhotos(userDefaultsKey:String,maxBitSize:Int,config:TSAIListHintBaseVC.Config,complete: @escaping (UIImage)->Void){
-        if userDefaultsKey.count == 0 {
-            self.pickSinglePhoto(maxBitSize:maxBitSize,complete:complete)
-        }else{
-            TSAIListHintBaseVC.userDefaultsKey = userDefaultsKey
-            if TSAIListHintBaseVC.isShowUploadImageHint{
-                TSAIListHintBaseVC.isShowUploadImageHint = false
-                self.presentModalHintVC(config:config,complete:complete)
-            }else {
-                self.pickSinglePhoto(maxBitSize:maxBitSize,complete:complete)
-            }
-        }
-    }
-    
-    
-    func presentModalHintVC(config:TSAIListHintBaseVC.Config,complete:@escaping (UIImage)->Void){
-        hintBaseVC = TSAIListHintBaseVC(config: config) { [weak self] image in
-            guard let self = self else { return }
-            if let image = image {
-                complete(image)
-            }else{
-                dePrint("图片异常")
-            }
-            kDelayMainShort {
-                self.hintBaseVC.dismissPageVC()
-            }
-        }
-        kPresentModalVC(target: self, modelVC: hintBaseVC,transitionStyle: .crossDissolve)
-    }
-    
-    func pickSinglePhoto(maxBitSize:Int,complete: @escaping (UIImage)->Void)  {
-//        photoPickerManager.pickSinglePhoto(maxBitSize: maxBitSize) { [weak self] image, errorString in
+    func pickSinglePhoto(complete: @escaping (UIImage)->Void)  {
         photoPickerManager.pickCustomSinglePhoto() { [weak self] image, errorString in
             guard let self = self else { return }
             if let errorString = errorString {

+ 3 - 4
TSLiveWallpaper/Business/TSBootVC/TSBootCell.swift

@@ -12,11 +12,9 @@ class TSBootBaseCell: TSBaseCollectionCell {
 
 class TSBootCell: TSBootBaseCell {
     
-
-    
     override var model:TSBootModel{
         didSet{
-            titleLabel.text = model.title
+            titleLabel.text = model.oldTitle
             comparisonView.configure(
                 oldImage: model.oldImage,
                 newImage: model.newImage
@@ -52,7 +50,7 @@ class TSBootCell: TSBootBaseCell {
            clickContinue()
        }
 
-       let imageView = UIImageView.createImageView(imageName: "launch_rightArrow",contentMode: .scaleToFill)
+        let imageView = UIImageView.createImageView(image:.bootRightArrow,contentMode: .scaleToFill)
        continueBtn.addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.width.height.equalTo(24)
@@ -79,6 +77,7 @@ class TSBootCell: TSBootBaseCell {
             UIView.animate(withDuration: duration, delay: 0.0, options: .curveEaseIn, animations: {
                 self.continueBtn.backgroundColor = self.btnBgNextColor
                 self.continueBtn.setTitle("Continue".localized, for: .normal)
+                self.titleLabel.text = self.model.newTitle
             }, completion: { end in
                 
             })

+ 7 - 3
TSLiveWallpaper/Business/TSBootVC/TSBootModel.swift

@@ -9,8 +9,10 @@ class TSBootModel {
     
     init(){ }
     
-    init(title: String, oldImage: UIImage, newImage: UIImage, state: Int, cellID: String,btnTitle:String) {
-        self.title = title
+    init(oldTitle:String,newTitle: String, oldImage: UIImage, newImage: UIImage, state: Int, cellID: String,btnTitle:String) {
+        
+        self.oldTitle = oldTitle
+        self.newTitle = newTitle
         self.oldImage = oldImage
         self.newImage = newImage
         self.state = state
@@ -18,7 +20,9 @@ class TSBootModel {
         self.btnTitle = btnTitle
     }
     
-    var title:String = ""
+    var oldTitle:String = ""
+    var newTitle:String = ""
+    
     var oldImage:UIImage = UIImage()
     var newImage:UIImage = UIImage()
     var state:Int = 0 //0 点击开始动画,1 点击下一页

+ 6 - 3
TSLiveWallpaper/Business/TSBootVC/TSBootVC.swift

@@ -19,21 +19,24 @@ class TSBootVC: TSBaseVC {
     
     lazy var dataArray: [TSBootModel] = {
         return [
-            TSBootModel(title: "Add Color to Memories".localized,
+            TSBootModel(oldTitle: "Add Color to Memories".localized,
+                        newTitle: "Your photo is now vibrantly colorized, bringing memories to life".localized,
                         oldImage: .bootOld0,
                         newImage: .bootNew0,
                         state: 0,
                         cellID: "TSBootCell",
                         btnTitle: "Colorize Photo".localized),
             
-            TSBootModel(title: "Your photo is now vibrantly colorized, bringing memories to life".localized,
+            TSBootModel(oldTitle: "Erase Scratches".localized,
+                        newTitle: "Scratches and blemishes have vanished".localized,
                         oldImage: .bootOld1,
                         newImage: .bootNew1,
                         state: 0,
                         cellID: "TSBootCell",
                         btnTitle: "Remove Scratches".localized),
             
-            TSBootModel(title: "Erase Scratches ".localized,
+            TSBootModel(oldTitle: "Make photos clearer".localized,
+                        newTitle: "Your photo has become clearer,and the details are more noticeable".localized,
                         oldImage: .bootOld2,
                         newImage: .bootNew2,
                         state: 0,

+ 5 - 5
TSLiveWallpaper/Business/TSEditLiveVC/TSEditLiveVC.swift

@@ -186,7 +186,7 @@ extension TSEditLiveVC {
 
                 if let imageURL = imageURL, let videoURL = videoURL {
                     LivePhotoConverter.saveToLibrary(videoURL: videoURL, imageURL: imageURL) { _ in
-                        kSavePhotoSuccesswShared.show(atView: self.view, text: "DIY Successfully".localized)
+                        kSaveSuccesswShared.show(atView: self.view, text: "DIY Successfully".localized)
                     }
                     kPurchaseBusiness.useOnceForFree(type: .general)
 
@@ -229,7 +229,7 @@ extension TSEditLiveVC {
 //                            hideLoading()
 //                            if success {
 //                                debugPrint("Live Photo Saved,The live photo was successfully saved to Photos.")
-//                                kSavePhotoSuccesswShared.show(atView: self.view)
+//                                kSaveSuccesswShared.show(atView: self.view)
 //                            }else {
 //                                debugPrint("Live Photo Not Saved,The live photo was not saved to Photos.")
 //                            }
@@ -257,7 +257,7 @@ extension TSEditLiveVC {
 //                                hideLoading()
 //                                if success {
 //                                    debugPrint("Live Photo Saved,The live photo was successfully saved to Photos.")
-//                                    kSavePhotoSuccesswShared.show(atView: self.view)
+//                                    kSaveSuccesswShared.show(atView: self.view)
 //                                }else {
 //                                    debugPrint("Live Photo Not Saved,The live photo was not saved to Photos.")
 //                                }
@@ -284,7 +284,7 @@ extension TSEditLiveVC {
         ////        LivePhotoCreater().saveLivePhoto(from: videoPath, outputDirectory: TSFileManagerTool.saveLiveVideoPathURL) { videoURL, imageURL, errorMsg in
 //            if let imageURL = imageURL,let videoURL = videoURL {
 //                LivePhotoConverter.saveToLibrary(videoURL: videoURL, imageURL: imageURL) { success in
-//                    kSavePhotoSuccesswShared.show(atView: self.view)
+//                    kSaveSuccesswShared.show(atView: self.view)
 //                }
 //
 //
@@ -319,7 +319,7 @@ extension TSEditLiveVC {
     ////        LivePhotoCreater().saveLivePhoto(from: videoPath, outputDirectory: TSFileManagerTool.saveLiveVideoPathURL) { videoURL, imageURL, errorMsg in
 //            if let imageURL = imageURL,let videoURL = videoURL {
 //                LivePhotoConverter.saveToLibrary(videoURL: videoURL, imageURL: imageURL) { success in
-//                    kSavePhotoSuccesswShared.show(atView: self.view)
+//                    kSaveSuccesswShared.show(atView: self.view)
 //                }
 //
 //

+ 1 - 1
TSLiveWallpaper/Business/TSHomeVC/TSLiveWallpaperBrowseVC/TSLiveWallpaperBrowseVC.swift

@@ -101,7 +101,7 @@ class TSLiveWallpaperBrowseVC: TSBaseVC {
                 cell.saveLivePhoto { [weak self]  success in
                      guard let self = self else { return }
                     if success {
-                        kSavePhotoSuccesswShared.show(atView: self.view)
+                        kSaveSuccesswShared.show(atView: self.view)
                     }else{
                         TSToastShared.showToast(text: "Save Fail".localized)
                     }

+ 58 - 70
TSLiveWallpaper/Business/TSPurchaseMembershipVC/TSPurchaseVC.swift

@@ -228,76 +228,57 @@ struct PurchaseView :View {
             Spacer()
             
             VStack {
-                
-//                let text = vipType == .none ? "Get PRO Access".localized : "Super Offer for Yearly Pro".localized
-                // 自定义颜色
-//                HighlightedText("Get PRO Access",
-//                              highlighted: "PRO",
-//                                baseColor: .white,
-//                                highlightColor: UIColor.themeColor.color)
                 Text("Get PRO Access")
                     .foregroundStyle(.white)
                     .multilineTextAlignment(.center)
                     .font(.font(name: .ZillaSlabBoldItalic,size: 36))
                     .frame(width: k_ScreenWidth - 32, alignment: .center)
                 
-                Spacer().frame(height: 16)
-                ZStack {
-                    VStack(alignment: .leading,spacing: 8) {
-                        HStack(spacing: 8) {
-                            Spacer().frame(width: 34)
-                            Image(.purchaseIconUnlimited).resizable().frame(width: 24, height: 24)
-                            Text("Unlimited Restore Photos".localized())
-                            Spacer()
-                        }
-                        HStack(spacing: 8) {
-                            Spacer().frame(width: 34)
-                            Image(.purchaseIconHd).resizable().frame(width: 24, height: 24)
-                            Text("Enhance & Colorize at High Quality".localized())
-                            Spacer()
-                        }
-                        
-                        HStack(spacing: 8) {
-                            Spacer().frame(width: 34)
-                            Image(.purchaseIconAd).resizable().frame(width: 24, height: 24)
-                            Text("100% No Ads".localized()).multilineTextAlignment(.leading)
-                            Spacer()
-                        }
-                    }.font(.font(size: 16)).foregroundColor(.white)
-                }
-
-
+                Spacer().frame(height: 24)
+                
+                HStack(alignment: .center, spacing: 8*kDesignScale, content: {
+                    TSFeatureItemView(image: .purchaseIconUnlimited, text: "Unlimited Process".localized())
+                    TSFeatureItemView(image: .purchaseIconLock, text: "Unlock All Features".localized())
+                    TSFeatureItemView(image: .purchaseIconHd, text: "High Speed & Quality".localized())
+                    TSFeatureItemView(image: .purchaseIconAd, text: "100%\nNo Ads".localized())
+                }).multilineTextAlignment(.center).font(.font(size: 12)).foregroundColor(.white)
             }
             
             Spacer().frame(height: 20)
  
+            
+            VStack(spacing: 16) {
+                
+                //                if vipType == .none {
+                                    ZStack(alignment: .topTrailing) {
+                //                    //增加月付费
+                //                        PurchaseItemView(title: "One Month".localized, type: .month, selectedType: $viewModel.selectedType).onTapGesture {
+                //                            viewModel.selectedType = .month
+                                        PurchaseItemView(title: "YEARLY".localized, type: .year, selectedType: $viewModel.selectedType).onTapGesture {
+                                            viewModel.selectedType = .year
+                                            viewModel.buyPublisher.send(true)
+                                        }
+                                        TSVipRecView(save: vipType.saveString)
+                                            .offset(x:-30,y:-14)
+                                    }
+                                    
+                                PurchaseItemView(title: "WEEKLY".localized, type: .week, selectedType: $viewModel.selectedType).onTapGesture {
+                                    viewModel.selectedType = .week
+                                        viewModel.buyPublisher.send(true)
+                                    }
+                                    
+                //                }else{
+                //                    PurchaseItemTypeOneView(title: "One Year".localized, type: .year, selectedType: $viewModel.selectedType).onTapGesture {
+                //                        viewModel.selectedType = .year
+                //                        viewModel.buyPublisher.send(true)
+                //                    }
+                //                }
+            }.padding(.horizontal)
+            
+            Spacer().frame(height: 24)
+            
             VStack(spacing: 12) {
                 
-//                if vipType == .none {
-                    ZStack(alignment: .topTrailing) {
-//                    //增加月付费
-//                        PurchaseItemView(title: "One Month".localized, type: .month, selectedType: $viewModel.selectedType).onTapGesture {
-//                            viewModel.selectedType = .month
-                        PurchaseItemView(title: "YEARLY".localized, type: .year, selectedType: $viewModel.selectedType).onTapGesture {
-                            viewModel.selectedType = .year
-                            viewModel.buyPublisher.send(true)
-                        }
-                        TSVipRecView(save: vipType.saveString)
-                            .offset(x:-30,y:-14)
-                    }
-                    
-                PurchaseItemView(title: "WEEKLY".localized, type: .week, selectedType: $viewModel.selectedType).onTapGesture {
-                    viewModel.selectedType = .week
-                        viewModel.buyPublisher.send(true)
-                    }
-                    
-//                }else{
-//                    PurchaseItemTypeOneView(title: "One Year".localized, type: .year, selectedType: $viewModel.selectedType).onTapGesture {
-//                        viewModel.selectedType = .year
-//                        viewModel.buyPublisher.send(true)
-//                    }
-//                }
-
                 Button {
                     viewModel.buyPublisher.send(true)
                 } label: {
@@ -390,18 +371,7 @@ struct PurchaseItemView: View {
                 .stroke(UIColor.themeColor.color, lineWidth: type == selectedType ? 1 : 0) // 边框
         )
     }
-    
-//    func priceString()->String{
-//        switch type {
-//        case .year:
-//            return "Just \(PurchaseManager.default.price(for: type) ?? "--") Per Year"
-//        case .month:
-//            return "Just \(PurchaseManager.default.price(for: type) ?? "--") Per Week"
-//        default:
-//            return "--"
-//        }
-//    }
-    
+
     func perString()->String{
         switch type {
         case .year:
@@ -431,6 +401,24 @@ struct TSVipRecView: View {
 //        .cornerRadius([.topLeading, .topTrailing, .bottomLeading, .bottomTrailing], 16.0)
     }
 }
+
+
+//推荐选择view
+struct TSFeatureItemView: View {
+    var image:ImageResource
+    var text:String
+    var body: some View {
+        let backgroundColor = Color.white.opacity(0.1)
+        ZStack {
+            backgroundColor.cornerRadius(8)
+            VStack(alignment: .center, spacing: 8) {
+                Image(image).resizable().frame(width: 24, height: 24)
+                Text(text)
+            }
+        }.frame(width: 80*kDesignScale, height: 80*kDesignScale)
+    }
+}
+
 extension View {
     /// 添加线性渐变背景
     /// - Parameters:

+ 98 - 98
TSLiveWallpaper/Business/TSPurchaseMembershipVC/TSViewTool/TSViewTool.swift

@@ -59,101 +59,101 @@ class TSViewTool: UIView {
 let kWapppaperPlaceholderImage = UIImage(named: "wapppaper_placeholder")
 let KIconLiveImage = UIImage(named: "icon_live")
 
-let kSavePhotoSuccesswShared = TSSavePhotoSuccessTool.shared
-class TSSavePhotoSuccessTool {
-    
-    static let shared = TSSavePhotoSuccessTool()
-    
-    private lazy var textLabel:UILabel = {
-        let textLabel = UILabel()
-        textLabel.textColor = "#4A5178".uiColor
-        textLabel.text = "Save Successfully".localized
-        textLabel.font = UIFont.font(size: 14)
-        return textLabel
-    }()
-    
-    private lazy var saveSuccessBg: UIView = {
-        return creatSaveSuccessBg()
-    }()
-    
-    func creatSaveSuccessBg() -> UIView {
-        let view = UIView()
-        view.frame = CGRect(x: 0, y: 0, width: 288, height: 48)
-        // 阴影
-        view.backgroundColor = .clear
-        view.layer.shadowColor = UIColor.black.cgColor
-        view.layer.shadowOffset = CGSize(width: 0, height: 2)
-        view.layer.shadowOpacity = 0.1
-        
-        // 圆角
-        let colorBg = UIView()
-        colorBg.backgroundColor = .white
-        colorBg.layer.cornerRadius = 8
-        colorBg.layer.masksToBounds = true
-        colorBg.clipsToBounds = true
-        
-        view.addSubview(colorBg)
-        colorBg.snp.makeConstraints { make in
-            make.leading.trailing.top.bottom.equalTo(0)
-        }
-        
-        let image = UIImage(named: "success_icon")
-        let iconView = UIImageView(image: image)
-        view.addSubview(iconView)
-        iconView.snp.makeConstraints { make in
-            make.width.height.equalTo(24)
-            make.centerY.equalToSuperview()
-            make.leading.equalTo(12)
-        }
-    
-
-        view.addSubview(textLabel)
-        
-        let viewButton = UIButton.createButton(title: "View".localized ,backgroundColor: "4FEA9D".toColor()?.withAlphaComponent(0.2),font: UIFont.font(size: 14),titleColor: "4FEA9D".toColor(),corner: 14) {
-            if let url = URL(string: "photos-redirect://") {
-                if UIApplication.shared.canOpenURL(url) {
-                    UIApplication.shared.open(url, options: [:], completionHandler: nil)
-                    playVibration()
-                }
-            }
-        }
-        view.addSubview(viewButton)
-        
-        viewButton.snp.makeConstraints { make in
-            make.width.equalTo(65)
-            make.height.equalTo(28)
-            make.trailing.equalTo(-8)
-            make.centerY.equalToSuperview()
-        }
-        
-        textLabel.snp.makeConstraints { make in
-            make.leading.equalTo(iconView.snp.trailing).offset(8)
-            make.trailing.equalTo(viewButton.snp.leading).offset(-4)
-            make.centerY.equalToSuperview()
-        }
-
-        return view
-    }
-
-    
-    
-    func show(atView:UIView,text:String = "Save Successfully".localized) {
-        
-        kMainAsync {
-            self.textLabel.text = text
-            atView.addSubview(self.saveSuccessBg)
-            self.saveSuccessBg.snp.remakeConstraints { make in
-                make.width.equalTo(288)
-                make.height.equalTo(48)
-                make.centerX.equalToSuperview()
-                make.top.equalTo(k_Height_statusBar()+56.0)
-            }
-        }
-
-        DispatchQueue.main.asyncAfter(deadline: .now()+5.0) {
-            self.saveSuccessBg.removeFromSuperview()
-        }
-    }
-    
-    
-}
+//let kSaveSuccesswShared = TSSavePhotoSuccessTool.shared
+//class TSSavePhotoSuccessTool {
+//    
+//    static let shared = TSSavePhotoSuccessTool()
+//    
+//    private lazy var textLabel:UILabel = {
+//        let textLabel = UILabel()
+//        textLabel.textColor = "#4A5178".uiColor
+//        textLabel.text = "Save Successfully".localized
+//        textLabel.font = UIFont.font(size: 14)
+//        return textLabel
+//    }()
+//    
+//    private lazy var saveSuccessBg: UIView = {
+//        return creatSaveSuccessBg()
+//    }()
+//    
+//    func creatSaveSuccessBg() -> UIView {
+//        let view = UIView()
+//        view.frame = CGRect(x: 0, y: 0, width: 288, height: 48)
+//        // 阴影
+//        view.backgroundColor = .clear
+//        view.layer.shadowColor = UIColor.black.cgColor
+//        view.layer.shadowOffset = CGSize(width: 0, height: 2)
+//        view.layer.shadowOpacity = 0.1
+//        
+//        // 圆角
+//        let colorBg = UIView()
+//        colorBg.backgroundColor = .white
+//        colorBg.layer.cornerRadius = 8
+//        colorBg.layer.masksToBounds = true
+//        colorBg.clipsToBounds = true
+//        
+//        view.addSubview(colorBg)
+//        colorBg.snp.makeConstraints { make in
+//            make.leading.trailing.top.bottom.equalTo(0)
+//        }
+//        
+//        let image = UIImage(named: "success_icon")
+//        let iconView = UIImageView(image: image)
+//        view.addSubview(iconView)
+//        iconView.snp.makeConstraints { make in
+//            make.width.height.equalTo(24)
+//            make.centerY.equalToSuperview()
+//            make.leading.equalTo(12)
+//        }
+//    
+//
+//        view.addSubview(textLabel)
+//        
+//        let viewButton = UIButton.createButton(title: "View".localized ,backgroundColor: "4FEA9D".toColor()?.withAlphaComponent(0.2),font: UIFont.font(size: 14),titleColor: "4FEA9D".toColor(),corner: 14) {
+//            if let url = URL(string: "photos-redirect://") {
+//                if UIApplication.shared.canOpenURL(url) {
+//                    UIApplication.shared.open(url, options: [:], completionHandler: nil)
+//                    playVibration()
+//                }
+//            }
+//        }
+//        view.addSubview(viewButton)
+//        
+//        viewButton.snp.makeConstraints { make in
+//            make.width.equalTo(65)
+//            make.height.equalTo(28)
+//            make.trailing.equalTo(-8)
+//            make.centerY.equalToSuperview()
+//        }
+//        
+//        textLabel.snp.makeConstraints { make in
+//            make.leading.equalTo(iconView.snp.trailing).offset(8)
+//            make.trailing.equalTo(viewButton.snp.leading).offset(-4)
+//            make.centerY.equalToSuperview()
+//        }
+//
+//        return view
+//    }
+//
+//    
+//    
+//    func show(atView:UIView,text:String = "Save Successfully".localized) {
+//        
+//        kMainAsync {
+//            self.textLabel.text = text
+//            atView.addSubview(self.saveSuccessBg)
+//            self.saveSuccessBg.snp.remakeConstraints { make in
+//                make.width.equalTo(288)
+//                make.height.equalTo(48)
+//                make.centerX.equalToSuperview()
+//                make.top.equalTo(k_Height_statusBar()+56.0)
+//            }
+//        }
+//
+//        DispatchQueue.main.asyncAfter(deadline: .now()+5.0) {
+//            self.saveSuccessBg.removeFromSuperview()
+//        }
+//    }
+//    
+//    
+//}

+ 1 - 1
TSLiveWallpaper/Business/TSRandomWallpaperVC/TSRandomWallpaperBrowseVC/TSRandomWallpaperBrowseVC.swift

@@ -163,7 +163,7 @@ class TSRandomWallpaperBrowseVC: TSBaseVC {
                     kMainAsync {
                         TSToastShared.hideLoading()
                         if success {
-                            kSavePhotoSuccesswShared.show(atView: self.view)
+                            kSaveSuccesswShared.show(atView: self.view)
                         } else {
                             TSToastShared.showToast(text: error?.localizedDescription ?? "Save Failure")
                         }

+ 15 - 14
TSLiveWallpaper/Business/TSTabBarController/TSTabBarController.swift

@@ -95,12 +95,26 @@ class TSTabBarController: UITabBarController {
         }
     }
 
+    deinit {
+        debugPrint("TSTabBarController deinit")
+        NotificationCenter.default.removeObserver(self)
+    }
+
+}
+extension TSTabBarController {
+    
+    func changeSelectedIndex(index:Int){
+        self.selectedIndex = index
+        updateMarkViewFrame()
+    }
+    
     func updateMarkViewFrame() {
         markView.snp.updateConstraints { make in
             make.left.equalTo(CGFloat(selectedIndex) * markWidth)
         }
     }
-
+    
+    
     private func tabBarItem(title: String, image: UIImage?, selectedImage: UIImage?, tag: Int) -> UITabBarItem {
         let tabBarItem = UITabBarItem()
         tabBarItem.image = image?.withRenderingMode(.alwaysOriginal)
@@ -109,20 +123,7 @@ class TSTabBarController: UITabBarController {
         return tabBarItem
     }
 
-    var currentNav: UINavigationController? {
-        if selectedIndex < (viewControllers?.count ?? 0) {
-            return viewControllers?[selectedIndex] as? UINavigationController
-        }
-        return nil
-    }
-
-    deinit {
-        debugPrint("TSTabBarController deinit")
-        NotificationCenter.default.removeObserver(self)
-    }
-
 }
-
 extension TSTabBarController: UITabBarControllerDelegate {
     func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
         updateMarkViewFrame()

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

@@ -75,9 +75,9 @@ public class PurchaseManager: NSObject {
     }
 
     @objc public var isVip: Bool {
-        #if DEBUG
-        return true
-        #endif
+//        #if DEBUG
+//        return true
+//        #endif
         guard let expiresDate = expiredDate else {
             return false
         }

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

@@ -59,16 +59,26 @@ class TSGenerateBasePhotoOperation: TSGenerateBaseOperation , @unchecked Sendabl
         if currentActionInfoModel.id == 0 {
             return
         }
+        
+        if let generateStyleModel = generateStyleModel {
+            currentActionInfoModel.generateStyle = generateStyleModel.generatorStyle.rawValue
+        }
+
         TSRMShared.aiListDB.updateData(currentActionInfoModel,id: currentActionInfoModel.id)
     }
     override func handleGenerateSuccess() {
 //        kPurchaseBusiness.useOnceForFree(type: .general)
-        TSRMShared.aiListDB.updateData(currentActionInfoModel,id: currentActionInfoModel.id)
+        saveDataDB()
         if isShowSuccessView == false {
             return
         }
         
-        
+        if let generateStyleModel = generateStyleModel {
+            //生成成功后,不再提示用户上传规则弹窗
+            UserDefaults.standard.set("1", forKey: generateStyleModel.generatorStyle.userDefaultsKey)
+            UserDefaults.standard.synchronize()
+        }
+ 
         guard let window = WindowHelper.getKeyWindow() else {
             debugPrint("getKeyWindow nil")
             return