|
@@ -471,6 +471,109 @@ class KMProductModel: ObservableObject {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func appStoreEquityVerification(_ notification: Notification,_ complete: @escaping KMMemberProductComplete) -> Void {
|
|
|
+ if let userInfo = notification.userInfo,
|
|
|
+ let transactionId = userInfo["transactionId"] as? String,
|
|
|
+ let productId = userInfo["productId"] as? String {
|
|
|
+ print("Transaction ID: \(transactionId)")
|
|
|
+ print("product ID: \(productId)")
|
|
|
+
|
|
|
+ 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 {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-annual-subscription"
|
|
|
+ if IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_new_6months.001" {
|
|
|
+ productCode = "advanced-annual-subscription-six-month"
|
|
|
+ if IAPProductsManager.default().allAccessPackNew6months_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_12months.001" {
|
|
|
+ productCode = "advanced-annual-subscription"
|
|
|
+ if IAPProductsManager.default().allAccessPack12months_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_6months.001" {
|
|
|
+ productCode = "advanced-annual-subscription-six-month"
|
|
|
+ if IAPProductsManager.default().allAccessPack6months_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_1_month" {
|
|
|
+ productCode = "ai-subscription-month"
|
|
|
+ if IAPProductsManager.default().aiAllAccessPack1month_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.ai_pack_12_month" {
|
|
|
+ productCode = "ai-subscription-year-trail"
|
|
|
+ if IAPProductsManager.default().aiAllAccessPack12month_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.all_access_pack_advanced_permanent_license.001" {
|
|
|
+ productCode = "advanced-permanent"
|
|
|
+ if IAPProductsManager.default().allAccessPackPermanent_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_devices_all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-annual-subscription-single-upgrade"
|
|
|
+ if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac_free.member.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-annual-subscription-multi-upgrade"
|
|
|
+ if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+#else
|
|
|
+ // AppStore 付费版
|
|
|
+ if productId == "com.pdfreaderpro.mac.ai_pack_1_month" {
|
|
|
+ productCode = "ai-subscription-month"
|
|
|
+ if IAPProductsManager.default().aiAllAccessPack1month_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac.ai_pack_12_month" {
|
|
|
+ productCode = "ai-subscription-year-trail"
|
|
|
+ if IAPProductsManager.default().aiAllAccessPack12month_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac.pdf_to_office_pack_permanent_license.001" {
|
|
|
+ productCode = "advanced-permanent-mac-upgrade"
|
|
|
+ if IAPProductsManager.default().pdfToOfficePackPermanent_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac.all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-permanent-mac-upgrade"
|
|
|
+ if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ 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.")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var isCancelAutoRenew: Bool {
|
|
|
return IAPProductsManager.default().isCancelAutoRenew()
|
|
|
}
|