Преглед на файлове

修改了 bug,并完成走完了测试场景

100Years преди 2 дни
родител
ревизия
407e3ab3b5

+ 1 - 1
AIEmoji.xcodeproj/xcshareddata/xcschemes/AIEmoji.xcscheme

@@ -31,7 +31,7 @@
       shouldAutocreateTestPlan = "YES">
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 2 - 2
AIEmoji/Business/TSPurchaseMembershipVC/TSPurchaseVideoTimesVC/TSPurchaseVideoTimesVC.swift

@@ -150,7 +150,7 @@ extension TSPurchaseVideoTimesVC {
                     TSToastShared.showLoading(text: "Purchasing now".localized,containerView: self.view)
                 case .paySuccess:
                     TSToastShared.hideLoading()
-                    var loadingText = "Congratulations on your purchase! You have %d video effect uses. Try now!".localized
+                    var loadingText = "Video Effects Pack Activated!".localized
                     if let purchaseNum = self.viewModel.selectedType.purchaseNum {
                         loadingText = String(format: "Congratulations on your purchase! You have %d video effect uses. Try now!".localized, purchaseNum)
                     }
@@ -170,7 +170,7 @@ extension TSPurchaseVideoTimesVC {
                     TSToastShared.showLoading(text: "Restoring now".localized,containerView: self.view)
                 case .restoreSuccess:
                     TSToastShared.hideLoading()
-                    var loadingText = "Congratulations on your purchase! You have %d video effect uses. Try now!".localized
+                    var loadingText = "Video Effects Pack Activated!".localized
                     if let purchaseNum = self.viewModel.selectedType.purchaseNum {
                         loadingText = String(format: "Congratulations on your purchase! You have %d video effect uses. Try now!".localized, purchaseNum)
                     }

+ 3 - 0
AIEmoji/Business/TSTabBarController/TSTabBarController.swift

@@ -119,6 +119,9 @@ class TSTabBarController: UITabBarController {
         // 关闭订阅页面,弹出优惠订阅
         refreshPurchasePromotional()
         NotificationCenter.default.addObserver(self, selector: #selector(refreshPurchasePromotional), name: .kCloseTSPurchaseVC, object: nil)
+        
+        
+        debugPrint("TSTabBarController self = \(self)")
     }
 
     deinit {

+ 1 - 1
AIEmoji/Business2/DIYVideo/TSAIDiyVideoVC.swift

@@ -178,7 +178,7 @@ extension TSAIDiyVideoVC {
             return false
         }else{
             if kPurchaseDefault.isVip {//如果是 vip,但次数不够,则提示去买次数
-                kPurchaseDefault.judgePurchaseVideoPackage(vipFreeNumType: VipFreeNumType.videoV2,isCanFree: false, target: self)
+                kPurchaseDefault.judgeInterceptPurchaseVideoPackage(vipFreeNumType: VipFreeNumType.videoV2,isCanFree: false, target: self)
             }else{
                 //否则弹订阅 vip提示
                 TSPurchaseVC.show(target: self, closePageBlock: nil)

+ 1 - 1
AIEmoji/Business2/DisCover/TSAIGenerateVC/TSAIGenerateVC.swift

@@ -153,7 +153,7 @@ class TSAIGenerateVC: TSAIGenerateBaseVC {
         // 判断 vip
         if kJudgeVip(externalBool:kPurchaseDefault.freeNumAvailable(type: generatorModel.generatorStyle.vipFreeNumType) == false, vc: self) { return }
         //判断是否需要购买视频加油包
-        if kPurchaseDefault.judgePurchaseVideoPackage(vipFreeNumType: generatorModel.generatorStyle.vipFreeNumType, target: self){ return }
+        if kPurchaseDefault.judgeInterceptPurchaseVideoPackage(vipFreeNumType: generatorModel.generatorStyle.vipFreeNumType, target: self){ return }
         
         infoModel?.actionStatus = .failed // 状态设为失败,走generatorCreat
         uuidString = UUID().uuidString // 设置新的uuid,新的储存数据

+ 1 - 1
AIEmoji/Business2/DisCover/TSGenerateHistoryVC/TSGenerateHistoryVC.swift

@@ -291,7 +291,7 @@ extension TSGenerateHistoryVC{
                 })
             }else if cmd == "delete" {
                 TSCustomAlertController.show(in: self, config: TSCustomAlertController.AlertConfig(
-                    message: "Are you sure to delete?".localized,
+                    message: "Are you sure to delete".localized,
                     cancelTitle: "Delete".localized,
                     cancelColor: .red,
                     confirmTitle: "Retain".localized,

+ 1 - 1
AIEmoji/Business2/DisCover/TSPTPUploadImageVC/TSPTPUploadImageVC.swift

@@ -75,7 +75,7 @@ extension TSPTPUploadImageVC {
         //判断图片尺寸
         if judgeVideoImagesizeError(image: viewModel.generatorModel.upLoadImage){ return }
         //判断是否需要购买视频加油包
-        if kPurchaseDefault.judgePurchaseVideoPackage(vipFreeNumType: viewModel.style.vipFreeNumType, target: self){ return }
+        if kPurchaseDefault.judgeInterceptPurchaseVideoPackage(vipFreeNumType: viewModel.style.vipFreeNumType, target: self){ return }
   
         let gennerateVC = TSAIGenerateVC(generatorModel: viewModel.generatorModel) { [weak self] _ in
             guard let self = self else { return }

+ 2 - 2
AIEmoji/Common/NetworkManager/TSNetWork/TSNetWork+Business.swift

@@ -237,7 +237,7 @@ extension TSNetworkManager {
         completion: @escaping (Result<Any, Error>) -> Void
     ) -> Request? {
         //检验生成次数,判断是否合规
-        if kPurchaseDefault.judgeUsedNumUrlType(urlType: urlType, completion: completion){
+        if kPurchaseDefault.judgeInterceptUsedNumUrlType(urlType: urlType, completion: completion){
             return nil
         }
         
@@ -328,7 +328,7 @@ extension TSNetworkManager {
     -> Request?{
         
         //检验生成次数,判断是否合规
-        if kPurchaseDefault.judgeUsedNumType(vipFreeNumType: vipFreeNumType, completion: completion){
+        if kPurchaseDefault.judgeInterceptUsedNumType(vipFreeNumType: vipFreeNumType, completion: completion){
             return nil
         }
   

+ 18 - 9
AIEmoji/Common/Purchase/TSPurchaseManager+Judge.swift

@@ -88,16 +88,25 @@ extension PurchaseManager {
     }
     
     //判断视频是否超出限制,return true 是拦截的意思
-    func judgeVideoV2ExceedLimit(vipFreeNumType:VipFreeNumType) -> Bool{
+    func judgeInterceptVideoV2ExceedLimit(vipFreeNumType:VipFreeNumType) -> Bool{
+        var intercept:Bool = false
         if vipFreeNumType.isVideo {
-            return videoAvailableNum <= 0 //次数不够的,返回 true
+            intercept = videoAvailableNum <= 0 //次数不够的,返回 true
         }
-        return false
+        
+        //如果次数不够用,且不是 vip,就看用户有没有免费次数
+        if intercept,isVip == false {
+            if freeNum(type: vipFreeNumType) > 0 {//如果有免费次数,则不拦截
+                intercept = false
+            }
+        }
+
+        return intercept
     }
     
-    func judgeUsedNumType(vipFreeNumType:VipFreeNumType,completion: @escaping (Any?, Error?) -> Void) -> Bool{
+    func judgeInterceptUsedNumType(vipFreeNumType:VipFreeNumType,completion: @escaping (Any?, Error?) -> Void) -> Bool{
         ///需要校验,是否超出了 vip 生成的次数,且需要判断是否超过最大次数
-        if judgeVideoV2ExceedLimit(vipFreeNumType: vipFreeNumType) {
+        if judgeInterceptVideoV2ExceedLimit(vipFreeNumType: vipFreeNumType) {
             completion(nil,NSError(domain: "", code: TSNetWorkCode.generateToMax.rawValue))
             return true
         }
@@ -111,10 +120,10 @@ extension PurchaseManager {
         return false
     }
     
-    func judgeUsedNumUrlType(urlType:TSNeURLType,completion:@escaping (Result<Any, Error>) -> Void) -> Bool{
+    func judgeInterceptUsedNumUrlType(urlType:TSNeURLType,completion:@escaping (Result<Any, Error>) -> Void) -> Bool{
         let vipFreeNumType:VipFreeNumType = urlType.isVideo ? VipFreeNumType.videoType : .aiGenerate
         ///需要校验,是否超出了 vip 生成的次数,且需要判断是否超过最大次数
-        if urlType.needValidate,judgeVideoV2ExceedLimit(vipFreeNumType: vipFreeNumType) {
+        if urlType.needValidate,judgeInterceptVideoV2ExceedLimit(vipFreeNumType: vipFreeNumType) {
             completion(.failure(NSError(domain: "", code: TSNetWorkCode.generateToMax.rawValue)))
             return true
         }
@@ -130,14 +139,14 @@ extension PurchaseManager {
 
     //判断试用的视频次数,是否超出了最大数量,如果超出,提示用户购买加油宝
     //isCanFree 是否可以免费试用
-    func judgePurchaseVideoPackage(vipFreeNumType:VipFreeNumType,isCanFree:Bool = true,target:UIViewController) -> Bool{
+    func judgeInterceptPurchaseVideoPackage(vipFreeNumType:VipFreeNumType,isCanFree:Bool = true,target:UIViewController) -> Bool{
         
         //先判断非会员是否有免费的试用次数
         if isCanFree,isVip == false,freeNum(type: vipFreeNumType) > 0 {
             return false
         }
         ///需要校验,是否超出了 vip 生成的次数,且需要判断是否超过最大次数
-        if judgeVideoV2ExceedLimit(vipFreeNumType: vipFreeNumType)  {
+        if judgeInterceptVideoV2ExceedLimit(vipFreeNumType: vipFreeNumType)  {
             kPresentModalVC(target: target, modelVC: TSPurchaseVideoTimesVC(isShowAlertModel: true),transitionStyle:.crossDissolve)
             return true
         }

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

@@ -613,3 +613,4 @@
 "Photo Filter" = "Fotofilter";
 "AI Videos" = "KI-Videos";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "Ungültiges Seitenverhältnis. Muss 1:2 bis 1:1,2 sein";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "Herzlichen Glückwunsch zu Ihrem Kauf! Sie haben %d Videoeffekt-Anwendungen. Jetzt ausprobieren!";

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

@@ -617,3 +617,4 @@ Small / Medium / Large: Manual amplitude selection ";
 "Photo Filter" = "Photo Filter";
 "AI Videos" = "AI Videos";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "Invalid aspect ratio. Must be 1:2 to 1:1.2";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "Congratulations on your purchase! You have %d video effect uses. Try now!";

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

@@ -611,3 +611,4 @@
 "Photo Filter" = "Filtro de fotos";
 "AI Videos" = "Vídeos de IA";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "Relación de aspecto no válida. Debe ser de 1:2 a 1:1.2.";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "¡Felicitaciones por tu compra! Tienes %d usos de efectos de video. ¡Pruébalo ahora!";

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

@@ -610,3 +610,4 @@
 "Photo Filter" = "写真フィルター";
 "AI Videos" = "AI ビデオ";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "アスペクト比が無効です。1:2~1:1.2 にする必要があります。";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "ご購入ありがとうございます!ビデオエフェクトの使用回数は%d回です。今すぐお試しください!";

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

@@ -614,3 +614,4 @@
 "Photo Filter" = "사진 필터";
 "AI Videos" = "AI 비디오";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "잘못된 종횡비입니다. 1:2에서 1:1.2 사이여야 합니다.";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "구매를 축하드립니다! %d개의 비디오 효과를 사용하실 수 있습니다. 지금 사용해 보세요!";

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

@@ -610,3 +610,4 @@
 "Photo Filter" = "Filtro de fotos";
 "AI Videos" = "AI Videos";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "Proporção de tela inválida. Deve ser de 1:2 a 1:1,2.";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "Parabéns pela sua compra! Você tem %d usos de efeitos de vídeo. Experimente agora!";

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

@@ -609,3 +609,4 @@
 "Photo Filter" = "Filtro de fotos";
 "AI Videos" = "AI Videos";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "Proporção de tela inválida. Deve ser de 1:2 a 1:1,2.";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "Parabéns pela sua compra! Você tem %d usos de efeitos de vídeo. Experimente agora!";

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

@@ -612,3 +612,4 @@
 "Photo Filter" = "图片滤镜";
 "AI Videos" = "AI 视频";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "宽高比错误,必须在 1:2 到 1:1.2 之间";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "恭喜您购买成功!您有 %d 次视频特效可用。快去试试吧~";

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

@@ -600,3 +600,4 @@
 "Photo Filter" = "圖片濾鏡";
 "AI Videos" = "AI 視頻";
 "Invalid aspect ratio. Must be 1:2 to 1:1.2" = "寬高比錯誤,必須在 1:2 到 1:1.2 之間";
+"Congratulations on your purchase! You have %d video effect uses. Try now!" = "恭喜您購買成功! 您有 %d 次視頻特效可用。 快去試試吧~";