From c195c77faf9a61e8c77781aef9bfae69764f945d Mon Sep 17 00:00:00 2001 From: Skyler Reimer Date: Wed, 2 Feb 2022 12:28:31 -0800 Subject: [PATCH 1/4] test update to kotlin 1.6 --- build.gradle | 4 ++-- link/src/main/java/com/stripe/android/link/LinkActivity.kt | 2 -- .../java/com/stripe/android/link/ui/signup/SignUpScreen.kt | 4 ---- .../ComposeFormDataCollectionFragment.kt | 6 ++---- .../stripe/android/ui/core/elements/AddressController.kt | 2 +- .../com/stripe/android/ui/core/elements/AddressElement.kt | 2 +- .../com/stripe/android/ui/core/elements/RowController.kt | 2 -- .../android/stripecardscan/payment/card/PaymentCardTest.kt | 2 +- 8 files changed, 7 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index 059b7028be0..1c9736fc01d 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ import java.time.Duration // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlinVersion = '1.5.31' + ext.kotlinVersion = '1.6.10' ext.dokkaVersion = '1.6.10' repositories { @@ -54,7 +54,7 @@ ext { kotlinCoroutinesVersion = '1.6.0' kotlinSerializationVersion = '1.3.2' coreKtxVersion = '1.7.0' - composeVersion = '1.0.5' + composeVersion = '1.1.0-rc03' // this will be changed to a non rc upon release. composeActivityVersion = '1.4.0' espressoVersion = '3.4.0' ktlintVersion = '0.43.2' diff --git a/link/src/main/java/com/stripe/android/link/LinkActivity.kt b/link/src/main/java/com/stripe/android/link/LinkActivity.kt index 26a00b266aa..421f67ef46b 100644 --- a/link/src/main/java/com/stripe/android/link/LinkActivity.kt +++ b/link/src/main/java/com/stripe/android/link/LinkActivity.kt @@ -3,7 +3,6 @@ package com.stripe.android.link import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material.Icon @@ -32,7 +31,6 @@ internal class LinkActivity : ComponentActivity() { LinkActivityContract.Args.fromIntent(intent) } - @ExperimentalAnimationApi override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { diff --git a/link/src/main/java/com/stripe/android/link/ui/signup/SignUpScreen.kt b/link/src/main/java/com/stripe/android/link/ui/signup/SignUpScreen.kt index 5968d397e9a..416b6cf15b1 100644 --- a/link/src/main/java/com/stripe/android/link/ui/signup/SignUpScreen.kt +++ b/link/src/main/java/com/stripe/android/link/ui/signup/SignUpScreen.kt @@ -2,7 +2,6 @@ package com.stripe.android.link.ui.signup import android.app.Application import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth @@ -44,7 +43,6 @@ import com.stripe.android.ui.core.elements.SectionElement import com.stripe.android.ui.core.elements.SectionElementUI import com.stripe.android.ui.core.elements.SectionFieldElement -@ExperimentalAnimationApi @Preview @Composable private fun SignUpBodyPreview() { @@ -57,7 +55,6 @@ private fun SignUpBodyPreview() { } } -@ExperimentalAnimationApi @Composable internal fun SignUpBody( application: Application, @@ -79,7 +76,6 @@ internal fun SignUpBody( ) } -@ExperimentalAnimationApi @Composable internal fun SignUpBody( merchantName: String, diff --git a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ComposeFormDataCollectionFragment.kt b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ComposeFormDataCollectionFragment.kt index e43d5de9a2d..628365e8d27 100644 --- a/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ComposeFormDataCollectionFragment.kt +++ b/paymentsheet/src/main/java/com/stripe/android/paymentsheet/paymentdatacollection/ComposeFormDataCollectionFragment.kt @@ -4,23 +4,23 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.ui.Modifier import androidx.compose.ui.platform.ComposeView -import androidx.compose.ui.unit.ExperimentalUnitApi import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import com.stripe.android.paymentsheet.forms.Form import com.stripe.android.paymentsheet.forms.FormViewModel import com.stripe.android.paymentsheet.model.SupportedPaymentMethod import com.stripe.android.ui.core.StripeTheme +import kotlinx.coroutines.FlowPreview /** * Fragment that displays a form for payment data collection based on the [SupportedPaymentMethod] * received in the arguments bundle. */ +@OptIn(FlowPreview::class) internal class ComposeFormDataCollectionFragment : Fragment() { private val formLayout by lazy { requireNotNull( @@ -48,8 +48,6 @@ internal class ComposeFormDataCollectionFragment : Fragment() { ) } - @ExperimentalUnitApi - @ExperimentalAnimationApi override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, diff --git a/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressController.kt b/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressController.kt index ee9decf570e..e6b77a3b7b7 100644 --- a/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressController.kt +++ b/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressController.kt @@ -12,6 +12,7 @@ import kotlinx.coroutines.flow.flatMapLatest * This is in contrast to the [SectionController] which is a section in which the fields * in it do not change. */ +@ExperimentalCoroutinesApi @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) class AddressController( val fieldsFlowable: Flow> @@ -19,7 +20,6 @@ class AddressController( @StringRes val label: Int? = null - @ExperimentalCoroutinesApi override val error = fieldsFlowable.flatMapLatest { sectionFieldElements -> combine( sectionFieldElements.map { it.sectionFieldErrorController().error } diff --git a/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressElement.kt b/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressElement.kt index 65a66618d75..c59d7d079c5 100644 --- a/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressElement.kt +++ b/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/AddressElement.kt @@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.map @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) +@ExperimentalCoroutinesApi class AddressElement constructor( _identifier: IdentifierSpec, private val addressFieldRepository: AddressFieldElementRepository, @@ -50,7 +51,6 @@ class AddressElement constructor( override fun sectionFieldErrorController(): SectionFieldErrorController = controller - @ExperimentalCoroutinesApi override fun getFormFieldValueFlow() = fields.flatMapLatest { fieldElements -> combine( fieldElements diff --git a/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/RowController.kt b/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/RowController.kt index ad4333b430f..3ceb050068f 100644 --- a/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/RowController.kt +++ b/stripe-ui-core/src/main/java/com/stripe/android/ui/core/elements/RowController.kt @@ -1,7 +1,6 @@ package com.stripe.android.ui.core.elements import androidx.annotation.RestrictTo -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.combine @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @@ -9,7 +8,6 @@ class RowController( val fields: List ) : SectionFieldErrorController { - @ExperimentalCoroutinesApi override val error = combine( fields.map { it.sectionFieldErrorController().error } ) { diff --git a/stripecardscan/src/test/java/com/stripe/android/stripecardscan/payment/card/PaymentCardTest.kt b/stripecardscan/src/test/java/com/stripe/android/stripecardscan/payment/card/PaymentCardTest.kt index 6fe8d621565..f2d01f1335d 100644 --- a/stripecardscan/src/test/java/com/stripe/android/stripecardscan/payment/card/PaymentCardTest.kt +++ b/stripecardscan/src/test/java/com/stripe/android/stripecardscan/payment/card/PaymentCardTest.kt @@ -150,7 +150,7 @@ class PaymentCardTest { fun isValidExpiry() { val expDay = "01" val expMonth = "02" - val expYear = "2022" + val expYear = "2025" assertTrue { isValidExpiry(expDay, expMonth, expYear) } assertTrue { isValidExpiry(null, expMonth, expYear) } From d6e3c99be0bb59a02043cb7fe4adc6ecd8abbff4 Mon Sep 17 00:00:00 2001 From: Skyler Reimer Date: Wed, 2 Feb 2022 14:49:14 -0800 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 773c3ce4abe..b92094c1db6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # CHANGELOG ## X.X.X - 2022-XX-XX +* [CHANGED] [4546](https://github.com/stripe/stripe-android/pull/4546) Update to kotlin 1.6 ### PaymentSheet ### Identity ### Card scanning From cfe0fa2c5c6c14e22241c919780a078f30431bd9 Mon Sep 17 00:00:00 2001 From: Skyler Reimer Date: Wed, 2 Feb 2022 15:02:05 -0800 Subject: [PATCH 3/4] fix This annotation is not applicable to target 'type usage' --- .../stripe/android/core/injection/WeakMapInjectorRegistry.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe-core/src/main/java/com/stripe/android/core/injection/WeakMapInjectorRegistry.kt b/stripe-core/src/main/java/com/stripe/android/core/injection/WeakMapInjectorRegistry.kt index 30e928665a7..a037b993e71 100644 --- a/stripe-core/src/main/java/com/stripe/android/core/injection/WeakMapInjectorRegistry.kt +++ b/stripe-core/src/main/java/com/stripe/android/core/injection/WeakMapInjectorRegistry.kt @@ -21,7 +21,7 @@ object WeakMapInjectorRegistry : InjectorRegistry { */ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) @VisibleForTesting - val staticCacheMap = WeakHashMap() + val staticCacheMap = WeakHashMap() /** * Global unique monotonically increasing key to be assigned as a suffixes to From 0218fb725c60bec15829e3d0bf1eab4efa5185bb Mon Sep 17 00:00:00 2001 From: Skyler Reimer Date: Thu, 10 Feb 2022 09:42:08 -0800 Subject: [PATCH 4/4] update to non rc compose version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1c9736fc01d..303e004c573 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ ext { kotlinCoroutinesVersion = '1.6.0' kotlinSerializationVersion = '1.3.2' coreKtxVersion = '1.7.0' - composeVersion = '1.1.0-rc03' // this will be changed to a non rc upon release. + composeVersion = '1.1.0' composeActivityVersion = '1.4.0' espressoVersion = '3.4.0' ktlintVersion = '0.43.2'