display initial state of call to new mapper

This commit is contained in:
Connor Turland 2016-03-01 12:25:38 +13:00
parent 4e92d4c2c5
commit bd5c88fb0b
5 changed files with 50 additions and 20 deletions

View file

@ -2126,7 +2126,7 @@ Metamaps.Realtime = {
var self = Metamaps.Realtime;
self.socket.emit('checkForCall', { room: self.room.room, mapid: Metamaps.Active.Map.id });
},
promptToJoin: function (data) {
promptToJoin: function () {
var self = Metamaps.Realtime;
var notifyText = 'There\'s a conversation happening, want to join?';
@ -2224,7 +2224,7 @@ Metamaps.Realtime = {
var username = self.mappersOnMap[inviter].name;
var notifyText = username + ' is inviting you to the conversation. Join?';
notifyText += ' <button type="button" class="toast-button button" onclick="Metamaps.Realtime.joinCall()">Yes</button>';
notifyText += ' <button type="button" class="toast-button button btn-no" onclick="Metamaps.GlobalUI.clearNotify()">No</button>';
notifyText += ' <button type="button" class="toast-button button btn-no" onclick="Metamaps.Realtime.denyInvite(' + inviter + ')">No</button>';
Metamaps.GlobalUI.notifyUser(notifyText, true);
},
acceptCall: function (userid) {
@ -2246,6 +2246,15 @@ Metamaps.Realtime = {
});
Metamaps.GlobalUI.clearNotify();
},
denyInvite: function (userid) {
var self = Metamaps.Realtime;
self.socket.emit('inviteDenied', {
mapid: Metamaps.Active.Map.id,
invited: Metamaps.Active.Mapper.id,
inviter: userid
});
Metamaps.GlobalUI.clearNotify();
},
inviteACall: function (userid) {
var self = Metamaps.Realtime;
self.socket.emit('inviteACall', {
@ -2263,7 +2272,7 @@ Metamaps.Realtime = {
inviter: Metamaps.Active.Mapper.id,
invited: userid
});
Metamaps.GlobalUI.notifyUser('Invitation has been sent.');
self.room.chat.invitationPending(userid);
},
callAccepted: function (userid) {
var self = Metamaps.Realtime;
@ -2280,6 +2289,13 @@ Metamaps.Realtime = {
Metamaps.GlobalUI.notifyUser(username + ' didn\'t accept your invite.');
self.room.chat.invitationAnswered(userid);
},
inviteDenied: function (userid) {
var self = Metamaps.Realtime;
var username = self.mappersOnMap[userid].name;
Metamaps.GlobalUI.notifyUser(username + ' didn\'t accept your invite.');
self.room.chat.invitationAnswered(userid);
},
joinCall: function () {
var self = Metamaps.Realtime;
@ -2352,6 +2368,7 @@ Metamaps.Realtime = {
socket.on(myId + '-' + Metamaps.Active.Map.id + '-invitedToJoin', self.invitedToJoin); // call already in progress
socket.on(myId + '-' + Metamaps.Active.Map.id + '-callAccepted', self.callAccepted);
socket.on(myId + '-' + Metamaps.Active.Map.id + '-callDenied', self.callDenied);
socket.on(myId + '-' + Metamaps.Active.Map.id + '-inviteDenied', self.inviteDenied);
// receive word that there's a conversation in progress
socket.on('maps-' + Metamaps.Active.Map.id + '-callInProgress', self.promptToJoin);
@ -2520,24 +2537,12 @@ Metamaps.Realtime = {
coords: {
x: 0,
y: 0
},
}
};
var onOff = data.userrealtime ? "On" : "Off";
var mapperListItem = '<li id="mapper';
mapperListItem += data.userid;
mapperListItem += '" class="rtMapper littleRt';
mapperListItem += onOff;
mapperListItem += '">';
mapperListItem += '<img style="border: 2px solid ' + self.mappersOnMap[data.userid].color + ';"';
mapperListItem += ' src="' + data.userimage + '" width="24" height="24" class="rtUserImage" />';
mapperListItem += data.username;
mapperListItem += '<div class="littleJuntoIcon"></div>';
mapperListItem += '</li>';
if (data.userid !== Metamaps.Active.Mapper.id) {
//$('#mapper' + data.userid).remove();
self.room.chat.addParticipant(self.mappersOnMap[data.userid]);
if (data.userinconversation) self.room.chat.mapperJoinedCall(data.userid);
// create a div for the collaborators compass
self.createCompass(data.username, data.userid, data.userimage, self.mappersOnMap[data.userid].color, !self.status);
@ -2586,6 +2591,7 @@ Metamaps.Realtime = {
userimage: Metamaps.Active.Mapper.get("image"),
userid: Metamaps.Active.Mapper.id,
userrealtime: self.status,
userinconversation: self.inConversation,
mapid: Metamaps.Active.Map.id
};
socket.emit('updateNewMapperList', update);

View file

@ -235,6 +235,7 @@ Metamaps.Views.chatView = (function () {
this.$participants.removeClass('is-participating');
this.$button.removeClass('active');
this.$participants.find('.participant').removeClass('active');
this.$participants.find('.participant').removeClass('pending');
}
chatView.prototype.leaveConversation = function () {

View file

@ -1,5 +1,5 @@
.collaborator-video {
z-index: 2;
z-index: 1;
position: absolute;
width: 150px;
height: 150px;
@ -236,7 +236,7 @@
.chat-box .participants .participant .chat-participant-invite-join {
display: none;
}
.chat-box .participants.is-live .participant:not(.active) .chat-participant-invite-join {
.chat-box .participants.is-live.is-participating .participant:not(.active) .chat-participant-invite-join {
display: block;
}
.chat-box .participants .participant .chat-participant-invite-call,

19
npm-debug.log Normal file
View file

@ -0,0 +1,19 @@
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'install' ]
2 info using npm@1.3.10
3 info using node@v0.10.25
4 error install Couldn't read dependencies
5 error Error: ENOENT, open '/vagrant/package.json'
6 error If you need help, you may report this log at:
6 error <http://github.com/isaacs/npm/issues>
6 error or email it to:
6 error <npm-@googlegroups.com>
7 error System Linux 3.13.0-66-generic
8 error command "/usr/bin/nodejs" "/usr/bin/npm" "install"
9 error cwd /vagrant
10 error node -v v0.10.25
11 error npm -v 1.3.10
12 error path /vagrant/package.json
13 error code ENOENT
14 error errno 34
15 verbose exit [ 34, true ]

View file

@ -17,6 +17,7 @@ function start() {
userid: data.userid,
username: data.username,
userrealtime: data.userrealtime,
userinconversation: data.userinconversation,
userimage: data.userimage
};
socket.broadcast.emit(data.userToNotify + '-' + data.mapid + '-UpdateMapperList', existingUser);
@ -25,7 +26,7 @@ function start() {
// as a new mapper check whether there's a call in progress to join
socket.on('checkForCall', function (data) {
var socketsInRoom = io.sockets.clients(data.room);
if (socketsInRoom.length) socket.emit('maps-' + data.mapid + '-callInProgress', socketsInRoom.length);
if (socketsInRoom.length) socket.emit('maps-' + data.mapid + '-callInProgress');
});
// send the invitation to start a call
socket.on('inviteACall', function (data) {
@ -43,6 +44,9 @@ function start() {
socket.on('callDenied', function (data) {
socket.broadcast.emit(data.inviter + '-' + data.mapid + '-callDenied', data.invited);
});
socket.on('inviteDenied', function (data) {
socket.broadcast.emit(data.inviter + '-' + data.mapid + '-inviteDenied', data.invited);
});
socket.on('mapperJoinedCall', function (data) {
socket.broadcast.emit('maps-' + data.mapid + '-mapperJoinedCall', data.id);
});