Pārlūkot izejas kodu

1.增加母亲节功能和跳转逻辑,和增加翻译
2.app 更改名字为Chibi
3.解决首次安装,且不是 vip(没有主动恢复内购),情况下.后台图生图成功后,点击 view,黑色空页面问题
4.默认选中 Anime Pro 风格

100Years 3 nedēļas atpakaļ
vecāks
revīzija
27a2d2e618
28 mainītis faili ar 129 papildinājumiem un 31 dzēšanām
  1. 2 2
      AIEmoji.xcodeproj/project.pbxproj
  2. 22 0
      AIEmoji/Assets.xcassets/AIList/aiList_MotherDay.imageset/Contents.json
  3. BIN
      AIEmoji/Assets.xcassets/AIList/aiList_MotherDay.imageset/aiList_MotherDay@2x.png
  4. BIN
      AIEmoji/Assets.xcassets/AIList/aiList_MotherDay.imageset/aiList_MotherDay@3x.png
  5. 3 3
      AIEmoji/Base.lproj/LaunchScreen.storyboard
  6. 6 2
      AIEmoji/Business/Data/TSDBHistoryManager.swift
  7. 2 0
      AIEmoji/Business/General/Ex/Notification+Ex.swift
  8. 41 1
      AIEmoji/Business/TSAILIstVC/TSAILIstVC/TSAILIstVC.swift
  9. 1 2
      AIEmoji/Business/TSAILIstVC/TSAIListHistoryBaseVC/TSAIListHistoryBaseCell.swift
  10. 3 1
      AIEmoji/Business/TSAILIstVC/TSAIListHistoryBaseVC/TSAIListHistoryBaseVC.swift
  11. 11 1
      AIEmoji/Business/TSAILIstVC/TSAIPhotoGeneratorBaseVC/TSAIPhotoGeneratorBaseVM/TSAIListPhotoGeneratorBaseVM.swift
  12. 3 0
      AIEmoji/Business/TSAILIstVC/TSAIUploadPhotoBaseVC/TSAIUploadPhotoBaseVC.swift
  13. 1 1
      AIEmoji/Business/TSGenmojiVC/TSGenmojiVC/View/TSGenmojiItemCell.swift
  14. 0 9
      AIEmoji/Business/TSPTPGeneratorVC/TSPTPGeneratorVC/TSPTPGeneratorVC.swift
  15. 1 1
      AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/VM/TSPTPInputVM.swift
  16. 7 5
      AIEmoji/Business/TSPurchaseMembershipVC/TSPurchaseVC.swift
  17. 5 0
      AIEmoji/Common/SchemeHandler/SchemeHandler+Ext.swift
  18. 1 1
      AIEmoji/Common/Tool/TSCommonTool/TSCommonTool.swift
  19. 2 0
      AIEmoji/de.lproj/Localizable.strings
  20. 2 0
      AIEmoji/en.lproj/Localizable.strings
  21. 2 0
      AIEmoji/es.lproj/Localizable.strings
  22. 2 0
      AIEmoji/ja.lproj/Localizable.strings
  23. 2 0
      AIEmoji/ko.lproj/Localizable.strings
  24. 2 0
      AIEmoji/pt-BR.lproj/Localizable.strings
  25. 2 0
      AIEmoji/pt-PT.lproj/Localizable.strings
  26. 2 0
      AIEmoji/zh-Hans.lproj/Localizable.strings
  27. 2 0
      AIEmoji/zh-Hant.lproj/Localizable.strings
  28. 2 2
      Podfile.lock

+ 2 - 2
AIEmoji.xcodeproj/project.pbxproj

@@ -2457,7 +2457,7 @@
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = AIEmoji/Info.plist;
-				INFOPLIST_KEY_CFBundleDisplayName = "AI Image";
+				INFOPLIST_KEY_CFBundleDisplayName = Chibi;
 				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Allow us to access photos to upload your photos to generate new styles.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
@@ -2496,7 +2496,7 @@
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_FILE = AIEmoji/Info.plist;
-				INFOPLIST_KEY_CFBundleDisplayName = "AI Image";
+				INFOPLIST_KEY_CFBundleDisplayName = Chibi;
 				INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Allow us to access photos to upload your photos to generate new styles.";
 				INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
 				INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;

+ 22 - 0
AIEmoji/Assets.xcassets/AIList/aiList_MotherDay.imageset/Contents.json

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

BIN
AIEmoji/Assets.xcassets/AIList/aiList_MotherDay.imageset/aiList_MotherDay@2x.png


BIN
AIEmoji/Assets.xcassets/AIList/aiList_MotherDay.imageset/aiList_MotherDay@3x.png


+ 3 - 3
AIEmoji/Base.lproj/LaunchScreen.storyboard

@@ -16,8 +16,8 @@
                         <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch_AI_Image" highlighted="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FfL-7D-71P">
-                                <rect key="frame" x="86.666666666666671" y="325" width="219.66666666666663" height="45.333333333333314"/>
+                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch_Chibi" highlighted="YES" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FfL-7D-71P">
+                                <rect key="frame" x="132.66666666666666" y="325" width="127.99999999999997" height="45.333333333333314"/>
                             </imageView>
                         </subviews>
                         <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
@@ -34,6 +34,6 @@
         </scene>
     </scenes>
     <resources>
-        <image name="launch_AI_Image" width="219.66667175292969" height="45.333332061767578"/>
+        <image name="launch_Chibi" width="128" height="45.333332061767578"/>
     </resources>
 </document>

+ 6 - 2
AIEmoji/Business/Data/TSDBHistoryManager.swift

@@ -24,7 +24,7 @@ enum TSDBHistoryType: String,CaseIterable {
     case photoLive = "kTSAIPhotoLiveHistoryListString"   //活照片
     case photoExpand = "kTSAIPhotoExpandHistoryListString"   //照片扩展
     case photoQuality = "kTSAIPhotoQualityHistoryListString"   //照片变高清
-    
+    case motherDay = "kTSAIMotherDayHistoryListString"   //母亲节
 }
 
 
@@ -286,6 +286,10 @@ extension TSRealmManager {
     var photoQualityDBHistory:TSDBHistory {
         return getDBHistory(type: TSDBHistoryType.photoQuality)
     }
-
+    
+    //变高清图
+    var motherDayDBHistory:TSDBHistory {
+        return getDBHistory(type: TSDBHistoryType.motherDay)
+    }
 }
 

+ 2 - 0
AIEmoji/Business/General/Ex/Notification+Ex.swift

@@ -17,4 +17,6 @@ extension Notification.Name {
     static let kGeneratePTPOperationChanged = Notification.Name("kGeneratePTPOperationChanged") //生成图生图任务发生变化
     
     static let kPTPDataChanged = Notification.Name("kPTPDataChanged") //图生图数据放生改变
+    
+    static let kOpenMotherDayVC = Notification.Name("kOpenMotherDayVC") //打开母亲节 vc
 }

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

@@ -12,6 +12,26 @@ class TSAILIstVC: TSBaseVC {
         let sectionModel = TSBasicSectionModel()
         dataArray.append(sectionModel)
 
+        //母亲节
+        sectionModel.addSubItemModel(
+            createItemModel(
+                leftImageName:"aiList_MotherDay",
+                leftTitle: "Happy Mother's Day".localized,
+                leftSubTitle: "".localized,
+                rightViewStyle: 0,
+                tapBlock: { [weak self] model, _, _ in
+                   guard let self = self else { return }
+//                    enterSelectPhotos(
+//                        userDefaultsKey: "",//"isFirstAIListMotherDayHintVC",
+//                        maxBitSize: kUploadImageMaxBit10Size,
+//                        config:.defaultConfig
+//                    ) { image in
+//                        let baseVc = TSAIUploadPhotoBaseVC(titleString: model.leftTitle ?? "",upLoadImage: image,imageMaxBitSize: kUploadImageMaxBit10Size, generatorStyle: .motherDay)
+//                        kPushVC(target: self, modelVC: baseVc)
+//                    }
+                    openMotherDayVC(titleString: model.leftTitle ?? "")
+        }))
+        
         
         sectionModel.addSubItemModel(
             createItemModel(
@@ -23,7 +43,7 @@ class TSAILIstVC: TSBaseVC {
                    guard let self = self else { return }
                     kPushVC(target: self, modelVC: TSTextGeneralPictureVC())
         }))
-        
+
         sectionModel.addSubItemModel(
             createItemModel(
                 leftImageName:"aiList_quality",
@@ -320,6 +340,13 @@ class TSAILIstVC: TSBaseVC {
         NotificationCenter.default.addObserver(self, selector: #selector(updateVipView), name: .kPurchaseDidChanged, object: nil)
         updateVipView()
         
+        NotificationCenter.default.addObserver(forName: .kOpenMotherDayVC, object: nil, queue: OperationQueue.main) { [weak self] _ in
+            guard let self = self else { return }
+            DispatchQueue.main.async {
+                self.openMotherDayVC(titleString: "Happy Mother's Day".localized)
+            }
+        }
+
     }
 }
 
@@ -429,3 +456,16 @@ extension TSAILIstVC{
         }
     }
 }
+
+extension TSAILIstVC{
+    func openMotherDayVC(titleString:String){
+        enterSelectPhotos(
+            userDefaultsKey: "isFirstAIListMotherDayHintVC",
+            maxBitSize: kUploadImageMaxBit10Size,
+            config:.defaultConfig
+        ) { image in
+            let baseVc = TSAIUploadPhotoBaseVC(titleString: titleString,upLoadImage: image,imageMaxBitSize: kUploadImageMaxBit10Size, generatorStyle: .motherDay)
+            kPushVC(target: self, modelVC: baseVc)
+        }
+    }
+}

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

@@ -6,9 +6,8 @@
 //
 
 class TSAIListHistoryBaseCell: TSBaseCollectionCell,TSSimpleConfigurableView {
-    
     weak var delegate: (any TSSmalCoacopods.TSSimpleCollectionViewDelegate)?
-    var indexPath: IndexPath? = IndexPath(item: 0, section: 0)
+    var indexPath: IndexPath = IndexPath(item: 0, section: 0)
     var data: Any? {
         didSet {
 //            debugPrint("TSAIListHistoryBaseCell data didSet")

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

@@ -92,7 +92,7 @@ class TSAIListHistoryBaseVC: TSBaseVC {
     @objc func clickNavRight() {
         showCustomAlert(message: "Are you sure to delete".localized, deleteHandler:  {
             self.removeAllHistoryList()
-            self.updateView()
+            self.updateDataView()
         })
     }
     
@@ -157,6 +157,8 @@ extension TSAIListHistoryBaseVC{
             TSRMShared.photoExpandDBHistory
         case .photoQuality:
             TSRMShared.photoQualityDBHistory
+        case .motherDay:
+            TSRMShared.motherDayDBHistory
         }
     }
     

+ 11 - 1
AIEmoji/Business/TSAILIstVC/TSAIPhotoGeneratorBaseVC/TSAIPhotoGeneratorBaseVM/TSAIListPhotoGeneratorBaseVM.swift

@@ -157,6 +157,14 @@ class TSAIListPhotoGeneratorBaseVM {
                 postDict = ["prompt":"提高上传图片的清晰度,不要改变任何",
                             "imageUrl":imageUrl,
                             "device":getUserInfoJsonString()]
+            case .motherDay:
+                urlType = .imageRewrite
+                postDict = ["prompt":"把照片转化为Q版人物形象,3D黏土风,是真实世界的光影,保留原始人物细节,包括服装和造型。整体放在一张拍立得照片中,有一只手握着拍立得相纸。图中角色从拍立得相纸中,突破边框,延伸进入现实世界的二维空间。背景要温馨,包含母亲节快乐的元素。",
+                            "imageUrl":imageUrl,
+                            "device":getUserInfoJsonString(),
+                            "advance": true
+                            
+                    ]
         }
         creatRequest = TSNetworkShared.post(urlType: urlType,parameters: postDict) { [weak self] data,error in
             guard let self = self else { return }
@@ -179,7 +187,7 @@ class TSAIListPhotoGeneratorBaseVM {
                 if let genmojiModel = TSActionInfoModel(JSON: result) {
                     switch genmojiModel.actionStatus {
                     case .success:
-                        if let url = URL(string:genmojiModel.response.resultUrl) {
+                        if let _ = URL(string:genmojiModel.response.resultUrl) {
                             if generatorModel.generatorStyle == .photoLive {
                                 downloadVideo(urlString: genmojiModel.response.resultUrl) { url in
                                     if let url = url {
@@ -276,6 +284,8 @@ class TSAIListPhotoGeneratorBaseVM {
             return 10*1024
         case .photoQuality:
             return 10*1024
+        case .motherDay:
+            return 10*1024
         }
     }
     

+ 3 - 0
AIEmoji/Business/TSAILIstVC/TSAIUploadPhotoBaseVC/TSAIUploadPhotoBaseVC.swift

@@ -15,6 +15,7 @@ enum TSGeneratorImageStyle {
     case photoLive     //把照片变活
     case photoExpand     //照片扩展
     case photoQuality    //照片变高清
+    case motherDay    //母亲节
 }
 
 class TSAIUploadPhotoBaseVC: TSBaseVC {
@@ -295,6 +296,8 @@ extension TSAIUploadPhotoBaseVC {
             dePrint("photoExpand")
         case .photoQuality:
             TSRMShared.photoQualityDBHistory.updateData(model)
+        case .motherDay:
+            TSRMShared.motherDayDBHistory.updateData(model)
         }
     }
 

+ 1 - 1
AIEmoji/Business/TSGenmojiVC/TSGenmojiVC/View/TSGenmojiItemCell.swift

@@ -9,7 +9,7 @@
 class TSGenmojiItemCell: TSBaseCollectionCell ,TSSimpleConfigurableView {
     
     weak var delegate: (any TSSmalCoacopods.TSSimpleCollectionViewDelegate)?
-    var indexPath: IndexPath? = IndexPath(item: 0, section: 0)
+    var indexPath: IndexPath = IndexPath(item: 0, section: 0)
     var data: Any? {
         didSet {
             if let dataModel = data as? TSActionInfoModel{

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

@@ -137,8 +137,6 @@ class TSPTPGeneratorVC: TSAIPhotoGeneratorBaseVC {
     @objc override func clickRegenerateBtn(){
         //判断 vip
         if kJudgeVip(externalBool: kPurchaseDefault.freeNumAvailable(type: .picToPic) == false, vc: self) { return }
-//        viewModel.uploadAndCreatImage()
-        
         if let model = self.infoModel {
             if model.actionStatus == .success  {
                 model.id = Date.timestampInt //如果是成功,且再生成一个,则更换一个 id ,作为新数据保存
@@ -164,18 +162,11 @@ class TSPTPGeneratorVC: TSAIPhotoGeneratorBaseVC {
     }
     
     override func dealThings() {
-//        viewModel.uploadAndCreatImage()
-//        viewModel.$stateDatauPblished.receive(on: DispatchQueue.main).sink {[weak self]  (state,model) in
-//            guard let self = self else { return }
-//            self.upDateView(state: state, model: model)
-//        }.store(in: &cancellable)
         creatImage()
     }
     
     
     func creatImage() {
-        //判断 vip
-        if kJudgeVipFreeType(vipFreeNumType: .picToPic, vc: self){ return }
         if let model = self.infoModel{
             if model.actionStatus == .failed{
                 creatOperation(infoModel: model)

+ 1 - 1
AIEmoji/Business/TSPTPGeneratorVC/TSPTPInputVC/VM/TSPTPInputVM.swift

@@ -17,7 +17,7 @@ class TSPTPInputVM {
         }
     }
     
-    var selectedStyleIndex:Int = 1
+    var selectedStyleIndex:Int = 0
     
     var upLoadImage:UIImage?{
         didSet{

+ 7 - 5
AIEmoji/Business/TSPurchaseMembershipVC/TSPurchaseVC.swift

@@ -316,11 +316,13 @@ func kJudgeVip(externalBool:Bool,
 extension TSPurchaseVC{
     
     static func show(target:UIViewController,closePageBlock:(()->Void)?){
-        let vc = TSPurchaseVC()
-        vc.closePageBlock = closePageBlock
-        let navi = TSBaseNavigationC(rootViewController: vc)
-        navi.modalPresentationStyle = .overFullScreen
-        target.present(navi, animated: true)
+        kDelayMainShort {
+            let vc = TSPurchaseVC()
+            vc.closePageBlock = closePageBlock
+            let navi = TSBaseNavigationC(rootViewController: vc)
+            navi.modalPresentationStyle = .overFullScreen
+            target.present(navi, animated: true)
+        }
     }
 
 }

+ 5 - 0
AIEmoji/Common/SchemeHandler/SchemeHandler+Ext.swift

@@ -44,10 +44,15 @@ extension SchemeHandler {
     /// 打开母亲节活动页面
     func handleMotherPolaroidOpen(params: [URLQueryItem]?) {
         // TODO: 跳转 母亲节页面,参考文生图
+        WindowHelper.resetToTabBarController(at: 1)
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
+            NotificationCenter.default.post(name: .kOpenMotherDayVC, object: nil)
+        }
     }
 
     /// 打开猫咪拟人化页面
     func handlePetHumanizationOpen(params: [URLQueryItem]?) {
         // TODO: 跳转猫咪拟人化页面,参考文生图
+
     }
 }

+ 1 - 1
AIEmoji/Common/Tool/TSCommonTool/TSCommonTool.swift

@@ -221,6 +221,6 @@ func kExecuteOnMainThread(_ block: @escaping () -> Void) {
     }
 }
 
-let kAppName:String = "AI Image" //Chibii Chibi Ghiblii
+let kAppName:String = "Chibi" //Chibii Chibi Ghiblii AI Image
 let kUploadImageMaxBit10Size:Int = 10 * 1024 * 1024 //10M
 let kUploadImageMaxBit5Size:Int = 5 * 1024 * 1024 //5M

+ 2 - 0
AIEmoji/de.lproj/Localizable.strings

@@ -294,3 +294,5 @@
 "Aspect Ratio" = "Seitenverhältnis";
 
 "The activity has expired, come next time" = "Die Aktivität ist abgelaufen, kommen Sie das nächste Mal";
+
+"Happy Mother's Day" = "Fröhlicher Muttertag";

+ 2 - 0
AIEmoji/en.lproj/Localizable.strings

@@ -292,3 +292,5 @@
 
 
 "The activity has expired, come next time" = "The activity has expired, come next time";
+
+"Happy Mother's Day" = "Happy Mother's Day";

+ 2 - 0
AIEmoji/es.lproj/Localizable.strings

@@ -291,3 +291,5 @@
 "Aspect Ratio" = "Relación de aspecto";
 
 "The activity has expired, come next time" = "La actividad ha caducado, ven la próxima vez.";
+
+"Happy Mother's Day" = "Feliz Día de la Madre";

+ 2 - 0
AIEmoji/ja.lproj/Localizable.strings

@@ -290,3 +290,5 @@
 "Aspect Ratio" = "アスペクト比";
 
 "The activity has expired, come next time" = "アクティビティの有効期限が切れました。次回に来てください";
+
+"Happy Mother's Day" = "ハッピー・マザーズ・デイ";

+ 2 - 0
AIEmoji/ko.lproj/Localizable.strings

@@ -296,3 +296,5 @@
 "Aspect Ratio" = "종횡비";
 
 "The activity has expired, come next time" = "활동이 만료되었습니다. 다음에 오세요.";
+
+"Happy Mother's Day" = "행복한 어머니의 날";

+ 2 - 0
AIEmoji/pt-BR.lproj/Localizable.strings

@@ -290,3 +290,5 @@
 "Aspect Ratio" = "Proporção";
 
 "The activity has expired, come next time" = "A atividade expirou, venha na próxima vez";
+
+"Happy Mother's Day" = "Feliz Dia das Mães";

+ 2 - 0
AIEmoji/pt-PT.lproj/Localizable.strings

@@ -290,3 +290,5 @@
 "Aspect Ratio" = "Proporção";
 
 "The activity has expired, come next time" = "A atividade expirou, venha na próxima vez";
+
+"Happy Mother's Day" = "Feliz Dia das Mães";

+ 2 - 0
AIEmoji/zh-Hans.lproj/Localizable.strings

@@ -291,3 +291,5 @@
 "Aspect Ratio" = "宽高比";
 
 "The activity has expired, come next time" = "活动已结束,下次再来";
+
+"Happy Mother's Day" = "母亲节快乐";

+ 2 - 0
AIEmoji/zh-Hant.lproj/Localizable.strings

@@ -282,3 +282,5 @@
 "Aspect Ratio" = "寬高比";
 
 "The activity has expired, come next time" = "活動結束,下次再來";
+
+"Happy Mother's Day" = "母親節快樂";

+ 2 - 2
Podfile.lock

@@ -137,8 +137,8 @@ SPEC CHECKSUMS:
   SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
   SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
   SwipeCellKit: 3972254a826da74609926daf59b08d6c72e619ea
-  TSSmalCoacopods: b168e4c8870d2c5593476237ac94ebe2e7de492a
+  TSSmalCoacopods: 6aa97167f0c76b16fc7d1fd1eb198bb6aece4f68
 
 PODFILE CHECKSUM: 2b99c499d2d0b8510ec7508631defa3f2e7debab
 
-COCOAPODS: 1.15.2
+COCOAPODS: 1.16.2