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.
Here is the PR, I add how to test and A screen record show how it works. WIP: Dev service worker by qinyuhang · Pull Request #1417 · online-go/online-go.com · GitHub
Very cool! Does the service worker do anything yet? I’d be happy to test, but not really sure what to look for
By the way, have you found this PR? Added the PWA service worker. by klueq · Pull Request #720 · online-go/online-go.com · GitHub
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.
Sorry for the code comment, it’s mostly reference from a open source tutorial, I will change the Chineses comment to English ASAP
Man that Charles stuff looks pretty nifty. Haven’t tried it yet, but if I can get it working, I’ll finally be able to test on my non-dev devices!
Yes, it is complicated.
I explain how the test work. Maybe this will help you.
Sorry for this stupid question, but how an interface for a server for playing online could be working offline?
I must be missing something.
Stuff you’ve already visited gets cached I guess. OP posted a demo video in the PR: https://user-images.githubusercontent.com/6239057/110064267-b97e3a80-7da7-11eb-8c41-b22d81fa11c2.MP4
Probably not useful for playing games and such, but I imagine it helps in returning to where you left off, which is actually useful.
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.
I already have that:
That’s quite easy: from browser’s options "Add to home screen "
Adds an icon which opens the site in some kind of “full screen” mode, which is even better.
So it does! Thanks a lot Lys! I just added it now
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.
All sorts of great stuff.
My #1 wishlist item is push notifs. But that’s well beyond the scope of the current PR
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)