Roznoshchik / Lurnby

A tool for active reading and personal knowledge management
https://www.lurnby.com
BSD 3-Clause "New" or "Revised" License
673 stars 17 forks source link

Offline Mode for web hosted lurnby #8

Open Roznoshchik opened 2 years ago

Roznoshchik commented 2 years ago

Currently lurnby.com doesn't work offline. If trying to access it offline the service worker just shows a standard this app doesn't work offline.

But the idea is that it should also work offline to some degree, although I am not sure exactly how much.

A simple idea is that it should cache the x most recent articles so that you could read them offline. Or it should cache x most recent highlights so that review is possible.

In the case of articles, I think that becomes a bit challenging when figuring out how to also allow highlighting in offline mode. Highlights actually change the text of the article so to create a highlight object, you would need to:

  1. Capture highlighted text
  2. Capture notes added to highlight
  3. Capture any tags/topics
  4. Capture the precise location in the text
  5. Add to some sort of queue that then updates the db when network access arrives.

One possible solution for this is that when creating a highlight while offline, the highlight is created with a temporary ID and then rendered to the screen as normal. A javascript object takes the place of the DB.

Once network functionality is regained and an actual ID is generated by the db, the article text gets updated so that the highlight points to the proper place.