Disable push notifications in Safari (#2889)

This commit is contained in:
Alexander Zinchuk 2023-03-30 18:26:05 -05:00
parent 17e14172e5
commit 1103f83113

View File

@ -28,7 +28,7 @@ import {
selectNotifySettings, selectNotifySettings,
selectUser, selectUser,
} from '../global/selectors'; } from '../global/selectors';
import { IS_SERVICE_WORKER_SUPPORTED, IS_TOUCH_ENV } from './windowEnvironment'; import { IS_SERVICE_WORKER_SUPPORTED, IS_TOUCH_ENV, IS_SAFARI } from './windowEnvironment';
import { translate } from './langProvider'; import { translate } from './langProvider';
import * as mediaLoader from './mediaLoader'; import * as mediaLoader from './mediaLoader';
import { debounce } from './schedulers'; import { debounce } from './schedulers';
@ -43,7 +43,8 @@ function getDeviceToken(subscription: PushSubscription) {
} }
function checkIfPushSupported() { function checkIfPushSupported() {
if (!IS_SERVICE_WORKER_SUPPORTED) return false; // Disable push notifications in Safari until VAPID keys are implemented on the server
if (!IS_SERVICE_WORKER_SUPPORTED || IS_SAFARI) return false;
if (!('showNotification' in ServiceWorkerRegistration.prototype)) { if (!('showNotification' in ServiceWorkerRegistration.prototype)) {
if (DEBUG) { if (DEBUG) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console