remove obsolete code from refactoring before

This commit is contained in:
Bruno Windels 2021-03-25 10:07:42 +01:00
parent a70a38f481
commit f98369c4d6

View File

@ -224,7 +224,6 @@ async function handlePushNotification(n) {
const sessionId = n.session_id; const sessionId = n.session_id;
let sender = n.sender_display_name || n.sender; let sender = n.sender_display_name || n.sender;
if (sender && n.event_id) { if (sender && n.event_id) {
const clientList = await self.clients.matchAll({type: "window"});
const roomId = n.room_id; const roomId = n.room_id;
const hasFocusedClientOnRoom = !!await findClient(async client => { const hasFocusedClientOnRoom = !!await findClient(async client => {
if (client.visibilityState === "visible" && client.focused) { if (client.visibilityState === "visible" && client.focused) {
@ -235,16 +234,6 @@ async function handlePushNotification(n) {
console.log("client is focused, room is open, don't show notif"); console.log("client is focused, room is open, don't show notif");
return; return;
} }
for (const client of clientList) {
// if the app is open and focused, don't show a notif when looking at the room already
if (client.visibilityState === "visible" && client.focused) {
const isRoomOpen = await sendAndWaitForReply(client, "hasRoomOpen", {sessionId, roomId});
if (isRoomOpen) {
console.log("client is focused, room is open, don't show notif");
return;
}
}
}
let label; let label;
if (n.room_name) { if (n.room_name) {
label = `${sender} wrote you in ${n.room_name}`; label = `${sender} wrote you in ${n.room_name}`;