|
@@ -165,6 +165,56 @@ class KMProductModel: ObservableObject {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ @abstract 获取DMG产品价格(美元)
|
|
|
+ */
|
|
|
+ func getDMGPrice(productCode: String) -> String {
|
|
|
+ guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
+ for model in productModels {
|
|
|
+ if model.code == "productCode" {
|
|
|
+ return model.price.stringValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ @abstract 获取DMG产品价格(人民币)
|
|
|
+ */
|
|
|
+ func getDMGCNYPrice(productCode: String) -> String {
|
|
|
+ guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
+ for model in productModels {
|
|
|
+ if model.code == "productCode" {
|
|
|
+ return model.cnyPrice.stringValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ @abstract 获取DMG产品折扣价格(美元)
|
|
|
+ */
|
|
|
+ func getDMGDisplayPrice(productCode: String) -> String {
|
|
|
+ guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
+ for model in productModels {
|
|
|
+ if model.code == "productCode" {
|
|
|
+ return model.displayPrice.stringValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ @abstract 获取DMG产品折扣价格(人民币)
|
|
|
+ */
|
|
|
+ func getDMGDisplayCNYPrice(productCode: String) -> String {
|
|
|
+ guard let productModels = dmgProductDatas?.listingProducts else { return "" }
|
|
|
+ for model in productModels {
|
|
|
+ if model.code == "productCode" {
|
|
|
+ return model.displayCnyPrice.stringValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
@abstract 获取登录用户价格(建立订单时需要用到)
|
|
|
@param productId 购买的产品id
|
|
@@ -460,38 +510,46 @@ class KMProductModel: ObservableObject {
|
|
|
return IAPProductsManager.default().advancedAdd2DevicesAllAccessPack12months_pro.price()
|
|
|
}
|
|
|
} else if type == .pdfReaderProStandard_dmg {
|
|
|
- return "79.99"
|
|
|
+ return getDMGPrice(productCode: "PDF Reader Pro Standard - Annual Plan")
|
|
|
} else if type == .pdfReaderProAdvanced_dmg {
|
|
|
- return "99.99"
|
|
|
+ return getDMGPrice(productCode: "PDF Reader Pro Advanced - Annual Plan")
|
|
|
} else if type == .pdfReaderProPermanent_dmg {
|
|
|
- return "119.99"
|
|
|
+ return getDMGPrice(productCode: "PDF Reader Pro Permanent")
|
|
|
} else if type == .pdfReaderProAIAnnual_dmg {
|
|
|
- return "125.99"
|
|
|
+ return getDMGPrice(productCode: "PDF Reader Pro AI - Annual Plan")
|
|
|
} else if type == .pdfReaderProAIMonthly_dmg {
|
|
|
- return "14.99"
|
|
|
+ return getDMGPrice(productCode: "PDF Reader Pro AI - Monthly Plan")
|
|
|
} else if type == .pdfToOffice_dmg {
|
|
|
- return "29.99"
|
|
|
+ return getDMGPrice(productCode: "PDF to Office")
|
|
|
} else if type == .add2Device_dmg {
|
|
|
- return "39.99"
|
|
|
+ return getDMGPrice(productCode: "Add 2-Device · Advanced Annual")
|
|
|
} else if type == .add3Device_dmg {
|
|
|
- return "49.99"
|
|
|
+ return getDMGPrice(productCode: "Add 3-Device · Advanced Annual")
|
|
|
}
|
|
|
return ""
|
|
|
}
|
|
|
|
|
|
func appstorePurchaseAction(_ tag: Int, _ complete: @escaping AppstorePurchaseComplete) -> Void {
|
|
|
if state == .dmg_Base {
|
|
|
- if tag == 0 {
|
|
|
-
|
|
|
+ var code = ""
|
|
|
+ if tag == 1 {
|
|
|
+ code = "PDF Reader Pro Standard - Annual Plan"
|
|
|
} else if tag == 3 {
|
|
|
-
|
|
|
+ code = "PDF Reader Pro Permanent"
|
|
|
} else {
|
|
|
-
|
|
|
+ code = "PDF Reader Pro Advanced - Annual Plan"
|
|
|
}
|
|
|
+ let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode(code)
|
|
|
+ embeddedWC.showWindow(nil)
|
|
|
+ embeddedWC.window?.center()
|
|
|
} else if state == .dmg_Upgrades1 {
|
|
|
-
|
|
|
+ let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("Add 2-Device · Advanced Annual")
|
|
|
+ embeddedWC.showWindow(nil)
|
|
|
+ embeddedWC.window?.center()
|
|
|
} else if state == .dmg_Upgrades2 {
|
|
|
-
|
|
|
+ let embeddedWC = KMPurchaseEmbeddedWindowController.currentCode("Add 3-Device · Advanced Annual")
|
|
|
+ embeddedWC.showWindow(nil)
|
|
|
+ embeddedWC.window?.center()
|
|
|
} else if state == .lite_Base {
|
|
|
if tag == 0 {
|
|
|
if isPurchaseSwitch { membershipPurchase(.fourDevicesAllAccessPackNew12months_lite) }
|