From 74b47ab969a0be3c8655a61aeded49301cddb031 Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Thu, 12 Dec 2024 17:13:02 -0500 Subject: [PATCH] Simplify implemenation to build the user agent substrings --- .../kotlin/dev/hotwire/core/config/HotwireConfig.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/dev/hotwire/core/config/HotwireConfig.kt b/core/src/main/kotlin/dev/hotwire/core/config/HotwireConfig.kt index 96cb4a8..3a74ebe 100644 --- a/core/src/main/kotlin/dev/hotwire/core/config/HotwireConfig.kt +++ b/core/src/main/kotlin/dev/hotwire/core/config/HotwireConfig.kt @@ -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(" ") } }