From f46bea25652267e10f5b11cfb6f3dda6e0afcbba Mon Sep 17 00:00:00 2001 From: Will Taylor Date: Wed, 20 Nov 2024 17:51:08 -0600 Subject: [PATCH] fix transaction metadata in purchase tester app --- .../Views/Offerings/OfferingDetailView.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Tests/TestingApps/PurchaseTesterSwiftUI/Shared/Views/Offerings/OfferingDetailView.swift b/Tests/TestingApps/PurchaseTesterSwiftUI/Shared/Views/Offerings/OfferingDetailView.swift index a2fc01e41c..a467fb2100 100644 --- a/Tests/TestingApps/PurchaseTesterSwiftUI/Shared/Views/Offerings/OfferingDetailView.swift +++ b/Tests/TestingApps/PurchaseTesterSwiftUI/Shared/Views/Offerings/OfferingDetailView.swift @@ -136,7 +136,13 @@ struct OfferingDetailView: View { let result: PurchaseResultData if let metadata = customerData.metadata { + #if ENABLE_TRANSACTION_METADATA let params = PurchaseParams.Builder(package: package).with(metadata: metadata).build() + #else + let params = PurchaseParams.Builder(package: package).build() + print("⚠️ Warning - ENABLE_TRANSACTION_METADATA feature flag is not enabled") + print("⚠️ Warning - Metadata will not be sent with the purchase") + #endif result = try await Purchases.shared.purchase(params) } else { result = try await Purchases.shared.purchase(package: self.package) @@ -151,7 +157,13 @@ struct OfferingDetailView: View { let result: PurchaseResultData if let metadata = customerData.metadata { - let params = PurchaseParams.Builder(product: self.package.storeProduct).with(metadata: metadata).build() + #if ENABLE_TRANSACTION_METADATA + let params = PurchaseParams.Builder(package: package).with(metadata: metadata).build() + #else + let params = PurchaseParams.Builder(package: package).build() + print("⚠️ Warning - ENABLE_TRANSACTION_METADATA feature flag is not enabled") + print("⚠️ Warning - Metadata will not be sent with the purchase") + #endif result = try await Purchases.shared.purchase(params) } else { result = try await Purchases.shared.purchase(product: self.package.storeProduct)