AccelerateNetworks / fusionpbx-webtexting

GNU Affero General Public License v3.0
0 stars 0 forks source link

Push Notifications not working in Chrome on Production #24

Closed danry25 closed 7 months ago

danry25 commented 8 months ago

Chrome doesn't show the push notification prompt due to this error in production web texting.

Uncaught (in promise) DOMException: Push subscriptions that don't enable userVisibleOnly are not supported.

image

thefinn93 commented 8 months ago

whoops! stupid chrome requirement, fix here is very easy. add userVisibleOnly: true to https://github.com/AccelerateNetworks/fusionpbx-webtexting/blob/main/webtexting.js#L48 and it should work. No frontend rebuild required. When fixed the line will look like this:


subscription = await registration.pushManager.subscribe({ applicationServerKey: convertedVapidKey, userVisibleOnly: true });
danry25 commented 8 months ago

Hmm, I tested this in Chromium (Version 116.0.5845.180 (Official Build) built on Debian 12.1, running on Debian 12.2 (64-bit)) but it doesn't seem to resolve the DOMException, getting the same userVisibleOnly error.

image

dunkeltron commented 7 months ago

There's another place you need to add the userVisibleOnly:true option on line 105 of webtexting.js Before: const state = await registration.pushManager.permissionState(); After: const state = await registration.pushManager.permissionState({userVisibleOnly:true});