yellowbluesky / PixivforMuzei3

Best Pixiv plugin for Muzei 3
GNU General Public License v3.0
174 stars 15 forks source link

Stop storing images to private storage when store into public storage is enabled #137

Closed KawaiiZapic closed 3 years ago

KawaiiZapic commented 3 years ago

I want to review every images downloaded so I won't enable clear cache,and I wanna to share images to my friends so I enabled store image to public storage. Is there any problem to read images from public storage directly?
I think is a good way to reduce storage space, or there are a lot of duplicate images in my device.

yellowbluesky commented 3 years ago

Hi there, thanks for raising/suggesting this issue. I'll have a look at things now

yellowbluesky commented 3 years ago

How downloadFile() currently works: https://github.com/yellowbluesky/PixivforMuzei3/blob/0e1a7c2ad2089596c9b46df50dfcd6975a1100a7/app/src/main/java/com/antony/muzei/pixiv/provider/PixivArtWorker.kt#L227-L228

  1. Download the file first to an private location. This always happens
  2. Check if the user has selected the option to save the image to external storage
  3. Do some checks, then copy the image from the internal storage to external storage.

I can change the code so that it only ever downloads to one place.

I'll try this out and will let you know of the result

yellowbluesky commented 3 years ago

Behaviour changed. Assuming a situation where "Store into external storage is checked"

Previously, copies of the artwork could be found at:

Now:

So far, I've removed one copy.

I'll see if I can also get rid of the artwork copy at /data/data/com.antony.muzei.pixiv. For this one I'm not so sure. I thought that overriding Muzei API's openFile() function in the MuzeiArtProvider() class would work, but it doesn't appear to be working??

yellowbluesky commented 3 years ago

Feature released to production.

Commit added in 8d4e975fb12cfc985e464b40bf27a975aee59786

The copy made to /data/data/com.antony.muzei.pixiv cannot be avoided, this is somethign that Muzei does