-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: add media auto-download #5076
Conversation
…show the image from local
…d unsuportted videos to the gallery
… back again to room and cancel the video previously downloading
…deo function name
// The return of mime.extension('video/quicktime') is .qt, | ||
// this format the iOS isn't recognize and can't save on gallery | ||
if (mimeType === 'video/quicktime') { | ||
return 'mov'; | ||
} |
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.
Rocket.Chat.ReactNative/app/views/AttachmentView.tsx
Lines 172 to 177 in 223550d
// The return of mime.extension('video/quicktime') is .qt, | |
// this format the iOS isn't recognize and can't save on gallery | |
const documentDir = `${RNFetchBlob.fs.dirs.DocumentDir}/`; | |
const path = `${documentDir + sha256(url) + extension}`; | |
const file = await RNFetchBlob.config({ path }).fetch('GET', mediaAttachment); | |
await CameraRoll.save(path, { album: 'Rocket.Chat' }); |
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.
Do a performance review of this PR, please.
@reinaldonetof Before this PR, what was the behavior of downloading image attachments? Did it always auto-download images or did it never auto-download (and instead would wait until the user tapped on the image preview thumbnail)? |
@nmagedman for images the previous behavior is always download. |
@nmagedman URLs didn't change. We just changed the moment we fetch media, which might have caused the impression of being slower. |
Proposed changes
Here we present the Media Auto-Download feature, which allows users to manage the download of Images, Videos, and Audio files. There are three available states: Never, Wifi, and Wifi & Mobile Data.
Auto-download of files occurs when the state is set to Wifi and the device is connected to a Wifi network, or when it is set to Wifi & Mobile Data, or when the user is the same author of the message.
When the Never state is selected or when the state is set to Wifi but the device is using mobile data:
Audio: No files will be cached except those sent by the user. The user needs to press the download icon, and playback will only be possible after the complete download is finished. Meanwhile, the file will be downloaded.
Image: No files will be cached except those sent by the user. The user needs to press the download icon, and playback will only be possible after the complete download is finished. While downloading, if the user clicks on the image again, the download will be canceled.
Video: No files will be cached, including those sent by the user. When the user clicks the play button, the video player will open and start playing the video using the provided link while simultaneously downloading the video. If the user closes the video player and the download is still in progress, they will see a loading icon and the option to "Cancel" the download.
When the state is set to Wifi and the device is connected to a wifi network, or when the state is set to Wifi & Mobile Data, all audio, video, and image files that appear will automatically initiate the download.
Issue(s)
How to test or reproduce
Screenshots
Audio
Screen.Recording.2023-07-24.at.20.18.10.mov
Image
Screen.Recording.2023-07-24.at.20.34.58.mov
Video
Screen.Recording.2023-07-24.at.20.14.23.mov
All medis wifi
all-wifi.mov
Types of changes
Checklist
Further comments
TC-579