From 22a03abdc4d81462674ea47af17589ca410d9449 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Mon, 7 Feb 2022 20:08:31 +0300 Subject: [PATCH] Code review fix. --- .../vector/app/features/location/UrlMapProvider.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt b/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt index 9f66ce4d24..adb5c27a02 100644 --- a/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt +++ b/vector/src/main/java/im/vector/app/features/location/UrlMapProvider.kt @@ -32,14 +32,16 @@ class UrlMapProvider @Inject constructor( ) { private val keyParam = "?key=${BuildConfig.mapTilerKey}" + private val fallbackMapUrl = buildString { + append(MAP_BASE_URL) + append(keyParam) + } + suspend fun getMapUrl(): String { - return tryOrNull { rawService.getElementWellknown(session.sessionParams) } + val upstreamMapUrl = tryOrNull { rawService.getElementWellknown(session.sessionParams) } ?.mapTileServerConfig ?.mapStyleUrl - ?: buildString { - append(MAP_BASE_URL) - append(keyParam) - } + return upstreamMapUrl ?: fallbackMapUrl } fun buildStaticMapUrl(locationData: LocationData,