|
@@ -87,23 +87,11 @@ class KMComparativeViewCollectionItem: NSCollectionViewItem {
|
|
}
|
|
}
|
|
|
|
|
|
if KMInAppPurchaseManager.manager.availableProducts.count == 0 {
|
|
if KMInAppPurchaseManager.manager.availableProducts.count == 0 {
|
|
- KMInAppPurchaseManager.manager.fetchProducts { [unowned self] isSuccess, products, error in
|
|
|
|
- let productId: String = data["productId"] as! String
|
|
|
|
- for product in KMInAppPurchaseManager.manager.availableProducts {
|
|
|
|
- if product.productIdentifier == productId {
|
|
|
|
- print("-----------------------------")
|
|
|
|
- print(product.priceLocale.currencyCode)
|
|
|
|
- print(product.introductoryPrice?.price)
|
|
|
|
- print(product.price)
|
|
|
|
- print("-----------------------------")
|
|
|
|
- let currencyCode: String = product.priceLocale.currencyCode ?? "$"
|
|
|
|
- let price: String = product.introductoryPrice?.price.description ?? "39.9"
|
|
|
|
- let originPrice: String = product.price.description ?? "79.9"
|
|
|
|
- self.subtitleLabel.stringValue = "\(currencyCode) \(price)"
|
|
|
|
- self.describeLabel.stringValue = "\(currencyCode) \(originPrice) \(describe)"
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ KMInAppPurchaseManager.manager.fetchProducts { [weak self] isSuccess, products, error in
|
|
|
|
+ self?.updatePrice()
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ self.updatePrice()
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
self.describeLabel.isHidden = true
|
|
self.describeLabel.isHidden = true
|
|
@@ -117,6 +105,26 @@ class KMComparativeViewCollectionItem: NSCollectionViewItem {
|
|
self.contentCollectionView.reloadData()
|
|
self.contentCollectionView.reloadData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ func updatePrice() {
|
|
|
|
+ for product in KMInAppPurchaseManager.manager.availableProducts {
|
|
|
|
+ let productId: String = self.data["productId"] as! String
|
|
|
|
+ let describe = NSLocalizedString(data["describe"] as? String ?? "", comment: "")
|
|
|
|
+
|
|
|
|
+ if product.productIdentifier == productId {
|
|
|
|
+ print("-----------------------------")
|
|
|
|
+ print(product.priceLocale.currencyCode)
|
|
|
|
+ print(product.introductoryPrice?.price)
|
|
|
|
+ print(product.price)
|
|
|
|
+ print("-----------------------------")
|
|
|
|
+ let currencyCode: String = product.priceLocale.currencyCode ?? "$"
|
|
|
|
+ let price: String = product.introductoryPrice?.price.description ?? "39.9"
|
|
|
|
+ let originPrice: String = product.price.description ?? "79.9"
|
|
|
|
+ self.subtitleLabel.stringValue = "\(currencyCode) \(price)"
|
|
|
|
+ self.describeLabel.stringValue = "\(currencyCode) \(originPrice) \(describe)"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
extension KMComparativeViewCollectionItem {
|
|
extension KMComparativeViewCollectionItem {
|