From 2f19b679a833a72fa54d3e512e0a24678974d41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Sat, 18 May 2024 20:57:21 +0200 Subject: [PATCH] Make sure code is compatible for older OS versions --- .../Presets/TelemetryDeck+Purchases.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift b/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift index 2b5cd87..eb92c1f 100644 --- a/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift +++ b/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift @@ -22,11 +22,11 @@ extension TelemetryDeck { let priceValueInNativeCurrency = NSDecimalNumber(decimal: transaction.price ?? Decimal()).doubleValue let priceValueInUSD: Double - if transaction.currency == Locale.Currency("USD") { + if transaction.currencyCode == "USD" { priceValueInUSD = priceValueInNativeCurrency } else if - let currency = transaction.currency, - let oneUSDExchangeRate = self.currencyCodeToOneUSDExchangeRate[currency.identifier] + let currencyCode = transaction.currencyCode, + let oneUSDExchangeRate = self.currencyCodeToOneUSDExchangeRate[currencyCode] { priceValueInUSD = priceValueInNativeCurrency / oneUSDExchangeRate } else { @@ -35,11 +35,11 @@ extension TelemetryDeck { var purchaseParameters: [String: String] = [ "TelemetryDeck.Purchase.type": transaction.subscriptionGroupID != nil ? "subscription" : "one-time-purchase", - "TelemetryDeck.Purchase.countryCode": transaction.storefront.countryCode, + "TelemetryDeck.Purchase.countryCode": transaction.storefrontCountryCode, ] - if let currency = transaction.currency { - purchaseParameters["TelemetryDeck.Purchase.currencyCode"] = currency.identifier + if let currencyCode = transaction.currencyCode { + purchaseParameters["TelemetryDeck.Purchase.currencyCode"] = currencyCode } self.signal(