owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.82k stars 3.05k forks source link

Don't download photos to local storage unless explicitly told to by the user #2297

Open rexbron opened 6 years ago

rexbron commented 6 years ago

Actual behaviour

-Photos are downloaded to local storage, rather than cached.

Expected behaviour

-When browsing a directory of photos, I don't want to have to wait for each photo to be downloaded and stored locally before being able to view them. -The behavour of video files is to stream them unless given the action to download. Photos should follow similar logic.

Steps to reproduce

  1. Create a folder on a remote server and add photos
  2. Navigate to the folder via the owncloud android app
  3. Have you local storage fill up trying to just view the files in the folder.

Can this problem be reproduced with the official owncloud server? (url: https://demo.owncloud.org, user: test, password: test) Yes

Environment data

Android version: 8.1 Sept 5th patch

Device model: Nexus 6p

Stock or customized system: Stock android

ownCloud app version: 2.8.0

ownCloud server version: 10.0.8

stupidly-logical commented 6 years ago

I am looking into this.

jesmrec commented 6 years ago

@stupidly-logical ok, also you can contribute in other stuff labelled as Contributions are welcome or good first issue. The current one is not an easy one (some implications to face), but if you are confident yourself, go ahead!

lefherz commented 5 years ago

A user on GooglePlay asked for the same feature, but with music instead of images.

lefherz commented 5 years ago

And another user added pdfs. can we just do this with files in general? Let them open by other apps and delete afterwards?

jesmrec commented 5 years ago

this issue, and other ones, are in the same scope of not handling with downloaded files. This is, when you open a file, it is removed just after, and only stays in device in case of offline availability. We can gather all issues with the same topic and check which background and if it is really worthy to change the current behaviour of the downloaded stuff.

CC @michaelstingl

gutiar-junky commented 5 years ago

This "problem" really annoys me, too, since many apps on the phone then will show these images after they were downloaded just by viewing them. An major use-case for me is to have all my photos in my owncloud and not on my phone but if viewing them will cause the photos to be "permanently" stored on my device again, it's nothing worth to initially get them off my phone and in my owncloud :(

jesmrec commented 5 years ago

thanks for your feedback. We will think about it... this feature was already suggested and make sense not to keep everything downloaded. There are many choices to do that, we can use the current issue to discuss and get the better approach.

gutiar-junky commented 5 years ago

I think the easiest way - on Android's API-side would be this https://developer.android.com/training/data-storage/files.html#WriteCacheFileInternal

even if i see, there're some abstraction layers in your code, for someone knowing where the actual downloading (and checking, if already downloaded) is taking place, it should be totally easy to replace possibly this outputStream = openFileOutput(filename, Context.MODE_PRIVATE); outputStream.write(fileContents.getBytes()); outputStream.close();

with that String fileNameWithoutPath = Uri.parse(filename).getLastPathSegment(); file = File.createTempFile(fileNameWithoutPath, null, context.getCacheDir());

davigonz commented 5 years ago

I think the easiest way - on Android's API-side would be this https://developer.android.com/training/data-storage/files.html#WriteCacheFileInternal

even if i see, there're some abstraction layers in your code, for someone knowing where the actual downloading (and checking, if already downloaded) is taking place, it should be totally easy to replace possibly this outputStream = openFileOutput(filename, Context.MODE_PRIVATE); outputStream.write(fileContents.getBytes()); outputStream.close();

with that String fileNameWithoutPath = Uri.parse(filename).getLastPathSegment(); file = File.createTempFile(fileNameWithoutPath, null, context.getCacheDir());

Thanks for your suggestion @gutiar-junky , would you like to contribute with that? It would be great

tikidad commented 5 years ago

Hello. I wanted to pile onto this thread and throw my support behind it. I think it would be a great idea to have the app able to stream media in general. Music and pictures both, since oddly it already streams video naturally. I have created my Owncloud as a media hub with the intent to access it on mobile. With the Owncloud Audio player and Gallery apps I can achieve this via Chrome browser but not the android app which would be much better. Full disclosure I am not a dev....Github needs a box that says "User" instead of Collaborator. :-) Since I have this all setup I am absolutely willing to help test or anything else that will help this effort if it becomes viable. Cheers!

michaelstingl commented 5 years ago

@tikidad This issue is about photos.

ownCloud Android app supports streaming of supported video files since early 2017. If you encountered a bug, then please open a new issue.

Related: https://github.com/owncloud/android/issues/592, https://github.com/owncloud/android/pull/1907

For music streaming, please also discuss in another issue to reduce noise.

GomoDD commented 3 years ago

This is a highly requested "feature" (from the user point of view expected way the app should work), Is there any progress on this? Why hasn't this been implemented even tho people are complaining for the past 3 years ... it can't be that complicated.

jesmrec commented 3 years ago

Implementing this feature will require changes in most of the sync engine, that we are currently working.

Rzepaq commented 2 years ago

Hi all, A question and a suggestion if I may. Question: how do I get rid of all the files that Owncloud has downloaded to my spartphone? Can't locate them anywhere. Suggestion: please get this problem solved by differentiateing files available offline from downloaded, and provide solution to remove downloaded files (automatically after use / set time / download to the "downloads" folder). The current state of affairs causes owncloud app to hoard multiple GB of unwanted data without any way to remove them.

abelgardep commented 2 years ago

The current state for downloaded and av offline files could be a little bit confusing.

Removal of av offline files only locally is not allowed. They would be downloaded again, so there is no sense to remove them now and waste resources downloading them again in the next 15 minutes.

Removal of downloaded files is possible. We can remove them just from the local storage. To do that, we select the file and then click on remove, and in the dialog to remove, we would see a "Local only" if it is downloaded. If we select a folder and remove it "Local only", all the downloaded files inside that folder would be removed locally.

We know that at the moment is not easy to handle, and we want to fix that in the short-mid term (We are working on the sync engine atm). We already have some suggestions to fix this. Feel free to write your point of view about this topic here