pull/2718/head
kunfei 2 years ago
parent af266eca7d
commit 7e52c19e65
  1. 2
      app/src/main/java/io/legado/app/lib/permission/Permissions.kt
  2. 9
      app/src/main/java/io/legado/app/lib/permission/Request.kt

@ -43,7 +43,7 @@ object Permissions {
object Group { object Group {
val STORAGE = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { val STORAGE = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
arrayOf(READ_EXTERNAL_STORAGE, MANAGE_EXTERNAL_STORAGE) arrayOf(MANAGE_EXTERNAL_STORAGE)
} else { } else {
arrayOf(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE) arrayOf(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
} }

@ -2,6 +2,7 @@ package io.legado.app.lib.permission
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.os.Build import android.os.Build
import android.os.Environment
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
@ -123,7 +124,13 @@ internal class Request : OnRequestPermissionsResultCallback {
if (permissions != null) { if (permissions != null) {
val deniedPermissionList = ArrayList<String>() val deniedPermissionList = ArrayList<String>()
for (permission in permissions) { for (permission in permissions) {
if ( if (permission == Permissions.MANAGE_EXTERNAL_STORAGE) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!Environment.isExternalStorageManager()) {
deniedPermissionList.add(permission)
}
}
} else if (
ContextCompat.checkSelfPermission(context, permission) ContextCompat.checkSelfPermission(context, permission)
!= PackageManager.PERMISSION_GRANTED != PackageManager.PERMISSION_GRANTED
) { ) {

Loading…
Cancel
Save