Skip to content

Commit

Permalink
Added a version check in hasStoragePermission because we don't need s…
Browse files Browse the repository at this point in the history
…torage permissions in android 13 to write to files (#663)

Co-authored-by: Nevenit <[email protected]>
  • Loading branch information
Sevosc and Nevenit authored Nov 19, 2023
1 parent 2880485 commit 30c1991
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/main/java/com/dar/nclientv2/settings/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,11 @@ public static List<File> getUsableFolders(Context context) {
}

public static boolean hasStoragePermission(Context context) {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return true; //We don't check permission on Android 13
} else {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M || ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED;
}
}

public static boolean isJPEGCorrupted(String path) {
Expand Down

0 comments on commit 30c1991

Please sign in to comment.