We have discussed two approaches to fetching & invalidating cached articles. Our ideal strategy would:
- Reduce or eliminate redundant article downloads (e.g. downloading the same revision of the article we have locally)
- Handle the offline case gracefully (i.e. not show a banner viewing a cached article offline)
- Try to honor (implied) promises to the user about content "freshness":
- As a user with a good internet connection, I should never see content that's significantly outdated, so that I can get the latest information and reap the full benefit of Wikipedia's active editor community
- A a user with a poor or nonexistent internet connection, I should be able to view the last revision of an article that I downloaded, so that I can have as full of an experience as possible while offline
New proposed algorithm
In a nutshell, never download content unless the user asks us to. It's our job to let users know when the content they're viewing is out of date, and empower them to decide (given their current internet connection and/or data restrictions) whether or not to download it.
Spec (Article View)
Scenario: Online w/ warm cache
Background:
Given $article is cached
And my connection is online
And there's a newer revision of $article
When I navigate to it
Then I should see locally stored revision of $article immediately
And I should eventually see a prompt to tap the refresh button to see the latest revision
And there's no newer revision of the article
When I navigate to it
Then I should see locally stored revision of $article immediately
And I should not see any banners
And the app can't retrieve the current revision of $article
When I navigate to it
Then I should see locally stored revision of $article immediately
And I should see a "warning" banner that we failed to determine the current revision of the article
Scenario: Offline w/ warm cache
Given $article is cached
And my connection is offline
When I navigate to it
Then I should see locally stored revision of $article immediately
And I should not see any banners (suppress offline warnings when content is cached)
Open questions
- How exactly should we indicate in the UI that the revision of the article the user is seeing is out of date and/or prompt them to refresh?
- If revisions change very frequently with very little change in the article, will this approach be too noisy?
- Should we indicate the user is browsing the article offline if we fail to fetch the latest revision?
Legacy algorithm
Spec (Article View)
Scenario: Online w/ warm cache
Background:
Given $article is cached
And my internet connection is online
When I navigate to it via (search-result|link)
Then I should see a blank view with a progress bar
And I should eventually see the latest version of $article
When I navigate to it via (*not* search-result|link)
Then I should see the $article content immediately
And I should not see any error banners
Scenario: Offline w/ warm cache
Background:
Given $article is cached
And my internet connection is offline
When I navigate to it
Then I should see the cached content
And I should not see an error banner
This should also address the issue where users see an offline error banner when viewing a cached article:
Steps to repro
- Save a featured article
- Enable airplane mode
- Tap on featured article
Expected results
No banner
Actual results
Offline banner: