From cc5733a42df975c56d1235fb3b5df0d5c691ac53 Mon Sep 17 00:00:00 2001 From: shah Date: Fri, 6 Oct 2023 17:59:23 +0530 Subject: [PATCH] ALS-1702 Broken display on attribution bug fix --- .../ui/main/attribution/AttributionFragment.kt | 7 +++++-- .../aws/amazonlocation/ui/main/explore/ExploreFragment.kt | 1 + .../main/java/com/aws/amazonlocation/utils/Constants.kt | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/attribution/AttributionFragment.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/attribution/AttributionFragment.kt index 89011317..f412e5c1 100644 --- a/app/src/main/java/com/aws/amazonlocation/ui/main/attribution/AttributionFragment.kt +++ b/app/src/main/java/com/aws/amazonlocation/ui/main/attribution/AttributionFragment.kt @@ -17,6 +17,7 @@ import com.aws.amazonlocation.ui.main.web_view.WebViewActivity import com.aws.amazonlocation.utils.KEY_MAP_NAME import com.aws.amazonlocation.utils.KEY_URL import com.aws.amazonlocation.utils.MAP_STYLE_ATTRIBUTION +import com.aws.amazonlocation.utils.attributionPattern class AttributionFragment : BaseFragment() { @@ -46,10 +47,12 @@ class AttributionFragment : BaseFragment() { private fun init() { mBinding.apply { - tvAttribution.text = mPreferenceManager.getValue(MAP_STYLE_ATTRIBUTION, getString(R.string.esri)) + tvAttribution.text = + mPreferenceManager.getValue(MAP_STYLE_ATTRIBUTION, getString(R.string.esri)) + ?.replace(Regex(attributionPattern), "") ?: "" + } } - private fun initClick() { mBinding.apply { btnLearnMoreSa.setOnClickListener { diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/explore/ExploreFragment.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/explore/ExploreFragment.kt index 05a09134..ae104d4c 100644 --- a/app/src/main/java/com/aws/amazonlocation/ui/main/explore/ExploreFragment.kt +++ b/app/src/main/java/com/aws/amazonlocation/ui/main/explore/ExploreFragment.kt @@ -3367,6 +3367,7 @@ class ExploreFragment : mBinding.apply { bottomSheetAttribution.apply { tvAttribution.text = mPreferenceManager.getValue(MAP_STYLE_ATTRIBUTION, getString(R.string.esri)) + ?.replace(Regex(attributionPattern), "") ?: "" } } } diff --git a/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt b/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt index 7415cdf1..fb9c4884 100644 --- a/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt +++ b/app/src/main/java/com/aws/amazonlocation/utils/Constants.kt @@ -148,6 +148,7 @@ val regionDisplayName = arrayListOf("Automatic", "Europe (Ireland) eu-west-1", " * eg 2> "49.281174, -123.116823" > Check LAT_LNG_REG_EXP > return true */ const val LAT_LNG_REG_EXP = "([+-]?\\d+\\.?\\d+)\\s*,\\s*([+-]?\\d+\\.?\\d+)" +const val attributionPattern = "]*>|" const val GEOFENCE_NAME_REG_EXP = "^[-._\\p{L}\\p{N}]+\$" const val userPoolIdPattern = "[\\w-]+_[0-9a-zA-Z]+"