Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline functionality #14

Open
Victor239 opened this issue Apr 29, 2021 · 4 comments
Open

Offline functionality #14

Victor239 opened this issue Apr 29, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@Victor239
Copy link

It would be great if the headlines and comments were cached so that if you open the app whilst offline you can still read them. If online however it would automatically refresh as per usual.

@Mosc
Copy link
Owner

Mosc commented May 1, 2021

Yup, would be nice. Can you tell me a bit more about your use case? Do you think the app should just cache the responses of all the pages you've visited, or should it also have a way to greedily retrieve comments of stories you have not opened (yet) to allow for a more fully-featured offline experience?

@Victor239
Copy link
Author

My usecase is reading HN whilst I have no internet access due to being on a train underground, which is up to an hour on certain days.

Just caching all headlines + the comments of visited pages would be sufficient for me really.

There's a similar option on a Reddit app I use to schedule retrieving all comments and posts of a subreddit, but I don't use it because I don't feel a need for it to download so many posts from so many subreddits at least once a day. With HN it's far less posts so maybe in this case I might enable it if it were an option, not sure though.

@thelazyoxymoron
Copy link

Chiming in to say that I'd love to see this getting implemented. My use-case would be similar to Victor239, but I'd prefer the ability to schedule download all posts and comments (maybe give a configuration option to select how many stories does the user want to save for each category). Since this is all text, caching would not put a whole lot of dent into the storage space also.

Thanks for building this app btw! I just came across it on Fdroid, played around with it a bit and instantly fell in love. Kudos! 💯

@Mosc
Copy link
Owner

Mosc commented May 19, 2021

Offline functionality has been implemented in db8f65d and 1260819. The app will cache every successful HTTP GET request during normal use for a period of 7 days. When any HTTP error occurs (which happens not only when the user is offline, but also when, for instance, the Hacker News server is down) this cache will be used as a fallback. The relevant item will gain an icon to indicate it's pulled from the cache. In addition, if the app detects that the user is not connected to any network, a banner will be shown to indicate that information may not be up-to-date. I'll release a new app version that includes this change soon.

I'm still working on the best way of exposing the preloading part that @thelazyoxymoron requested. A relatively easy way would be to make it a manual action accessed from the menu:

Scheduling is an option, but introduces a number of additional complexities:

  • How frequently do we run the preloading task? And at what time? Is it okay to run on a metered connection?
  • Although the app is currently only released for Android, I'd like it to work as well as possible on every platform that Flutter supports. Scheduling would appear to be limited to Android and iOS through something like workmanager. The iOS part of that provides basically no customization. flt_worker is a promising alternative.
  • Apparently some device manufacturers require user permission before the app can autostart after reboots.

@Mosc Mosc added the enhancement New feature or request label Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants