-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use deprecated parcelable method. (#6900)
- Loading branch information
1 parent
6a0ff5d
commit 6889167
Showing
1 changed file
with
5 additions
and
8 deletions.
There are no files selected for viewing
13 changes: 5 additions & 8 deletions
13
financial-connections/src/main/java/com/stripe/android/financialconnections/utils/Intent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |