Purple App Experience

Offline behaviour

8min

Purple Apps



Summary

Purple Native apps still work when your device isn't connected to the internet. However, there are some limits to what you can do without an internet connection. This article explains offline behaviour and how you can define an offline view to let your users know that they are currently not online while using your app.

Offline Behaviour in Purple Apps

Purple Native Apps still work even if your users' device isn't connected to the internet. However, there are some limits on what you can do without internet connectivity.

Here are the basics:

First time usage of the app

The first time using the app, the user needs to be connected to the internet. Once something in the app has been viewed, it's cached so it can be viewed again without an internet connection.

Sign in/out

When signing in or signing out, the cache is cleared, and content will disappear or queries will not be resolved. This happens because some options within the app change depending on the login status.

When trying to sign in or sign out in offline mode, it's likely that the user won't be able to see views while staying offline.

Search

Some searches won't work offline unless you've already looked at them online at least once, even if you set them to only show things you've saved.

Downloaded Content

Define offline views

To ensure consistent usability while being offline, we recommend creating a view that displays all content that is completely or - depending on your desired behavior - partially available for offline usage.

To ensure your users can easily find this view, you can trigger a message if the device is online and link directly to the aforementioned view.

Downloaded Content View

This view may show content you've explicitly saved and content you've viewed online.

Downloaded Content Behaviour

  • Content that was not downloaded explicitly is available only up to the point where it was consumed before, e.g. an issue will only be displayed up to the page that it was read before.
  • We do not explicitly download thumbnails, so they will only appear if the user has had a look at the downloads page before going offline.

Here's how to do that:

1) In Experience Builder -> views.json, you can create a view to display downloaded content, including partially downloaded elements:

Views.json in Experience Builder
Views.json in Experience Builder


Note that the actual value of the emptyMessage is controlled via messages.json. For further details on that, see messages.json: static texts.

Offline notification and link

2) You can now create a message that will be triggered if the device is offline. To ensure maintainability, this should be done in two steps:

a) Creation of a view with the desired message and behaviour. Not depicted, but possible is to add further tracking parameters to that view as well (see Configure views for tracking for details). You are free to add CSS accordingly to style that part to your need.

Document image


b) Inserting that view into any other view where you want to display the message

Document image


With this approach, you can make significant changes to the message without manually altering many views. You also get the freedom to integrate other elements that you trigger on specific conditions.