-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix for iOS Image Downloads not going through Photos lib #7849
Conversation
@thienlnam @parasharrajat While I am implementing this with the proposal I mentioned, I am guessing this isn't an issue with Android. I don't have a phone to test.
|
Yeah I don't think it is, seems like we deal with android permission properly already but can also be checked with an android simulator
Yeah I would create a seperate file
You can use an external library to determine mime type - we probably won't want to maintain a library for that |
👋🏽 Hi @mananjadhav is there is any progress here? I'm still looking for an update from the comment I left you #7307 (comment) If there is no further progress on this issue within the next 24 hours we will be un-assigning this and reopening it back to the pool of other contributors. We'd like to keep working with you on this but we will need some more communication. For more details check step 11 here https://github.com/Expensify/App/blob/main/CONTRIBUTING.md#begin-coding-your-solution-in-a-pull-request |
Hey, @thienlnam missed your comment. Sorry. Almost done. Works fine on Android, iOS images working fine, the issue with videos. I'll finish by today and push by tomorrow for review. Also it seems I cannot build on iOS device and can only test on simulator. |
Thanks for the update. That's fine if you can't build on a physical iOS device, simulator testing should suffice |
is this ready @mananjadhav? |
Yes ready for review and merge. |
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.
Ok, Video downloading is failing on iOS. When we directly download the attachment from the chat list for the first time you download an attachment. It asks for permission and then the video never downloads.
Steps:
- install the app.
- Download the video from any chat.
- It should ask for permission. Give the permission. Wait to see the download.
- Download never completes.
I don't see any Expensify folder in the Files app. I don't know where did the pdf go.
@parasharrajat I am not able to reproduce the video download error. I tried a fresh install with All Allow and Selected Photos both the options. I tried on iPhone 12 and iPhone 8 simulators. I did test a few more cases and it did work fine. Additionally retested the permission rejection case with the second settings popupview. I also checked the PDF file. For me a new directory, "New Expensify" is created and the PDF is saved in Files -> On My iPhone -> New Expensify path. Can you test once more from your side? |
Sure, I will do that. |
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.
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.
Changes look good, just have a few comments. Going to have the copy double checked
return Promise.all([writePromise, readPromise]).then(([hasWritePermission, hasReadPermission]) => { | ||
if (hasWritePermission && hasReadPermission) { | ||
return true; // Return true if permission is already given | ||
} | ||
|
||
// Ask for permission if not given | ||
return PermissionsAndroid.requestMultiple([ | ||
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE, | ||
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, | ||
]).then(status => status['android.permission.READ_EXTERNAL_STORAGE'] === 'granted' | ||
&& status['android.permission.WRITE_EXTERNAL_STORAGE'] === 'granted'); | ||
}); | ||
} |
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.
What if the user has given read permission but not write permission? Does it matter if we request it again?
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.
I haven't tested this. Also considering that this issue was specifically for iOS, in Android I just checked if it doesn't break anything. Do you want me to test this thoroughly for Android as well?
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.
During my testing, Android only ask once for permission which means it combines them together. So if you deny it shows an error. Downloading the file again asks for permission.
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.
Awesome, thanks! 🚀
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Cherry-picked to staging by @sketchydroide in version: 1.1.57-8 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by @chiragsalian in version: 1.1.57-17 🚀
|
Details
react-native-cameraroll
andreact-native-mime-types
Fixed Issues
$ #7307
Tests
QA Steps
iOS Image
iOS Video
iOS Other files
Android all files
Web/MWeb/Desktop
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
ios-image-download.mp4
Android