Skip to content

Commit

Permalink
remove enum for appPlatform because space is breaking kotlin generation
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Mar 26, 2024
1 parent 41754bb commit 066bb54
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 34 deletions.
8 changes: 2 additions & 6 deletions schemas/SuperProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
"type": "string"
},
"appPlatform": {
"description": "Used by web to identify the platform (Web/Electron)",
"type": "string",
"oneOf": [
{"const": "Web Platform", "description": "Web version of the app."},
{"const": "Electron Platform", "description": "Desktop version of the app."}
]
"description": "Used by web to identify the platform (Web Platform/Electron Platform)",
"type": "string"
}
},
"required": [],
Expand Down
2 changes: 1 addition & 1 deletion types/kotlin/SuperProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package quicktype
*/
data class SuperProperties (
/**
* Used by web to identify the platform (Web/Electron)
* Used by web to identify the platform (Web Platform/Electron Platform)
*/
val appPlatform: String? = null,

Expand Down
19 changes: 3 additions & 16 deletions types/kotlin2/SuperProperties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ package im.vector.app.features.analytics.plan
*/
data class SuperProperties(
/**
* Used by web to identify the platform (Web/Electron)
* Used by web to identify the platform (Web Platform/Electron Platform)
*/
val appPlatform: AppPlatform? = null,
val appPlatform: String? = null,
/**
* Which crypto backend is the client currently using.
*/
Expand All @@ -51,22 +51,9 @@ data class SuperProperties(
Rust,
}

enum class AppPlatform {

/**
* Desktop version of the app.
*/
Electron Platform,

/**
* Web version of the app.
*/
Web Platform,
}

fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
appPlatform?.let { put("appPlatform", it.name) }
appPlatform?.let { put("appPlatform", it) }
cryptoSDK?.let { put("cryptoSDK", it.name) }
cryptoSDKVersion?.let { put("cryptoSDKVersion", it) }
}.takeIf { it.isNotEmpty() }
Expand Down
15 changes: 4 additions & 11 deletions types/swift/SuperProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import Foundation
extension AnalyticsEvent {
public struct SuperProperties {

/// Used by web to identify the platform (Web/Electron)
public let appPlatform: AppPlatform?
/// Used by web to identify the platform (Web Platform/Electron Platform)
public let appPlatform: String?
/// Which crypto backend is the client currently using.
public let cryptoSDK: CryptoSDK?
/// Version of the crypto backend.
public let cryptoSDKVersion: String?

public init(appPlatform: AppPlatform?, cryptoSDK: CryptoSDK?, cryptoSDKVersion: String?) {
public init(appPlatform: String?, cryptoSDK: CryptoSDK?, cryptoSDKVersion: String?) {
self.appPlatform = appPlatform
self.cryptoSDK = cryptoSDK
self.cryptoSDKVersion = cryptoSDKVersion
Expand All @@ -43,16 +43,9 @@ extension AnalyticsEvent {
case Rust
}

public enum AppPlatform: String {
/// Desktop version of the app.
case Electron Platform
/// Web version of the app.
case Web Platform
}

public var properties: [String: Any?] {
return [
"appPlatform": appPlatform?.rawValue,
"appPlatform": appPlatform,
"cryptoSDK": cryptoSDK?.rawValue,
"cryptoSDKVersion": cryptoSDKVersion
]
Expand Down

0 comments on commit 066bb54

Please sign in to comment.