|
@@ -172,7 +172,7 @@ class KMProductModel: ObservableObject {
|
|
func getDMGPrice(productCode: String) -> String {
|
|
func getDMGPrice(productCode: String) -> String {
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
for model in productModels {
|
|
for model in productModels {
|
|
- if model.code == "productCode" {
|
|
|
|
|
|
+ if model.code == productCode {
|
|
return model.price.stringValue
|
|
return model.price.stringValue
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -184,7 +184,7 @@ class KMProductModel: ObservableObject {
|
|
func getDMGCNYPrice(productCode: String) -> String {
|
|
func getDMGCNYPrice(productCode: String) -> String {
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
for model in productModels {
|
|
for model in productModels {
|
|
- if model.code == "productCode" {
|
|
|
|
|
|
+ if model.code == productCode {
|
|
return model.cnyPrice.stringValue
|
|
return model.cnyPrice.stringValue
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -196,7 +196,7 @@ class KMProductModel: ObservableObject {
|
|
func getDMGDisplayPrice(productCode: String) -> String {
|
|
func getDMGDisplayPrice(productCode: String) -> String {
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
for model in productModels {
|
|
for model in productModels {
|
|
- if model.code == "productCode" {
|
|
|
|
|
|
+ if model.code == productCode {
|
|
return model.displayPrice.stringValue
|
|
return model.displayPrice.stringValue
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -208,7 +208,7 @@ class KMProductModel: ObservableObject {
|
|
func getDMGDisplayCNYPrice(productCode: String) -> String {
|
|
func getDMGDisplayCNYPrice(productCode: String) -> String {
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
for model in productModels {
|
|
for model in productModels {
|
|
- if model.code == "productCode" {
|
|
|
|
|
|
+ if model.code == productCode {
|
|
return model.displayCnyPrice.stringValue
|
|
return model.displayCnyPrice.stringValue
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -425,6 +425,28 @@ class KMProductModel: ObservableObject {
|
|
对应商品价格
|
|
对应商品价格
|
|
*/
|
|
*/
|
|
func getProductPrice(_ type: KMPurchasedProductType) -> String {
|
|
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 type == .fourDevicesAllAccessPackNew6months_lite {
|
|
if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
|
|
if let product = IAPProductsManager.default().fourDevicesAllAccessPackNew6Months_lite, product.isOffers {
|
|
return product.offersPrice()
|
|
return product.offersPrice()
|
|
@@ -467,7 +489,11 @@ class KMProductModel: ObservableObject {
|
|
} else {
|
|
} else {
|
|
return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_lite.price()
|
|
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 {
|
|
if let product = IAPProductsManager.default().aiAllAccessPack1month_pro, product.isOffers {
|
|
return product.offersPrice()
|
|
return product.offersPrice()
|
|
} else {
|
|
} else {
|
|
@@ -509,23 +535,8 @@ class KMProductModel: ObservableObject {
|
|
} else {
|
|
} else {
|
|
return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
|
|
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 ""
|
|
return ""
|
|
}
|
|
}
|
|
|
|
|
|
@@ -533,11 +544,11 @@ class KMProductModel: ObservableObject {
|
|
if state == .dmg_Base {
|
|
if state == .dmg_Base {
|
|
var code = ""
|
|
var code = ""
|
|
if tag == 1 {
|
|
if tag == 1 {
|
|
- code = "PDF Reader Pro Standard - Annual Plan"
|
|
|
|
|
|
+ code = "standard-annual-subscription"
|
|
} else if tag == 3 {
|
|
} else if tag == 3 {
|
|
- code = "PDF Reader Pro Permanent"
|
|
|
|
|
|
+ code = "advanced-permanent"
|
|
} else {
|
|
} else {
|
|
- code = "PDF Reader Pro Advanced - Annual Plan"
|
|
|
|
|
|
+ code = "advanced-annual-subscription"
|
|
}
|
|
}
|
|
#if VERSION_DMG
|
|
#if VERSION_DMG
|
|
let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
|
|
let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
|
|
@@ -770,6 +781,7 @@ class KMProductModel: ObservableObject {
|
|
会员购买
|
|
会员购买
|
|
*/
|
|
*/
|
|
private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
|
|
private func membershipPurchase(_ type: KMPurchasedProductType) -> Void {
|
|
|
|
+#if !VERSION_DMG
|
|
if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
|
|
if type == .fourDevicesAllAccessPackNew6months_lite || type == .fourDevicesAllAccessPackNew12months_lite {
|
|
if isPurchaseSwitch {
|
|
if isPurchaseSwitch {
|
|
IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
|
|
IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().fourDevicesAllAccessPackNew12months_lite, discount: isCancelAutoRenew)
|
|
@@ -801,6 +813,7 @@ class KMProductModel: ObservableObject {
|
|
} else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
|
|
} else if type == .advancedAdd2DevicesAllAccessPack12months_pro {
|
|
IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
|
|
IAPProductsManager.default().makeSubProduct(IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro, discount: isCancelAutoRenew)
|
|
}
|
|
}
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
// MARK: Action Method
|
|
// MARK: Action Method
|