From 72b1a829352db81a433983cb8f5e5bec8653e055 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 14:53:51 +0000 Subject: [PATCH 1/4] Update dependency org.maplibre.gl:android-sdk to v11 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 27dfaa42f1..0e6aa375c8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -173,7 +173,7 @@ vanniktech_blurhash = "com.vanniktech:blurhash:0.3.0" telephoto_zoomableimage = { module = "me.saket.telephoto:zoomable-image-coil", version.ref = "telephoto" } telephoto_flick = { module = "me.saket.telephoto:flick-android", version.ref = "telephoto" } statemachine = "com.freeletics.flowredux:compose:1.2.1" -maplibre = "org.maplibre.gl:android-sdk:10.3.1" +maplibre = "org.maplibre.gl:android-sdk:11.0.0" maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:2.0.2" maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:2.0.2" opusencoder = "io.element.android:opusencoder:1.1.0" From a2e88383bd013d9a8a20f62b39044ed556ac5233 Mon Sep 17 00:00:00 2001 From: ganfra Date: Tue, 21 May 2024 16:12:19 +0200 Subject: [PATCH 2/4] maplibre : remove all mapbox references and update plugin to be compatible. --- .../location/impl/common/MapDefaults.kt | 4 ++-- .../location/impl/send/SendLocationView.kt | 6 ++--- .../location/impl/show/ShowLocationView.kt | 8 +++---- .../impl/show/ShowLocationViewTest.kt | 2 +- gradle/libs.versions.toml | 2 +- .../libraries/maplibre/compose/CameraMode.kt | 2 +- .../compose/CameraMoveStartedReason.kt | 12 +++++----- .../maplibre/compose/CameraPositionState.kt | 18 +++++++------- .../libraries/maplibre/compose/IconAnchor.kt | 2 +- .../libraries/maplibre/compose/MapApplier.kt | 8 +++---- ...Composable.kt => MapLibreMapComposable.kt} | 8 +++---- .../libraries/maplibre/compose/MapUpdater.kt | 14 +++++------ .../libraries/maplibre/compose/MapboxMap.kt | 24 +++++++++---------- .../libraries/maplibre/compose/Symbol.kt | 10 ++++---- 14 files changed, 60 insertions(+), 60 deletions(-) rename libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/{MapboxMapComposable.kt => MapLibreMapComposable.kt} (83%) diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/MapDefaults.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/MapDefaults.kt index f5f0bbe078..6896172363 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/MapDefaults.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/common/MapDefaults.kt @@ -21,12 +21,12 @@ import android.view.Gravity import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.ui.graphics.Color -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.geometry.LatLng import io.element.android.compound.theme.ElementTheme import io.element.android.libraries.maplibre.compose.MapLocationSettings import io.element.android.libraries.maplibre.compose.MapSymbolManagerSettings import io.element.android.libraries.maplibre.compose.MapUiSettings +import org.maplibre.android.camera.CameraPosition +import org.maplibre.android.geometry.LatLng /** * Common configuration values for the map. diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt index a396cc120f..40aac154fa 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/send/SendLocationView.kt @@ -37,7 +37,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.mapbox.mapboxsdk.camera.CameraPosition import io.element.android.compound.theme.ElementTheme import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.features.location.api.Location @@ -61,9 +60,10 @@ import io.element.android.libraries.designsystem.theme.components.bottomsheet.re import io.element.android.libraries.designsystem.utils.CommonDrawables import io.element.android.libraries.maplibre.compose.CameraMode import io.element.android.libraries.maplibre.compose.CameraMoveStartedReason -import io.element.android.libraries.maplibre.compose.MapboxMap +import io.element.android.libraries.maplibre.compose.MapLibreMap import io.element.android.libraries.maplibre.compose.rememberCameraPositionState import io.element.android.libraries.ui.strings.CommonStrings +import org.maplibre.android.camera.CameraPosition @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -189,7 +189,7 @@ fun SendLocationView( .consumeWindowInsets(it), contentAlignment = Alignment.Center ) { - MapboxMap( + MapLibreMap( styleUri = rememberTileStyleUrl(), modifier = Modifier.fillMaxSize(), cameraPositionState = cameraPositionState, diff --git a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt index 2f352d50d2..3370dbc751 100644 --- a/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt +++ b/features/location/impl/src/main/kotlin/io/element/android/features/location/impl/show/ShowLocationView.kt @@ -33,8 +33,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.geometry.LatLng import io.element.android.compound.theme.ElementTheme import io.element.android.compound.tokens.generated.CompoundIcons import io.element.android.compound.tokens.generated.TypographyTokens @@ -56,12 +54,14 @@ import io.element.android.libraries.designsystem.utils.CommonDrawables import io.element.android.libraries.maplibre.compose.CameraMode import io.element.android.libraries.maplibre.compose.CameraMoveStartedReason import io.element.android.libraries.maplibre.compose.IconAnchor -import io.element.android.libraries.maplibre.compose.MapboxMap +import io.element.android.libraries.maplibre.compose.MapLibreMap import io.element.android.libraries.maplibre.compose.Symbol import io.element.android.libraries.maplibre.compose.rememberCameraPositionState import io.element.android.libraries.maplibre.compose.rememberSymbolState import io.element.android.libraries.ui.strings.CommonStrings import kotlinx.collections.immutable.toImmutableMap +import org.maplibre.android.camera.CameraPosition +import org.maplibre.android.geometry.LatLng @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -166,7 +166,7 @@ fun ShowLocationView( ) } - MapboxMap( + MapLibreMap( styleUri = rememberTileStyleUrl(), modifier = Modifier.fillMaxSize(), images = mapOf(PIN_ID to CommonDrawables.pin).toImmutableMap(), diff --git a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationViewTest.kt b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationViewTest.kt index 05160dca56..22377c3879 100644 --- a/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationViewTest.kt +++ b/features/location/impl/src/test/kotlin/io/element/android/features/location/impl/show/ShowLocationViewTest.kt @@ -144,7 +144,7 @@ private fun AndroidComposeTestRule.setShowL onBackPressed: () -> Unit = EnsureNeverCalled(), ) { setContent { - // Simulate a LocalInspectionMode for MapboxMap + // Simulate a LocalInspectionMode for MapLibreMap CompositionLocalProvider(LocalInspectionMode provides true) { ShowLocationView( state = state, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0e6aa375c8..e917045d33 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -175,7 +175,7 @@ telephoto_flick = { module = "me.saket.telephoto:flick-android", version.ref = " statemachine = "com.freeletics.flowredux:compose:1.2.1" maplibre = "org.maplibre.gl:android-sdk:11.0.0" maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:2.0.2" -maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:2.0.2" +maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:3.0.0" opusencoder = "io.element.android:opusencoder:1.1.0" kotlinpoet = "com.squareup:kotlinpoet:1.16.0" diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMode.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMode.kt index 0c85d3dfb3..a527201b31 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMode.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMode.kt @@ -19,7 +19,7 @@ package io.element.android.libraries.maplibre.compose import androidx.compose.runtime.Immutable -import com.mapbox.mapboxsdk.location.modes.CameraMode as InternalCameraMode +import org.maplibre.android.location.modes.CameraMode as InternalCameraMode @Immutable public enum class CameraMode { diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMoveStartedReason.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMoveStartedReason.kt index 10c9d8b69a..697bbed8ed 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMoveStartedReason.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraMoveStartedReason.kt @@ -19,14 +19,14 @@ package io.element.android.libraries.maplibre.compose import androidx.compose.runtime.Immutable -import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_API_ANIMATION -import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_API_GESTURE -import com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION +import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_API_ANIMATION +import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_API_GESTURE +import org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener.REASON_DEVELOPER_ANIMATION /** * Enumerates the different reasons why the map camera started to move. * - * Based on enum values from https://docs.maptiler.com/maplibre-gl-native-android/com.mapbox.mapboxsdk.maps/#oncameramovestartedlistener. + * Based on enum values from https://docs.maptiler.com/maplibre-gl-native-android/org.maplibre.android.maps/#oncameramovestartedlistener. * * [NO_MOVEMENT_YET] is used as the initial state before any map movement has been observed. * @@ -44,11 +44,11 @@ public enum class CameraMoveStartedReason(public val value: Int) { public companion object { /** - * Converts from the Maps SDK [com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener] + * Converts from the Maps SDK [org.maplibre.android.maps.MapLibreMap.OnCameraMoveStartedListener] * constants to [CameraMoveStartedReason], or returns [UNKNOWN] if there is no such * [CameraMoveStartedReason] for the given [value]. * - * See https://docs.maptiler.com/maplibre-gl-native-android/com.mapbox.mapboxsdk.maps/#oncameramovestartedlistener. + * See https://docs.maptiler.com/maplibre-gl-native-android/org.maplibre.android.maps/#oncameramovestartedlistener. */ public fun fromInt(value: Int): CameraMoveStartedReason { return values().firstOrNull { it.value == value } ?: return UNKNOWN diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraPositionState.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraPositionState.kt index 114e6acc02..a71ece9732 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraPositionState.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/CameraPositionState.kt @@ -28,11 +28,11 @@ import androidx.compose.runtime.saveable.Saver import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.runtime.staticCompositionLocalOf -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Projection import kotlinx.parcelize.Parcelize +import org.maplibre.android.camera.CameraPosition +import org.maplibre.android.camera.CameraUpdateFactory +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.Projection /** * Create and [rememberSaveable] a [CameraPositionState] using [CameraPositionState.Saver]. @@ -49,7 +49,7 @@ public inline fun rememberCameraPositionState( /** * A state object that can be hoisted to control and observe the map's camera state. - * A [CameraPositionState] may only be used by a single [MapboxMap] composable at a time + * A [CameraPositionState] may only be used by a single [MapLibreMap] composable at a time * as it reflects instance state for a single view of a map. * * @param position the initial camera position @@ -143,15 +143,15 @@ public class CameraPositionState( // The map currently associated with this CameraPositionState. // Guarded by `lock`. - private var map: MapboxMap? by mutableStateOf(null) + private var map: MapLibreMap? by mutableStateOf(null) // The current map is set and cleared by side effect. // There can be only one associated at a time. - internal fun setMap(map: MapboxMap?) { + internal fun setMap(map: MapLibreMap?) { synchronized(lock) { if (this.map == null && map == null) return if (this.map != null && map != null) { - error("CameraPositionState may only be associated with one MapboxMap at a time") + error("CameraPositionState may only be associated with one MapLibreMap at a time") } this.map = map if (map == null) { @@ -179,7 +179,7 @@ internal val LocalCameraPositionState = staticCompositionLocalOf { CameraPositio /** The current [CameraPositionState] used by the map. */ public val currentCameraPositionState: CameraPositionState - @[MapboxMapComposable ReadOnlyComposable Composable] + @[MapLibreMapComposable ReadOnlyComposable Composable] get() = LocalCameraPositionState.current @Parcelize diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/IconAnchor.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/IconAnchor.kt index 25f6f38c66..cb64f63a44 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/IconAnchor.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/IconAnchor.kt @@ -19,7 +19,7 @@ package io.element.android.libraries.maplibre.compose import androidx.compose.runtime.Immutable -import com.mapbox.mapboxsdk.style.layers.Property +import org.maplibre.android.style.layers.Property @Immutable public enum class IconAnchor { diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapApplier.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapApplier.kt index 650e9d27ef..9b03a1e952 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapApplier.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapApplier.kt @@ -19,9 +19,9 @@ package io.element.android.libraries.maplibre.compose import androidx.compose.runtime.AbstractApplier -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Style -import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.Style +import org.maplibre.android.plugins.annotation.SymbolManager internal interface MapNode { fun onAttached() {} @@ -32,7 +32,7 @@ internal interface MapNode { private object MapNodeRoot : MapNode internal class MapApplier( - val map: MapboxMap, + val map: MapLibreMap, val style: Style, val symbolManager: SymbolManager, ) : AbstractApplier(MapNodeRoot) { diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMapComposable.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMapComposable.kt similarity index 83% rename from libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMapComposable.kt rename to libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMapComposable.kt index 15876b0033..19f5864815 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMapComposable.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMapComposable.kt @@ -22,10 +22,10 @@ import androidx.compose.runtime.ComposableTargetMarker /** * An annotation that can be used to mark a composable function as being expected to be use in a - * composable function that is also marked or inferred to be marked as a [MapboxMapComposable]. + * composable function that is also marked or inferred to be marked as a [MapLibreMapComposable]. * - * This will produce build warnings when [MapboxMapComposable] composable functions are used outside - * of a [MapboxMapComposable] content lambda, and vice versa. + * This will produce build warnings when [MapLibreMapComposable] composable functions are used outside + * of a [MapLibreMapComposable] content lambda, and vice versa. */ @Retention(AnnotationRetention.BINARY) @ComposableTargetMarker(description = "MapLibre Map Composable") @@ -36,4 +36,4 @@ import androidx.compose.runtime.ComposableTargetMarker AnnotationTarget.TYPE, AnnotationTarget.TYPE_PARAMETER, ) -public annotation class MapboxMapComposable +public annotation class MapLibreMapComposable diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapUpdater.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapUpdater.kt index 759061ac3d..7a41c9f7b9 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapUpdater.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapUpdater.kt @@ -26,17 +26,17 @@ import androidx.compose.runtime.ComposeNode import androidx.compose.runtime.currentComposer import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext -import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions -import com.mapbox.mapboxsdk.location.LocationComponentOptions -import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener -import com.mapbox.mapboxsdk.location.engine.LocationEngineRequest -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Style +import org.maplibre.android.location.LocationComponentActivationOptions +import org.maplibre.android.location.LocationComponentOptions +import org.maplibre.android.location.OnCameraTrackingChangedListener +import org.maplibre.android.location.engine.LocationEngineRequest +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.Style private const val LOCATION_REQUEST_INTERVAL = 750L internal class MapPropertiesNode( - val map: MapboxMap, + val map: MapLibreMap, style: Style, context: Context, cameraPositionState: CameraPositionState, diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt index 4fab4b506f..352585cc1a 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt @@ -46,14 +46,14 @@ import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.viewinterop.AndroidView import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver -import com.mapbox.mapboxsdk.Mapbox -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Style -import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager import kotlinx.collections.immutable.ImmutableMap import kotlinx.collections.immutable.persistentMapOf import kotlinx.coroutines.awaitCancellation +import org.maplibre.android.MapLibre +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.Style +import org.maplibre.android.plugins.annotation.SymbolManager import kotlin.coroutines.resume import kotlin.coroutines.suspendCoroutine @@ -63,7 +63,7 @@ import kotlin.coroutines.suspendCoroutine * Heavily inspired by https://github.com/googlemaps/android-maps-compose * * @param styleUri a URI where to asynchronously fetch a style for the map - * @param modifier Modifier to be applied to the MapboxMap + * @param modifier Modifier to be applied to the MapLibreMap * @param images images added to the map's style to be later used with [Symbol] * @param cameraPositionState the [CameraPositionState] to be used to control or observe the map's * camera state @@ -73,7 +73,7 @@ import kotlin.coroutines.suspendCoroutine * @param content the content of the map */ @Composable -public fun MapboxMap( +public fun MapLibreMap( styleUri: String, modifier: Modifier = Modifier, images: ImmutableMap = persistentMapOf(), @@ -82,7 +82,7 @@ public fun MapboxMap( symbolManagerSettings: MapSymbolManagerSettings = DefaultMapSymbolManagerSettings, locationSettings: MapLocationSettings = DefaultMapLocationSettings, content: ( - @Composable @MapboxMapComposable + @Composable @MapLibreMapComposable () -> Unit )? = null, ) { @@ -99,7 +99,7 @@ public fun MapboxMap( val context = LocalContext.current val mapView = remember { - Mapbox.getInstance(context) + MapLibre.getInstance(context) MapView(context) } @@ -168,13 +168,13 @@ private suspend inline fun CompositionContext.newComposition( } } -private suspend inline fun MapView.awaitMap(): MapboxMap = suspendCoroutine { continuation -> +private suspend inline fun MapView.awaitMap(): MapLibreMap = suspendCoroutine { continuation -> getMapAsync { map -> continuation.resume(map) } } -private suspend inline fun MapboxMap.awaitStyle( +private suspend inline fun MapLibreMap.awaitStyle( context: Context, styleUri: String, images: ImmutableMap, @@ -227,7 +227,7 @@ private fun MapView.lifecycleObserver(previousState: MutableState { // Skip calling mapView.onCreate if the lifecycle did not go through onDestroy - in - // this case the MapboxMap composable also doesn't leave the composition. So, + // this case the MapLibreMap composable also doesn't leave the composition. So, // recreating the map does not restore state properly which must be avoided. if (previousState.value != Lifecycle.Event.ON_STOP) { this.onCreate(Bundle()) diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/Symbol.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/Symbol.kt index bb40c7dfa9..18d942ec80 100644 --- a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/Symbol.kt +++ b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/Symbol.kt @@ -26,10 +26,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.Saver import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue -import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.plugins.annotation.Symbol -import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions +import org.maplibre.android.geometry.LatLng +import org.maplibre.android.plugins.annotation.Symbol +import org.maplibre.android.plugins.annotation.SymbolManager +import org.maplibre.android.plugins.annotation.SymbolOptions internal class SymbolNode( val symbolManager: SymbolManager, @@ -85,7 +85,7 @@ public fun rememberSymbolState( * @param iconAnchor the anchor for the symbol image */ @Composable -@MapboxMapComposable +@MapLibreMapComposable public fun Symbol( iconId: String, state: SymbolState = rememberSymbolState(), From a41d323c938ac3c23c679290abce62a3934f5892 Mon Sep 17 00:00:00 2001 From: ganfra Date: Wed, 22 May 2024 11:56:06 +0200 Subject: [PATCH 3/4] MapLibre : rename file MapBoxMap to match composable. --- .../libraries/maplibre/compose/{MapboxMap.kt => MapLibreMap.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/{MapboxMap.kt => MapLibreMap.kt} (100%) diff --git a/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt b/libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMap.kt similarity index 100% rename from libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapboxMap.kt rename to libraries/maplibre-compose/src/main/kotlin/io/element/android/libraries/maplibre/compose/MapLibreMap.kt From 1414a48c8bfbb339909b4ed0b85945ddaa5fbbc1 Mon Sep 17 00:00:00 2001 From: ganfra Date: Thu, 30 May 2024 11:33:52 +0200 Subject: [PATCH 4/4] MapLibre : also update ktx lib --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c96397e5b7..d6b9e0d601 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -171,7 +171,7 @@ telephoto_zoomableimage = { module = "me.saket.telephoto:zoomable-image-coil", v telephoto_flick = { module = "me.saket.telephoto:flick-android", version.ref = "telephoto" } statemachine = "com.freeletics.flowredux:compose:1.2.1" maplibre = "org.maplibre.gl:android-sdk:11.0.0" -maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:2.0.2" +maplibre_ktx = "org.maplibre.gl:android-sdk-ktx-v7:3.0.0" maplibre_annotation = "org.maplibre.gl:android-plugin-annotation-v9:3.0.0" opusencoder = "io.element.android:opusencoder:1.1.0" kotlinpoet = "com.squareup:kotlinpoet:1.17.0"