code4romania / mon-vot-android-kotlin

Android election monitoring app - a mobile app through which commissioned observers can easily report back to their respective NGOs throughout the election day
https://votemonitor.org
Mozilla Public License 2.0
7 stars 29 forks source link

Copy files to cache instead of using directly. Fixes #178 #219

Closed DeKaN closed 4 years ago

DeKaN commented 4 years ago

Get InputStream for Uri and write its content to the cache folder instead of trying to get the file.

Checked on Uri's:

content://com.android.providers.media.documents/document/image%3A1017 (Images)
content://com.android.providers.downloads.documents/document/msf%3A1019 (Downloads)
content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3Dencoded%3DI35Uf5ygTirRhYv9I9zj96uxAsRmXJ5TIy1FrpWs7F%2Fa0pH8BNFolg%3D%3D (Google Drive)
content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F317/ORIGINAL/NONE/image%2Fjpeg/1932874955 (Google Photo)
aniri commented 4 years ago

@DeKaN hey, thanks for your contribution! It looks good and fixes the bug, there's just a small improvement to be made:

The flow of uploading notes with images is the following:

I noticed the delete of the image file from the cache is only done if the internet connection was up when first saving a note and it was sent to the server. But not in the manual sync case. Could you please check and add the delete there also?

Thanks!

sonarcloud[bot] commented 4 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

aniri commented 4 years ago

@DeKaN awesome :rocket: thank you!