Skip to content

Commit

Permalink
Ask for permission only if it's Shared Storage in Android
Browse files Browse the repository at this point in the history
  • Loading branch information
okmanideep committed Apr 17, 2023
1 parent acd4ccd commit 0ce088c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class LightCompressorPlugin : FlutterPlugin, MethodCallHandler,
else -> VideoQuality.MEDIUM
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (isSharedStorage && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (ContextCompat.checkSelfPermission(
activity,
Manifest.permission.READ_MEDIA_VIDEO,
Expand Down Expand Up @@ -120,7 +120,7 @@ class LightCompressorPlugin : FlutterPlugin, MethodCallHandler,
videoWidth, saveAt, videoName
)
}
} else if (Build.VERSION.SDK_INT >= 23) {
} else if (isSharedStorage && Build.VERSION.SDK_INT >= 23) {
val permissions = arrayOf(
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
Expand Down

0 comments on commit 0ce088c

Please sign in to comment.