-
-
Notifications
You must be signed in to change notification settings - Fork 677
android: Request WRITE_EXTERNAL_STORAGE permission. #3123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
const actionSheetButtons: ButtonType[] = [ | ||
{ title: 'Download file', onPress: downloadImage }, | ||
{ title: 'Download image', onPress: tryToDownloadImage }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to update the messages_en.json
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will update! I wonder if there's any way that this could be caught via the test suite or some other automated check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not without a complicated (but exciting!) side project.... likely involving Babel and analyzing strings used vs translated.
e4b1f11
to
2e8cf18
Compare
(Also, this moves forward #2618.) |
Resolve a naming collision in LightboxActionSheet.js by renaming the function previously named `downloadFile` to `tryToDownloadImage`.
Fixes zulip#3115. See React Native 0.57's PermissionsAndroid API.
This helps make the logic a bit easier to follow.
I think these can still be improved (they still feel a little stuffy), but this should be good enough.
2e8cf18
to
07354a3
Compare
Thanks @jackrzhang ! Merged. I made a few edits on top that I think make the code easier to understand -- please take a look. I missed @borisyankov 's comment above (sorry!) until I'd already merged:
But actually I think the situation is that these messages -- all the labels in the lightbox action sheet -- are already untranslated even when our volunteer translators have kindly provided translations. 😞 Note the lack of any code to act on these strings to find their translations. I also quickly verified just now with German. So that would be good to fix. Also while we're at it make the new messages in this new flow get translated too. :-) |
(#2812 is some background for that translation issue.) |
The first time a user attempts to download an image, permission to write to external storage (the SD card) should be requested. If permission is granted by the user, the image should proceed to download.
If permission is denied, the image will not be fetched, and the corresponding text 'Storage permission denied' is shown. Any subsequent time that a user attempts to download an image, a 'rationale' modal will appear with explaining why the app needs permissions, and the permission will once again be requested.
If a user instructs that the permission not be asked for again, then subsequent attempts to download an image will only result in showing the text 'Storage permission denied', though the permission can always be changed via Android Settings.
For reference, see React Native 0.57's PermissionsAndroid API and Android's developer documentation on requesting permissions.
This fixes #3115 and progresses #3075.
@gnprice