Skip to content

Commit

Permalink
[mirotalksfu] - add confirmation before delete poll
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Nov 16, 2024
1 parent 2f7e632 commit ca653af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ function joinRoom(peer_name, room_id) {
if (rc && rc.isConnected()) {
console.log('Already connected to a room');
} else {
const isDesktopDevice = !DetectRTC.isMobileDevice && !isTabletDevice && !isIPadDevice;
console.log('05 ----> join Room ' + room_id);
roomId.innerText = room_id;
userName.innerText = peer_name;
Expand All @@ -1330,6 +1331,7 @@ function joinRoom(peer_name, room_id) {
peer_name,
peer_uuid,
peer_info,
isDesktopDevice,
isAudioAllowed,
isVideoAllowed,
isScreenAllowed,
Expand Down
26 changes: 22 additions & 4 deletions public/js/RoomClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class RoomClient {
peer_name,
peer_uuid,
peer_info,
isDesktopDevice,
isAudioAllowed,
isVideoAllowed,
isScreenAllowed,
Expand All @@ -216,6 +217,11 @@ class RoomClient {
this.peer_uuid = peer_uuid;
this.peer_info = peer_info;

// Device type
this.isDesktopDevice = isDesktopDevice;
this.isMobileDevice = DetectRTC.isMobileDevice;
this.isMobileSafari = this.isMobileDevice && DetectRTC.browser.name === 'Safari';

// RTMP selected file name
this.selectedRtmpFilename = '';

Expand Down Expand Up @@ -258,9 +264,6 @@ class RoomClient {
this.consumerTransport = null;
this.device = null;

this.isMobileDevice = DetectRTC.isMobileDevice;
this.isMobileSafari = this.isMobileDevice && DetectRTC.browser.name === 'Safari';

this.isScreenShareSupported =
navigator.getDisplayMedia || navigator.mediaDevices.getDisplayMedia ? true : false;

Expand Down Expand Up @@ -4792,7 +4795,22 @@ class RoomClient {
deletePollButton.className = 'del-btn';
deletePollButton.insertBefore(deletePollButtonIcon, deletePollButton.firstChild);
deletePollButton.addEventListener('click', () => {
this.socket.emit('deletePoll', { index, peer_name: this.peer_name, peer_uuid: this.peer_uuid });
// confirm before delete poll
Swal.fire({
background: swalBackground,
position: 'top',
title: 'Delete this poll?',
imageUrl: image.delete,
showDenyButton: true,
confirmButtonText: `Yes`,
denyButtonText: `No`,
showClass: { popup: 'animate__animated animate__fadeInDown' },
hideClass: { popup: 'animate__animated animate__fadeOutUp' },
}).then((result) => {
if (result.isConfirmed) {
this.socket.emit('deletePoll', { index, peer_name: this.peer_name, peer_uuid: this.peer_uuid });
}
});
});
pollButtonsDiv.appendChild(deletePollButton);

Expand Down

0 comments on commit ca653af

Please sign in to comment.