From 958a5633c22bc35332d488a643873ff39f6d484d Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 May 2024 11:29:45 +0200 Subject: [PATCH 1/2] Remove platformCodeName and reuse existing appPlatform --- schemas/SuperProperties.json | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/schemas/SuperProperties.json b/schemas/SuperProperties.json index a03b2d6..3793fd2 100644 --- a/schemas/SuperProperties.json +++ b/schemas/SuperProperties.json @@ -15,21 +15,16 @@ "type": "string" }, "appPlatform": { - "description": "Used by web to identify the platform (Web Platform/Electron Platform).", - "type": "string" - }, - - "platformCodeName": { "description": "Used as a discriminant to breakdown usage per client.", "type": "string", "oneOf": [ - {"const": "Web", "description": "Element Web platform code."}, - {"const": "Desktop", "description": "Element Desktop platform code."}, - {"const": "EI", "description": "Element iOS platform code."}, - {"const": "EXI", "description": "Element-X iOS platform code."}, - {"const": "EA", "description": "Element Android platform code."}, - {"const": "EXA", "description": "Element-X Android platform code."}, - {"const": "Other", "description": "Other Platform code."} + {"const": "Web Platform", "description": "Element Web platform."}, + {"const": "Electron Platform", "description": "Element Desktop platform."}, + {"const": "EI", "description": "Element iOS platform."}, + {"const": "EXI", "description": "Element-X iOS platform."}, + {"const": "EA", "description": "Element Android platform."}, + {"const": "EXA", "description": "Element-X Android platform."}, + {"const": "Other", "description": "Other Platform."} ] } }, From 2e7ddec4460a07b57de2ce5532fec8edee7382de Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 29 May 2024 11:30:48 +0200 Subject: [PATCH 2/2] Generate code from updated schema --- .../analytics/plan/SuperProperties.kt | 38 ++++++++----------- types/swift/SuperProperties.swift | 34 ++++++++--------- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt index d3736b0..7af74a1 100644 --- a/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt +++ b/kotlin/lib/src/main/java/im/vector/app/features/analytics/plan/SuperProperties.kt @@ -26,10 +26,9 @@ package im.vector.app.features.analytics.plan */ data class SuperProperties( /** - * Used by web to identify the platform (Web Platform/Electron - * Platform). + * Used as a discriminant to breakdown usage per client. */ - val appPlatform: String? = null, + val appPlatform: AppPlatform? = null, /** * Which crypto backend is the client currently using. */ @@ -38,10 +37,6 @@ data class SuperProperties( * Version of the crypto backend. */ val cryptoSDKVersion: String? = null, - /** - * Used as a discriminant to breakdown usage per client. - */ - val platformCodeName: PlatformCodeName? = null, ) { enum class CryptoSDK(val rawValue: String) { @@ -56,50 +51,49 @@ data class SuperProperties( Rust("Rust"), } - enum class PlatformCodeName(val rawValue: String) { - - /** - * Element Desktop platform code. - */ - Desktop("Desktop"), + enum class AppPlatform(val rawValue: String) { /** - * Element Android platform code. + * Element Android platform. */ EA("EA"), /** - * Element iOS platform code. + * Element iOS platform. */ EI("EI"), /** - * Element-X Android platform code. + * Element-X Android platform. */ EXA("EXA"), /** - * Element-X iOS platform code. + * Element-X iOS platform. */ EXI("EXI"), /** - * Other Platform code. + * Element Desktop platform. + */ + ElectronPlatform("Electron Platform"), + + /** + * Other Platform. */ Other("Other"), /** - * Element Web platform code. + * Element Web platform. */ - Web("Web"), + WebPlatform("Web Platform"), } fun getProperties(): Map? { return mutableMapOf().apply { - appPlatform?.let { put("appPlatform", it) } + appPlatform?.let { put("appPlatform", it.rawValue) } cryptoSDK?.let { put("cryptoSDK", it.rawValue) } cryptoSDKVersion?.let { put("cryptoSDKVersion", it) } - platformCodeName?.let { put("platformCodeName", it.rawValue) } }.takeIf { it.isNotEmpty() } } } diff --git a/types/swift/SuperProperties.swift b/types/swift/SuperProperties.swift index 12ef46c..afa8b97 100644 --- a/types/swift/SuperProperties.swift +++ b/types/swift/SuperProperties.swift @@ -23,20 +23,17 @@ import Foundation extension AnalyticsEvent { public struct SuperProperties { - /// Used by web to identify the platform (Web Platform/Electron Platform). - public let appPlatform: String? + /// Used as a discriminant to breakdown usage per client. + public let appPlatform: AppPlatform? /// Which crypto backend is the client currently using. public let cryptoSDK: CryptoSDK? /// Version of the crypto backend. public let cryptoSDKVersion: String? - /// Used as a discriminant to breakdown usage per client. - public let platformCodeName: PlatformCodeName? - public init(appPlatform: String?, cryptoSDK: CryptoSDK?, cryptoSDKVersion: String?, platformCodeName: PlatformCodeName?) { + public init(appPlatform: AppPlatform?, cryptoSDK: CryptoSDK?, cryptoSDKVersion: String?) { self.appPlatform = appPlatform self.cryptoSDK = cryptoSDK self.cryptoSDKVersion = cryptoSDKVersion - self.platformCodeName = platformCodeName } public enum CryptoSDK: String { @@ -46,29 +43,28 @@ extension AnalyticsEvent { case Rust = "Rust" } - public enum PlatformCodeName: String { - /// Element Desktop platform code. - case Desktop = "Desktop" - /// Element Android platform code. + public enum AppPlatform: String { + /// Element Android platform. case EA = "EA" - /// Element iOS platform code. + /// Element iOS platform. case EI = "EI" - /// Element-X Android platform code. + /// Element-X Android platform. case EXA = "EXA" - /// Element-X iOS platform code. + /// Element-X iOS platform. case EXI = "EXI" - /// Other Platform code. + /// Element Desktop platform. + case ElectronPlatform = "Electron Platform" + /// Other Platform. case Other = "Other" - /// Element Web platform code. - case Web = "Web" + /// Element Web platform. + case WebPlatform = "Web Platform" } public var properties: [String: Any?] { return [ - "appPlatform": appPlatform, + "appPlatform": appPlatform?.rawValue, "cryptoSDK": cryptoSDK?.rawValue, - "cryptoSDKVersion": cryptoSDKVersion, - "platformCodeName": platformCodeName?.rawValue + "cryptoSDKVersion": cryptoSDKVersion ] } }