Do not show error when service worker is not available on mobile
This commit is contained in:
parent
d36ac99d18
commit
b249212eb2
@ -2,7 +2,7 @@ import { scriptUrl } from 'service-worker-loader!../serviceWorker';
|
|||||||
|
|
||||||
import { DEBUG } from '../config';
|
import { DEBUG } from '../config';
|
||||||
import { getDispatch } from '../lib/teact/teactn';
|
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';
|
import { notifyClientReady } from './notifications';
|
||||||
|
|
||||||
type WorkerAction = {
|
type WorkerAction = {
|
||||||
@ -10,9 +10,8 @@ type WorkerAction = {
|
|||||||
payload: Record<string, any>;
|
payload: Record<string, any>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function handleWorkerMessage(e: MessageEvent) {
|
function handleWorkerMessage(e: MessageEvent) {
|
||||||
const action:WorkerAction = e.data;
|
const action: WorkerAction = e.data;
|
||||||
if (!action.type) return;
|
if (!action.type) return;
|
||||||
const dispatch = getDispatch();
|
const dispatch = getDispatch();
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
@ -52,7 +51,10 @@ if (IS_SERVICE_WORKER_SUPPORTED) {
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('[SW] ServiceWorker not available');
|
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) {
|
} catch (err) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user