Move the custom tile server URL config to the Element wellknown content (#7416)

* Move the custom tile server URL config to the Element wellknown content

* Iteration: use whole `MapTilerConfig` in the remote config
This commit is contained in:
Jorge Martin Espinosa
2026-08-14 08:20:37 +02:00
committed by GitHub
parent ddbc6a2a33
commit 22195a47f2
35 changed files with 279 additions and 117 deletions
@@ -48,6 +48,8 @@ data class InternalElementWellKnown(
val contentScannerUrl: String? = null,
@SerialName("force_disable_e2ee")
val forceDisableE2EE: Boolean? = null,
@SerialName("map_tiler")
val mapTilerConfig: InternalMapTilerConfig? = null,
)
@Serializable
@@ -55,3 +57,15 @@ data class InternalCustomRecoveryPassphrase(
@SerialName("min_character_count")
val minCharacterCount: Int? = null,
)
@Serializable
data class InternalMapTilerConfig(
@SerialName("api_key")
val apiKey: String,
@SerialName("light_style_id")
val lightStyleId: String? = null,
@SerialName("dark_style_id")
val darkStyleId: String? = null,
@SerialName("base_url")
val baseUrl: String? = null,
)
@@ -11,6 +11,7 @@ package io.element.android.libraries.wellknown.impl
import io.element.android.libraries.core.log.logger.LoggerTag
import io.element.android.libraries.wellknown.api.CustomRecoveryPassphrase
import io.element.android.libraries.wellknown.api.ElementWellKnown
import io.element.android.libraries.wellknown.api.MapTilerConfig
import timber.log.Timber
private val loggerTag = LoggerTag("Wellknown")
@@ -32,6 +33,14 @@ fun InternalElementWellKnown.map() = ElementWellKnown(
customRecoveryPassphrase = customRecoveryPassphrase?.toPublic(),
contentScannerUrl = contentScannerUrl,
forceDisableE2EE = forceDisableE2EE,
mapTilerConfig = mapTilerConfig?.let {
MapTilerConfig(
apiKey = it.apiKey,
lightStyleId = it.lightStyleId,
darkStyleId = it.darkStyleId,
baseUrl = it.baseUrl,
)
}
)
private fun InternalCustomRecoveryPassphrase.toPublic(): CustomRecoveryPassphrase {
@@ -13,6 +13,7 @@ package io.element.android.libraries.wellknown.impl
import com.google.common.truth.Truth.assertThat
import io.element.android.features.enterprise.test.FakeEnterpriseService
import io.element.android.features.wellknown.test.FakeElementWellknownStore
import io.element.android.features.wellknown.test.aMapTilerConfig
import io.element.android.features.wellknown.test.anElementWellKnown
import io.element.android.libraries.core.uri.ensureProtocol
import io.element.android.libraries.matrix.api.UrlContentFetcher
@@ -204,7 +205,11 @@ class DefaultWellknownRetrieverTest {
"notification_sound": "a_notification_sound.flac",
"idp_app_scheme": "an_app_scheme",
"content_scanner_url": "https://content-scanner.example.com",
"force_disable_e2ee": false
"force_disable_e2ee": false,
"map_tiler": {
"api_key": "test_api_key",
"base_url": "https://tile-server.example.com"
}
}"""
private val expectedElementWellKnown = ElementWellKnown(
@@ -217,6 +222,10 @@ class DefaultWellknownRetrieverTest {
contentScannerUrl = "https://content-scanner.example.com",
customRecoveryPassphrase = null,
forceDisableE2EE = false,
mapTilerConfig = aMapTilerConfig(
apiKey = "test_api_key",
baseUrl = "https://tile-server.example.com",
)
)
}
}