M permissions removed: not mandatory#227
Conversation
maxSdkVersion removed - needed for saving image to Downloads
|
Changes in BitmapLoadTask is exactly what i was talking about! |
a244a6f to
bd3a8bb
Compare
|
Sample app is restored, leaving changes to the BitmapLoadTask only. |
| } | ||
| } else if ("content".equals(inputUriScheme)) { | ||
| String path = FileUtils.getPath(mContext, mInputUri); | ||
| String path = getFilePath(); |
There was a problem hiding this comment.
I think it's better to check for permission in here. And in case there is no one, then throw exception.
Something like throw new IllegalStateException("No permission for storage was provided"); Bacause now if just null returned, than user of the lib will get NoSuchFileEcxeption and it's misleading.
There was a problem hiding this comment.
The whole point of this PR is that Storage permission is not mandatory to read image file.
Fore example, if user selects image from an external app (Gallery etc), then temporary permission is granted for your app to read image file from specific Uri.
In other words, app has permission to read image file from Uri, but not to query ContentProvider.
With null returned we avoid querying ContentProvider, instead we try to access the file directly (via copyFile).
This way we are able to pick an image from gallery without Storage permission.
There was a problem hiding this comment.
Yep, that makes sense. Thank you very much.
|
@Cool04ek |
#212
If image is picked from the gallery, temporary permission to access an image is granted. Cropping destination can be set to the path returned from Context.getExternalFilesDir(), which, starting with KITKAT, does not need external storage permission.
Permission to save cropped image to
Downloadsfolder is still required however.This replicates
1.5.0behaviour where External storage permission was not needed. It also prevents lib from crashing if permission not granted.