From be8d519b7a7125cf248587f23913e8c46e8c3443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Sun, 1 Dec 2024 14:16:39 +0100 Subject: [PATCH] Respect SwiftUI previews & analyticsDisabled for internal signals --- Sources/TelemetryDeck/TelemetryDeck.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/TelemetryDeck/TelemetryDeck.swift b/Sources/TelemetryDeck/TelemetryDeck.swift index ab91cf7..a57bb38 100644 --- a/Sources/TelemetryDeck/TelemetryDeck.swift +++ b/Sources/TelemetryDeck/TelemetryDeck.swift @@ -89,6 +89,9 @@ public enum TelemetryDeck { let manager = TelemetryManager.shared let configuration = manager.configuration + // make sure to not send any signals when run by Xcode via SwiftUI previews + guard !configuration.swiftUIPreviewMode, !configuration.analyticsDisabled else { return } + let prefixedDefaultParameters = configuration.defaultParameters().mapKeys { (configuration.defaultParameterPrefix ?? "") + $0 } let combinedParameters = prefixedDefaultParameters.merging(parameters) { $1 }