Revert partial media permission handling

This commit is contained in:
Ensar Sarajčić 2023-08-30 09:04:52 +02:00
parent 3f67830d60
commit 2c82c1bee8
5 changed files with 12 additions and 9 deletions

View file

@ -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()

View file

@ -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)
}
}

View file

@ -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)

View file

@ -47,7 +47,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
setupOptionsMenu()
refreshMenuItems()
handlePartialMediaPermissions(getPermissionsToRequest()) {
handlePermission(getPermissionToRequest()) {
if (it) {
checkIntent(savedInstanceState)
} else {

View file

@ -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 {