From 6fa80286e96881087dcb3fb1f6aac254deeca047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Tue, 4 Jun 2024 17:43:08 +0200 Subject: [PATCH] Fix build issue in new purchases code when targeting visionOS --- .../TelemetryClient/Presets/TelemetryDeck+Purchases.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift b/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift index eb92c1f..96b442a 100644 --- a/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift +++ b/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift @@ -33,9 +33,15 @@ extension TelemetryDeck { priceValueInUSD = 0 } + #if os(visionOS) + let countryCode = "US" // NOTE: visionOS 1.x does not support the `storefrontCountryCode` field + #else + let countryCode = transaction.storefrontCountryCode + #endif + var purchaseParameters: [String: String] = [ "TelemetryDeck.Purchase.type": transaction.subscriptionGroupID != nil ? "subscription" : "one-time-purchase", - "TelemetryDeck.Purchase.countryCode": transaction.storefrontCountryCode, + "TelemetryDeck.Purchase.countryCode": countryCode, ] if let currencyCode = transaction.currencyCode {