|
@@ -1034,120 +1034,141 @@ import Combine
|
|
|
|
|
|
specialImageView.image = image
|
|
|
specialImageView1.image = image
|
|
|
- if KMKdanRemoteConfig.remoteConfig.showAPP_AveragePrice() {
|
|
|
- if model.isShowSale {
|
|
|
- value1PurchaseSubLabel.stringValue = String(format: "%@/%@", averageMonthPriceDiscount ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
- } else {
|
|
|
- if let data = introAveragePrice, data.isEmpty == false {
|
|
|
- value1PurchaseSubLabel.stringValue = String(format: "%@/%@", data , NSLocalizedString("mon", comment: ""))
|
|
|
+ let showAveragePrice = KMKdanRemoteConfig.remoteConfig.showAPP_AveragePrice()
|
|
|
+ // 商品是否有推介优惠
|
|
|
+ let hasIntroPrice = (introPrice != nil && introPrice?.isEmpty == false)
|
|
|
+ if model.isPurchaseSwitch { // 年订阅
|
|
|
+ let iapProduct = fourDevicesAllAccessPackNew12months_lite
|
|
|
+ if model.isShowSale { // 旧订阅优惠
|
|
|
+ if showAveragePrice {
|
|
|
+ value1PurchaseSubLabel.stringValue = String(format: "%@/%@", averageMonthPriceDiscount ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
} else {
|
|
|
- value1PurchaseLabel.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = true
|
|
|
- billedTopConst.constant = 0
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- let hasIntroPrice = (introPrice != nil && introPrice?.isEmpty == false)
|
|
|
- if model.isPurchaseSwitch {
|
|
|
- let iapProduct = fourDevicesAllAccessPackNew12months_lite
|
|
|
- if model.isShowSale {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPriceDiscount ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
- } else {
|
|
|
- let isNewUser = IAPReceiptTool.isNewUser(with: _fetchReceiptModel(), withGroupIdentifier: iapProduct?.product?.subscriptionGroupIdentifier)
|
|
|
- if hasIntroPrice && isNewUser { // 推介优惠
|
|
|
+ }
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = false
|
|
|
+ billedTopConst.constant = 16
|
|
|
+ } else {
|
|
|
+ // 是否为新用户
|
|
|
+ let isNewUser = IAPReceiptTool.isNewUser(with: _fetchReceiptModel(), withGroupIdentifier: iapProduct?.product?.subscriptionGroupIdentifier)
|
|
|
+ if hasIntroPrice && isNewUser { // 推介优惠
|
|
|
+ if showAveragePrice {
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", introAveragePrice ?? "" , NSLocalizedString("mon", comment: ""))
|
|
|
+ value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
+ } else {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", introPrice ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
-
|
|
|
- self.value1PurchaseDiscountBox.isHidden = true
|
|
|
- } else {
|
|
|
- // 促销优惠
|
|
|
- var useDiscountCode: String? = nil
|
|
|
- if discountType_ == .advancedYearSubscribeTrialingCancel {
|
|
|
- let discountCode = "4_devices_all_access_pack_12months_20250102"
|
|
|
- if let priceString = iapProduct?.discountPrice(withDiscountCode: discountCode), priceString.isEmpty == false {
|
|
|
- self.value1PurchaseDiscountBox.isHidden = false
|
|
|
- self.value1PurchaseDiscountView_.label.stringValue = "-"+priceString
|
|
|
-
|
|
|
- useDiscountCode = discountCode
|
|
|
- } else {
|
|
|
- self.value1PurchaseDiscountBox.isHidden = true
|
|
|
- }
|
|
|
+ }
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = false
|
|
|
+ billedTopConst.constant = 16
|
|
|
+
|
|
|
+ self.value1PurchaseDiscountBox.isHidden = true
|
|
|
+ } else { // 促销优惠
|
|
|
+ var useDiscountCode: String? = nil
|
|
|
+ if discountType_ == .advancedYearSubscribeTrialingCancel {
|
|
|
+ let discountCode = "4_devices_all_access_pack_12months_20250102"
|
|
|
+ if let priceString = iapProduct?.discountPrice(withDiscountCode: discountCode), priceString.isEmpty == false {
|
|
|
+ self.value1PurchaseDiscountBox.isHidden = false
|
|
|
+ self.value1PurchaseDiscountView_.label.stringValue = "-"+priceString
|
|
|
+
|
|
|
+ useDiscountCode = discountCode
|
|
|
} else {
|
|
|
self.value1PurchaseDiscountBox.isHidden = true
|
|
|
}
|
|
|
-
|
|
|
- if let data = iapProduct?.productPrice(withDiscountCode: useDiscountCode ?? ""), data.isEmpty == false {
|
|
|
+ } else {
|
|
|
+ self.value1PurchaseDiscountBox.isHidden = true
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = iapProduct?.productPrice(withDiscountCode: useDiscountCode ?? ""), data.isEmpty == false {
|
|
|
+ if showAveragePrice {
|
|
|
+ let priceS = iapProduct?.productAveragePrice(withDiscountCode: useDiscountCode ?? "") ?? ""
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", priceS , NSLocalizedString("mon", comment: ""))
|
|
|
+ value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
+ } else {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", data ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
+ }
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = false
|
|
|
+ billedTopConst.constant = 16
|
|
|
+ } else {
|
|
|
+ if showAveragePrice {
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
} else {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("12 months", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = true
|
|
|
- billedTopConst.constant = 0
|
|
|
}
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = true
|
|
|
+ billedTopConst.constant = 0
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
- let iapProduct = fourDevicesAllAccessPackNew6Months_lite
|
|
|
- if model.isShowSale { // [旧订阅][活动][可移除]
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let iapProduct = fourDevicesAllAccessPackNew6Months_lite
|
|
|
+ if model.isShowSale { // [旧订阅][活动][可移除]
|
|
|
+ if showAveragePrice {
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", averageMonthPriceDiscount ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
+ value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
+ } else {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPriceDiscount ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
- } else {
|
|
|
- let isNewUser = IAPReceiptTool.isNewUser(with: _fetchReceiptModel(), withGroupIdentifier: iapProduct?.product?.subscriptionGroupIdentifier)
|
|
|
- if hasIntroPrice && isNewUser { // 推介优惠
|
|
|
+ }
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = false
|
|
|
+ billedTopConst.constant = 16
|
|
|
+ } else {
|
|
|
+ let isNewUser = IAPReceiptTool.isNewUser(with: _fetchReceiptModel(), withGroupIdentifier: iapProduct?.product?.subscriptionGroupIdentifier)
|
|
|
+ if hasIntroPrice && isNewUser { // 推介优惠
|
|
|
+ if showAveragePrice {
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", introAveragePrice ?? "" , NSLocalizedString("mon", comment: ""))
|
|
|
+ value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
+ } else {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", introPrice ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
-
|
|
|
- if discountType_ == .newUserGift {
|
|
|
+ }
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = false
|
|
|
+ billedTopConst.constant = 16
|
|
|
+
|
|
|
+ if discountType_ == .newUserGift {
|
|
|
+ self.value1PurchaseDiscountBox.isHidden = false
|
|
|
+ let priceString = iapProduct?.introDiscountPrice() ?? "$10"
|
|
|
+ self.value1PurchaseDiscountView_.label.stringValue = "-"+priceString
|
|
|
+ } else {
|
|
|
+ self.value1PurchaseDiscountBox.isHidden = true
|
|
|
+ }
|
|
|
+ } else { // 促销优惠
|
|
|
+ var useDiscountCode: String? = nil
|
|
|
+ if discountType_ == .advancedYearSubscribeTrialingCancel {
|
|
|
+ let discountCode = "4_devices_all_access_pack_new_6month_20250102"
|
|
|
+ if let priceString = iapProduct?.discountPrice(withDiscountCode: discountCode), priceString.isEmpty == false {
|
|
|
self.value1PurchaseDiscountBox.isHidden = false
|
|
|
- let priceString = iapProduct?.introDiscountPrice() ?? "$10"
|
|
|
self.value1PurchaseDiscountView_.label.stringValue = "-"+priceString
|
|
|
+
|
|
|
+ useDiscountCode = discountCode
|
|
|
} else {
|
|
|
self.value1PurchaseDiscountBox.isHidden = true
|
|
|
}
|
|
|
} else {
|
|
|
- // 促销优惠
|
|
|
- var useDiscountCode: String? = nil
|
|
|
- if discountType_ == .advancedYearSubscribeTrialingCancel {
|
|
|
- let discountCode = "4_devices_all_access_pack_new_6month_20250102"
|
|
|
- if let priceString = iapProduct?.discountPrice(withDiscountCode: discountCode), priceString.isEmpty == false {
|
|
|
- self.value1PurchaseDiscountBox.isHidden = false
|
|
|
- self.value1PurchaseDiscountView_.label.stringValue = "-"+priceString
|
|
|
-
|
|
|
- useDiscountCode = discountCode
|
|
|
- } else {
|
|
|
- self.value1PurchaseDiscountBox.isHidden = true
|
|
|
- }
|
|
|
+ self.value1PurchaseDiscountBox.isHidden = true
|
|
|
+ }
|
|
|
+
|
|
|
+ if let data = iapProduct?.productPrice(withDiscountCode: useDiscountCode ?? ""), data.isEmpty == false {
|
|
|
+ if showAveragePrice {
|
|
|
+ let priceS = iapProduct?.productAveragePrice(withDiscountCode: useDiscountCode ?? "") ?? ""
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", priceS , NSLocalizedString("mon", comment: ""))
|
|
|
+ value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
} else {
|
|
|
- self.value1PurchaseDiscountBox.isHidden = true
|
|
|
- }
|
|
|
-
|
|
|
- if let data = iapProduct?.productPrice(withDiscountCode: useDiscountCode ?? ""), data.isEmpty == false {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", data ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
value1PurchaseOriPriceLbl.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = false
|
|
|
- billedTopConst.constant = 16
|
|
|
+ }
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = false
|
|
|
+ billedTopConst.constant = 16
|
|
|
+ } else {
|
|
|
+ if showAveragePrice {
|
|
|
+ value1PurchaseLabel.stringValue = String(format: "%@/%@", averageMonthPrice ?? "", NSLocalizedString("mon", comment: ""))
|
|
|
} else {
|
|
|
value1PurchaseLabel.stringValue = String(format: "%@/%@", monthPrice ?? "", NSLocalizedString("6mon", comment: ""))
|
|
|
- value1PurchaseOriPriceLbl.isHidden = true
|
|
|
- billedTopConst.constant = 0
|
|
|
}
|
|
|
+ value1PurchaseOriPriceLbl.isHidden = true
|
|
|
+ billedTopConst.constant = 0
|
|
|
}
|
|
|
}
|
|
|
}
|