Location sharing: don't hardcode API key

In an effort to make it easier for forks to (a) use their own
API keys (b) change map styles or maybe even providers, move
the MapTiler key out of the source code and pass it in via
env var or property.

Also refactor the utility classes slightly to keep all the URL
related functions together, to reduce the chance of collisions
when maintaining such forks.
This commit is contained in:
Chris Smith
2023-07-10 14:43:59 +01:00
parent 467ce70ba8
commit b7bd08b210
9 changed files with 128 additions and 218 deletions

View File

@@ -50,7 +50,7 @@ import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager
import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions
import com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_BOTTOM
import io.element.android.features.location.api.Location
import io.element.android.features.location.api.internal.buildTileServerUrl
import io.element.android.features.location.api.internal.tileStyleUrl
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
import io.element.android.libraries.designsystem.theme.components.Text
@@ -102,7 +102,7 @@ fun MapView(
isCompassEnabled = false
isRotateGesturesEnabled = false
}
map.setStyle(buildTileServerUrl(darkMode = darkMode)) { style ->
map.setStyle(tileStyleUrl(context, darkMode)) { style ->
mapRefs = MapRefs(
map = map,
symbolManager = SymbolManager(mapView, map, style).apply {