mirror of
https://github.com/nextcloud/android.git
synced 2024-12-18 23:11:58 +03:00
Merge pull request #14127 from nextcloud/bugfix/infinite-storage-permission-request
BugFix - Infinite Storage Permission Check
This commit is contained in:
commit
4a224815cc
2 changed files with 10 additions and 6 deletions
|
@ -191,6 +191,7 @@ class SyncedFoldersActivity :
|
|||
setTheme(R.style.FallbackThemingTheme)
|
||||
}
|
||||
binding.emptyList.emptyListViewAction.setOnClickListener { showHiddenItems() }
|
||||
PermissionUtil.requestExternalStoragePermission(this, viewThemeUtils, true)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -808,9 +809,6 @@ class SyncedFoldersActivity :
|
|||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// permission was granted
|
||||
load(getItemsDisplayedPerFolder(), true)
|
||||
} else {
|
||||
// permission denied --> request again
|
||||
PermissionUtil.requestExternalStoragePermission(this, viewThemeUtils, true)
|
||||
}
|
||||
}
|
||||
else -> super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
|
|
|
@ -251,10 +251,16 @@ object PermissionUtil {
|
|||
activity,
|
||||
listener
|
||||
)
|
||||
}
|
||||
|
||||
val dialogFragment = StoragePermissionDialogFragment.newInstance(permissionRequired)
|
||||
dialogFragment.show(activity.supportFragmentManager, PERMISSION_CHOICE_DIALOG_TAG)
|
||||
// Check if the dialog is already added to the FragmentManager.
|
||||
val existingDialog = activity.supportFragmentManager.findFragmentByTag(PERMISSION_CHOICE_DIALOG_TAG)
|
||||
|
||||
// Only show the dialog if it's not already shown.
|
||||
if (existingDialog == null) {
|
||||
val dialogFragment = StoragePermissionDialogFragment.newInstance(permissionRequired)
|
||||
dialogFragment.show(activity.supportFragmentManager, PERMISSION_CHOICE_DIALOG_TAG)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue