mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
464 stars 131 forks source link

Disable Telemetry in Compose Attribution #2461

Open FloTank opened 1 month ago

FloTank commented 1 month ago

New Feature

When using the Attribution introduced in the Compose - MapboxMap in (and after up until the lastest Version) Version 11.3.0+, one can't disable telemetry afterwards by code anymore.


    MapboxMap(
        composeMapInitOptions = ComposeMapInitOptions(
            pixelRatio = context.resources.displayMetrics.density,
            textureView = true
        ),
        attribution = {
            Attribution(
                iconColor = attributionIconColor
            )
        },
    ) {
        MapEffect(Unit) { mapView ->
            mapView.attribution.apply {
                setCustomAttributionDialogManager(MapboxAttributionDialogManager(context))
                getMapAttributionDelegate().telemetry().apply {
                    userTelemetryRequestState = isMapTrackingAllowed
                    if (isMapTrackingAllowed.not()) disableTelemetrySession()
                }
            }
        }
    }

Previously with the AttributionSettings something like this was allowed, as the PluginId of the mapView.attribution was set. Now, after introducing the Attribution() Composable another Plugin Id is used, which we can't access so the mapView.attribution is not accessible anymore as it crashes.

As of right now I can't find a way to do the same things we did in the mapView.Attribution in the new Attribution Composable. A custom Dialog is possible but Telemetry can't be disabled.

Why

The User should also be able to disable telemetry in the App Settings so we need to pass it to MapBox

kiryldz commented 3 weeks ago

@FloTank thanks for reporting. We are tracking this internally and will let you know when it's implemented.