diff --git a/android/app/src/main/assets/public/main.js b/android/app/src/main/assets/public/main.js index ecd51413..f514589c 100644 --- a/android/app/src/main/assets/public/main.js +++ b/android/app/src/main/assets/public/main.js @@ -1461,8 +1461,8 @@ function showFixedContextMenu(rect, html) { fixedContextMenu.style.transition = 'none'; fixedContextMenu.style.opacity = '0'; - fixedContextMenu.style.left = '0px'; - fixedContextMenu.style.top = '0px'; + fixedContextMenu.style.left = '0rem'; + fixedContextMenu.style.top = '0rem'; fixedContextMenu.classList.add("show"); @@ -3139,7 +3139,7 @@ async function generateMessagesHtml(entries, isPinnedContext = false) { let safeType = encodeURIComponent(att.type).replace(/'/g, "%27"); let safeName = encodeURIComponent(att.name).replace(/'/g, "%27"); - attachmentsHtml += `
+ attachmentsHtml += `
${iconSvg}
${escapeHtml(displayName)}
@@ -3653,12 +3653,12 @@ async function downloadAndRenderAttachment(container, msgId, attId, type, name, container.dataset.url = blobUrl; if (type.startsWith("image/")) { - container.innerHTML = ``; + container.innerHTML = ``; } else if (type.startsWith("video/")) { - container.innerHTML = ``; + container.innerHTML = ``; } else { container.innerHTML = originalHtml; - container.style.border = "1px solid var(--accent-color)"; + container.style.border = "0.0625rem solid var(--accent-color)"; let a = document.createElement("a"); a.href = blobUrl; a.download = name; @@ -3716,7 +3716,7 @@ function renderAttachmentsPreview() { } html += ` -
+
${iconHtml}
${escapeHtml(file.name)}
-
`; document.body.appendChild(incomingUi); + requestAnimationFrame(() => { + requestAnimationFrame(() => incomingUi.classList.add("show")); + }); +} + +function dismissIncomingCall() { + let el = document.getElementById("incoming-call-popup"); + if (!el || el.classList.contains("hide")) return; + el.classList.remove("show"); + el.classList.add("hide"); + setTimeout(() => el.remove(), 400); +} + +function joinIncomingCall(roomId) { + dismissIncomingCall(); + initiateVoiceCall(roomId); } async function sendVoiceSignalToUser(targetUserId, roomId) { @@ -510,19 +542,20 @@ function showVoiceUI() { voiceUiContainer.id = "voice-call-popup"; voiceUiContainer.innerHTML = ` -
-
- Voice Chat +
+
+ ${ICONS.call({width: "1.1rem", height: "1.1rem"})} + Voice Chat
-
Connecting...
+
Connecting...
-
-
+
+
`; - + document.body.appendChild(voiceUiContainer); + requestAnimationFrame(() => { + requestAnimationFrame(() => voiceUiContainer.classList.add("show")); + }); let header = document.getElementById("voice-header"); let isDragging = false; @@ -639,10 +675,6 @@ function updateVoiceUIUsers() { let mediaEl = streamData.canvas || streamData.video; if (mediaEl) { - mediaEl.style.width = "100%"; - mediaEl.style.height = "100%"; - mediaEl.style.objectFit = "cover"; - mediaEl.style.background = "#000"; div.appendChild(mediaEl); } @@ -696,6 +728,9 @@ function showVoiceUserSettings(clientId, e) { if (top + rect.height > window.innerHeight) top = window.innerHeight - rect.height - 10; popup.style.left = left + "px"; popup.style.top = top + "px"; + requestAnimationFrame(() => { + requestAnimationFrame(() => popup.classList.add("open")); + }); const closePopup = (ev) => { if (!popup.contains(ev.target)) { @@ -718,6 +753,7 @@ window.updateVoiceVol = function(clientId, val, type) { function toggleVoiceMic() { isMicMuted = !isMicMuted; + if (isMicMuted) setTileSpeaking(String(window.id), false); let btn = document.getElementById("voice-btn-mic"); if (btn) { if (isMicMuted) { @@ -779,9 +815,14 @@ function endVoiceSession() { currentVoiceCallType = null; currentVoiceCallId = null; + clearAllSpeaking(); + if (voiceUiContainer) { - voiceUiContainer.remove(); + let popupEl = voiceUiContainer; voiceUiContainer = null; + popupEl.classList.remove("show"); + popupEl.classList.add("hide"); + setTimeout(() => popupEl.remove(), 350); } } diff --git a/webroot/main.js b/webroot/main.js index ecd51413..f514589c 100644 --- a/webroot/main.js +++ b/webroot/main.js @@ -1461,8 +1461,8 @@ function showFixedContextMenu(rect, html) { fixedContextMenu.style.transition = 'none'; fixedContextMenu.style.opacity = '0'; - fixedContextMenu.style.left = '0px'; - fixedContextMenu.style.top = '0px'; + fixedContextMenu.style.left = '0rem'; + fixedContextMenu.style.top = '0rem'; fixedContextMenu.classList.add("show"); @@ -3139,7 +3139,7 @@ async function generateMessagesHtml(entries, isPinnedContext = false) { let safeType = encodeURIComponent(att.type).replace(/'/g, "%27"); let safeName = encodeURIComponent(att.name).replace(/'/g, "%27"); - attachmentsHtml += `
+ attachmentsHtml += `
${iconSvg}
${escapeHtml(displayName)}
@@ -3653,12 +3653,12 @@ async function downloadAndRenderAttachment(container, msgId, attId, type, name, container.dataset.url = blobUrl; if (type.startsWith("image/")) { - container.innerHTML = ``; + container.innerHTML = ``; } else if (type.startsWith("video/")) { - container.innerHTML = ``; + container.innerHTML = ``; } else { container.innerHTML = originalHtml; - container.style.border = "1px solid var(--accent-color)"; + container.style.border = "0.0625rem solid var(--accent-color)"; let a = document.createElement("a"); a.href = blobUrl; a.download = name; @@ -3716,7 +3716,7 @@ function renderAttachmentsPreview() { } html += ` -
+
${iconHtml}
${escapeHtml(file.name)}
-
`; document.body.appendChild(incomingUi); + requestAnimationFrame(() => { + requestAnimationFrame(() => incomingUi.classList.add("show")); + }); +} + +function dismissIncomingCall() { + let el = document.getElementById("incoming-call-popup"); + if (!el || el.classList.contains("hide")) return; + el.classList.remove("show"); + el.classList.add("hide"); + setTimeout(() => el.remove(), 400); +} + +function joinIncomingCall(roomId) { + dismissIncomingCall(); + initiateVoiceCall(roomId); } async function sendVoiceSignalToUser(targetUserId, roomId) { @@ -510,19 +542,20 @@ function showVoiceUI() { voiceUiContainer.id = "voice-call-popup"; voiceUiContainer.innerHTML = ` -
-
- Voice Chat +
+
+ ${ICONS.call({width: "1.1rem", height: "1.1rem"})} + Voice Chat
-
Connecting...
+
Connecting...
-
-
+
+
`; - + document.body.appendChild(voiceUiContainer); + requestAnimationFrame(() => { + requestAnimationFrame(() => voiceUiContainer.classList.add("show")); + }); let header = document.getElementById("voice-header"); let isDragging = false; @@ -639,10 +675,6 @@ function updateVoiceUIUsers() { let mediaEl = streamData.canvas || streamData.video; if (mediaEl) { - mediaEl.style.width = "100%"; - mediaEl.style.height = "100%"; - mediaEl.style.objectFit = "cover"; - mediaEl.style.background = "#000"; div.appendChild(mediaEl); } @@ -696,6 +728,9 @@ function showVoiceUserSettings(clientId, e) { if (top + rect.height > window.innerHeight) top = window.innerHeight - rect.height - 10; popup.style.left = left + "px"; popup.style.top = top + "px"; + requestAnimationFrame(() => { + requestAnimationFrame(() => popup.classList.add("open")); + }); const closePopup = (ev) => { if (!popup.contains(ev.target)) { @@ -718,6 +753,7 @@ window.updateVoiceVol = function(clientId, val, type) { function toggleVoiceMic() { isMicMuted = !isMicMuted; + if (isMicMuted) setTileSpeaking(String(window.id), false); let btn = document.getElementById("voice-btn-mic"); if (btn) { if (isMicMuted) { @@ -779,9 +815,14 @@ function endVoiceSession() { currentVoiceCallType = null; currentVoiceCallId = null; + clearAllSpeaking(); + if (voiceUiContainer) { - voiceUiContainer.remove(); + let popupEl = voiceUiContainer; voiceUiContainer = null; + popupEl.classList.remove("show"); + popupEl.classList.add("hide"); + setTimeout(() => popupEl.remove(), 350); } }