Skip to content

Commit

Permalink
Use deprecated parcelable method. (#6900)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmuvi-stripe authored Jun 20, 2023
1 parent 6a0ff5d commit 6889167
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package com.stripe.android.financialconnections.utils

import android.content.Intent
import android.os.Build.VERSION.SDK_INT
import android.os.Build.VERSION_CODES.TIRAMISU
import android.os.Parcelable

internal inline fun <reified T : Parcelable> Intent.parcelable(key: String): T? = when {
SDK_INT >= TIRAMISU -> getParcelableExtra(key, T::class.java)
else -> {
@Suppress("DEPRECATION")
getParcelableExtra(key) as? T
}
// The new Intent.getParcelableExtra(String,Class) throws an NPE internally
// see https://issuetracker.google.com/issues/240585930#comment6
internal inline fun <reified T : Parcelable> Intent.parcelable(key: String): T? {
@Suppress("DEPRECATION")
return getParcelableExtra(key) as? T
}

0 comments on commit 6889167

Please sign in to comment.