Skip to content

Commit

Permalink
Fix URL params decoding (#62)
Browse files Browse the repository at this point in the history
* Fix missing URL decoding

* Improve analytics logging
  • Loading branch information
ILIYANGERMANOV authored Dec 4, 2024
1 parent df5a289 commit 2dcfd03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Analytics(
appScope.launch {
// TODO: Optimize later by batching events
val paramsJson = Json.encodeToString(params)
logger.info("$TAG Tracking: '$eventName' with $paramsJson params...")
logger.info("$TAG Tracking: '$eventName' with $paramsJson params.")
analyticsRepository.logEvent(
setOf(
AnalyticsEventDto(
Expand Down
10 changes: 9 additions & 1 deletion composeApp/src/jsMain/kotlin/navigation/SystemNavigation.js.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ class WebSystemNavigation : SystemNavigation {
.split("&")
.mapNotNull {
val parts = it.split("=")
if (parts.size == 2) parts[0] to parts[1] else null
if (parts.size == 2) {
val key = decodeURIComponent(parts[0])
val value = decodeURIComponent(parts[1])
key to value
} else null
}
.toMap()
}

private fun decodeURIComponent(encoded: String): String {
return js("decodeURIComponent")(encoded) as String
}
}


Expand Down

0 comments on commit 2dcfd03

Please sign in to comment.