Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to kotlin 1.6 #4546

Merged
merged 6 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# CHANGELOG
## X.X.X - 2022-XX-XX
* [CHANGED] [4546](https://github.com/stripe/stripe-android/pull/4546) Update to kotlin 1.6
* [FIXED] [4560](https://github.com/stripe/stripe-android/pull/4560) Fix `cardValidCallback` being added multiple times in `CardInputWidget`.
### PaymentSheet
* [FIXED] [4466](https://github.com/stripe/stripe-android/pull/4466) Fix issues when activities are lost on low resource phones.
* [FIXED] [4557](https://github.com/stripe/stripe-android/pull/4557) Add missing app info to some Stripe API requests

### Identity
### Card scanning
* [FIXED] [4548](https://github.com/stripe/stripe-android/pull/4548) Potential work leak when canceling a card scan in StripeCardScan
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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'
composeActivityVersion = '1.4.0'
flowlayoutVersion = '0.23.0'
espressoVersion = '3.4.0'
Expand Down
2 changes: 0 additions & 2 deletions link/src/main/java/com/stripe/android/link/LinkActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -32,7 +31,6 @@ internal class LinkActivity : ComponentActivity() {
LinkActivityContract.Args.fromIntent(intent)
}

@ExperimentalAnimationApi
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand All @@ -57,7 +55,6 @@ private fun SignUpBodyPreview() {
}
}

@ExperimentalAnimationApi
@Composable
internal fun SignUpBody(
application: Application,
Expand All @@ -79,7 +76,6 @@ internal fun SignUpBody(
)
}

@ExperimentalAnimationApi
@Composable
internal fun SignUpBody(
merchantName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ 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<List<SectionFieldElement>>
) : SectionFieldErrorController {
@StringRes
val label: Int? = null

@ExperimentalCoroutinesApi
override val error = fieldsFlowable.flatMapLatest { sectionFieldElements ->
combine(
sectionFieldElements.map { it.sectionFieldErrorController().error }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -50,7 +51,6 @@ class AddressElement constructor(
override fun sectionFieldErrorController(): SectionFieldErrorController =
controller

@ExperimentalCoroutinesApi
override fun getFormFieldValueFlow() = fields.flatMapLatest { fieldElements ->
combine(
fieldElements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
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)
class RowController(
val fields: List<SectionSingleFieldElement>
) : SectionFieldErrorController {

@ExperimentalCoroutinesApi
override val error = combine(
fields.map { it.sectionFieldErrorController().error }
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -48,8 +48,6 @@ internal class ComposeFormDataCollectionFragment : Fragment() {
)
}

@ExperimentalUnitApi
@ExperimentalAnimationApi
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object WeakMapInjectorRegistry : InjectorRegistry {
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@VisibleForTesting
val staticCacheMap = WeakHashMap<Injector, @InjectorKey String>()
val staticCacheMap = WeakHashMap<Injector, @receiver:InjectorKey String>()

/**
* Global unique monotonically increasing key to be assigned as a suffixes to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class PaymentCardTest {
fun isValidExpiry() {
val expDay = "01"
val expMonth = "02"
val expYear = "2022"
val expYear = "2025"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it that time already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave you a few extra years this time.


assertTrue { isValidExpiry(expDay, expMonth, expYear) }
assertTrue { isValidExpiry(null, expMonth, expYear) }
Expand Down