Skip to content

SPIKE: Elm PWA - Basic Offline Support #254

@nelsonic

Description

@nelsonic

How much use is a "keep track of all the things" App that doesn't work offline?
offline
We hypothesize that an App meant to help people capture everything on their mind and get stuff done must work offline.

With this in mind, we need to do a Spike1 to explore using Elm for a Progressive Web App (PWA).

We can only test "offline support" by having some sort of "online" functionality thankfully we already have the "online" counterpart in the form of the capture workflow in dwyl/app-mvp-phoenix

Objectives

  • Build a super basic Elm App with a Phoenix back-end (for storing data) /elm-pwa-example
    we only need the "capture" functionality from Sprint Zero with the most basic textarea

    There's a new repo /elm-pwa-example but we will import all the code from dwyl/app-mvp-phoenix once the Google Auth PR has been merged so we have that as a starting point. The reason for having a separate "spike" repo is to "snapshot" the basic PWA functionality in isolation but not have to re-write any of the auth or capture code from scratch.

    • Saving the content of the textarea should:
      • Update the Model (fairly obvious)
      • Should save Model.items to localStorage so that the page can be refreshed without losing the content see: https://elmprogramming.com/saving-app-state.html
      • if the device is online save the item to the backend.

      We may need to write some JS to handle this if we can't do it in Elm.

  • Turn phone to "airplane mode" ✈️ (wifi and cellular radios disabled)
  • Should display an icon signal_wifi_off in UI to inform the user they're offline.
  • Should still be able to view the existing item when offline.
  • Should be able to create a new item while offline
  • Items created offline should sync to backend when re-connected.
  • Meet the criteria specified in Google's PWA Checklist: https://developers.google.com/web/progressive-web-apps/checklist

Todo

The PWA does not have to use Elm UI, but it would be a good "bonus level" to attempt to use it.
See: dwyl/learn-elm#145

We have collected a few useful links on Elm PWAs dwyl/learn-elm#54
including a complete application: https://github.com/rl-king/elm-hnpwa
We should be able to get started quite quickly by combining the work done in our dwyl/app-mvp-phoenix
with this https://github.com/opvasger/elm-pwa by following this guide: dwyl/learn-elm#54 (comment)

Constraints

  • The Spike does not need to have any fancy functionality, the purpose is just to test the idea.
  • We don't want to spend more than 3 days on this, so pace yourself accordingly.
  • Must include all steps taken so that someone else can re-produce the app
    i.e. we aren't interested in just the "end result" we want to know exactly how it was done.
    If you're in any doubt what step-by-step instructions look like, see: /todo-list-javascript-tutorial
    The point of a Spike1 is to share the knowledge acquired with the team
    (and in our case the wider @dwyl community)

1https://en.wikipedia.org/wiki/Spike_(software_development)

Metadata

Metadata

Assignees

Labels

discussShare your constructive thoughts on how to make progress with this issuehelp wantedIf you can help make progress with this issue, please comment!spikeThe simplest possible experiment to explore potential solutions to a problemtechnicalA technical issue that requires understanding of the code, infrastructure or dependencies

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions