File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
app/src/main/java/com/owncloud/android Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ class SyncedFoldersActivity :
198198 setTheme(R .style.FallbackThemingTheme )
199199 }
200200 binding.emptyList.emptyListViewAction.setOnClickListener { showHiddenItems() }
201+ PermissionUtil .requestExternalStoragePermission(this , viewThemeUtils, true )
201202 }
202203
203204 override fun onCreateOptionsMenu (menu : Menu ): Boolean {
@@ -810,9 +811,6 @@ class SyncedFoldersActivity :
810811 if (grantResults.isNotEmpty() && grantResults[0 ] == PackageManager .PERMISSION_GRANTED ) {
811812 // permission was granted
812813 load(getItemsDisplayedPerFolder(), true )
813- } else {
814- // permission denied --> request again
815- PermissionUtil .requestExternalStoragePermission(this , viewThemeUtils, true )
816814 }
817815 }
818816 else -> super .onRequestPermissionsResult(requestCode, permissions, grantResults)
Original file line number Diff line number Diff line change @@ -251,10 +251,16 @@ object PermissionUtil {
251251 activity,
252252 listener
253253 )
254- }
255254
256- val dialogFragment = StoragePermissionDialogFragment .newInstance(permissionRequired)
257- dialogFragment.show(activity.supportFragmentManager, PERMISSION_CHOICE_DIALOG_TAG )
255+ // Check if the dialog is already added to the FragmentManager.
256+ val existingDialog = activity.supportFragmentManager.findFragmentByTag(PERMISSION_CHOICE_DIALOG_TAG )
257+
258+ // Only show the dialog if it's not already shown.
259+ if (existingDialog == null ) {
260+ val dialogFragment = StoragePermissionDialogFragment .newInstance(permissionRequired)
261+ dialogFragment.show(activity.supportFragmentManager, PERMISSION_CHOICE_DIALOG_TAG )
262+ }
263+ }
258264 }
259265 }
260266
You can’t perform that action at this time.
0 commit comments