diff --git a/Sources/TelemetryDeck/Signals/Signal.swift b/Sources/TelemetryDeck/Signals/Signal.swift index 5a65ef4..6727529 100644 --- a/Sources/TelemetryDeck/Signals/Signal.swift +++ b/Sources/TelemetryDeck/Signals/Signal.swift @@ -77,6 +77,7 @@ public struct DefaultSignalPayload: Encodable { "TelemetryDeck.Device.platform": Self.platform, "TelemetryDeck.Device.screenResolutionHeight": Self.screenResolutionHeight, "TelemetryDeck.Device.screenResolutionWidth": Self.screenResolutionWidth, + "TelemetryDeck.Device.screenScaleFactor": Self.screenScaleFactor, "TelemetryDeck.Device.systemMajorMinorVersion": Self.majorMinorSystemVersion, "TelemetryDeck.Device.systemMajorVersion": Self.majorSystemVersion, "TelemetryDeck.Device.systemVersion": Self.systemVersion, @@ -371,6 +372,7 @@ extension DefaultSignalPayload { } /// The color scheme set by the user. Returns `N/A` on unsupported platforms + @MainActor static var colorScheme: String { #if os(iOS) || os(tvOS) switch UIScreen.main.traitCollection.userInterfaceStyle { @@ -422,7 +424,7 @@ extension DefaultSignalPayload { if let screen = NSScreen.main { return "\(screen.frame.width)" } - return "Unknown" + return "N/A" #else return "N/A" #endif @@ -439,9 +441,23 @@ extension DefaultSignalPayload { if let screen = NSScreen.main { return "\(screen.frame.height)" } - return "Unknown" - #else return "N/A" + #else + return "N/A" + #endif + } + + @MainActor + static var screenScaleFactor: String { + #if os(iOS) || os(tvOS) + return "\(UIScreen.main.scale)" + #elseif os(macOS) + if let screen = NSScreen.main { + return "\(screen.backingScaleFactor)" + } + return "N/A" + #else + return "N/A" #endif }