From 789eb723744384d14992346d5ca0136193d465c8 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Thu, 6 Jun 2024 16:30:41 +0300 Subject: [PATCH] Adds os_version parameter to feature flags and dashboard cards apis --- Sources/WordPressKit/Models/SessionDetails.swift | 3 +++ .../WordPressKitTests/Tests/DashboardServiceRemoteTests.swift | 3 ++- .../Tests/Utilities/FeatureFlagRemoteTests.swift | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Sources/WordPressKit/Models/SessionDetails.swift b/Sources/WordPressKit/Models/SessionDetails.swift index 46f4df451..dc36e0fbd 100644 --- a/Sources/WordPressKit/Models/SessionDetails.swift +++ b/Sources/WordPressKit/Models/SessionDetails.swift @@ -4,6 +4,7 @@ public struct SessionDetails { let buildNumber: String let marketingVersion: String let identifier: String + let osVersion: String } extension SessionDetails: Encodable { @@ -14,6 +15,7 @@ extension SessionDetails: Encodable { case buildNumber = "build_number" case marketingVersion = "marketing_version" case identifier = "identifier" + case osVersion = "os_version" } init(deviceId: String, bundle: Bundle = .main) { @@ -22,6 +24,7 @@ extension SessionDetails: Encodable { self.buildNumber = bundle.infoDictionary?["CFBundleVersion"] as? String ?? "Unknown" self.marketingVersion = bundle.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown" self.identifier = bundle.bundleIdentifier ?? "Unknown" + self.osVersion = UIDevice.current.systemVersion } func dictionaryRepresentation() throws -> [String: AnyObject]? { diff --git a/Tests/WordPressKitTests/Tests/DashboardServiceRemoteTests.swift b/Tests/WordPressKitTests/Tests/DashboardServiceRemoteTests.swift index 86d62c61d..8e6e60c03 100644 --- a/Tests/WordPressKitTests/Tests/DashboardServiceRemoteTests.swift +++ b/Tests/WordPressKitTests/Tests/DashboardServiceRemoteTests.swift @@ -23,7 +23,8 @@ class DashboardServiceRemoteTests: RemoteTestCase, RESTTestable { "marketing_version", "device_id", "cards", - "locale" + "locale", + "os_version", ] stubRemoteResponse({ req in diff --git a/Tests/WordPressKitTests/Tests/Utilities/FeatureFlagRemoteTests.swift b/Tests/WordPressKitTests/Tests/Utilities/FeatureFlagRemoteTests.swift index c84197e74..602d8957e 100644 --- a/Tests/WordPressKitTests/Tests/Utilities/FeatureFlagRemoteTests.swift +++ b/Tests/WordPressKitTests/Tests/Utilities/FeatureFlagRemoteTests.swift @@ -15,7 +15,8 @@ class FeatureFlagRemoteTests: RemoteTestCase, RESTTestable { "platform", "build_number", "marketing_version", - "device_id" + "device_id", + "os_version", ] stub { req -> Bool in