Skip to content

Commit

Permalink
Merge pull request #14133 from nextcloud/backport/14127/stable-3.30
Browse files Browse the repository at this point in the history
[stable-3.30] BugFix - Infinite Storage Permission Check
  • Loading branch information
tobiasKaminsky authored Dec 5, 2024
2 parents aa29235 + a9109b4 commit bf527a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class SyncedFoldersActivity :
setTheme(R.style.FallbackThemingTheme)
}
binding.emptyList.emptyListViewAction.setOnClickListener { showHiddenItems() }
PermissionUtil.requestExternalStoragePermission(this, viewThemeUtils, true)
}

override fun onCreateOptionsMenu(menu: Menu): Boolean {
Expand Down Expand Up @@ -810,9 +811,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)
Expand Down
12 changes: 9 additions & 3 deletions app/src/main/java/com/owncloud/android/utils/PermissionUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

Expand Down

0 comments on commit bf527a4

Please sign in to comment.