Page MenuHomePhabricator

Offline mode for iOS Watchlist
Closed, ResolvedPublic

Assigned To
None
Authored By
RWambua-WMF
May 2 2023, 7:36 PM
Referenced Files
F37142834: 4.png
Jul 18 2023, 2:10 PM
F37142832: 3.png
Jul 18 2023, 2:10 PM
F37142829: 2.jpeg
Jul 18 2023, 2:10 PM
F37142826: 1.jpeg
Jul 18 2023, 2:10 PM

Description

Support offline display of cached watchlist data if available.

Technical requirements

  1. Watchlist data should be cached in a lightweight way (akin to widgets and talk pages with SharedContainerCache) to the filesystem
  2. On any successful API fetch of the user's watchlist items in the main watchlist list view, replace the cache with this latest fetch. It's not necessary to do any comparison to find the diffs here – just replacing the watchlist cache on success is sufficient.
  3. Ideally this work happens in the Data framework – the Components frameworks should not have knowledge about whether the data it is receiving is freshly fetched or cached content, or even about caching at all.

Presentation details

  1. When the Watchlist list view is presented, perform fetch for user's currently watched article data
  2. If the user is offline (API call fails), display cached data
  3. If no cached data is available, display empty state
  4. If the user is offline, let them perform any change diff taps as usual. We'll rely on those pushed views failing in response to no internet connection rather than disabling user interaction based on Reachability.

Previous description below:


Background

The aim of this task is to enhance the offline functionality of the watchlist feature in the Wikipedia iOS app. This aims to provide a seamless user experience irrespective of internet connectivity, allowing users to interact with their watchlist and view cached articles. This involves ensuring a clear, intuitive interface that informs users about their connectivity status and the last data sync time.

Task

  • To create designs for the iOS Offline Mode behavior
  • To implement the designs into offline capabilities for the iOS Watchlist

Requirements

  • To implement caching, develop a mechanism to store and retrieve the 7 most recently appearing items from the watchlist.
  • To handle no cached items, display a generic error message indicating the unavailability of cached data.
  • To ensure offline access, cache the latest viewed diff and display a persistent banner indicating the user is offline.
  • To provide offline feedback, design a banner displaying "Not connected to the internet" and show the last sync status.
  • To handle edge cases, display appropriate error messages for offline scenarios similar to Android.
  • To allow offline navigation, show cached watchlist items, ensure non-scrollability, and display an offline banner.
  • To disable offline interactions, make the watchlist cards unclickable when the user is offline.
  • To prevent access to unavailable options, disable three-dot overflow menu actions when the user is offline.
  • To disable offline access, gray out and disable the watch selection option in the overflow menu.
  • To inform the user, display a generic error message indicating no internet connection when attempting to access the diff view offline.
  • To support offline searching, implement a search functionality for cached items.
  • To update the offline banner, change the message to "Data connection not allowed" and persistently display it.
  • To determine screen visibility, consult with engineers during the iOS planning meeting and identify the portion displayable when offline.
  • To assess real-time online/offline status, inquire during the iOS planning meeting about using technologies like jQuery for dynamic feedback.
  • Rebecca and Jazmin to first sign off on this

Current Android Watchlist offline mode behavior

  1. When going to view an article The button to add an article to the Android watchlist is still selectable when offline which is confusing to say the least because a user is unsure if an article has been added or not.

1.jpeg (512×259 px, 50 KB)

  1. When offline, this error is displayed to users:

2.jpeg (512×239 px, 8 KB)

  • Ideas for iOS Watchlist offline mode behavior**

1. Pre-caching and caching:
We should cache the 7 most recently appearing items from the watchlist. We should also cache watchlist items that have been recently opened.
If no items have been cached, then display generic error message
Latest viewed diff should be cached in case a user goes offline with banner that person is offline

2. Banner:
A banner displaying that the user is offline should be displayed to say “Not connected to the internet. It can also display last sync status?

3. Default for any edge cases or unplanned/unexpected scenarios:
When offline, an error should be displayed to users just like in android

Scenario: User is offline on a different page and wants to navigate to the Watchlist
Display cached watchlist items
Should be non scrollable past
Should display banner saying, “User is not connected to the internet”
The cards should be unclickable when they user is offline.

3.png (512×238 px, 43 KB)

The three dot overflow options should all be disabled. Therefore when offline users should never be able to go to the diff or any other page
All options should be grayed out and should be unclickable including:

  • Userpage
  • User talk page
  • User contributions
  • Thank
  • Watchlist expiry

Scenario 2 : user is offline looking at an article and goes to the overflow menu to select
The watch selection should be grayed out an unclickable

4.png (512×238 px, 57 KB)

4. Diff
It should show a generic error message when the user is offline to tell the user that they are not connected to the internet similar to the Android Watchlist message:

1.jpeg (512×259 px, 50 KB)

5. Search
Users should be able to search for cached items.

2.jpeg (512×239 px, 8 KB)

References

Related Objects

Event Timeline

LGoto added a subscriber: scblr.
RWambua-WMF renamed this task from Offline to Offline mode for iOS Watchlist.May 16 2023, 5:23 PM
RWambua-WMF updated the task description. (Show Details)
LGoto triaged this task as Low priority.May 23 2023, 6:33 PM
LGoto moved this task from Needs Triage to Product Backlog on the Wikipedia-iOS-App-Backlog board.

Please update this task with a checklist of what tasks need to be completed for this ticket to be considered complete. Think about the tasks section as the output from this task (revisit task structure in 1:1 doc).

Requirements are things like

The app should also clearly show how much storage space each download will require.

That falls under requirements.

Can you make this more concrete? I am not sure what it means:

The app should provide a user-friendly interface for this selection process.

As mentioned in our 1:1 please include details of what should happen when users click actions in the watchlist based on the figma file from Robin. Remember, to include user stories for scenarios of if someone is on a train vs. completely offline. What does the experience look like in those scenarios.

A few thoughts:

To implement caching, develop a mechanism to store and retrieve the 7 most recently appearing items from the watchlist.

Our quickest path to offline mode is to simply persist as a local file the latest watchlist response from the server. This would include all items. Only persisting the last 7 and disabling scrolling would actually be more work for us. Not a lot more, but I don't think we should do it if they could see even more data while offline with less work. The additional storage space for all items (max 500) is negligible.

To disable offline interactions, make the watchlist cards unclickable when the user is offline.
To prevent access to unavailable options, disable three-dot overflow menu actions when the user is offline.
To disable offline access, gray out and disable the watch selection option in the overflow menu.

Our general pattern has been to allow all interactivity, but any button that triggers a network call would then display a "No Internet Connection" banner. Just another potential area of scope cut as actively listening for network connectivity and disabling UI would require more work and is a place for state bugs to be introduced.

To handle no cached items, display a generic error message indicating the unavailability of cached data.

I would encourage all messaging to be a simple "No internet connection" statement - a user doesn't need to know the details about caching, in my opinion.

To assess real-time online/offline status, inquire during the iOS planning meeting about using technologies like jQuery for dynamic feedback.

We have a reachability listener that we can tap into on iOS that allows us to display a "No internet connection" banner as soon as the connection drops. It is notoriously unreliable though, which is why I would discourage disabling UI in reaction to it. But we can display a banner.

I agree with all Toni's points:

  • Lightweight persistence of latest watchlist response, displayed if offline
  • Don't disallow user interaction if offline – instead, continue with pattern we use in rest of app: allow user to perform actions, display failure/no internet connection if those actions fail on their respective views

Additionally:

  • I don't think displaying last sync time/date in any offline views here is worth the engineering effort. It's additional state management/logic for something whose value I'm not clear is completely worth it in this case.

@Dmantena can you update this ticket based on what we discussed in Planning. You should take the approach you and Toni described.

@Dmantena can you update this ticket based on what we discussed in Planning. You should take the approach you and Toni described.

@JTannerWMF Sure thing – updated.

I worked on the caching piece of this in the filters Data PR - https://github.com/wikimedia/wikipedia-ios-data/pull/6

Once this is merged, I think most all that will be left will be triggering the "No Internet Connection" banner at the right times.

Aklapper renamed this task from Offline mode for iOS Watchlist to Removing inactive task assignee who's not with WMF anymore. (WMF Mobile Apps team: Please do so as part of team offboarding steps - thanks.).Aug 24 2023, 4:59 PM
Aklapper removed RWambua-WMF as the assignee of this task.
Aklapper renamed this task from Removing inactive task assignee who's not with WMF anymore. (WMF Mobile Apps team: Please do so as part of team offboarding steps - thanks.) to Offline mode for iOS Watchlist.Aug 24 2023, 5:09 PM
Aklapper removed a subscriber: RWambua-WMF.
Dmantena added a subscriber: ABorbaWMF.

@ABorbaWMF Should be testable on TestFlight in main app target: Wikipedia 7.4.2 (Build 2654)

This one looks good on 7.4.2 (2654) and 7.4.2 (2658).

However, I did notice two minor issues that may be by-design, but I thought were a little confusing:

First, if the user is viewing an article, the device goes into offline mode, the user taps the menu and selects Watch, then the user is presented with an offline error after choosing the watch duration. It may be better to present the offline message before presenting the watch duration.

Second, if the user is viewing a saved article while offline and the user taps the menu, the Watch option is not present. The user may expect the Watch option to be present here and perhaps grayed out.

Please let me know if there should be tickets created for any of the issues described above.

This one looks good on 7.4.2 (2654) and 7.4.2 (2658).

However, I did notice two minor issues that may be by-design, but I thought were a little confusing:

First, if the user is viewing an article, the device goes into offline mode, the user taps the menu and selects Watch, then the user is presented with an offline error after choosing the watch duration. It may be better to present the offline message before presenting the watch duration.

Second, if the user is viewing a saved article while offline and the user taps the menu, the Watch option is not present. The user may expect the Watch option to be present here and perhaps grayed out.

Please let me know if there should be tickets created for any of the issues described above.

@ABorbaWMF Thanks for the note. While we can always improve the experience in the future, this is expected behavior. Constructing the article toolbar will fail to add the watchlist toolbar items if requesting the user's watchlist status fails (aka the user is offline, or their connection is bad). This occurs whether the article is saved offline or just being browsed in the article view itself. We allow the user to select the watchlist toolbar action, as well as navigate between pages, and if the network action fails we display a toast with the info we have available. This pattern is the balance we've applied here and other places in the app, as we can't always positively know an API call will fail or not until we actually make it.

Up to you @JTannerWMF but I think we should be comfortable with this balance for our first release.