Open uruvelakassapa opened 1 month ago
Just want to put this idea out there: in my head it makes sense that offline mode is enabled by default, and if the user really doesn't want it he can turn that setting off. It is not a lot of data anyway, and a large portion of it is being stored already now to make the searching through content available.
Let me know if this makes sense.
Either way, a better status indicator that the site is "available offline" would be nice, whatever the default setting is.
@bkhpanigha what do you think?
@interested-in-dhamma makes sense to me. Only question is that if that's technically possible or that in fact the user needs to do something to activate the service worker.
Just want to put this idea out there: in my head it makes sense that offline mode is enabled by default, and if the user really doesn't want it he can turn that setting off. It is not a lot of data anyway, and a large portion of it is being stored already now to make the searching through content available.
Let me know if this makes sense.
Either way, a better status indicator that the site is "available offline" would be nice, whatever the default setting is.
@bkhpanigha what do you think?
I think downloading it by default would make sense for people accessing it through unlimited home internet, but I know from experience that monks living in Asia could be running a data plan of only a few dozen MBs at times. But if the difference between what's already necessary to run search and the full download is not much, then it might still be reasonable.
@bkhpanigha I was wondering about the data scarcity issue for some users too.
I believe we have to ensure that the same data is used for both search and offline mode because by default they are stored in seperate locations. E.g. the comments page will download all comment files by default when used in "online" mode and will only use the files stored for offline mode by the service worker when there is no internet connection.
~~@uruvelakassapa I was thinking about how to implement #170, right now it looks like the translation files are stored as is for the search (e.g. "snp5.9:1.1":"‘all they explained to me before,’ "
) and we would need to scrape only the translations without the first part.
So I see two solutions, either do it before storing it in the database or doing it during the search, the former would be ideal performance wise, but it will hinder what you are planning to do here, wouldn't it?~~
After further evaluation I believe we have no choice but to use the current "python/generated/suttas-database-data.json" file for link generation.
@Reptilioo I haven't had the chance to look at how search has been implemented. I believe there are ways to grab all files via the service worker and have it cached by default. Not sure if that answers your question, but either way feel free to implement it however you wish and I'll work with/around it.
Also I'll only have access to a laptop for 4 days over then next 4 months (or longer) so I'll likely only be able to finish the settings panel this year
There is a progress bar implemented for the comments page. Perhaps we can reuse that for offline mode. Sometime I dont know if it actually is downloading or errorring out so a progress bar might help with figuring that out.
Edit: as per @interested-in-dhamma comment, might be good to have an indicator as well to confirm that indeed the site is available offline