fix/enhance(sw): プッシュ通知 (バックグラウンドで開いている場合も通知, リアクション通知はノートにつき1つに) (#9977)
* fix(sw): クライアントがあってもpush notificationを無視しない 「プッシュ通知を更新しました」の原因になるため * enhance(sw): リアクション通知は1つのノートにつき1つしか表示しない Safari対応で、通知tagは能動的に閉じるように * revert closeNotificationsByTags
This commit is contained in:
@@ -53,9 +53,6 @@ globalThis.addEventListener('push', ev => {
|
||||
// 1日以上経過している場合は無視
|
||||
if ((new Date()).getTime() - data.dateTime > 1000 * 60 * 60 * 24) break;
|
||||
|
||||
// クライアントがあったらストリームに接続しているということなので通知しない
|
||||
if (clients.length !== 0) break;
|
||||
|
||||
return createNotification(data);
|
||||
case 'readAllNotifications':
|
||||
for (const n of await globalThis.registration.getNotifications()) {
|
||||
@@ -83,7 +80,8 @@ globalThis.addEventListener('push', ev => {
|
||||
break;
|
||||
}
|
||||
|
||||
return createEmptyNotification();
|
||||
await createEmptyNotification();
|
||||
return;
|
||||
}));
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user