mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 12:55:11 +01:00
[Dev] Fix errors caused my missing Service Worker on localhost for iOS (#1431)
This commit is contained in:
parent
3e8d87d436
commit
73883a6776
@ -332,7 +332,7 @@ export async function showNewMessageNotification({
|
||||
const icon = await getAvatar(chat);
|
||||
|
||||
if (checkIfPushSupported()) {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
if (navigator.serviceWorker?.controller) {
|
||||
// notify service worker about new message notification
|
||||
navigator.serviceWorker.controller.postMessage({
|
||||
type: 'newMessageNotification',
|
||||
@ -379,7 +379,7 @@ export async function showNewMessageNotification({
|
||||
}
|
||||
|
||||
export function closeMessageNotifications(payload: { chatId: number; lastReadInboxMessageId?: number }) {
|
||||
if (IS_TEST || !navigator.serviceWorker.controller) return;
|
||||
if (IS_TEST || !navigator.serviceWorker?.controller) return;
|
||||
navigator.serviceWorker.controller.postMessage({
|
||||
type: 'closeMessageNotifications',
|
||||
payload,
|
||||
@ -388,7 +388,7 @@ export function closeMessageNotifications(payload: { chatId: number; lastReadInb
|
||||
|
||||
// Notify service worker that client is fully loaded
|
||||
export function notifyClientReady() {
|
||||
if (!navigator.serviceWorker.controller) return;
|
||||
if (!navigator.serviceWorker?.controller) return;
|
||||
navigator.serviceWorker.controller.postMessage({
|
||||
type: 'clientReady',
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user