online-go / online-go.com

Source code for the Online-Go.com web interface
https://online-go.com/
GNU Affero General Public License v3.0
1.24k stars 345 forks source link

Make browser notifications stay visible until dismissed #2208

Open David263 opened 1 year ago

David263 commented 1 year ago

I'm frustrated when OGS game notifications are missed because I don't happen to be looking at my monitor during the three seconds that the notification is shown.

Describe the solution you'd like This can be done when the notification is first created by setting the requireInteraction option to true in the options object of the Notification() constructor.

Describe alternatives you've considered I've considered suicide, but concluded that it would be too extreme a response. Also, it would not solve this problem for other OGS users.

Additional context Chrome Version 111.0.5563.112 (Official Build) (64-bit), Windows 10 Home, laptop.

anoek commented 1 year ago

So I implemented this with 5b4fc19 but as far as I can tell, neither chrome nor firefox support it. Chrome might support it on windows, but I haven't tested it.

If you go to https://online-go.com/settings/general you will see an option to turn it on. I would be curious to hear back whether it works for you in chrome on windows or not, if it doesn't I'm going to probably remove the "feature" entirely as being non implementable to avoid confusion in the settings page.

David263 commented 1 year ago

Thank you so much! I have turned on the new option, and will let you know. But, currently, I'm not receiving ANY "your turn" notifications from OGS at all. For awhile, I was getting repeated notifications that the same game was ready to be played, and now I get no notifications at all. I don't think I changed any of my settings other than suppressing "banners" on Chrome to stop the repeated notification bug.

Do you have any way to debug this stuff with alpha or beta testers, rather than just with me? There might be something wrong with my browser or my OS.

anoek commented 1 year ago

Repeat notifications should no longer happen, but your turn notification certainly should - and do on my test environment.

https://beta.online-go.com/ is the test server if you are up for experimenting and playing. It's a completely separate system so you'll need to create a new account (or multiple accounts if you want) .

David263 commented 1 year ago

I just received a 'my turn' notification for a game, and it stayed on the screen for a few seconds. But when I used my keyboard to report success, it disappeared. I'll wait for another notification and report what happens here.

David263 commented 1 year ago

I just received a notification for game https://online-go.com/game/52714549, but it only stayed on the screen for about 5 seconds, then disappeared. Not good.

I've made a Beta account. How do I set up a game with Computer so that I will receive a notification that it is my turn?

anoek commented 1 year ago

The easiest way is to open up a second browser, or a private / incognito tab, create a separate user, and challenge yourself that way.

You could theoretically do it with a bot too, but you'd have to make a move and navigate away from the page before the bot responded.

However, I don't imagine you'll see anything different, I suspect this feature is simply no longer supported. It was an experimental feature and never supported by Firefox, I suspect Chrome dropped at some point to combat sites from spamming notifications that the user had to do something with, drumming up those fake clicks and whatnot.

David263 commented 1 year ago

If browsers have decided to make notifications always last 4 or 5 seconds, to reduce possible virus installation clicks, then they are only useful while we are actually sitting at our computer. So I guess the notification solution that OGS should push for 'your move' is email. Email is guaranteed to be seen within a few days, worst case, and within a couple of minutes, best case (I have my email client set to refresh every 2 minutes). We'll have to forget about notifications for all but Live games. Blitz games are too fast for notifications, and Correspondence games are too slow. What do you think?

David263 commented 1 year ago

The only other possibility is explicit asynchronous JavaScript code on OGS pages that does its own notifications using Web Extension functions specific to the detected browser. That can be done, but is a major project. I've done something similar (for timed local notifications) using Firefox extension code, so maybe I could volunteer to write the basic coding with a standardized interface to OGS? The user would see a request for enough permissions for this to work, when they enable notifications from OGS. oops, maybe this solution would require installing an actual browser extension?

anoek commented 1 year ago

Interesting, well if that's something you want to take on you might make some folks happy.

Tagging as a related commit to the attempts here: 5b4fc19 and 643c8e1

David263 commented 1 year ago

I didn't understand "Tagging as a related commit to the attempts here: https://github.com/online-go/online-go.com/commit/5b4fc19e5f0a58494dc77226c5eb18bdb540e76e and https://github.com/online-go/online-go.com/commit/643c8e12f44c27ade5235dea55b9efdf90a639c9"

I've tried to learn GitHub, but failed. GreenAsJade has been helping me to come up to speed as a developer, but it's been very slow so far. Sorry.

anoek commented 1 year ago

That's just me putting references in this issue for things we tried, just logging for historical reasons, and in case something becomes clear as to why it didn't work or something like that.

anoek commented 1 year ago

(P.S. the better way of doing would have been if I had just tagged the issue #2208 in the commit message, it would have shown up nicely in github.. but I forgot)