|
@@ -172,7 +172,7 @@ class KMProductModel: ObservableObject {
|
|
|
func getDMGPrice(productCode: String) -> String {
|
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
for model in productModels {
|
|
|
- if model.code == "productCode" {
|
|
|
+ if model.code == productCode {
|
|
|
return model.price.stringValue
|
|
|
}
|
|
|
}
|
|
@@ -184,7 +184,7 @@ class KMProductModel: ObservableObject {
|
|
|
func getDMGCNYPrice(productCode: String) -> String {
|
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
for model in productModels {
|
|
|
- if model.code == "productCode" {
|
|
|
+ if model.code == productCode {
|
|
|
return model.cnyPrice.stringValue
|
|
|
}
|
|
|
}
|
|
@@ -196,7 +196,7 @@ class KMProductModel: ObservableObject {
|
|
|
func getDMGDisplayPrice(productCode: String) -> String {
|
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
for model in productModels {
|
|
|
- if model.code == "productCode" {
|
|
|
+ if model.code == productCode {
|
|
|
return model.displayPrice.stringValue
|
|
|
}
|
|
|
}
|
|
@@ -208,7 +208,7 @@ class KMProductModel: ObservableObject {
|
|
|
func getDMGDisplayCNYPrice(productCode: String) -> String {
|
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
for model in productModels {
|
|
|
- if model.code == "productCode" {
|
|
|
+ if model.code == productCode {
|
|
|
return model.displayCnyPrice.stringValue
|
|
|
}
|
|
|
}
|
|
@@ -425,6 +425,28 @@ class KMProductModel: ObservableObject {
|
|
|
对应商品价格
|
|
|
*/
|
|
|
func getProductPrice(_ type: KMPurchasedProductType) -> String {
|
|
|
+#if VERSION_FREE
|
|
|
+#if VERSION_DMG
|
|
|
+ // DMG
|
|
|
+ if type == .pdfReaderProStandard_dmg {
|
|
|
+ return getDMGPrice(productCode: "standard-annual-subscription")
|
|
|
+ } else if type == .pdfReaderProAdvanced_dmg {
|
|
|
+ return getDMGPrice(productCode: "advanced-annual-subscription")
|
|
|
+ } else if type == .pdfReaderProPermanent_dmg {
|
|
|
+ return getDMGPrice(productCode: "advanced-permanent")
|
|
|
+ } else if type == .pdfReaderProAIAnnual_dmg {
|
|
|
+ return getDMGPrice(productCode: "ai-subscription-year-trail")
|
|
|
+ } else if type == .pdfReaderProAIMonthly_dmg {
|
|
|
+ return getDMGPrice(productCode: "ai-subscription-month")
|
|
|
+ } else if type == .pdfToOffice_dmg {
|
|
|
+ return getDMGPrice(productCode: "PDF to Office")
|
|
|
+ } else if type == .add2Device_dmg {
|
|
|
+ return getDMGPrice(productCode: "Add 2-Device · Advanced Annual")
|
|
|
+ } else if type == .add3Device_dmg {
|
|
|
+ return getDMGPrice(productCode: "Add 3-Device · Advanced Annual")
|
|
|
+ }
|
|
|
+#else
|
|
|
+ // AppStore 免费版本
|
|
|
if type == .fourDevicesAllAccessPackNew6months_lite {
|
|
|
if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
|
|
|
return product.offersPrice()
|
|
@@ -467,7 +489,11 @@ class KMProductModel: ObservableObject {
|
|
|
} else {
|
|
|
return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.price()
|
|
|
}
|
|
|
- } else if type == .aiAllAccessPack1month_pro {
|
|
|
+ }
|
|
|
+#endif
|
|
|
+#else
|
|
|
+ // AppStore 付费版
|
|
|
+ if type == .aiAllAccessPack1month_pro {
|
|
|
if let product = IAPProductsManager.default().aiAllAccessPack1month_pro, product.isOffers {
|
|
|
return product.offersPrice()
|
|
|
} else {
|
|
@@ -509,23 +535,8 @@ class KMProductModel: ObservableObject {
|
|
|
} else {
|
|
|
return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
|
|
|
}
|
|
|
- } else if type == .pdfReaderProStandard_dmg {
|
|
|
- return getDMGPrice(productCode: "PDF Reader Pro Standard - Annual Plan")
|
|
|
- } else if type == .pdfReaderProAdvanced_dmg {
|
|
|
- return getDMGPrice(productCode: "PDF Reader Pro Advanced - Annual Plan")
|
|
|
- } else if type == .pdfReaderProPermanent_dmg {
|
|
|
- return getDMGPrice(productCode: "PDF Reader Pro Permanent")
|
|
|
- } else if type == .pdfReaderProAIAnnual_dmg {
|
|
|
- return getDMGPrice(productCode: "PDF Reader Pro AI - Annual Plan")
|
|
|
- } else if type == .pdfReaderProAIMonthly_dmg {
|
|
|
- return getDMGPrice(productCode: "PDF Reader Pro AI - Monthly Plan")
|
|
|
- } else if type == .pdfToOffice_dmg {
|
|
|
- return getDMGPrice(productCode: "PDF to Office")
|
|
|
- } else if type == .add2Device_dmg {
|
|
|
- return getDMGPrice(productCode: "Add 2-Device · Advanced Annual")
|
|
|
- } else if type == .add3Device_dmg {
|
|
|
- return getDMGPrice(productCode: "Add 3-Device · Advanced Annual")
|
|
|
}
|
|
|
+#endif
|
|
|
return ""
|
|
|
}
|
|
|
|
|
@@ -533,11 +544,11 @@ class KMProductModel: ObservableObject {
|
|
|
if state == .dmg_Base {
|
|
|
var code = ""
|
|
|
if tag == 1 {
|
|
|
- code = "PDF Reader Pro Standard - Annual Plan"
|
|
|
+ code = "standard-annual-subscription"
|
|
|
} else if tag == 3 {
|
|
|
- code = "PDF Reader Pro Permanent"
|
|
|
+ code = "advanced-permanent"
|
|
|
} else {
|
|
|
- code = "PDF Reader Pro Advanced - Annual Plan"
|
|
|
+ code = "advanced-annual-subscription"
|
|
|
}
|
|
|
#if VERSION_DMG
|
|
|
let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
|
|
@@ -727,6 +738,21 @@ class KMProductModel: ObservableObject {
|
|
|
if IAPProductsManager.default().fourDevicesAllAccessPack12months_pro.isSubscribed {
|
|
|
isSubscribed = true
|
|
|
}
|
|
|
+ } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-annual-subscription-standard-upgrade"
|
|
|
+ if IAPProductsManager.default().standardAddDevicesAllAccessPack12months_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac.advanced_add_devices_all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-annual-subscription-single-upgrade"
|
|
|
+ if IAPProductsManager.default().advancedAddDevicesAllAccessPack12months_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
+ } else if productId == "com.pdfreaderpro.mac.advanced_add_2_devices_all_access_pack_advanced_annual.001" {
|
|
|
+ productCode = "advanced-annual-subscription-multi-upgrade"
|
|
|
+ if IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.isSubscribed {
|
|
|
+ isSubscribed = true
|
|
|
+ }
|
|
|
}
|
|
|
if isSubscribed {
|
|
|
KMMemberCenterManager.manager.appStoreEquityVerification(applePayProductId: productId, transactionId: transactionId, productCode: productCode) { success, result in
|
|
@@ -770,6 +796,7 @@ class KMProductModel: ObservableObject {
|
|
|
会员购买
|
|
|
*/
|
|
|
private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
|
|
|
+#if !VERSION_DMG
|
|
|
if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
|
|
|
if isPurchaseSwitch {
|
|
|
IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
|
|
@@ -801,6 +828,7 @@ class KMProductModel: ObservableObject {
|
|
|
} else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
|
|
|
IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
// MARK: Action Method
|