Hi every one,
I saw we have discuss about PWA but the implement of PWA in online-go.com is on step 1 by adding manifest.json to the site.
So I did some code to add service worker to online-go.com. How could I get some one to test these codes?
The first commit is very basic, it just add resource cache, make online-go.com can work offline. But I hope some one can help test it.
UPDATE March 5th GMT+8
I managed to inject the sw.js to my iPhone’s installed OGS PWA app. It works fine. I post the screen record on github, any one can check it. I record it on Flight Mode on, so there is no internet connections at all.
Just a heads up… Someone has tried to add a service worker in the past, but it didn’t really do anything so it didn’t make it in. It would probably be good if you have more answers to the questions that were raised in that thread.
It looks like your PR is more featureful than the previous one I’d be happy to test if you tell me what to look for. I don’t know what a resource cache does. Maybe let’s me close the app and re-open where I left off?
One other thing- idk if you wrote all these or copied it from somewhere else, but I noticed a lot of comments in Chinese. Since the codebase is mostly in English, I’m not sure how helpful these comments will be to other contributors. Maybe consider commenting in English as well if you think the comments are important.
hi thanks for telling me the old PR,I just read it,the PR says it’s “dummy service worker”, I found it just write one line of code with do anything but just register a empty function to service worker’s fetch event. My commit is trying to add cache so the installed web app can run offline. I will try do some test on my laptop, I’ll report progress in this topic.
I love this! I’ve looked into service workers before and honestly even just having one so that Android users can add a shortcut to OGS as an icon would be positive! This forum uses a service worker for that same thing and it has definitely increased the amount that I check and use it.
You can add an icon now! Biggest issue is that it opens a new browser tab each time (at least it does for me, using chrome). I think a service worker will fix that. At least discourse (OGS Forums) never opens new tabs.
Yeah, for me it doesn’t look as nice as the service worker icon for the discourse forum. Also, with a service worker, chrome on Android automatically suggests creating a homescreen icon to all visitors (so no need to know how to do that from the chrome menu)
Also it always opens to the home screen, not your last screen, a service worker would let you always start in chat or play or a group or observe games or anywhere you want.
I read Google API docs about push notification, it is kind complicated, I’ll try figure out how to implement, but I have to borrow an Android phone first. I guess it will take some time.
That would be glorious thanks for looking into that!
TBH I think it’s okay to wait on additional features anyway. We don’t even know if this will be merged yet and it would be good to know if the maintainer (anoek) is on board.
From memory his only objection last time was that they tried to add the framework without any features, presupposing that if the framework there people would just decide to build on it.
Since this new proposal is actually coming with new features both included and planned, I think it likely stands a much greater chance of getting through.
Oh yeah, I definitely think this has a higher chance of getting in. I’m just not trying to pressure OP into adding additional features before the original PR is approved (small PRs and all that)