|
@@ -150,6 +150,7 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
@IBOutlet weak var imageBottomLayout: NSLayoutConstraint!
|
|
@IBOutlet weak var imageBottomLayout: NSLayoutConstraint!
|
|
@IBOutlet weak var image2BottomLayout: NSLayoutConstraint!
|
|
@IBOutlet weak var image2BottomLayout: NSLayoutConstraint!
|
|
|
|
|
|
|
|
+ private var _product_code : String = ""
|
|
private var _dmgProductType: KMDMGProductType = .advanced_annual_subscription_trail
|
|
private var _dmgProductType: KMDMGProductType = .advanced_annual_subscription_trail
|
|
private var _product_Info: KMListingProductsModel = KMListingProductsModel(id: "23", productName: "PDF Reader Pro Advanced - Annual Plan", price: NSNumber(value: 99.99), maxDeviceNum: 4, displayPrice: NSNumber(value: 0.0), levels: "3", platforms: "Windows,Android,Mac,iOS", productLineId: 1, paymentModel: 1, cycle: 4, cnyPrice: NSNumber(value: 0), displayCnyPrice: NSNumber(value: 0.0), upgradePrice: NSNumber(value: 0.0), code: "advanced-annual-subscription-trail")
|
|
private var _product_Info: KMListingProductsModel = KMListingProductsModel(id: "23", productName: "PDF Reader Pro Advanced - Annual Plan", price: NSNumber(value: 99.99), maxDeviceNum: 4, displayPrice: NSNumber(value: 0.0), levels: "3", platforms: "Windows,Android,Mac,iOS", productLineId: 1, paymentModel: 1, cycle: 4, cnyPrice: NSNumber(value: 0), displayCnyPrice: NSNumber(value: 0.0), upgradePrice: NSNumber(value: 0.0), code: "advanced-annual-subscription-trail")
|
|
|
|
|
|
@@ -254,6 +255,18 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc static func currentCode(_ productCode: String) -> KMPurchaseEmbeddedWindowController {
|
|
|
|
+ if currentWindowController != nil {
|
|
|
|
+ currentWindowController.product_code = productCode
|
|
|
|
+ return currentWindowController
|
|
|
|
+ } else {
|
|
|
|
+ let configWC: KMPurchaseEmbeddedWindowController = KMPurchaseEmbeddedWindowController.init(windowNibName: "KMPurchaseEmbeddedWindowController")
|
|
|
|
+ currentWindowController = configWC;
|
|
|
|
+ currentWindowController.product_code = productCode
|
|
|
|
+ return currentWindowController
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc static func currentFirstTrialWC(_ productId: String) -> KMPurchaseEmbeddedWindowController {
|
|
@objc static func currentFirstTrialWC(_ productId: String) -> KMPurchaseEmbeddedWindowController {
|
|
if currentWindowController != nil {
|
|
if currentWindowController != nil {
|
|
currentWindowController.productID = productId
|
|
currentWindowController.productID = productId
|
|
@@ -1767,6 +1780,44 @@ class KMPurchaseEmbeddedWindowController: NSWindowController {
|
|
|
|
|
|
// MARK: get & set
|
|
// MARK: get & set
|
|
|
|
|
|
|
|
+ var product_code : String {
|
|
|
|
+ get {
|
|
|
|
+ return _product_code
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ set {
|
|
|
|
+ _product_code = newValue
|
|
|
|
+
|
|
|
|
+ let model = KMProductModel.shared
|
|
|
|
+ let products : [KMListingProductsModel] = model.dmgProductDatas?.listingProducts ?? []
|
|
|
|
+ if products.count > 0 {
|
|
|
|
+ for product in products {
|
|
|
|
+ if product.code == _product_code {
|
|
|
|
+ self.product_Info = product;
|
|
|
|
+ //更新价格
|
|
|
|
+ self.updateProduct_Info()
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ model.getDMGProductDatas() { [weak self] success, result in
|
|
|
|
+ let products : [KMListingProductsModel] = model.dmgProductDatas?.listingProducts ?? []
|
|
|
|
+ if products.count > 0 {
|
|
|
|
+ for product in products {
|
|
|
|
+ if product.code == self?.product_code {
|
|
|
|
+ self?.product_Info = product;
|
|
|
|
+ //更新价格
|
|
|
|
+ self?.updateProduct_Info()
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
var product_Info: KMListingProductsModel {
|
|
var product_Info: KMListingProductsModel {
|
|
get {
|
|
get {
|
|
return _product_Info
|
|
return _product_Info
|