Skip to content

Commit

Permalink
Updated valid field transform code
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed May 28, 2024
1 parent 42f2d9d commit 73f07ef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ data class SuperProperties(
/**
* Element Desktop platform.
*/
Electron_Platform("Electron Platform"),
ElectronPlatform("Electron Platform"),

/**
* Other Platform.
Expand All @@ -86,7 +86,7 @@ data class SuperProperties(
/**
* Element Deb platform.
*/
Web_Platform("Web Platform"),
WebPlatform("Web Platform"),
}

fun getProperties(): Map<String, Any>? {
Expand Down
3 changes: 2 additions & 1 deletion stub-generator/matrix_analytics_stub_generator/kotlin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from .schema import Schema, is_mobile_screen_event, first_letter_up, first_letter_down, split_text

def compute_kotlin(schema: Schema) -> str:
Expand Down Expand Up @@ -86,7 +87,7 @@ def compute_kotlin(schema: Schema) -> str:
result += f" /**\n"
result += f"{split_text(' * ', value.description)}\n"
result += f" */\n"
validIdentifier = value.name.replace(" ", "_")
validIdentifier = re.sub('[^a-zA-Z0-9_]', '', value.name)
result += f" {validIdentifier}(\"{value.name}\"),\n"
isFirstEnum = False
result += " }\n"
Expand Down
3 changes: 2 additions & 1 deletion stub-generator/matrix_analytics_stub_generator/swift.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from .schema import Schema, Member, is_mobile_screen_event


Expand Down Expand Up @@ -123,7 +124,7 @@ def compute_swift(schema: Schema) -> str:
for value in enum.values:
if value.description:
result += f" /// {value.description}\n"
validIdentifier = value.name.replace(" ", "_")
validIdentifier = re.sub('[^a-zA-Z0-9_]', '', value.name)
result += f" case {validIdentifier} = \"{value.name}\"\n"
result += " }\n"

Expand Down
4 changes: 2 additions & 2 deletions types/swift/SuperProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ extension AnalyticsEvent {
/// Element-X iOS platform.
case EXI = "EXI"
/// Element Desktop platform.
case Electron_Platform = "Electron Platform"
case ElectronPlatform = "Electron Platform"
/// Other Platform.
case Other = "Other"
/// Element Deb platform.
case Web_Platform = "Web Platform"
case WebPlatform = "Web Platform"
}

public var properties: [String: Any?] {
Expand Down

0 comments on commit 73f07ef

Please sign in to comment.