Browse Source

3.6.3(3)
1.去除生成接口次数限制逻辑
2.修改 bug

100Years 4 weeks ago
parent
commit
cc3e2b2773

+ 2 - 2
AIEmoji.xcodeproj/project.pbxproj

@@ -2472,7 +2472,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -2511,7 +2511,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

+ 2 - 3
AIEmoji/Business/TSPTPGeneratorVC/TSGennertatorSelectStyleVC/StyleList/TSGennertatorSelectStyleCell.swift

@@ -21,12 +21,11 @@ class TSGennertatorSelectStyleCell: TSBaseCollectionCell {
     var itemModel:TSGenerateOnlineStyleModel = TSGenerateOnlineStyleModel(){
         didSet{
             imageView.setAsyncImage(urlString: itemModel.coverUrl,placeholder: UIImage(named: "placeholderImageNoAlpha"))
-            
             if itemModel.mSpecialType.imageName.isEmpty {
+                hotImageView.isHidden = true
+            }else{
                 hotImageView.image = UIImage(named: itemModel.mSpecialType.imageName)
                 hotImageView.isHidden = false
-            }else{
-                hotImageView.isHidden = true
             }
             textLabel.text = itemModel.name
         }

+ 17 - 11
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/TSPTPInputVC.swift

@@ -339,19 +339,25 @@ class TSPTPInputVC: TSBaseVC {
 
             if let userInfo = notification.userInfo as? [String: Any], let state = userInfo["state"] as? TSProgressState {
                 dePrint("TSBaseOperation stateDatauPblished 收到 = \(state)")
-                if state.isResult {//有结果,一定要刷新
-                    updataCollectionView()
-                }
-                else if self.isViewVisible == false {
-//                    dePrint("TSBaseOperation 视图不可见")
+//                if state.isResult {//有结果,一定要刷新
+//                    updataCollectionView()
+//                }
+//                else if self.isViewVisible == false {
+////                    dePrint("TSBaseOperation 视图不可见")
+//                    return
+//                }
+//                else if state.reloadNewData {//主要是给pending用,让他再视图中有个位置占着
+//                    updataCollectionView()
+//                }
+//                else if viewModel.needReloadColView {
+//                    updataCollectionView()
+//                }
+                
+                if self.isViewVisible == false {
                     return
                 }
-                else if state.reloadNewData {//主要是给pending用,让他再视图中有个位置占着
-                    updataCollectionView()
-                }
-                else if viewModel.needReloadColView {
-                    updataCollectionView()
-                }
+                updataCollectionView()
+            
             }
         }
 

+ 4 - 4
AIEmoji/Business/TSPTPGeneratorVC/TSPhotoToPhotoVC/M/TSPTPStyleModel.swift

@@ -80,10 +80,10 @@ enum ModelType: String {
 }
 
 enum SpecialStyle: Int {
-    case hot
-    case new
-    case max
-    case unknown
+    case hot = 1
+    case new = 2
+    case max = 3
+    case unknown = 0
     
     var imageName : String {
         switch self {

+ 5 - 11
AIEmoji/Business/TSSetingVC/SetingVC/TSSetingViewModel.swift

@@ -101,17 +101,11 @@ class TSSetingViewModel: ObservableObject {
         }
     
 #if DEBUG
-//        TSAbnormalPopUpAlertVC.showRobotWarning()
-//        guard let window = WindowHelper.getKeyWindow() else {
-//            debugPrint("getKeyWindow nil")
-//            return
-//        }
-//        let topY = k_Nav_Height+10
-//        debugPrint("topY=\(topY)")
-//        kSaveSuccesswShared.show(atView: window,text: "Successfully generated".localized,deadline: 5.0,bottom: kSaveSuccesswShared.getBottom(topY: topY)) {
-//        }
-//    
-//        TSRMShared.textPtpDBHistory()
+        let model = TSActionInfoModel()
+        let gennerateVC = TSPTPGeneratorVC(generateStyleModel: TSGenerateOnlineStyleModel(),infoModel:nil) { model in }
+        gennerateVC.modalPresentationStyle = .overFullScreen
+        gennerateVC.modalTransitionStyle = .crossDissolve
+        parent.present(gennerateVC, animated: true)
 #endif
     }
     

+ 21 - 18
AIEmoji/Common/NetworkManager/TSNetWork/TSNetWork+Business.swift

@@ -288,24 +288,27 @@ extension TSNetworkManager {
         animationView:UIView?,
         resetNavigationState:Bool = false,
         completion: @escaping (Any?, Error?) -> Void){
-        _ = TSNetworkShared.get(urlType: .generateCheck,parameters: ["action_type":checkURLType.actionType],animationView: animationView, completion: { [weak self] result,error in
-            if let result = result {
-                let error = NSError(domain: "Service exception", code: 0)
-                if let code = kNetWorkGetCode(data: result) {
-                    switch code {
-                    case 200://成功
-                        completion(result,nil)
-                    case 400://机器人提示
-                        TSAbnormalPopUpAlertVC.showRobotWarning(resetNavigationState: resetNavigationState)
-                        completion(nil,error)
-                    default:
-                        completion(nil,error)
-                    }
-                }
-            }else{
-                completion(nil,error)
-            }
-        })
+            
+            completion("",nil)
+            
+//        _ = TSNetworkShared.get(urlType: .generateCheck,parameters: ["action_type":checkURLType.actionType],animationView: animationView, completion: { [weak self] result,error in
+//            if let result = result {
+//                let error = NSError(domain: "Service exception", code: 0)
+//                if let code = kNetWorkGetCode(data: result) {
+//                    switch code {
+//                    case 200://成功
+//                        completion(result,nil)
+//                    case 400://机器人提示
+//                        TSAbnormalPopUpAlertVC.showRobotWarning(resetNavigationState: resetNavigationState)
+//                        completion(nil,error)
+//                    default:
+//                        completion(nil,error)
+//                    }
+//                }
+//            }else{
+//                completion(nil,error)
+//            }
+//        })
         
     }
     

+ 0 - 3
AIEmoji/Common/NetworkManager/TSNetWork/TSNetworkManager.swift

@@ -350,9 +350,6 @@ func kNetWorkCodeSuccess(data:Any?) -> [String:Any]? {
         switch code {
         case 200://成功
             return dataDict
-//        case 400://机器人提示
-//            TSAbnormalPopUpAlertVC.showRobotWarning()
-//            return nil
         default:
             return nil
         }

+ 2 - 0
AIEmoji/Common/Tool/OperationQueue/TSGenerateBaseOperation/TSGenerateBaseOperation.swift

@@ -70,7 +70,9 @@ class TSGenerateBaseOperation: TSBaseOperation , @unchecked Sendable{
     var action_id:Int = 0
     var isSaveDB:Bool = false //是否保存到数据库
     var currentActionInfoModelChanged:((TSActionInfoModel)->Void)?
+    
     @Published var currentActionInfoModel: TSActionInfoModel = TSActionInfoModel()
+    static var saveCurrentActionInfoModel: TSActionInfoModel?
     
     func initializeActionInfoModel(oldModel:TSActionInfoModel) {
         currentActionInfoModel = oldModel

+ 35 - 7
AIEmoji/Common/Tool/OperationQueue/TSGenerateBaseOperation/TSGeneratePosterOperation.swift

@@ -28,6 +28,7 @@ class TSGeneratePTPOperationQueue: TSGenerateBaseOperationQueue {
     
 }
 
+
 class TSGeneratePTPOperation: TSGenerateBaseOperation , @unchecked Sendable{
     
     //是否展示成功后的 View 提醒
@@ -58,26 +59,54 @@ class TSGeneratePTPOperation: TSGenerateBaseOperation , @unchecked Sendable{
         currentActionInfoModelChanged?(currentActionInfoModel)
     }
 
+//    override func handleGenerateSuccess() {
+//        kPurchaseDefault.useOnceForFree(type: .picToPic)
+//
+//        if isShowSuccessView == false {
+//            return
+//        }
+//        
+//        guard let window = WindowHelper.getKeyWindow() else {
+//            debugPrint("getKeyWindow nil")
+//            return
+//        }
+//        
+//        guard let rootVC = WindowHelper.topViewController() else {
+//            debugPrint("handleGenerateSuccess topViewController nil")
+//            return
+//        }
+//        
+//        let copyModel = self.currentActionInfoModel.copy()
+//        if let rootVC = WindowHelper.getCurrentViewController() ,let cyModel = copyModel as? TSActionInfoModel {
+//            kSaveSuccesswShared.show(atView: rootVC.view,text: "Successfully generated".localized,deadline: 5.0,bottom: kSaveSuccesswShared.getBottom(topY: k_Nav_Height+10)) {
+//                let gennerateVC = TSPTPGeneratorVC(generateStyleModel: TSGenerateOnlineStyleModel(),infoModel: cyModel) { model in }
+//                gennerateVC.modalPresentationStyle = .overFullScreen
+//                gennerateVC.modalTransitionStyle = .crossDissolve
+//                rootVC.present(gennerateVC, animated: true)
+//            }
+//        }else{
+//            debugPrint("copyModel as? TSActionInfoModel error")
+//        }
+//    }
+    
     override func handleGenerateSuccess() {
         kPurchaseDefault.useOnceForFree(type: .picToPic)
-        
+        Self.saveCurrentActionInfoModel = self.currentActionInfoModel
         if isShowSuccessView == false {
             return
         }
         
-        
-        guard let window = WindowHelper.getKeyWindow() else {
+        guard let _ = WindowHelper.getKeyWindow() else {
             debugPrint("getKeyWindow nil")
             return
         }
         
-        guard let rootVC = WindowHelper.topViewController() else {
+        guard let _ = WindowHelper.topViewController() else {
             debugPrint("handleGenerateSuccess topViewController nil")
             return
         }
         
-        let copyModel = self.currentActionInfoModel.copy()
-        if let rootVC = WindowHelper.getCurrentViewController() ,let cyModel = copyModel as? TSActionInfoModel {
+        if let rootVC = WindowHelper.getCurrentViewController() ,let cyModel = Self.saveCurrentActionInfoModel {
             kSaveSuccesswShared.show(atView: rootVC.view,text: "Successfully generated".localized,deadline: 5.0,bottom: kSaveSuccesswShared.getBottom(topY: k_Nav_Height+10)) {
                 let gennerateVC = TSPTPGeneratorVC(generateStyleModel: TSGenerateOnlineStyleModel(),infoModel: cyModel) { model in }
                 gennerateVC.modalPresentationStyle = .overFullScreen
@@ -88,7 +117,6 @@ class TSGeneratePTPOperation: TSGenerateBaseOperation , @unchecked Sendable{
             debugPrint("copyModel as? TSActionInfoModel error")
         }
     }
-    
 
     /**
         1.用户上传图片