File tree 2 files changed +10
-6
lines changed
app/src/main/java/com/owncloud/android
2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ class SyncedFoldersActivity :
198
198
setTheme(R .style.FallbackThemingTheme )
199
199
}
200
200
binding.emptyList.emptyListViewAction.setOnClickListener { showHiddenItems() }
201
+ PermissionUtil .requestExternalStoragePermission(this , viewThemeUtils, true )
201
202
}
202
203
203
204
override fun onCreateOptionsMenu (menu : Menu ): Boolean {
@@ -810,9 +811,6 @@ class SyncedFoldersActivity :
810
811
if (grantResults.isNotEmpty() && grantResults[0 ] == PackageManager .PERMISSION_GRANTED ) {
811
812
// permission was granted
812
813
load(getItemsDisplayedPerFolder(), true )
813
- } else {
814
- // permission denied --> request again
815
- PermissionUtil .requestExternalStoragePermission(this , viewThemeUtils, true )
816
814
}
817
815
}
818
816
else -> super .onRequestPermissionsResult(requestCode, permissions, grantResults)
Original file line number Diff line number Diff line change @@ -251,10 +251,16 @@ object PermissionUtil {
251
251
activity,
252
252
listener
253
253
)
254
- }
255
254
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
+ }
258
264
}
259
265
}
260
266
You can’t perform that action at this time.
0 commit comments