Skip to content

Commit

Permalink
fix(share_plus): Resolve deprecation warning in Android part (#2717)
Browse files Browse the repository at this point in the history
  • Loading branch information
vbuberen committed Mar 17, 2024
1 parent c37acd6 commit 5913ac7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package dev.fluttercommunity.plus.share

import android.content.*
import android.os.Build
import androidx.annotation.RequiresApi

/**
* This helper class allows us to use FLAG_MUTABLE on the PendingIntent used in the Share class,
Expand All @@ -21,6 +22,7 @@ internal class SharePlusPendingIntent: BroadcastReceiver() {
/**
* Handler called after an action was chosen. Called only on success.
*/
@RequiresApi(Build.VERSION_CODES.LOLLIPOP_MR1)
override fun onReceive(context: Context, intent: Intent) {
// Extract chosen ComponentName
val chosenComponent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
Expand All @@ -29,7 +31,7 @@ internal class SharePlusPendingIntent: BroadcastReceiver() {
} else {
// Deprecated in API level 33
@Suppress("DEPRECATION")
intent.getParcelableExtra<ComponentName>(Intent.EXTRA_CHOSEN_COMPONENT)
intent.getParcelableExtra(Intent.EXTRA_CHOSEN_COMPONENT)
}

// Unambiguously identify the chosen action
Expand Down

0 comments on commit 5913ac7

Please sign in to comment.