awesome news sounnndzzzz

This commit is contained in:
Connor Turland 2016-04-03 20:40:40 -04:00
parent f21a3d114f
commit 1a69b0faf4
9 changed files with 22 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1938,15 +1938,6 @@ Metamaps.Realtime = {
init: function () {
var self = Metamaps.Realtime;
var reenableRealtime = function () {
self.reenableRealtime();
};
var turnOff = function () {
self.turnOff();
};
$(".rtOn").click(reenableRealtime);
$(".rtOff").click(turnOff);
self.addJuntoListeners();
self.socket = new SocketIoConnection({ url: '<%= ENV['REALTIME_SERVER'] %>' });
@ -2248,8 +2239,11 @@ Metamaps.Realtime = {
invitedToCall: function (inviter) {
var self = Metamaps.Realtime;
self.room.chat.sound.play('sessioninvite');
var username = self.mappersOnMap[inviter].name;
var notifyText = username + ' is suggesting a video call. What do you think?';
var notifyText = "<img src='<%= asset_path('junto_spinner_darkgrey.gif') %>' style='display: inline-block; margin-top: -12px; vertical-align: top;' />";
notifyText += username + ' is inviting you to a conversation. Join live?';
notifyText += ' <button type="button" class="toast-button button" onclick="Metamaps.Realtime.acceptCall(' + inviter + ')">Yes</button>';
notifyText += ' <button type="button" class="toast-button button btn-no" onclick="Metamaps.Realtime.denyCall(' + inviter + ')">No</button>';
Metamaps.GlobalUI.notifyUser(notifyText, true);
@ -2257,6 +2251,8 @@ Metamaps.Realtime = {
invitedToJoin: function (inviter) {
var self = Metamaps.Realtime;
self.room.chat.sound.play('sessioninvite');
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>';
@ -2265,6 +2261,7 @@ Metamaps.Realtime = {
},
acceptCall: function (userid) {
var self = Metamaps.Realtime;
self.room.chat.sound.stop('sessioninvite');
self.socket.emit('callAccepted', {
mapid: Metamaps.Active.Map.id,
invited: Metamaps.Active.Mapper.id,
@ -2275,6 +2272,7 @@ Metamaps.Realtime = {
},
denyCall: function (userid) {
var self = Metamaps.Realtime;
self.room.chat.sound.stop('sessioninvite');
self.socket.emit('callDenied', {
mapid: Metamaps.Active.Map.id,
invited: Metamaps.Active.Mapper.id,
@ -2284,6 +2282,7 @@ Metamaps.Realtime = {
},
denyInvite: function (userid) {
var self = Metamaps.Realtime;
self.room.chat.sound.stop('sessioninvite');
self.socket.emit('inviteDenied', {
mapid: Metamaps.Active.Map.id,
invited: Metamaps.Active.Mapper.id,
@ -2322,14 +2321,14 @@ Metamaps.Realtime = {
var self = Metamaps.Realtime;
var username = self.mappersOnMap[userid].name;
Metamaps.GlobalUI.notifyUser(username + ' didn\'t accept your invite.');
Metamaps.GlobalUI.notifyUser(username + ' didn\'t accept your invitation');
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.');
Metamaps.GlobalUI.notifyUser(username + ' didn\'t accept your invitation');
self.room.chat.invitationAnswered(userid);
},
joinCall: function () {
@ -2611,6 +2610,7 @@ Metamaps.Realtime = {
// create an item for them in the realtime box
if (data.userid !== Metamaps.Active.Mapper.id && self.status) {
self.room.chat.sound.play('joinmap');
self.room.chat.addParticipant(self.mappersOnMap[data.userid]);
// create a div for the collaborators compass
@ -2661,7 +2661,7 @@ Metamaps.Realtime = {
// data.username
delete self.mappersOnMap[data.userid];
self.room.chat.sound.play('leavemap');
//$('#mapper' + data.userid).remove();
$('#compass' + data.userid).remove();
self.room.chat.removeParticipant(data.username);

View file

@ -94,9 +94,13 @@ Metamaps.Views.chatView = (function () {
},
initializeSounds: function() {
this.sound = new Howl({
urls: ["<%= asset_path 'sounds/sounds.mp3' %>", "<%= asset_path 'sounds/sounds.ogg' %>"],
urls: ["<%= asset_path 'sounds/MM_sounds.mp3' %>", "<%= asset_path 'sounds/MM_sounds.ogg' %>"],
sprite: {
laser: [3000, 700]
joinmap: [0, 561],
leavemap: [1000, 592],
receivechat: [2000, 318],
sendchat: [3000, 296],
sessioninvite: [4000, 5393, true]
}
});
},
@ -105,7 +109,7 @@ Metamaps.Views.chatView = (function () {
this.$unread.html(this.unreadMessages);
this.$unread.show();
},
addMessage: function(message, isInitial) {
addMessage: function(message, isInitial, wasMe) {
if (!this.isOpen && !isInitial) Private.incrementUnread.call(this);
@ -129,7 +133,7 @@ Metamaps.Views.chatView = (function () {
this.$messages.append($html);
if (!isInitial) this.scrollMessages(200);
if (!isInitial && this.alertSound) this.sound.play('laser');
if (!isInitial && this.alertSound && !wasMe) this.sound.play('receivechat');
},
initialMessages: function() {
var messages = this.messages.models;

View file

@ -156,6 +156,7 @@ Metamaps.Views.room = (function () {
room.prototype.sendChatMessage = function (data) {
var self = this;
//this.roomRef.child('messages').push(data);
if (self.chat.alertSound) self.chat.sound.play('sendchat');
var m = new Metamaps.Backbone.Message({
message: data.message,
resource_id: Metamaps.Active.Map.id,

View file

@ -273,7 +273,6 @@
box-shadow: 0px 6px 3px rgba(0, 0, 0, 0.23), 10px 10px 10px rgba(0, 0, 0, 0.19);
}
.chat-box .chat-header .sound-toggle {
display: none;
width: 24px;
height: 24px;
margin-right: 32px;