فهرست منبع

【会员系统】DMG 不需要的方法屏蔽

zenghong 1 هفته پیش
والد
کامیت
30f931caca
1فایلهای تغییر یافته به همراه29 افزوده شده و 8 حذف شده
  1. 29 8
      PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

+ 29 - 8
PDF Office/PDF Master/MemberCenter/ViewModel/KMProductModel.swift

@@ -506,6 +506,11 @@ class KMProductModel: ObservableObject {
     }
     
     func appStoreEquityVerification(_ notification: Notification,_ complete: @escaping KMMemberProductComplete) -> Void {
+#if VERSION_FREE
+#if VERSION_DMG
+        // DMG
+#else
+        // AppStore 免费版本
         if let userInfo = notification.object as? SKPaymentTransaction,
            let transactionId = userInfo.transactionIdentifier as? String,
            let productId = userInfo.payment.productIdentifier as? String {
@@ -514,11 +519,6 @@ class KMProductModel: ObservableObject {
             
             var productCode = ""
             var isSubscribed = false
-#if VERSION_FREE
-#if VERSION_DMG
-    // DMG
-#else
-    // AppStore 免费版本
             if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_6months.001" {
                 productCode = "advanced-annual-subscription-six-month"
                 if IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite.isSubscribed {
@@ -570,9 +570,30 @@ class KMProductModel: ObservableObject {
                     isSubscribed = true
                 }
             }
+            if isSubscribed {
+                KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
+                    if success {
+                        complete(true, result)
+                    } else {
+                        complete(false, result)
+                    }
+                    
+                }
+            }
+        } else {
+            print("Transaction ID not found in notification.")
+        }
 #endif
 #else
-    // AppStore 付费版
+        // AppStore 付费版
+        if let userInfo = notification.object as? SKPaymentTransaction,
+           let transactionId = userInfo.transactionIdentifier as? String,
+           let productId = userInfo.payment.productIdentifier as? String {
+            print("Transaction ID: \(transactionId)")
+            print("product ID: \(productId)")
+            
+            var productCode = ""
+            var isSubscribed = false
             if productId == "com.pdfreaderpro.mac.ai_pack_1_month" {
                 productCode = "ai-subscription-month"
                 if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
@@ -594,7 +615,6 @@ class KMProductModel: ObservableObject {
                     isSubscribed = true
                 }
             }
-#endif
             if isSubscribed {
                 KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
                     if success {
@@ -602,12 +622,13 @@ class KMProductModel: ObservableObject {
                     } else {
                         complete(false, result)
                     }
-
+                    
                 }
             }
         } else {
             print("Transaction ID not found in notification.")
         }
+#endif
     }
     
     var isCancelAutoRenew: Bool {