File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
nextcloud/client/preferences Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,8 @@ default void onDarkThemeModeChanged(DarkMode mode) {
372372
373373 void setInAppReviewData (@ NonNull AppReviewShownModel appReviewShownModel );
374374
375+ boolean isStoragePermissionRequested ();
376+
375377 @ Nullable
376378 AppReviewShownModel getInAppReviewData ();
377379
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ public final class AppPreferencesImpl implements AppPreferences {
9999
100100 private static final String PREF__PDF_ZOOM_TIP_SHOWN = "pdf_zoom_tip_shown" ;
101101 private static final String PREF__MEDIA_FOLDER_LAST_PATH = "media_folder_last_path" ;
102-
102+ private static final String PREF__STORAGE_PERMISSION_REQUESTED = "storage_permission_requested" ;
103103 private static final String PREF__IN_APP_REVIEW_DATA = "in_app_review_data" ;
104104
105105 private static final String PREF__TWO_WAY_STATUS = "two_way_sync_status" ;
@@ -756,6 +756,11 @@ public int getPdfZoomTipShownCount() {
756756 return preferences .getInt (PREF__PDF_ZOOM_TIP_SHOWN , 0 );
757757 }
758758
759+ @ Override
760+ public boolean isStoragePermissionRequested () {
761+ return preferences .getBoolean (PREF__STORAGE_PERMISSION_REQUESTED , false );
762+ }
763+
759764 @ VisibleForTesting
760765 public int computeBruteForceDelay (int count ) {
761766 return (int ) Math .min (count / 3d , 10 );
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import androidx.appcompat.app.AppCompatActivity
2323import androidx.core.app.ActivityCompat
2424import androidx.core.content.ContextCompat
2525import com.google.android.material.snackbar.Snackbar
26+ import com.nextcloud.client.preferences.AppPreferencesImpl
2627import com.owncloud.android.R
2728import com.owncloud.android.lib.common.utils.Log_OC
2829import com.owncloud.android.ui.dialog.StoragePermissionDialogFragment
@@ -131,9 +132,11 @@ object PermissionUtil {
131132 }
132133
133134 fun showStoragePermissionsSnackbarOrRequest (activity : Activity , viewThemeUtils : ViewThemeUtils ) {
135+ @Suppress(" DEPRECATION" )
136+ val preferences = AppPreferencesImpl .fromContext(activity)
134137 val permissions = getStoragePermissions()
135138
136- if (permissions.any { shouldShowRequestPermissionRationale(activity, it) }) {
139+ if (permissions.any { shouldShowRequestPermissionRationale(activity, it) } || ! preferences.isStoragePermissionRequested ) {
137140 showStoragePermissionsSnackbar(activity, permissions, viewThemeUtils)
138141 } else {
139142 requestPermissions(activity, permissions)
You can’t perform that action at this time.
0 commit comments