From ffc01d11306f710de782572eedad70326b7ada93 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Wed, 14 Dec 2016 17:33:19 +0100 Subject: [PATCH 1/6] Leave current room without reloading the page. Signed-off-by: Ivan Sein --- js/rooms.js | 6 ++++++ js/views/roomlistview.js | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/rooms.js b/js/rooms.js index c38f30aac..f7cf5bccf 100644 --- a/js/rooms.js +++ b/js/rooms.js @@ -75,6 +75,12 @@ OCA.SpreedMe.webrtc.joinRoom(roomId); OCA.SpreedMe.Rooms.ping(); }, + leaveCurrentRoom: function() { + OCA.SpreedMe.webrtc.leaveRoom(); + + currentRoomId = 0; + OC.Util.History.pushState(); + }, currentRoom: function() { return currentRoomId; }, diff --git a/js/views/roomlistview.js b/js/views/roomlistview.js index 1e4fa9010..d729e0f3d 100644 --- a/js/views/roomlistview.js +++ b/js/views/roomlistview.js @@ -216,10 +216,7 @@ leaveGroup: function() { //If user is in that room, it should leave that room first. if (this.model.get('active')) { - var homeURL = OC.generateUrl('/apps/spreed'); - - OCA.SpreedMe.webrtc.leaveRoom(); - window.location.replace(homeURL); + OCA.SpreedMe.Rooms.leaveCurrentRoom(); } this.$el.slideUp(); From 71f4024de7ba841dfb0ae99dbf0047f12326eb62 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 15 Dec 2016 11:34:05 +0100 Subject: [PATCH 2/6] Add info messages when leaving a room or when the call does not exist. Signed-off-by: Ivan Sein --- js/rooms.js | 27 ++++++++++++++++++++++++++- js/views/roomlistview.js | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/js/rooms.js b/js/rooms.js index f7cf5bccf..219f05f10 100644 --- a/js/rooms.js +++ b/js/rooms.js @@ -99,7 +99,10 @@ { roomId: OCA.SpreedMe.Rooms.currentRoom() } - ); + ).fail(function() { + OCA.SpreedMe.Rooms.leaveCurrentRoom(); + OCA.SpreedMe.Rooms.showRoomDeletedMessage(false); + }); }, leaveAllRooms: function() { $.ajax({ @@ -108,6 +111,28 @@ async: false }); }, + showRoomDeletedMessage: function(deleter) { + var message, messageAdditional; + + if (deleter) { + message = t('spreed', 'You have left the call'); + } else { + message = t('spreed', 'This call has ended'); + } + + messageAdditional = t('spreed', 'You can start a new call from "Chose person …" on the top left of this window.'); + + //Remove previous icon, avatar or link from emptycontent + var emptyContentIcon = document.getElementById("emptyContentIcon"); + emptyContentIcon.removeAttribute("class"); + emptyContentIcon.innerHTML = ""; + $('#shareRoomInput').addClass('hidden'); + $('#shareRoomClipboardButton').addClass('hidden'); + + $('#emptyContentIcon').addClass('icon-video-off'); + $('#emptycontent h2').text(message); + $('#emptycontent p').text(messageAdditional); + } }; OCA.SpreedMe.initRooms = initRooms; diff --git a/js/views/roomlistview.js b/js/views/roomlistview.js index d729e0f3d..7be6d22e5 100644 --- a/js/views/roomlistview.js +++ b/js/views/roomlistview.js @@ -217,6 +217,7 @@ //If user is in that room, it should leave that room first. if (this.model.get('active')) { OCA.SpreedMe.Rooms.leaveCurrentRoom(); + OCA.SpreedMe.Rooms.showRoomDeletedMessage(true); } this.$el.slideUp(); From 197f24496326dbfbd3cfe1585092936b09327542 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 15 Dec 2016 15:09:26 +0100 Subject: [PATCH 3/6] Remove 'start new call' info text. Signed-off-by: Ivan Sein --- js/rooms.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/js/rooms.js b/js/rooms.js index 219f05f10..962152e10 100644 --- a/js/rooms.js +++ b/js/rooms.js @@ -112,7 +112,7 @@ }); }, showRoomDeletedMessage: function(deleter) { - var message, messageAdditional; + var message; if (deleter) { message = t('spreed', 'You have left the call'); @@ -120,8 +120,6 @@ message = t('spreed', 'This call has ended'); } - messageAdditional = t('spreed', 'You can start a new call from "Chose person …" on the top left of this window.'); - //Remove previous icon, avatar or link from emptycontent var emptyContentIcon = document.getElementById("emptyContentIcon"); emptyContentIcon.removeAttribute("class"); @@ -131,7 +129,7 @@ $('#emptyContentIcon').addClass('icon-video-off'); $('#emptycontent h2').text(message); - $('#emptycontent p').text(messageAdditional); + $('#emptycontent p').text(""); } }; From 0d682cad37796449d4fdcab92c385159bbb38c03 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 15 Dec 2016 16:58:44 +0100 Subject: [PATCH 4/6] Change info messages wording. Signed-off-by: Ivan Sein --- js/rooms.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/js/rooms.js b/js/rooms.js index 962152e10..920b54c7f 100644 --- a/js/rooms.js +++ b/js/rooms.js @@ -112,14 +112,6 @@ }); }, showRoomDeletedMessage: function(deleter) { - var message; - - if (deleter) { - message = t('spreed', 'You have left the call'); - } else { - message = t('spreed', 'This call has ended'); - } - //Remove previous icon, avatar or link from emptycontent var emptyContentIcon = document.getElementById("emptyContentIcon"); emptyContentIcon.removeAttribute("class"); @@ -127,9 +119,15 @@ $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); - $('#emptyContentIcon').addClass('icon-video-off'); - $('#emptycontent h2').text(message); - $('#emptycontent p').text(""); + if (deleter) { + $('#emptyContentIcon').addClass('icon-video'); + $('#emptycontent h2').text(t('spreed', 'Looking great today! :)')); + $('#emptycontent p').text(t('spreed', 'Time to call your friends')); + } else { + $('#emptyContentIcon').addClass('icon-video-off'); + $('#emptycontent h2').text(t('spreed', 'This call has ended')); + $('#emptycontent p').text(""); + } } }; From 8cec497c299fb1173ad3114647f225067b3e640e Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 15 Dec 2016 23:41:33 +0100 Subject: [PATCH 5/6] Use single quotes in JS. Signed-off-by: Ivan Sein --- js/app.js | 6 +++--- js/rooms.js | 8 ++++---- js/views/roomlistview.js | 6 +++--- js/webrtc.js | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js/app.js b/js/app.js index 7b8871aaa..aceee08bc 100644 --- a/js/app.js +++ b/js/app.js @@ -298,9 +298,9 @@ var message, messageAdditional; //Remove previous icon or avatar - var emptyContentIcon = document.getElementById("emptyContentIcon"); - emptyContentIcon.removeAttribute("class"); - emptyContentIcon.innerHTML = ""; + var emptyContentIcon = document.getElementById('emptyContentIcon'); + emptyContentIcon.removeAttribute('class'); + emptyContentIcon.innerHTML = ''; if (Object.keys(participants).length === 1) { var waitingParticipantId, waitingParticipantName; diff --git a/js/rooms.js b/js/rooms.js index 920b54c7f..3db98bcb9 100644 --- a/js/rooms.js +++ b/js/rooms.js @@ -113,9 +113,9 @@ }, showRoomDeletedMessage: function(deleter) { //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById("emptyContentIcon"); - emptyContentIcon.removeAttribute("class"); - emptyContentIcon.innerHTML = ""; + var emptyContentIcon = document.getElementById('emptyContentIcon'); + emptyContentIcon.removeAttribute('class'); + emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); @@ -126,7 +126,7 @@ } else { $('#emptyContentIcon').addClass('icon-video-off'); $('#emptycontent h2').text(t('spreed', 'This call has ended')); - $('#emptycontent p').text(""); + $('#emptycontent p').text(''); } } }; diff --git a/js/views/roomlistview.js b/js/views/roomlistview.js index 7be6d22e5..d895c80b2 100644 --- a/js/views/roomlistview.js +++ b/js/views/roomlistview.js @@ -236,9 +236,9 @@ var message, messageAdditional, participants; //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById("emptyContentIcon"); - emptyContentIcon.removeAttribute("class"); - emptyContentIcon.innerHTML = ""; + var emptyContentIcon = document.getElementById('emptyContentIcon'); + emptyContentIcon.removeAttribute('class'); + emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); diff --git a/js/webrtc.js b/js/webrtc.js index 49cfdf376..f5a617723 100644 --- a/js/webrtc.js +++ b/js/webrtc.js @@ -293,9 +293,9 @@ var spreedMappingTable = []; } //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById("emptyContentIcon"); - emptyContentIcon.removeAttribute("class"); - emptyContentIcon.innerHTML = ""; + var emptyContentIcon = document.getElementById('emptyContentIcon'); + emptyContentIcon.removeAttribute('class'); + emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); @@ -312,9 +312,9 @@ var spreedMappingTable = []; messageAdditional = t('spreed', 'Please use a different browser like Firefox or Chrome'); //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById("emptyContentIcon"); - emptyContentIcon.removeAttribute("class"); - emptyContentIcon.innerHTML = ""; + var emptyContentIcon = document.getElementById('emptyContentIcon'); + emptyContentIcon.removeAttribute('class'); + emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); From 63d13d465dfe7c1d85238473c50bf4b965a66307 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 15 Dec 2016 23:50:24 +0100 Subject: [PATCH 6/6] Change emptyContentIcon element id to emptycontent-icon. Signed-off-by: Ivan Sein --- css/style.css | 2 +- js/app.js | 8 ++++---- js/rooms.js | 6 +++--- js/views/roomlistview.js | 10 +++++----- js/webrtc.js | 8 ++++---- templates/index-public.php | 2 +- templates/index.php | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/css/style.css b/css/style.css index ead4ab913..92ac91e1a 100644 --- a/css/style.css +++ b/css/style.css @@ -190,7 +190,7 @@ video { z-index: 40; } -#emptyContentIcon { +#emptycontent-icon { width: 128px; margin: 0 auto; padding-bottom: 20px; diff --git a/js/app.js b/js/app.js index aceee08bc..64b98246e 100644 --- a/js/app.js +++ b/js/app.js @@ -298,7 +298,7 @@ var message, messageAdditional; //Remove previous icon or avatar - var emptyContentIcon = document.getElementById('emptyContentIcon'); + var emptyContentIcon = document.getElementById('emptycontent-icon'); emptyContentIcon.removeAttribute('class'); emptyContentIcon.innerHTML = ''; @@ -314,9 +314,9 @@ var avatar = document.createElement('div'); avatar.className = 'avatar room-avatar'; - $('#emptyContentIcon').append(avatar); + $('#emptycontent-icon').append(avatar); - $('#emptyContentIcon').find('.avatar').each(function () { + $('#emptycontent-icon').find('.avatar').each(function () { if (waitingParticipantName && (waitingParticipantId !== waitingParticipantName)) { $(this).avatar(waitingParticipantId, 128, undefined, false, undefined, waitingParticipantName); } else { @@ -329,7 +329,7 @@ } else { message = t('spreed', 'Waiting for others to join the call …'); messageAdditional = ''; - $('#emptyContentIcon').addClass('icon-contacts-dark'); + $('#emptycontent-icon').addClass('icon-contacts-dark'); } $('#emptycontent h2').text(message); diff --git a/js/rooms.js b/js/rooms.js index 3db98bcb9..bd191c8b4 100644 --- a/js/rooms.js +++ b/js/rooms.js @@ -113,18 +113,18 @@ }, showRoomDeletedMessage: function(deleter) { //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById('emptyContentIcon'); + var emptyContentIcon = document.getElementById('emptycontent-icon'); emptyContentIcon.removeAttribute('class'); emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); if (deleter) { - $('#emptyContentIcon').addClass('icon-video'); + $('#emptycontent-icon').addClass('icon-video'); $('#emptycontent h2').text(t('spreed', 'Looking great today! :)')); $('#emptycontent p').text(t('spreed', 'Time to call your friends')); } else { - $('#emptyContentIcon').addClass('icon-video-off'); + $('#emptycontent-icon').addClass('icon-video-off'); $('#emptycontent h2').text(t('spreed', 'This call has ended')); $('#emptycontent p').text(''); } diff --git a/js/views/roomlistview.js b/js/views/roomlistview.js index d895c80b2..2fefb086c 100644 --- a/js/views/roomlistview.js +++ b/js/views/roomlistview.js @@ -236,7 +236,7 @@ var message, messageAdditional, participants; //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById('emptyContentIcon'); + var emptyContentIcon = document.getElementById('emptycontent-icon'); emptyContentIcon.removeAttribute('class'); emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); @@ -259,9 +259,9 @@ var avatar = document.createElement('div'); avatar.className = 'avatar room-avatar'; - $('#emptyContentIcon').append(avatar); + $('#emptycontent-icon').append(avatar); - $('#emptyContentIcon').find('.avatar').each(function () { + $('#emptycontent-icon').find('.avatar').each(function () { if (waitingParticipantName && (waitingParticipantId !== waitingParticipantName)) { $(this).avatar(waitingParticipantId, 128, undefined, false, undefined, waitingParticipantName); } else { @@ -280,7 +280,7 @@ message = t('spreed', 'No other participants in this call'); messageAdditional = 'You can invite other participants to this call by clicking "+ Add person" in the call menu.'; } - $('#emptyContentIcon').addClass('icon-contacts-dark'); + $('#emptycontent-icon').addClass('icon-contacts-dark'); break; case 3: if (Object.keys(participants).length > 1) { @@ -289,7 +289,7 @@ message = t('spreed', 'No other participants in this call'); } messageAdditional = 'Share this link to invite others!'; - $('#emptyContentIcon').addClass('icon-public'); + $('#emptycontent-icon').addClass('icon-public'); //Add link var url = window.location.protocol + '//' + window.location.host + OC.generateUrl('/apps/spreed?roomId=' + this.model.get('id')); diff --git a/js/webrtc.js b/js/webrtc.js index f5a617723..4a9fa7ce9 100644 --- a/js/webrtc.js +++ b/js/webrtc.js @@ -293,13 +293,13 @@ var spreedMappingTable = []; } //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById('emptyContentIcon'); + var emptyContentIcon = document.getElementById('emptycontent-icon'); emptyContentIcon.removeAttribute('class'); emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); - $('#emptyContentIcon').addClass('icon-video-off'); + $('#emptycontent-icon').addClass('icon-video-off'); $('#emptycontent h2').text(message); $('#emptycontent p').text(messageAdditional); }); @@ -312,13 +312,13 @@ var spreedMappingTable = []; messageAdditional = t('spreed', 'Please use a different browser like Firefox or Chrome'); //Remove previous icon, avatar or link from emptycontent - var emptyContentIcon = document.getElementById('emptyContentIcon'); + var emptyContentIcon = document.getElementById('emptycontent-icon'); emptyContentIcon.removeAttribute('class'); emptyContentIcon.innerHTML = ''; $('#shareRoomInput').addClass('hidden'); $('#shareRoomClipboardButton').addClass('hidden'); - $('#emptyContentIcon').addClass('icon-video-off'); + $('#emptycontent-icon').addClass('icon-video-off'); $('#emptycontent h2').text(message); $('#emptycontent p').text(messageAdditional); } diff --git a/templates/index-public.php b/templates/index-public.php index 817e5ea55..2fae950f8 100644 --- a/templates/index-public.php +++ b/templates/index-public.php @@ -64,7 +64,7 @@ script(
-
+

t('Looking great today! :)')) ?>

t('Smile in 3… 2… 1!')) ?>

diff --git a/templates/index.php b/templates/index.php index cdff42da3..c763909bb 100644 --- a/templates/index.php +++ b/templates/index.php @@ -64,7 +64,7 @@ script(
-
+

t('Looking great today! :)')) ?>

t('Time to call your friends')) ?>