Skip to content

Commit

Permalink
Simplify implemenation to build the user agent substrings
Browse files Browse the repository at this point in the history
  • Loading branch information
jayohms committed Dec 12, 2024
1 parent b7794de commit 74b47ab
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/src/main/kotlin/dev/hotwire/core/config/HotwireConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ class HotwireConfig internal constructor() {
fun userAgent(context: Context): String {
val components = registeredBridgeComponentFactories.joinToString(" ") { it.name }

return applicationUserAgentPrefix?.let { "$it " }.orEmpty() +
"Hotwire Native Android; Turbo Native Android; " +
"bridge-components: [$components]; " +
Hotwire.webViewInfo(context).defaultUserAgent
return listOf(
applicationUserAgentPrefix,
"Hotwire Native Android; Turbo Native Android;",
"bridge-components: [$components];",
Hotwire.webViewInfo(context).defaultUserAgent
).filterNotNull().joinToString(" ")
}
}

0 comments on commit 74b47ab

Please sign in to comment.