浏览代码

3.6.28(5)修改 bug,提测

100Years 1 周之前
父节点
当前提交
06b389eed2

+ 2 - 2
AIEmoji.xcodeproj/project.pbxproj

@@ -3288,7 +3288,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 4;
+				CURRENT_PROJECT_VERSION = 5;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;
@@ -3327,7 +3327,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CLANG_ENABLE_MODULES = YES;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 4;
+				CURRENT_PROJECT_VERSION = 5;
 				DEVELOPMENT_TEAM = 65UD255J84;
 				ENABLE_USER_SCRIPT_SANDBOXING = NO;
 				GENERATE_INFOPLIST_FILE = YES;

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

@@ -144,7 +144,7 @@ extension TSPurchaseVideoTimesVC {
                     let message = "Failed to get the price, will automatically retry in 5 seconds".localized
                     TSToastShared.showToast(text: message)
                     DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
-                        TSPurchaseTimesManager.default.requestProducts()
+                        PurchaseManager.default.requestProducts()
                     }
                 case .paying:
                     TSToastShared.showLoading(text: "Purchasing now".localized,containerView: self.view)

+ 0 - 121
AIEmoji/Business/TSPurchaseMembershipVC/TSPurchaseVideoTimesVC/View/TSPurchaseVideoTimesAlertView.swift

@@ -115,17 +115,6 @@ struct TSPurchaseVideoTimesAlertView :View {
                                 }else{
                                     Spacer().frame(height: k_Height_safeAreaInsetsBottom())
                                 }
-                                
-//                                // 关键:透明的底部定位Spacer
-//                                Color.clear
-//                                    .frame(height: 1)
-//                                    .id(bottomID) // 设置唯一标识符
-//                                    .onAppear {
-//                                        if isExpand == true {
-//                                            scrollProxy?.scrollTo(bottomID, anchor: .bottom)
-//                                        }
-//                                        print("展开完成")
-//                                    }
                             }
                             .padding(.horizontal,16)
                             .onAppear {
@@ -145,113 +134,3 @@ struct TSPurchaseVideoTimesAlertView :View {
         .ignoresSafeArea()
     }
 }
-
-
-//struct TSPurchaseVideoTimesAlertView :View {
-//    @ObservedObject var viewModel: TSPurchaseVideoTimesVM
-//    @State var isExpand: Bool = false
-//    var body: some View {
-//        VStack {
-//            let limit = "No effect uses left. Get more to keep creating.".localized
-//            
-//            Spacer()
-//            ZStack(alignment: .topTrailing) {
-//                VStack {
-//                    Spacer().frame(height: 24)
-//                    Text("Limit Reached".localized)
-//                        .multilineTextAlignment(.center)
-//                        .font(.font(size: 22,weight: .medium))
-//                        .foregroundColor(.white)
-//                        .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
-//                    
-//                    Spacer().frame(height: 16)
-//                    Text(limit)
-//                        .font(.font(size: 14,weight: .regular))
-//                        .multilineTextAlignment(.center)
-//                        .foregroundColor(.white.opacity(0.7))
-//                        .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
-//                    
-//                    Spacer().frame(height: 15)
-//                    VStack(alignment: .leading, spacing: 20, content: {
-//                        TSPurchaseVideoTimesCellView(type: .purchase(.videoNum1), selectedType: $viewModel.selectedType)
-//                            .onTapGesture {
-//                                viewModel.selectedType = .purchase(.videoNum1)
-//                            }
-//                        ZStack(alignment: .topTrailing) {
-//                            TSPurchaseVideoTimesCellView(type: .purchase(.videoNum2), selectedType: $viewModel.selectedType)
-//                                .onTapGesture {
-//                                    viewModel.selectedType = .purchase(.videoNum2)
-//                                }
-//                            TSPurchaseVideoTimesRecView()
-//                                .offset(x:-12,y:-14)
-//                        }
-//                        TSPurchaseVideoTimesCellView(type: .purchase(.videoNum3), selectedType: $viewModel.selectedType)
-//                            .onTapGesture {
-//                                viewModel.selectedType = .purchase(.videoNum3)
-//                            }
-//                    }).multilineTextAlignment(.center).font(.font(size: 16,weight:.regular)).foregroundColor(.white)
-//                    
-//                    Spacer().frame(height: 28)
-//                    
-//                    
-//                    Button {
-//                        viewModel.buyPublisher.send(true)
-//                    } label: {
-//                        ZStack {
-//                            Image(.purchaseVideoTimesBtnbg)
-//                            Text("Purchase".localized)
-//                                .font(.font(size: 16,weight: .medium))
-//                                .foregroundColor(.white)
-//                        }.frame(maxWidth: .infinity ,minHeight: 48.0,maxHeight: 48.0)
-//                    }
-//                    
-//                    
-//                    VStack{
-//                        Spacer().frame(height: 15)
-//                        Button {
-//                            withAnimation(.easeInOut(duration: 0.3)) {
-//                                isExpand.toggle()
-//                            }
-//                        } label: {
-//                            HStack(spacing: 4) {
-//                                Text("View Usage Rules".localized)
-//                                    .font(.font(size: 12,weight: .regular))
-//                                    .foregroundColor(.white.opacity(0.7))
-//                                Image(isExpand ? .chatUpArrow : .chatDownArrow)
-//                            }
-//                        }
-//                    }
-//                    
-//                    if isExpand {
-//                        
-//                        Spacer().frame(height: 10)
-//                        
-//                        VStack(alignment: .leading, spacing: 8, content: {
-//                            TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "Only VIP can purchase video effect uses".localized)
-//                            TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "Uses can be applied to all video generations".localized)
-//                            TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "Uses never expire and can be purchased repeatedly".localized)
-//                            TSPurchaseVideoTextLineView(image: .purchaseVideoTimesCheck, text: "All unused uses will be lost if the app is uninstalled".localized)
-//                        })
-//                        .padding(EdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10))
-//                        
-//                        Spacer().frame(height: 24 + k_Height_safeAreaInsetsBottom())
-//                    }else{
-//                        Spacer().frame(height: k_Height_safeAreaInsetsBottom())
-//                    }
-//
-//                }
-//                .padding(.horizontal,16)
-//                .background(
-//                    Color.hex("#261840").cornerRadius([.topLeading,.topTrailing], 20)
-//                )
-//                
-//                Button {
-//                    viewModel.closePagePublisher.send(true)
-//                } label: {
-//                    Image(.closeClear).resizable().frame(width: 24, height: 24)
-//                }.offset(x:-8,y:8)
-//            }
-//        }
-//        .ignoresSafeArea()
-//    }
-//}

+ 18 - 1
AIEmoji/Common/Purchase/TSPurchaseManager+Enmu.swift

@@ -18,7 +18,6 @@ public enum PremiumPeriod{
     
     public enum WeekType:String, CaseIterable{
         case week = "week"
-        case week1 = "week1"
         case weekPromotional1 = "weekPromotional1"
     }
     
@@ -165,6 +164,23 @@ extension PremiumPeriod {
             return 0
         }
     }
+    
+    var weight:Int{
+        switch self {
+        case .lifetime:
+            return 6
+        case .year:
+            return 5
+        case .month:
+            return 4
+        case .week(.weekPromotional1):
+            return 3
+        case .week(.week):
+            return 2
+        case .none,.purchase(_):
+            return 0
+        }
+    }
 }
 
 public enum VipFreeNumType: String, CaseIterable {
@@ -185,6 +201,7 @@ public struct PurchaseProduct {
         self.productId = productId
         self.period = period
     }
+
 }
 
 

+ 77 - 46
AIEmoji/Common/Purchase/TSPurchaseManager.swift

@@ -32,6 +32,10 @@ public class PurchaseManager: NSObject {
             PurchaseProduct(productId: "102", period: .year),
             PurchaseProduct(productId: "103", period: .week(.week)),
             PurchaseProduct(productId: "113", period: .week(.weekPromotional1)),
+            
+            PurchaseProduct(productId: "201", period: .purchase(.videoNum1)),
+            PurchaseProduct(productId: "202", period: .purchase(.videoNum2)),
+            PurchaseProduct(productId: "203", period: .purchase(.videoNum3)),
         ]
     }()
 
@@ -53,7 +57,15 @@ public class PurchaseManager: NSObject {
     // 原始订单交易id dict
     var originalTransactionIdentifierDict: [String: String] = [:]
     
-
+    private lazy var onceVerifyPayResult: Void = {
+        dePrint("这段代码只会执行一次")
+#if DEBUG
+    verifyPayResult(transaction: SKPaymentTransaction(), useSandBox: true,uiBlock:nil)
+#else
+    verifyPayResult(transaction: SKPaymentTransaction(), useSandBox: false,uiBlock:nil)
+#endif
+    }()
+    
 
     override init() {
         super.init()
@@ -65,13 +77,7 @@ public class PurchaseManager: NSObject {
         }
 
         initializeForFree()
-        
-//#if DEBUG
-//    verifyPayResult(transaction: SKPaymentTransaction(), useSandBox: true)
-//#else
-//    verifyPayResult(transaction: SKPaymentTransaction(), useSandBox: false)
-//#endif
-        
+    
     }
     
     public var expiredDate: Date? {
@@ -331,27 +337,31 @@ extension PurchaseManager: SKProductsRequestDelegate {
         self.products = products
         purchase(self, didChaged: .loadSuccess, object: nil,transaction: nil)
         NotificationCenter.default.post(name: .kPurchasePrepared, object: nil)
-        debugPrint("PurchaseManager productsRequest didReceive = \(products)")
+        dePrint("PurchaseManager productsRequest didReceive = \(products)")
         
         for product in products {
-            print("请求到商品ID: \(product.productIdentifier)")
+            dePrint("请求到商品ID: \(product.productIdentifier)")
             // 获取促销价格
             if let introductoryPrice = product.introductoryPrice {
-                print("新用户促销价格: \(introductoryPrice.price) \(introductoryPrice.priceLocale.currencySymbol ?? "")")
-                print("新用户促销周期: \(introductoryPrice.subscriptionPeriod.numberOfUnits) \(introductoryPrice.subscriptionPeriod.unit)")
+                dePrint("新用户促销价格: \(introductoryPrice.price) \(introductoryPrice.priceLocale.currencySymbol ?? "")")
+                dePrint("新用户促销周期: \(introductoryPrice.subscriptionPeriod.numberOfUnits) \(introductoryPrice.subscriptionPeriod.unit)")
             }
             
             // 获取促销价格
             for discounts in product.discounts {
-                print("老用户促销价格: \(discounts.price) \(discounts.priceLocale.currencySymbol ?? "")")
-                print("老用户促销周期: \(discounts.subscriptionPeriod.numberOfUnits)")
+                dePrint("老用户促销价格: \(discounts.price) \(discounts.priceLocale.currencySymbol ?? "")")
+                dePrint("老用户促销周期: \(discounts.subscriptionPeriod.numberOfUnits)")
             }
 
         }
+        
+        //拿到商品后,主动拉取一次苹果订单,处理会员
+        _ = onceVerifyPayResult
+        dePrint("PurchaseManager onceVerifyPayResult")
     }
 
     public func request(_ request: SKRequest, didFailWithError error: Error) {
-        debugPrint("PurchaseManager productsRequest error = \(error)")
+        dePrint("PurchaseManager productsRequest error = \(error)")
         purchase(self, didChaged: .loadFail, object: error.localizedDescription,transaction: nil)
     }
 }
@@ -384,9 +394,9 @@ extension PurchaseManager: SKPaymentTransactionObserver {
 
                 // Transaction is in queue, user has been charged.  Client should complete the transaction.
                 #if DEBUG
-                    verifyPayResult(transaction: transaction, useSandBox: true)
+                    verifyPayResult(transaction: transaction, useSandBox: true,uiBlock: purchase(_:didChaged:object:transaction:))
                 #else
-                    verifyPayResult(transaction: transaction, useSandBox: false)
+                    verifyPayResult(transaction: transaction, useSandBox: false,uiBlock: purchase(_:didChaged:object:transaction:))
                 #endif
 
             case .failed:
@@ -440,9 +450,9 @@ extension PurchaseManager: SKPaymentTransactionObserver {
                 if let original = transaction.original,
                    original.transactionState == .purchased {
                     #if DEBUG
-                        verifyPayResult(transaction: transaction, useSandBox: true)
+                        verifyPayResult(transaction: transaction, useSandBox: true,uiBlock: purchase(_:didChaged:object:transaction:))
                     #else
-                        verifyPayResult(transaction: transaction, useSandBox: false)
+                        verifyPayResult(transaction: transaction, useSandBox: false,uiBlock: purchase(_:didChaged:object:transaction:))
                     #endif
                 } else {
                     purchase(self, didChaged: .restoreFail, object: "Failed to restore subscribe, please try again",transaction: transaction)
@@ -463,7 +473,7 @@ extension PurchaseManager: SKPaymentTransactionObserver {
 
     public func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
         if let trans = queue.transactions.first(where: { $0.transactionState == .purchased }) {
-            verifyPayResult(transaction: trans, useSandBox: false)
+            verifyPayResult(transaction: trans, useSandBox: false,uiBlock: purchase(_:didChaged:object:transaction:))
         } else if queue.transactions.isEmpty {
             purchase(self, didChaged: .restoreFail, object: "You don't have an active subscription",transaction: nil)
         }
@@ -482,12 +492,12 @@ extension PurchaseManager: SKPaymentTransactionObserver {
 }
 
 extension PurchaseManager {
-    func verifyPayResult(transaction: SKPaymentTransaction, useSandBox: Bool) {
-        purchase(self, didChaged: .verifying, object: nil,transaction: transaction)
 
+    func verifyPayResult(transaction: SKPaymentTransaction, useSandBox: Bool, uiBlock:((PurchaseManager,PremiumRequestState,Any?,SKPaymentTransaction?)->Void)?) {
+        
         guard let url = Bundle.main.appStoreReceiptURL,
               let receiptData = try? Data(contentsOf: url) else {
-            purchase(self, didChaged: .verifyFail, object: "凭证文件为空",transaction: transaction)
+            uiBlock?(self,.verifyFail,"凭证文件为空",transaction)
             return
         }
 
@@ -496,7 +506,7 @@ extension PurchaseManager {
             "password": AppleSharedKey,
         ]
         guard let requestData = try? JSONSerialization.data(withJSONObject: requestContents) else {
-            purchase(self, didChaged: .verifyFail, object: "凭证文件为空",transaction: transaction)
+            uiBlock?(self,.verifyFail,"凭证文件为空",transaction)
             return
         }
 
@@ -509,18 +519,18 @@ extension PurchaseManager {
                 debugPrint("PurchaseManager verifyPayResult = \(jsonResponse)")
                 let status = jsonResponse["status"]
                 if let status = status as? String, status == "21007" {
-                    self.verifyPayResult(transaction: transaction, useSandBox: true)
+                    self.verifyPayResult(transaction: transaction, useSandBox: true,uiBlock: uiBlock)
                 } else if let status = status as? Int, status == 21007 {
-                    self.verifyPayResult(transaction: transaction, useSandBox: true)
+                    self.verifyPayResult(transaction: transaction, useSandBox: true,uiBlock: uiBlock)
                 } else if let status = status as? String, status == "0" {
-                    self.handlerPayResult(transaction: transaction, resp: jsonResponse)
+                    self.handlerPayResult(transaction: transaction, resp: jsonResponse,uiBlock: uiBlock)
                 } else if let status = status as? Int, status == 0 {
-                    self.handlerPayResult(transaction: transaction, resp: jsonResponse)
+                    self.handlerPayResult(transaction: transaction, resp: jsonResponse,uiBlock: uiBlock)
                 } else {
-                    self.purchase(self, didChaged: .verifyFail, object: "验证结果状态码错误:\(status.debugDescription)",transaction: transaction)
+                    uiBlock?(self,.verifyFail,"验证结果状态码错误:\(status.debugDescription)",transaction)
                 }
             } else {
-                self.purchase(self, didChaged: .verifyFail, object: "验证结果为空",transaction: transaction)
+                uiBlock?(self,.verifyFail,"验证结果为空",transaction)
                 debugPrint("PurchaseManager 验证结果为空")
             }
         }
@@ -537,7 +547,7 @@ extension PurchaseManager {
          */
     }
 
-    func handlerPayResult(transaction: SKPaymentTransaction, resp: [String: Any]) {
+    func handlerPayResult(transaction: SKPaymentTransaction, resp: [String: Any], uiBlock:((PurchaseManager,PremiumRequestState,Any?,SKPaymentTransaction?)->Void)?) {
         
         //购买视频次数相关
         //分析处理购买消耗品的逻辑处理
@@ -579,9 +589,9 @@ extension PurchaseManager {
 
         DispatchQueue.main.async {
             if transaction.transactionState == .restored {
-                self.purchase(self, didChaged: .restoreSuccess, object: nil,transaction: transaction)
+                uiBlock?(self, .restoreSuccess, nil, transaction)
             } else {
-                self.purchase(self, didChaged: .paySuccess, object: nil,transaction: transaction)
+                uiBlock?(self, .paySuccess, nil, transaction)
             }
         }
 
@@ -593,8 +603,8 @@ extension PurchaseManager {
         guard !resp.isEmpty else {
             return false
         }
-
-   
+        
+        
         guard let pendingRenewalInfoArray = resp["pending_renewal_info"] as? [[String: Any]]
         else { return false}
 
@@ -604,21 +614,44 @@ extension PurchaseManager {
             "auto_renew_status" = 1;
             "original_transaction_id" = 2000000929272571;
             "product_id" = 101;
-        }*/
+        }
+         "latest_receipt_info": <__NSArrayI 0x10e290500>(
+         {
+             "expires_date" = "2025-08-11 07:54:13 Etc/GMT";
+             "expires_date_ms" = 1754898853000;
+             "product_id" = 101;
+             "transaction_id" = 2000000980915817;
+             "web_order_line_item_id" = 2000000108151289;
+         }
+         */
 
         if let firstItem = pendingRenewalInfoArray.first ,
-           let auto_renew_product_id = firstItem["auto_renew_product_id"] as? String,
-           let auto_product_id = firstItem["product_id"] as? String {
-            if auto_renew_product_id != auto_product_id {//拿到待生效的和当前的对比不一样,以待生效的为主
-                //取当前的过期时间+加上待生效的会员过期时长
+           let auto_renew_product_id = firstItem["auto_renew_product_id"] as? String,//待生效的
+           let product_id = firstItem["product_id"] as? String //当前的
+        {
+            if auto_renew_product_id != product_id {//拿到待生效的和当前的对比不一样,取当前的过期时间+加上待生效的会员过期时长
+                
                 let info = resp["latest_receipt_info"] as? [[String: Any]]
                 if let firstItem = info?.first,
-                   let expires_date_ms = firstItem["expires_date_ms"] as? String {
+                   let expires_date_ms = firstItem["expires_date_ms"] as? String { //拿到当前会员的过期时间错
+                    //当前的过期时间戳
                     let expiresms = Int(expires_date_ms) ?? 0
-                    let milliseconds = period(for: auto_renew_product_id).milliseconds
+                    //待生效会员的时间戳
+                    let autoRenewPeriod = period(for: auto_renew_product_id)
+                    let milliseconds = autoRenewPeriod.milliseconds
+                    
+                    //当前的过期时间+加上待生效的会员过期时长
                     let totalExpiresms = expiresms + milliseconds
-           
-                    updateExpireTime(String(totalExpiresms), for: auto_renew_product_id)
+                    
+                    //先用待生效的会员商品id
+                    var newProductId = auto_renew_product_id
+                    //如果当前的权重大于待生效的,则用当前的
+                    let currentProductPeriod = period(for: product_id)
+                    if currentProductPeriod.weight > autoRenewPeriod.weight {
+                        newProductId = product_id
+                    }
+                    
+                    updateExpireTime(String(totalExpiresms), for: newProductId)
                     return true
                 }
             }
@@ -679,8 +712,6 @@ public extension PurchaseManager {
     }
 
     func purchase(_ manager: PurchaseManager, didChaged state: PremiumRequestState, object: Any?,transaction:SKPaymentTransaction?) {
-        onPurchaseStateChanged?(manager, state, object)
-        
         if transaction == nil{
             onPurchaseStateChanged?(manager, state, object)
         }else if transaction?.transactionState == .restored,paymentProductIdentifier == "restoreCompletedTransactions"{

+ 4 - 55
AIEmoji/Common/Purchase/TSPurchaseTimesManager/TSPurchaseTimesManager.swift

@@ -14,64 +14,29 @@ typealias PurchaseTimesStateChangeHandler = (_ manager: TSPurchaseTimesManager,
 public class TSPurchaseTimesManager: NSObject {
     @objc public static let `default` = TSPurchaseTimesManager()
     
-    
+    //购买次数的商品
     static var purchaseNumProducts: [String] = {
         return ["201","202","203"]
     }()
     
-    // 商品信息
-    public lazy var purchaseProducts: [PurchaseProduct] = {
-        [
-            PurchaseProduct(productId: "201", period: .purchase(.videoNum1)),
-            PurchaseProduct(productId: "202", period: .purchase(.videoNum2)),
-            PurchaseProduct(productId: "203", period: .purchase(.videoNum3)),
-        ]
-    }()
-
-
-
-    
     lazy var products: [SKProduct] = []
     var paymentProductIdentifier:String?
     var onPurchaseStateChanged: PurchaseTimesStateChangeHandler?
 
     // 原始订单交易id dict
     var originalTransactionIdentifierDict: [String: String] = [:]
-    
 
-                         
     override init() {
         super.init()
         SKPaymentQueue.default().add(self)
     }
 
 }
-// MARK: 商品 & 订阅请求
 
-extension TSPurchaseTimesManager {
-    // 时间周期对应的商品id
-    func productId(for period: PremiumPeriod) -> String? {
-        return purchaseProducts.first(where: { $0.period == period })?.productId
-    }
-    public func product(for period: PremiumPeriod) -> SKProduct? {
-        return products.first(where: { $0.productIdentifier == productId(for: period) })
-    }
-    
-    /// 请求商品
-    public func requestProducts() {
-        if !products.isEmpty {
-            purchase(self, didChaged: .loadSuccess, object: nil,transaction: nil)
-        }
-
-        purchase(self, didChaged: .loading, object: nil,transaction: nil)
-        let productIdentifiers = Set(purchaseProducts.map({ $0.productId }))
-        debugPrint("TSPurchaseTimesManager requestProducts = \(productIdentifiers)")
-        let request = SKProductsRequest(productIdentifiers: productIdentifiers)
-        request.delegate = self
-        request.start()
-    }
 
 
+// MARK: 商品 & 订阅请求
+extension TSPurchaseTimesManager {
     /// 购买支付
     public func pay(for period: PremiumPeriod) {
         guard SKPaymentQueue.canMakePayments() else {
@@ -85,7 +50,7 @@ extension TSPurchaseTimesManager {
             return
         }
         
-        if let product = product(for: period) {
+        if let product = kPurchaseDefault.product(for: period) {
             purchase(self, didChaged: .paying, object: nil,transaction: nil)
             let payment = SKPayment(product: product)
             debugPrint("TSPurchaseTimesManager pay product = \(product.localizedDescription)")
@@ -100,22 +65,6 @@ extension TSPurchaseTimesManager {
     }
 }
 
-// MARK: 商品回调
-extension TSPurchaseTimesManager: SKProductsRequestDelegate {
-    public func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
-        let products = response.products
-        self.products = products
-        purchase(self, didChaged: .loadSuccess, object: nil,transaction: nil)
-        NotificationCenter.default.post(name: .kPurchasePrepared, object: nil)
-        debugPrint("TSPurchaseTimesManager productsRequest didReceive = \(products)")
-    }
-
-    public func request(_ request: SKRequest, didFailWithError error: Error) {
-        debugPrint("TSPurchaseTimesManager productsRequest error = \(error)")
-        purchase(self, didChaged: .loadFail, object: error.localizedDescription,transaction: nil)
-    }
-}
-
 // MARK: 订阅回调
 
 extension TSPurchaseTimesManager: SKPaymentTransactionObserver {

+ 0 - 1
AIEmoji/TSLaunchVC.swift

@@ -61,7 +61,6 @@ class TSLaunchVC: UIViewController {
             }
             
             PurchaseManager.default.requestProducts()
-            TSPurchaseTimesManager.default.requestProducts()
         }
     }