Revert partial media permission handling
This commit is contained in:
parent
3f67830d60
commit
2c82c1bee8
5 changed files with 12 additions and 9 deletions
|
@ -100,7 +100,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
}
|
||||
|
||||
setupOptionsMenu()
|
||||
handlePartialMediaPermissions(getPermissionsToRequest()) {
|
||||
handlePermission(getPermissionToRequest()) {
|
||||
if (!it) {
|
||||
toast(com.simplemobiletools.commons.R.string.no_storage_permissions)
|
||||
finish()
|
||||
|
|
|
@ -168,16 +168,19 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
private fun handleMediaPermissions(callback: (granted: Boolean) -> Unit) {
|
||||
if (!hasAllPermissions(getPermissionsToRequest())) {
|
||||
handlePartialMediaPermissions(getPermissionsToRequest(), true) {
|
||||
callback(it)
|
||||
handlePermission(getPermissionToRequest()) { granted ->
|
||||
callback(granted)
|
||||
if (granted && isRPlus()) {
|
||||
handlePermission(PERMISSION_MEDIA_LOCATION) {}
|
||||
if (isTiramisuPlus()) {
|
||||
handlePermission(PERMISSION_READ_MEDIA_VIDEO) {}
|
||||
}
|
||||
|
||||
if (!mWasMediaManagementPromptShown) {
|
||||
mWasMediaManagementPromptShown = true
|
||||
handleMediaManagementPrompt { }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
callback(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
}
|
||||
|
||||
private fun tryLoadGallery() {
|
||||
handlePartialMediaPermissions(getPermissionsToRequest()) {
|
||||
handlePermission(getPermissionToRequest()) {
|
||||
if (it) {
|
||||
val dirName = when {
|
||||
mPath == FAVORITES -> getString(com.simplemobiletools.commons.R.string.favorites)
|
||||
|
|
|
@ -47,7 +47,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
|
||||
setupOptionsMenu()
|
||||
refreshMenuItems()
|
||||
handlePartialMediaPermissions(getPermissionsToRequest()) {
|
||||
handlePermission(getPermissionToRequest()) {
|
||||
if (it) {
|
||||
checkIntent(savedInstanceState)
|
||||
} else {
|
||||
|
|
|
@ -96,7 +96,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
checkNotchSupport()
|
||||
(MediaActivity.mMedia.clone() as ArrayList<ThumbnailItem>).filterIsInstanceTo(mMediaFiles, Medium::class.java)
|
||||
|
||||
handlePartialMediaPermissions(getPermissionsToRequest()) {
|
||||
handlePermission(getPermissionToRequest()) {
|
||||
if (it) {
|
||||
initViewPager()
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue