XF 2.2 Push notifications - No supporting on this device

Scandal

Active member
I'm not sure when the problem starts, but I can't enable push notifications on my xF2.2 board.

On admin panel shows that my server supports them (and some time before they were working as expected).

Today I upgraded my board to xF2.2 and enabled PWA, when I realized that I can't enable push notification on account/preferences user control panel.

The button is disabled and says that is not supporting on my device.

I tried with Firefox (Windows 10 PC) and Chrome for Android (on my Android smartphone).

Any idea what could I check to detect the bug? :)
 

Mike

XenForo developer
Staff member
So if the button shows up, that generally means the server side is fine. Other than that, the detection does generally come down to the browser capabilities working as expected.

I would run a file health check to confirm everything is in position as expected. If it is, then I'd check the browser console for error messages.
 

Scandal

Active member
So if the button shows up, that generally means the server side is fine. Other than that, the detection does generally come down to the browser capabilities working as expected.

I would run a file health check to confirm everything is in position as expected. If it is, then I'd check the browser console for error messages.
oh yes, you're right. I had forgot that the button is generated after page load.

Well, this is what I get on console:
navigator.serviceWorker.register threw an error.
This is from core-compiled.js:
JavaScript:
    XF.PushToggle = XF.Element.newHandler({
        options: {},
        isSubscribed: !1,
        cancellingSub: null,
        init: function() {
            XF.Push.isSupported() ? "denied" === Notification.permission ? (this.updateButton(XF.phrase("push_blocked_label"), !1), console.error("Notification.permission === denied")) : this.registerWorker() : (this.updateButton(XF.phrase("push_not_supported_label"), !1), console.error("XF.Push.isSupported() returned false"))
        },
        registerWorker: function() {
            var a = this;
            XF.Push.registerWorker(function() {
                a.$target.on("click", XF.proxy(a, "buttonClick"));
                c(e).on("push:init-subscribed", function() {
                    a.updateButton(XF.phrase("push_disable_label"), !0)
                });
                c(e).on("push:init-unsubscribed", function() {
                    a.updateButton(XF.phrase("push_enable_label"), !0)
                })
            }, function() {
                a.updateButton(XF.phrase("push_not_supported_label"), !1);
                console.error("navigator.serviceWorker.register threw an error.")
            })
        },

Just some tips where to investigate? :)
 

Mike

XenForo developer
Staff member
Looking at the site you've listed for your license, the service worker appeared to be registered as expected in Firefox and Chrome for me, so this may ultimately be a browser configuration option or extension which is blocking the service worker. You might want to confirm on a fresh profile to potentially try to eliminate that issue.
 
Top