Page MenuHomePhabricator

[Tech side] As a user I want to manually clear the app cache
Closed, ResolvedPublic

Assigned To
Authored By
Josve05a
Mar 31 2016, 12:55 PM
Referenced Files
F7633444: Simulator Screen Shot Apr 19, 2017, 7.18.15 AM.png
Apr 19 2017, 11:18 AM
F7619417: cache_icon only.pdf
Apr 18 2017, 10:11 PM
F7619418: cache_yellow.pdf
Apr 18 2017, 10:11 PM
F7619419: Settings.png
Apr 18 2017, 10:11 PM
F7609763: Simulator Screen Shot Apr 18, 2017, 9.34.14 AM.png
Apr 18 2017, 1:35 PM
F7598277: Simulator Screen Shot Apr 17, 2017, 4.31.01 PM.png
Apr 17 2017, 8:31 PM
F7597897: settings-dev.pdf
Apr 17 2017, 8:13 PM
F7597920: settings-about.pdf
Apr 17 2017, 8:13 PM
Tokens
"Piece of Eight" token, awarded by Nemo_bis.

Description

Basic requirements:

  • Add a row to settings beneath the Notifications row with "Clear cached data"
  • Pop a confirmation asking "Clear cached data (this does not delete your saved pages)?"
  • If user confirms, delete all locally cached items EXCEPT saved pages data and current feed data.

Bonus points: show cache size - "Clear cached data (NN MBs)"

@cmadeo to provide icon and amend the above as needed...

Event Timeline

JMinor triaged this task as Lowest priority.Apr 5 2016, 8:41 PM
JMinor subscribed.

Lets add a button to Settings.

"Clear local data", which should delete all locally saved caches and clear the history/saved pages and reset the feed to install state.

JMinor raised the priority of this task from Lowest to Low.Jun 27 2016, 10:27 PM

Caches can get VERY large with regular usage (1GB+). Need to address this soon-ish. If users are not saving pages we should not be saving content locally except as needed to make loading the feed performant.

Put this as an additional setting row under the Notifications setting.

Do an initial spike to investigate whether we can clear the SDWebImage cache without removing images for saved articles.

Another implementation note - ensure NSURLCache is cleared as well (this can be fully cleared)

JMinor renamed this task from As a user I want to manually or automatically clear the app cache to As a user I want to manually clear the app cache.Feb 9 2017, 8:12 PM

Is there a reason why the SDImageCache is in <Container>/Cache and not <Container>/Library/Caches?

I believe the latter will be automatically cleaned up by the OS and ignored by iCloud backup, which I think is what we want.

cc @JoeWalsh

iirc it's because we don't want the OS to automatically clean up images which are associated with saved articles...

Hm strictly speaking those wouldn't really be "cached" images anymore, and should probably be stored in the documents directory. I'll look into how article saving works and see what I come up with

It might be worth removing SDWebImage entirely and using the same NSURLCache that WKWebView uses for temporary caching (IIRC, it's the same cache we set to [NSURLCache sharedCache]). For permanent caching, we could maintain our own folder setup in the documents directory. This way, we'd no longer be double-storing temporarily cached images.

@cmadeo could I have the icon for the clear cache setting? Here's an example of the dev settings & about icons (B&W only PDF, they're tinted in the app)

What if we just show the cache size in the confirmation?

Simulator Screen Shot Apr 17, 2017, 4.31.01 PM.png (1×750 px, 127 KB)

@JoeWalsh I like showing the cache size in the confirmation. Could we have the two options presented side by side instead of vertically? "Cancel" and "Clear cache" if the string is too long?

Updated. We don't have control over that presentation since it's a system dialog. If the string is longer in other languages, it'll be stacked vertically.

Simulator Screen Shot Apr 18, 2017, 9.34.14 AM.png (1×750 px, 126 KB)

@JoeWalsh Let me know if you need a different version of the icon (icon only and icon with background attached below the mock).

Settings.png (944×375 px, 71 KB)

JoeWalsh renamed this task from As a user I want to manually clear the app cache to [Tech side] As a user I want to manually clear the app cache.May 4 2017, 7:07 PM