diff --git a/app/build.gradle b/app/build.gradle index c5e941e952..6ab49db85b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -54,7 +54,7 @@ android { defaultConfig { compileSdk 34 applicationId "com.kickstarter" - minSdkVersion 23 + minSdkVersion 24 targetSdkVersion 34 testApplicationId "com.kickstarter.internal.debug.test" testInstrumentationRunner "com.kickstarter.screenshoot.testing.KSScreenShotTestRunner" diff --git a/app/src/main/java/com/kickstarter/libs/ApiCapabilities.java b/app/src/main/java/com/kickstarter/libs/ApiCapabilities.java index 2be62247c8..25dabf036a 100644 --- a/app/src/main/java/com/kickstarter/libs/ApiCapabilities.java +++ b/app/src/main/java/com/kickstarter/libs/ApiCapabilities.java @@ -8,8 +8,4 @@ private ApiCapabilities() {} public static boolean canCreateNotificationChannels() { return android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; } - - public static boolean needsLegacyHtml() { - return android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.N; - } } diff --git a/app/src/main/java/com/kickstarter/libs/utils/ViewUtils.java b/app/src/main/java/com/kickstarter/libs/utils/ViewUtils.java index c2bdf2c4c6..5c5479a633 100644 --- a/app/src/main/java/com/kickstarter/libs/utils/ViewUtils.java +++ b/app/src/main/java/com/kickstarter/libs/utils/ViewUtils.java @@ -27,7 +27,6 @@ import androidx.annotation.Nullable; import com.kickstarter.R; -import com.kickstarter.libs.ApiCapabilities; import com.kickstarter.ui.views.ConfirmDialog; import rx.functions.Action1; @@ -68,11 +67,7 @@ public static int getScreenWidthDp(final @NonNull Context context) { * */ public static Spanned html(final @NonNull String htmlString) { - if (ApiCapabilities.needsLegacyHtml()) { - return Html.fromHtml(htmlString); - } else { - return Html.fromHtml(htmlString, Html.FROM_HTML_MODE_COMPACT); - } + return Html.fromHtml(htmlString, Html.FROM_HTML_MODE_COMPACT); } public static boolean isFontScaleLarge(final @NonNull Context context) { diff --git a/app/src/main/java/com/kickstarter/libs/utils/extensions/StringExt.kt b/app/src/main/java/com/kickstarter/libs/utils/extensions/StringExt.kt index e6e8ba078b..008f6f450d 100644 --- a/app/src/main/java/com/kickstarter/libs/utils/extensions/StringExt.kt +++ b/app/src/main/java/com/kickstarter/libs/utils/extensions/StringExt.kt @@ -2,7 +2,6 @@ package com.kickstarter.libs.utils.extensions -import android.os.Build import android.text.Html import android.text.Spanned import android.text.TextUtils @@ -212,11 +211,7 @@ fun String.hrefUrlFromTranslation(): String { * Takes a String resource with HTMl Returns displayable styled text from the provided HTML string. */ fun String.toHtml(): Spanned { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - Html.fromHtml(TextUtils.htmlEncode(this), Html.FROM_HTML_MODE_LEGACY) - } else { - Html.fromHtml(TextUtils.htmlEncode(this)) - } + return Html.fromHtml(TextUtils.htmlEncode(this), Html.FROM_HTML_MODE_LEGACY) } fun String.toHashedSHAEmail(): String { diff --git a/app/src/main/java/com/kickstarter/ui/fragments/projectpage/ProjectOverviewFragment.kt b/app/src/main/java/com/kickstarter/ui/fragments/projectpage/ProjectOverviewFragment.kt index 84d710bb08..0a54138856 100644 --- a/app/src/main/java/com/kickstarter/ui/fragments/projectpage/ProjectOverviewFragment.kt +++ b/app/src/main/java/com/kickstarter/ui/fragments/projectpage/ProjectOverviewFragment.kt @@ -2,7 +2,6 @@ package com.kickstarter.ui.fragments.projectpage import android.app.Activity import android.content.Intent -import android.os.Build import android.os.Bundle import android.text.Html import android.text.Html.FROM_HTML_MODE_LEGACY @@ -429,11 +428,8 @@ class ProjectOverviewFragment : Fragment(), Configure { } private fun setBlurbTextViews(blurb: String) { - val blurbHtml = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + val blurbHtml = Html.fromHtml(TextUtils.htmlEncode(blurb), FROM_HTML_MODE_LEGACY) - } else { - Html.fromHtml(TextUtils.htmlEncode(blurb)) - } binding.blurb.text = blurbHtml } diff --git a/app/src/main/java/com/kickstarter/ui/viewholders/ThanksShareViewHolder.kt b/app/src/main/java/com/kickstarter/ui/viewholders/ThanksShareViewHolder.kt index f6986c7e3e..c2b961e57c 100644 --- a/app/src/main/java/com/kickstarter/ui/viewholders/ThanksShareViewHolder.kt +++ b/app/src/main/java/com/kickstarter/ui/viewholders/ThanksShareViewHolder.kt @@ -3,7 +3,6 @@ package com.kickstarter.ui.viewholders import android.app.Activity import android.content.Intent import android.net.Uri -import android.os.Build import android.text.Html import android.util.Pair import com.facebook.share.model.ShareLinkContent @@ -90,32 +89,18 @@ class ThanksShareViewHolder(private val binding: ThanksShareViewBinding) : KSVie } private fun showPostCampaignPledgeText(pcptext: Pair) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - binding.backedProject.text = Html.fromHtml( - ksString.format( - context().getString(R.string.You_have_successfully_pledged_to_project_post_campaign_html_short), - "pledge_total", - ksCurrency.format( - initialValue = pcptext.first, - project = pcptext.second, - roundingMode = RoundingMode.HALF_UP - ) - ), - Html.FROM_HTML_MODE_LEGACY - ) - } else { - binding.backedProject.text = Html.fromHtml( - ksString.format( - context().getString(R.string.You_have_successfully_pledged_to_project_post_campaign_html_short), - "pledge_total", - ksCurrency.format( - initialValue = pcptext.first, - project = pcptext.second, - roundingMode = RoundingMode.HALF_UP - ) - ), - ) - } + binding.backedProject.text = Html.fromHtml( + ksString.format( + context().getString(R.string.You_have_successfully_pledged_to_project_post_campaign_html_short), + "pledge_total", + ksCurrency.format( + initialValue = pcptext.first, + project = pcptext.second, + roundingMode = RoundingMode.HALF_UP + ) + ), + Html.FROM_HTML_MODE_LEGACY + ) } private fun startShare(projectNameAndShareUrl: Pair) { diff --git a/app/src/test/java/com/kickstarter/KSRobolectricGradleTestRunner.java b/app/src/test/java/com/kickstarter/KSRobolectricGradleTestRunner.java index b0df904e79..3bc4c3ecca 100644 --- a/app/src/test/java/com/kickstarter/KSRobolectricGradleTestRunner.java +++ b/app/src/test/java/com/kickstarter/KSRobolectricGradleTestRunner.java @@ -6,7 +6,7 @@ import org.robolectric.RobolectricTestRunner; public class KSRobolectricGradleTestRunner extends RobolectricTestRunner { - static final int DEFAULT_SDK = Build.VERSION_CODES.M; + static final int DEFAULT_SDK = Build.VERSION_CODES.N; public KSRobolectricGradleTestRunner(final Class testClass) throws InitializationError { super(testClass); diff --git a/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseTest.kt b/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseTest.kt index f7a6a8e569..1d9ff5dbc1 100644 --- a/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseTest.kt +++ b/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseTest.kt @@ -222,7 +222,7 @@ class SendThirdPartyEventUseCaseTest : KSRobolectricTestCase() { assertEquals(false, input.appData.iOSConsent) assertEquals("a2", input.appData.extInfo.first()) assertEquals(16, input.appData.extInfo.size) - assertEquals("6.0.1", input.appData.extInfo[4]) + assertEquals("7.0", input.appData.extInfo[4]) } @Test @@ -404,7 +404,7 @@ class SendThirdPartyEventUseCaseTest : KSRobolectricTestCase() { assertEquals(false, input.appData.iOSConsent) assertEquals("a2", input.appData.extInfo.first()) assertEquals(16, input.appData.extInfo.size) - assertEquals("6.0.1", input.appData.extInfo[4]) + assertEquals("7.0", input.appData.extInfo[4]) } private fun subscribeToThirdPartyEvent( diff --git a/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseV2Test.kt b/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseV2Test.kt index 68041efff3..babf00584a 100644 --- a/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseV2Test.kt +++ b/app/src/test/java/com/kickstarter/viewmodels/usecases/SendThirdPartyEventUseCaseV2Test.kt @@ -232,7 +232,7 @@ class SendThirdPartyEventUseCaseV2Test : KSRobolectricTestCase() { assertEquals(false, input.appData.iOSConsent) assertEquals("a2", input.appData.extInfo.first()) assertEquals(16, input.appData.extInfo.size) - assertEquals("6.0.1", input.appData.extInfo[4]) + assertEquals("7.0", input.appData.extInfo[4]) } @Test @@ -416,7 +416,7 @@ class SendThirdPartyEventUseCaseV2Test : KSRobolectricTestCase() { assertEquals(false, input.appData.iOSConsent) assertEquals("a2", input.appData.extInfo.first()) assertEquals(16, input.appData.extInfo.size) - assertEquals("6.0.1", input.appData.extInfo[4]) + assertEquals("7.0", input.appData.extInfo[4]) } private fun subscribeToThirdPartyEvent(