Skip to content

Commit

Permalink
fix: Lint problems that make lint analysis fail and not completing th…
Browse files Browse the repository at this point in the history
…e build (#1600)
  • Loading branch information
Garlondrake committed Jan 30, 2024
1 parent fdf375d commit facab1a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.reactnativestripesdk

import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Build
Expand Down Expand Up @@ -204,7 +205,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
fun setPostalCodeEnabled(isEnabled: Boolean) {
mCardWidget.postalCodeEnabled = isEnabled

if (isEnabled === false) {
if (isEnabled == false) {
mCardWidget.postalCodeRequired = false
}
}
Expand All @@ -217,6 +218,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
* We can reliable assume that setPostalCodeEnabled is called before
* setCountryCode because of the order of the props in CardField.tsx
*/
@SuppressLint("RestrictedApi")
fun setCountryCode(countryString: String?) {
if (mCardWidget.postalCodeEnabled) {
val countryCode = CountryCode.create(value = countryString ?: LocaleListCompat.getAdjustedDefault()[0]?.country ?: "US")
Expand Down Expand Up @@ -354,6 +356,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
)
}

@SuppressLint("RestrictedApi")
private fun createPostalCodeInputFilter(countryCode: CountryCode): InputFilter {
return InputFilter { charSequence, start, end, _, _, _ ->
for (i in start until end) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.reactnativestripesdk

import android.annotation.SuppressLint
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Build
Expand Down Expand Up @@ -62,6 +63,7 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
cardForm.isEnabled = !isDisabled
}

@SuppressLint("RestrictedApi")
private fun setCountry(countryString: String?) {
if (countryString != null) {
cardFormViewBinding.countryLayout.setSelectedCountryCode(CountryCode(countryString))
Expand Down Expand Up @@ -122,6 +124,7 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
CardFocusEvent(id, currentFocusedField))
}

@SuppressLint("RestrictedApi")
fun setCardStyle(value: ReadableMap) {
val backgroundColor = getValOr(value, "backgroundColor", null)
val textColor = getValOr(value, "textColor", null)
Expand Down Expand Up @@ -287,6 +290,7 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
)
}

@SuppressLint("RestrictedApi")
private fun createPostalCodeInputFilter(): InputFilter {
return InputFilter { charSequence, start, end, _, _, _ ->
if (cardFormViewBinding.countryLayout.getSelectedCountryCode() == CountryCode.US) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.reactnativestripesdk

import android.annotation.SuppressLint
import android.util.Log
import android.view.View
import android.widget.FrameLayout
Expand Down Expand Up @@ -41,6 +42,7 @@ class GooglePayButtonView(private val context: ThemedReactContext) : FrameLayout
return googlePayButton
}

@SuppressLint("RestrictedApi")
private fun buildButtonOptions(): ButtonOptions {
val allowedPaymentMethods = JSONArray().put(
GooglePayJsonFactory(context).createCardPaymentMethod(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.reactnativestripesdk.utils

import android.annotation.SuppressLint
import android.os.Bundle
import android.util.Log
import com.facebook.react.bridge.*
Expand Down Expand Up @@ -447,6 +448,7 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
return map
}

@SuppressLint("RestrictedApi")
internal fun mapFromMicrodepositType(type: MicrodepositType): String {
return when (type) {
MicrodepositType.AMOUNTS -> "amounts"
Expand All @@ -455,6 +457,7 @@ internal fun mapFromMicrodepositType(type: MicrodepositType): String {
}
}

@SuppressLint("RestrictedApi")
internal fun mapNextAction(type: NextActionType?, data: NextActionData?): WritableNativeMap? {
val nextActionMap = WritableNativeMap()
when (type) {
Expand Down

0 comments on commit facab1a

Please sign in to comment.