Skip to content

Commit 1b06d09

Browse files
authored
Expose native map (#3044)
1 parent 593c36a commit 1b06d09

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

maps-sdk/api/Release/metalava.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ package com.mapbox.maps {
220220
method public com.mapbox.maps.MapOptions getMapOptions();
221221
method public double getMetersPerPixelAtLatitude(double latitude, double zoom);
222222
method public double getMetersPerPixelAtLatitude(double latitude);
223+
method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) @com.mapbox.maps.MapboxDelicateApi @com.mapbox.maps.MapboxExperimental public com.mapbox.maps.Map getNativeMap();
223224
method public byte getPrefetchZoomDelta();
224225
method public boolean getRenderWorldCopies();
225226
method public com.mapbox.maps.Size getSize();

maps-sdk/api/maps-sdk.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public final class com/mapbox/maps/MapboxMap : com/mapbox/maps/MapboxStyleManage
220220
public fun getMapOptions ()Lcom/mapbox/maps/MapOptions;
221221
public fun getMetersPerPixelAtLatitude (D)D
222222
public fun getMetersPerPixelAtLatitude (DD)D
223+
public final fun getNativeMap ()Lcom/mapbox/maps/Map;
223224
public final fun getPrefetchZoomDelta ()B
224225
public final fun getRenderWorldCopies ()Z
225226
public fun getSize ()Lcom/mapbox/maps/Size;

maps-sdk/src/main/java/com/mapbox/maps/MapboxMap.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2842,6 +2842,14 @@ class MapboxMap :
28422842
}
28432843
}
28442844

2845+
/**
2846+
* For internal usage only.
2847+
*/
2848+
@MapboxExperimental
2849+
@MapboxDelicateApi
2850+
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
2851+
fun getNativeMap(): Map = nativeMap.map
2852+
28452853
/**
28462854
* A convenience object to access MapboxMap's static utilities.
28472855
*/

maps-sdk/src/test/java/com/mapbox/maps/MapboxMapTest.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,14 @@ class MapboxMapTest {
18331833
verifyOnce { mapboxMap.getViewAnnotationAvoidLayers() }
18341834
assertEquals(layerIds, mapboxMap.getViewAnnotationAvoidLayers())
18351835
}
1836+
1837+
@OptIn(MapboxExperimental::class, MapboxDelicateApi::class)
1838+
@Test
1839+
fun getNativeMap() {
1840+
val map = mockk<Map>()
1841+
every { nativeMap.map } returns map
1842+
assertEquals(mapboxMap.getNativeMap(), map)
1843+
}
18361844
}
18371845

18381846
@RunWith(ParameterizedRobolectricTestRunner::class)

0 commit comments

Comments
 (0)