diff --git a/CHANGELOG.md b/CHANGELOG.md index 748252a401..72256d00a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,14 +3,15 @@ Mapbox welcomes participation and contributions from everyone. # main -## Features ✨ and improvements 🏁 -* Added Attribution and Telemetry pop-up dialogs and compass view content description translations for Arabic, Bulgarian, Catalan, Chinese Simplified, Chinese Traditional, Czech, Danish, Dutch, French, Galician, German, Hebrew, Italian, Japanese, Korean, Lithuanian, Norwegian, Polish, Belarusian, Russian, Spanish, Swedish, Ukranian and Vietnamese. - ## Breaking changes ⚠️ * [compose] Replace `MapboxMap.compassSettings`, `MapboxMap.scaleBarSettings`, `MapboxMap.logoSettings`, `MapboxMap.attributionSettings` with composable functions in dedicated scopes: `MapCompassScope.Compass()`, `MapScaleBarScope.ScaleBar()`, `MapLogoScope.Logo()`, `MapAttributionScope.Attribution()`. +## Features ✨ and improvements 🏁 +* Added Attribution and Telemetry pop-up dialogs and compass view content description translations for Arabic, Bulgarian, Catalan, Chinese Simplified, Chinese Traditional, Czech, Danish, Dutch, French, Galician, German, Hebrew, Italian, Japanese, Korean, Lithuanian, Norwegian, Polish, Belarusian, Russian, Spanish, Swedish, Ukranian and Vietnamese. + ## Bug fixes 🐞 * [compose] Fix `ViewAnnotation` not cleared when it leaves composition. +* Fix attribution links not opening in some scenarios. # 11.2.0 February 29, 2024 ## Features ✨ and improvements 🏁 diff --git a/extension-compose/src/main/java/com/mapbox/maps/extension/compose/ornaments/attribution/MapAttributionScope.kt b/extension-compose/src/main/java/com/mapbox/maps/extension/compose/ornaments/attribution/MapAttributionScope.kt index f372d95070..6308e7cc15 100644 --- a/extension-compose/src/main/java/com/mapbox/maps/extension/compose/ornaments/attribution/MapAttributionScope.kt +++ b/extension-compose/src/main/java/com/mapbox/maps/extension/compose/ornaments/attribution/MapAttributionScope.kt @@ -1,6 +1,5 @@ package com.mapbox.maps.extension.compose.ornaments.attribution -import android.app.Activity import android.content.ActivityNotFoundException import android.content.Intent import android.net.Uri @@ -334,18 +333,22 @@ public class MapAttributionScope internal constructor( } private fun showWebPage(url: String) { - if (mapView.context is Activity) { - try { - val intent = Intent(Intent.ACTION_VIEW) - intent.data = Uri.parse(url) - mapView.context.startActivity(intent) - } catch (exception: ActivityNotFoundException) { // explicitly handling if the device hasn't have a web browser installed. #8899 - Toast.makeText( - mapView.context, - R.string.mapbox_attributionErrorNoBrowser, - Toast.LENGTH_LONG - ).show() - } + try { + val intent = Intent(Intent.ACTION_VIEW) + intent.data = Uri.parse(url) + mapView.context.startActivity(intent) + } catch (exception: ActivityNotFoundException) { + Toast.makeText( + mapView.context, + R.string.mapbox_attributionErrorNoBrowser, + Toast.LENGTH_LONG + ).show() + } catch (t: Throwable) { + Toast.makeText( + mapView.context, + t.localizedMessage, + Toast.LENGTH_LONG + ).show() } } diff --git a/plugin-attribution/src/main/java/com/mapbox/maps/plugin/attribution/AttributionDialogManagerImpl.kt b/plugin-attribution/src/main/java/com/mapbox/maps/plugin/attribution/AttributionDialogManagerImpl.kt index 5a2b56f816..5e3ebb8882 100644 --- a/plugin-attribution/src/main/java/com/mapbox/maps/plugin/attribution/AttributionDialogManagerImpl.kt +++ b/plugin-attribution/src/main/java/com/mapbox/maps/plugin/attribution/AttributionDialogManagerImpl.kt @@ -148,14 +148,14 @@ class AttributionDialogManagerImpl( } private fun showWebPage(url: String) { - if (context is Activity) { - try { - val intent = Intent(Intent.ACTION_VIEW) - intent.data = Uri.parse(url) - context.startActivity(intent) - } catch (exception: ActivityNotFoundException) { // explicitly handling if the device hasn't have a web browser installed. #8899 - Toast.makeText(context, R.string.mapbox_attributionErrorNoBrowser, Toast.LENGTH_LONG).show() - } + try { + val intent = Intent(Intent.ACTION_VIEW) + intent.data = Uri.parse(url) + context.applicationContext.startActivity(intent) + } catch (exception: ActivityNotFoundException) { + Toast.makeText(context, R.string.mapbox_attributionErrorNoBrowser, Toast.LENGTH_LONG).show() + } catch (t: Throwable) { + Toast.makeText(context, t.localizedMessage, Toast.LENGTH_LONG).show() } }