android icon indicating copy to clipboard operation
android copied to clipboard

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

Open rexbron opened this issue 7 years ago • 15 comments

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

rexbron avatar Sep 26 '18 15:09 rexbron

I am looking into this.

stupidly-logical avatar Oct 01 '18 07:10 stupidly-logical

@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!

jesmrec avatar Oct 02 '18 06:10 jesmrec

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

lefherz avatar Mar 11 '19 12:03 lefherz

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

lefherz avatar Apr 30 '19 13:04 lefherz

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

jesmrec avatar Apr 30 '19 13:04 jesmrec

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 :(

gutiar-junky avatar May 10 '19 09:05 gutiar-junky

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.

jesmrec avatar May 14 '19 10:05 jesmrec

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());

gutiar-junky avatar May 21 '19 14:05 gutiar-junky

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

davigonz avatar May 21 '19 14:05 davigonz

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!

tikidad avatar May 22 '19 17:05 tikidad

@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.

michaelstingl avatar May 23 '19 09:05 michaelstingl

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.

GomoDD avatar Apr 07 '21 20:04 GomoDD

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

jesmrec avatar Apr 08 '21 06:04 jesmrec

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.

Rzepaq avatar Jul 20 '22 21:07 Rzepaq

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

  • Av. Offline files are files that we want to keep synced every 15 minutes and that we consider important for us to be downloaded so we can open them via Documents Provider anytime.

  • Downloaded files are files that were downloaded eventually. We download them explicitly or we just open them and they are downloaded because, at the moment, we can stream just videos.

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

abelgardep avatar Jul 21 '22 08:07 abelgardep