From 0313c602a6cbe2dcc116b5e0b9df2b2e997ad46b Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Mon, 28 Jul 2025 09:20:44 +0200 Subject: [PATCH] [call-me] - add notification 4 new user join --- package-lock.json | 4 ++-- package.json | 2 +- public/client.js | 30 +++++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4ff1b25..eb0b398 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "call-me", - "version": "1.1.07", + "version": "1.1.08", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "call-me", - "version": "1.1.07", + "version": "1.1.08", "license": "AGPLv3", "dependencies": { "@ngrok/ngrok": "1.5.1", diff --git a/package.json b/package.json index 554d3fd..db3af27 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "call-me", - "version": "1.1.07", + "version": "1.1.08", "description": "Your Go-To for Instant Video Calls", "author": "Miroslav Pejic - miroslav.pejic.85@gmail.com", "license": "AGPLv3", diff --git a/public/client.js b/public/client.js index e38996d..66364f8 100755 --- a/public/client.js +++ b/public/client.js @@ -922,8 +922,18 @@ async function handleCandidate(data) { // Handle connected users function handleUsers(data) { - allConnectedUsers = data.users.filter((u) => u !== userName); + // Show toast for new users + const prevUsers = new Set(allConnectedUsers); + const currentUsers = data.users.filter((u) => u !== userName); + allConnectedUsers = currentUsers; filterUserList(userSearchInput.value || ''); + if (userSignedIn) { + currentUsers.forEach((u) => { + if (!prevUsers.has(u)) { + toast(`${u} joined`, 'success'); + } + }); + } } // Handle remote video status @@ -993,6 +1003,24 @@ function handleLeave(disconnect = true) { } } +// Display toast messages +function toast(message, icon = 'info', position = 'top', timer = 3000) { + const Toast = Swal.mixin({ + toast: true, + position: position, + icon: icon, + showConfirmButton: false, + timerProgressBar: true, + timer: timer, + }); + Toast.fire({ + icon: icon, + title: message, + showClass: { popup: 'animate__animated animate__fadeInDown' }, + hideClass: { popup: 'animate__animated animate__fadeOutUp' }, + }); +} + // Handle and display errors function handleError(message, error = false, position = 'top', timer = 6000) { if (error) console.error(error);