From 080057c564251e5992de837727dd015216c82a7f Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Tue, 24 Sep 2024 10:18:20 -0400 Subject: [PATCH] Provide client type in LD context (#4798) --- .../Services/Implementations/LaunchDarklyFeatureService.cs | 2 ++ src/Core/Utilities/DeviceTypes.cs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Core/Services/Implementations/LaunchDarklyFeatureService.cs b/src/Core/Services/Implementations/LaunchDarklyFeatureService.cs index 0bee58fc1..b65aa7525 100644 --- a/src/Core/Services/Implementations/LaunchDarklyFeatureService.cs +++ b/src/Core/Services/Implementations/LaunchDarklyFeatureService.cs @@ -21,6 +21,7 @@ public class LaunchDarklyFeatureService : IFeatureService private const string _contextAttributeClientVersion = "client-version"; private const string _contextAttributeDeviceType = "device-type"; + private const string _contextAttributeClientType = "client-type"; private const string _contextAttributeOrganizations = "organizations"; public LaunchDarklyFeatureService( @@ -149,6 +150,7 @@ public class LaunchDarklyFeatureService : IFeatureService if (_currentContext.DeviceType.HasValue) { builder.Set(_contextAttributeDeviceType, (int)_currentContext.DeviceType.Value); + builder.Set(_contextAttributeClientType, (int)DeviceTypes.ToClientType(_currentContext.DeviceType.Value)); } } diff --git a/src/Core/Utilities/DeviceTypes.cs b/src/Core/Utilities/DeviceTypes.cs index ea34c7fd8..a1cca7575 100644 --- a/src/Core/Utilities/DeviceTypes.cs +++ b/src/Core/Utilities/DeviceTypes.cs @@ -22,7 +22,6 @@ public static class DeviceTypes DeviceType.LinuxCLI ]; - public static IReadOnlyCollection BrowserExtensionTypes { get; } = [ DeviceType.ChromeExtension, @@ -45,7 +44,7 @@ public static class DeviceTypes DeviceType.UnknownBrowser ]; - private static ClientType ToClientType(DeviceType? deviceType) + public static ClientType ToClientType(DeviceType? deviceType) { return deviceType switch {