From b249212eb20f5ee1ec0a79303b1633861c584a18 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 8 Jul 2021 18:00:50 +0300 Subject: [PATCH] Do not show error when service worker is not available on mobile --- src/util/setupServiceWorker.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/setupServiceWorker.ts b/src/util/setupServiceWorker.ts index 58172ef24..e2d859407 100644 --- a/src/util/setupServiceWorker.ts +++ b/src/util/setupServiceWorker.ts @@ -2,7 +2,7 @@ import { scriptUrl } from 'service-worker-loader!../serviceWorker'; import { DEBUG } from '../config'; import { getDispatch } from '../lib/teact/teactn'; -import { IS_SERVICE_WORKER_SUPPORTED } from './environment'; +import { IS_ANDROID, IS_IOS, IS_SERVICE_WORKER_SUPPORTED } from './environment'; import { notifyClientReady } from './notifications'; type WorkerAction = { @@ -10,9 +10,8 @@ type WorkerAction = { payload: Record; }; - function handleWorkerMessage(e: MessageEvent) { - const action:WorkerAction = e.data; + const action: WorkerAction = e.data; if (!action.type) return; const dispatch = getDispatch(); switch (action.type) { @@ -52,7 +51,10 @@ if (IS_SERVICE_WORKER_SUPPORTED) { // eslint-disable-next-line no-console console.error('[SW] ServiceWorker not available'); } - getDispatch().showDialog({ data: { message: 'SERVICE_WORKER_DISABLED', hasErrorKey: true } }); + + if (!IS_IOS && !IS_ANDROID) { + getDispatch().showDialog({ data: { message: 'SERVICE_WORKER_DISABLED', hasErrorKey: true } }); + } } } catch (err) { if (DEBUG) {