100Years 4 weeks ago
parent
commit
5e59b6b18d

+ 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 = 3;
+				CURRENT_PROJECT_VERSION = 5;
 				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 = 3;
+				CURRENT_PROJECT_VERSION = 5;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

+ 8 - 6
AIEmoji/Business/TSPTPGeneratorVC/TSGennertatorSelectStyleVC/StyleList/TSGennertatorSelectStyleListVc.swift

@@ -58,9 +58,7 @@ class TSGennertatorSelectStyleListVc: TSBaseVC {
         viewModel.$datas.receive(on: DispatchQueue.main).sink { [weak self] datas in
             guard let self = self else { return }
             if !datas.isEmpty && viewModel.currentIndexPath.item < datas.count {
-//                DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
-                    self.selectIndex(indexPath: self.viewModel.currentIndexPath, dir: .centeredVertically)
-//                }
+                self.selectIndex(indexPath: self.viewModel.currentIndexPath,isScrollPosition: false, dir: .centeredVertically)
             }
         }.store(in: &cancellable)
     }
@@ -94,15 +92,19 @@ class TSGennertatorSelectStyleListVc: TSBaseVC {
         loadingView.isHidden = true
     }
 
-    public func selectIndex(indexPath: IndexPath, dir: UICollectionView.ScrollPosition = .centeredHorizontally) {
+    public func selectIndex(indexPath: IndexPath,isScrollPosition:Bool = true, dir: UICollectionView.ScrollPosition = .centeredHorizontally) {
         viewModel.currentIndexPath = indexPath
         
         DispatchQueue.main.async{
-//        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
             if let model = self.viewModel.datas.safeObj(At: indexPath.item) {
                 self.selectedValueBlock?(indexPath, model)
             }
-            self.styleCollectionView.selectItem(at: self.viewModel.currentIndexPath, animated: true, scrollPosition: dir)
+            if isScrollPosition {
+                self.styleCollectionView.selectItem(at: self.viewModel.currentIndexPath, animated: true, scrollPosition: dir)
+            }else {
+                self.styleCollectionView.selectItem(at: self.viewModel.currentIndexPath, animated: false, scrollPosition: .top)
+                self.styleCollectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .top, animated: false)
+            }
         }
     }
 

+ 0 - 1
AIEmoji/Business/TSPTPGeneratorVC/TSGennertatorSelectStyleVC/TSGennertatorSelectStyle/TSGennertatorSelectStyleVC.swift

@@ -89,7 +89,6 @@ class TSGennertatorSelectStyleVC: TSBaseVC {
     }
 
     override func dealThings() {
-        addPullDownClosePage()
     }
     
     @objc func clickTopView(){

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

@@ -257,8 +257,7 @@ extension TSPTPGeneratorVC {
     }
     
     func showLoading(){
-        generateInView.updateShowLoading(text: "Generating".localized + " ...")
-
+        generateInView.updateShowLoading(text: "Generating".localized + " 0%")
         isClickTheBlankClosePage = false
         bottomView.isHidden = true
         netWorkImageView.isHidden = true

+ 6 - 3
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/TSPTPInputVC.swift

@@ -352,12 +352,15 @@ class TSPTPInputVC: TSBaseVC {
 //                else if viewModel.needReloadColView {
 //                    updataCollectionView()
 //                }
-                
-                if self.isViewVisible == false {
+
+                if state.reloadNewData {//主要是给pending用,让他再视图中有个位置占着,再就是有结果,一定要刷新
+                    updataCollectionView()
+                }
+                else if self.isViewVisible == false {
                     return
                 }
+                
                 updataCollectionView()
-            
             }
         }
 

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

@@ -101,11 +101,11 @@ class TSSetingViewModel: ObservableObject {
         }
     
 #if DEBUG
-        let model = TSActionInfoModel()
-        let gennerateVC = TSPTPGeneratorVC(generateStyleModel: TSGenerateOnlineStyleModel(),infoModel:nil) { model in }
-        gennerateVC.modalPresentationStyle = .overFullScreen
-        gennerateVC.modalTransitionStyle = .crossDissolve
-        parent.present(gennerateVC, animated: true)
+//        let model = TSActionInfoModel()
+//        let gennerateVC = TSPTPGeneratorVC(generateStyleModel: TSGenerateOnlineStyleModel(),infoModel:nil) { model in }
+//        gennerateVC.modalPresentationStyle = .overFullScreen
+//        gennerateVC.modalTransitionStyle = .crossDissolve
+//        parent.present(gennerateVC, animated: true)
 #endif
     }
     

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

@@ -92,6 +92,7 @@ class TSGeneratePTPOperation: TSGenerateBaseOperation , @unchecked Sendable{
     override func handleGenerateSuccess() {
         kPurchaseDefault.useOnceForFree(type: .picToPic)
         Self.saveCurrentActionInfoModel = self.currentActionInfoModel
+        debugPrint("handleGenerateSuccess currentActionInfoModel=\(self.currentActionInfoModel)")
         if isShowSuccessView == false {
             return
         }
@@ -108,6 +109,7 @@ class TSGeneratePTPOperation: TSGenerateBaseOperation , @unchecked Sendable{
         
         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)) {
+                debugPrint("handleGenerateSuccess saveCurrentActionInfoModel=\(cyModel)")
                 let gennerateVC = TSPTPGeneratorVC(generateStyleModel: TSGenerateOnlineStyleModel(),infoModel: cyModel) { model in }
                 gennerateVC.modalPresentationStyle = .overFullScreen
                 gennerateVC.modalTransitionStyle = .crossDissolve