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

Upgrade Kotlin to 1.5.0 #3685

Merged
merged 3 commits into from
May 6, 2021
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 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.4.32'
ext.kotlinVersion = '1.5.0'
ext.dokkaVersion = '1.4.30'

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.stripe.android.model.Address
import com.stripe.android.model.PaymentMethod
import com.stripe.android.model.PaymentMethodCreateParams
import com.stripe.example.databinding.SofortActivityBinding
import java.util.Locale

class SofortPaymentMethodActivity : StripeIntentActivity() {
private val viewBinding: SofortActivityBinding by lazy {
Expand All @@ -27,7 +26,7 @@ class SofortPaymentMethodActivity : StripeIntentActivity() {
viewBinding.submit.setOnClickListener {
keyboardController.hide()

val country = viewBinding.country.text.toString().toLowerCase(Locale.ROOT)
val country = viewBinding.country.text.toString().lowercase()
createAndConfirmPaymentIntent(
country,
PaymentMethodCreateParams.create(
Expand Down
742 changes: 619 additions & 123 deletions stripe/api/stripe.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ class GooglePayJsonFactory constructor(
transactionInfo: TransactionInfo
): JSONObject {
return JSONObject()
.put("currencyCode", transactionInfo.currencyCode.toUpperCase(Locale.ROOT))
.put("currencyCode", transactionInfo.currencyCode.uppercase())
.put("totalPriceStatus", transactionInfo.totalPriceStatus.code)
.apply {
transactionInfo.countryCode?.let {
put("countryCode", it.toUpperCase(Locale.ROOT))
put("countryCode", it.uppercase())
}

transactionInfo.transactionId?.let {
Expand All @@ -153,7 +153,7 @@ class GooglePayJsonFactory constructor(
PayWithGoogleUtils.getPriceString(
it,
Currency.getInstance(
transactionInfo.currencyCode.toUpperCase(Locale.ROOT)
transactionInfo.currencyCode.uppercase()
)
)
)
Expand Down Expand Up @@ -370,7 +370,7 @@ class GooglePayJsonFactory constructor(
internal val normalizedAllowedCountryCodes: Set<String>
get() {
return allowedCountryCodes.map {
it.toUpperCase(Locale.ROOT)
it.uppercase()
}.toSet()
}

Expand Down
3 changes: 1 addition & 2 deletions stripe/src/main/java/com/stripe/android/model/Address.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.stripe.android.ObjectBuilder
import com.stripe.android.model.parsers.AddressJsonParser
import kotlinx.parcelize.Parcelize
import org.json.JSONObject
import java.util.Locale

/**
* Model for an owner [address](https://stripe.com/docs/api#source_object-owner-address)
Expand Down Expand Up @@ -46,7 +45,7 @@ data class Address internal constructor(
}

fun setCountry(country: String?): Builder = apply {
this.country = country?.toUpperCase(Locale.ROOT)
this.country = country?.uppercase()
}

internal fun setCountryCode(countryCode: CountryCode?): Builder = apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.stripe.android.model
import android.os.Parcelable
import com.stripe.android.ObjectBuilder
import kotlinx.parcelize.Parcelize
import java.util.Locale

@Parcelize
data class AddressJapanParams(
Expand Down Expand Up @@ -78,7 +77,7 @@ data class AddressJapanParams(
* @param country Two-letter country code (ISO 3166-1 alpha-2).
*/
fun setCountry(country: String?): Builder = apply {
this.country = country?.toUpperCase(Locale.ROOT)
this.country = country?.uppercase()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ internal data class CountryCode private constructor(
fun isCA(countryCode: CountryCode?) = countryCode == CA
fun isGB(countryCode: CountryCode?) = countryCode == GB

fun create(value: String) = CountryCode(value.toUpperCase(Locale.ROOT))
fun create(value: String) = CountryCode(value.uppercase())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import com.stripe.android.Stripe
import kotlinx.parcelize.Parcelize
import org.json.JSONException
import org.json.JSONObject
import java.util.Locale

/**
* Model for PaymentMethod creation parameters.
Expand Down Expand Up @@ -439,7 +438,7 @@ data class PaymentMethodCreateParams internal constructor(
) : StripeParamsModel, Parcelable {
override fun toParamMap(): Map<String, Any> {
return mapOf(
PARAM_COUNTRY to country.toUpperCase(Locale.ROOT)
PARAM_COUNTRY to country.uppercase()
)
}

Expand All @@ -454,7 +453,7 @@ data class PaymentMethodCreateParams internal constructor(
) : StripeParamsModel, Parcelable {
override fun toParamMap(): Map<String, Any> {
return mapOf(
PARAM_BANK to bank.toLowerCase(Locale.ROOT)
PARAM_BANK to bank.lowercase()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal class CurrencyFormatter {
targetLocale: Locale = Locale.getDefault()
) = format(
amount,
Currency.getInstance(amountCurrencyCode.toUpperCase(Locale.ROOT)),
Currency.getInstance(amountCurrencyCode.uppercase()),
targetLocale
)

Expand Down Expand Up @@ -70,7 +70,7 @@ internal class CurrencyFormatter {
*/
return SERVER_DECIMAL_DIGITS
.filter { entry ->
entry.key.contains(currency.currencyCode.toUpperCase(Locale.ROOT))
entry.key.contains(currency.currencyCode.uppercase())
}.map {
it.value
}.firstOrNull() ?: currency.defaultFractionDigits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import android.widget.Filter
import android.widget.TextView
import com.stripe.android.R
import java.lang.ref.WeakReference
import java.util.Locale

/**
* Adapter that populates a list of countries for a spinner.
Expand Down Expand Up @@ -128,8 +127,8 @@ internal class CountryAdapter(
private fun getSuggestedCountries(constraint: CharSequence?): List<Country> {
return unfilteredCountries
.filter {
it.name.toLowerCase(Locale.ROOT).startsWith(
constraint.toString().toLowerCase(Locale.ROOT)
it.name.lowercase().startsWith(
constraint.toString().lowercase()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal object CountryUtils {
return listOfNotNull(getCountryByCode(currentLocale.getCountryCode(), currentLocale))
.plus(
localizedCountries(currentLocale)
.sortedBy { it.name.toLowerCase(Locale.ROOT) }
.sortedBy { it.name.lowercase() }
.filterNot { it.code == currentLocale.getCountryCode() }
)
}
Expand All @@ -60,7 +60,7 @@ internal object CountryUtils {
)
@JvmSynthetic
internal fun doesCountryUsePostalCode(countryCode: String): Boolean {
return !NO_POSTAL_CODE_COUNTRIES.contains(countryCode.toUpperCase(Locale.ROOT))
return !NO_POSTAL_CODE_COUNTRIES.contains(countryCode.uppercase())
}

@JvmSynthetic
Expand Down