Skip to content

Commit

Permalink
Only ask for storage permissions when not using SAF
Browse files Browse the repository at this point in the history
  • Loading branch information
wb9688 authored and Stypox committed Jan 14, 2021
1 parent 5c16135 commit 09312a9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import androidx.core.content.ContextCompat;

import org.schabi.newpipe.R;
import org.schabi.newpipe.settings.NewPipeSettings;

public final class PermissionHelper {
public static final int DOWNLOAD_DIALOG_REQUEST_CODE = 778;
Expand All @@ -26,6 +27,10 @@ public final class PermissionHelper {
private PermissionHelper() { }

public static boolean checkStoragePermissions(final Activity activity, final int requestCode) {
if (NewPipeSettings.useStorageAccessFramework(activity)) {
return true; // Storage permissions are not needed for SAF
}

if (!checkReadStoragePermissions(activity, requestCode)) {
return false;
}
Expand Down

0 comments on commit 09312a9

Please sign in to comment.