-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
feature/2331/saveFiles #3416
feature/2331/saveFiles #3416
Conversation
Hi @FaribaKhandani, thanks for your PR! With my test device it works as expected 👍 Regarding the handshake failed error: can you comment on #1578 by adding the devices and versions you used? Regarding the code i have some minor remarks, i will just add some comments. |
@SuppressLint("LongLogTag") | ||
private fun saveImageToStorage( | ||
fileName: String, | ||
funToCallWhenDownloadSuccessful: (() -> Unit) |
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.
the second parameter (funToCallWhenDownloadSuccessful) is not used so it could also just be deleted.
So just call the method with saveImageToStorage(fileName) and delete the observer.
try { | ||
for (workInfo in workers.get()) { | ||
if (workInfo.state == WorkInfo.State.RUNNING || workInfo.state == WorkInfo.State.ENQUEUED) { | ||
Log.d(TAG, "Download worker for $fileId is already running or scheduled") |
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.
just replace "Download Worker" with SaveFileToStorageWorker, so the log message makes sense again.
} | ||
} | ||
|
||
fun showWarningDialog(message: ChatMessage) { |
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.
maybe better find a name that tells a bit more about what this dialog does. For example "showSaveToStorageWarning"
|
||
val cacheFile = File(sourceFilePath) | ||
|
||
val downloadDirectory = "storage/self/primary/Download" |
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 think it would be better to use MediaStore to store the files.
https://developer.android.com/training/data-storage/shared
Log.d("amdd" , destFile.path) | ||
|
||
if (destFile.exists()){ | ||
destFile.delete() |
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.
deleting is not the best choice here i guess. Instead there could be number appended. But that's maybe out of scope for this PR.
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.
Hello
All of your remarks are fixed and pushed .
Media Store approach for saving file is added (previous way for saving files is commented within the code )
Please let me know what is the next step?
d92a238
to
fec0b0d
Compare
fec0b0d
to
dd9eb35
Compare
Hi Fariba, thanks again for the PR and also thanks to solve the remarks.
Please feel free to ask if any of my changes are unclear. |
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! |
resolves #2331
The feature of saving media in personal storage space
Access to feature
Access to this feature is possible through the menu in full screen media mode or long click on media.
process of saving
In this feature, if the media is already stored in the cache, it is copied to the download folder, and if the media is not available in the cache, it is first downloaded to the cache and then copied to the download folder.
Permitions
Due to the limitations of memory access, if there is no prior permission from the user's side, the user's permission will be asked first, and like other features in this app, the media will be saved in the next attempt.
According to the descriptions mentioned in the related issue, every time an attempt is made to save the media, a warning is sent to the user that other programs have access to the saved media.
TODO
For this reason, this feature has only been tested on virtual Android devices and needs to be tested by the QA team on a physical device.