クライアントがあったらストリームに接続しているということなので通知しない判定の位置を修正
This commit is contained in:
@@ -57,17 +57,15 @@ self.lib.onpush = (ev: ServiceWorkerGlobalScopeEventMap['push']) => {
|
||||
includeUncontrolled: true,
|
||||
type: 'window'
|
||||
}).then(async <K extends keyof pushNotificationDataMap>(clients: readonly WindowClient[]) => {
|
||||
// // クライアントがあったらストリームに接続しているということなので通知しない
|
||||
// if (clients.length != 0) return;
|
||||
|
||||
const data: pushNotificationDataMap[K] = ev.data?.json();
|
||||
|
||||
switch (data.type) {
|
||||
// case 'driveFileCreated':
|
||||
case 'notification':
|
||||
case 'unreadMessagingMessage':
|
||||
// クライアントがあったらストリームに接続しているということなので通知しない
|
||||
if (clients.length != 0) return;
|
||||
return createNotification(data);
|
||||
|
||||
case 'readAllNotifications':
|
||||
for (const n of await self.registration.getNotifications()) {
|
||||
if (n?.data?.type === 'notification') n.close();
|
||||
|
Reference in New Issue
Block a user