Skip to content

Commit

Permalink
[call-me] - refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jan 11, 2025
1 parent 42c33cc commit fed013d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "call-me",
"version": "1.0.48",
"version": "1.0.49",
"description": "Your Go-To for Instant Video Calls",
"author": "Miroslav Pejic - miroslav.pejic.85@gmail.com",
"license": "AGPLv3",
Expand Down
24 changes: 12 additions & 12 deletions public/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function checkHostPassword(maxRetries = 3, attempts = 0) {
timer: 1500,
showConfirmButton: false,
});
signInPage.style.display = 'block';
elemDisplay(signInPage, true);
} else {
attempts++;
if (attempts < maxRetries) {
Expand All @@ -133,7 +133,7 @@ async function checkHostPassword(maxRetries = 3, attempts = 0) {
}
} else {
// No password required
signInPage.style.display = 'block';
elemDisplay(signInPage, true);
}
} catch (error) {
console.error('Error:', error);
Expand Down Expand Up @@ -226,7 +226,7 @@ function handleDirectJoin() {
// Session Time
function startSessionTime() {
console.log('Start session time');
sessionTime.style.display = 'inline-flex';
elemDisplay(sessionTime, true, 'inline-flex');
let sessionElapsedTime = 0;
setInterval(function printTime() {
sessionElapsedTime++;
Expand Down Expand Up @@ -524,10 +524,10 @@ function handleSignIn(data) {
setTimeout(handleHangUpClick, 3000);
}
} else {
githubDiv.style.display = 'none';
attribution.style.display = 'none';
signInPage.style.display = 'none';
roomPage.style.display = 'block';
elemDisplay(githubDiv, false);
elemDisplay(attribution, false);
elemDisplay(signInPage, false);
elemDisplay(roomPage, true);

navigator.mediaDevices
.getUserMedia({ video: true, audio: true })
Expand Down Expand Up @@ -603,7 +603,7 @@ function offerCreate() {
type: 'offer',
offer,
});
callUsernameIn.style.display = 'none';
elemDisplay(callUsernameIn, false);
})
.catch((error) => {
handleError('Error when creating an offer.', error);
Expand All @@ -628,8 +628,8 @@ function offerAccept(data) {
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
}).then((result) => {
if (result.isConfirmed) {
callUsernameIn.style.display = 'none';
callBtn.style.display = 'none';
elemDisplay(callUsernameIn, false);
elemDisplay(callBtn, false);
data.type = 'offerCreate';
socket.recipient = data.from;
} else {
Expand Down Expand Up @@ -670,10 +670,10 @@ function handleAnswer(data) {
// Handle incoming ICE candidate
function handleCandidate(data) {
const { candidate } = data;
callBtn.style.display = 'none';
elemDisplay(callBtn, false);
thisConnection.addIceCandidate(new RTCIceCandidate(candidate)).catch((error) => {
handleError('Error when add ice candidate.', error);
callBtn.style.display = 'inline';
elemDisplay(callBtn, true, 'inline');
});
}

Expand Down

0 comments on commit fed013d

Please sign in to comment.