bug fixes and chat sounds on by default
This commit is contained in:
parent
ac762e0056
commit
c3595f9cb4
3 changed files with 11 additions and 9 deletions
|
@ -2239,6 +2239,7 @@ Metamaps.Realtime = {
|
||||||
invitedToCall: function (inviter) {
|
invitedToCall: function (inviter) {
|
||||||
var self = Metamaps.Realtime;
|
var self = Metamaps.Realtime;
|
||||||
|
|
||||||
|
self.room.chat.sound.stop('sessioninvite');
|
||||||
self.room.chat.sound.play('sessioninvite');
|
self.room.chat.sound.play('sessioninvite');
|
||||||
|
|
||||||
var username = self.mappersOnMap[inviter].name;
|
var username = self.mappersOnMap[inviter].name;
|
||||||
|
@ -2251,6 +2252,7 @@ Metamaps.Realtime = {
|
||||||
invitedToJoin: function (inviter) {
|
invitedToJoin: function (inviter) {
|
||||||
var self = Metamaps.Realtime;
|
var self = Metamaps.Realtime;
|
||||||
|
|
||||||
|
self.room.chat.sound.stop('sessioninvite');
|
||||||
self.room.chat.sound.play('sessioninvite');
|
self.room.chat.sound.play('sessioninvite');
|
||||||
|
|
||||||
var username = self.mappersOnMap[inviter].name;
|
var username = self.mappersOnMap[inviter].name;
|
||||||
|
|
|
@ -38,7 +38,7 @@ Metamaps.Views.chatView = (function () {
|
||||||
this.$participants = $('<div class="participants"></div>');
|
this.$participants = $('<div class="participants"></div>');
|
||||||
this.$conversationInProgress = $('<div class="conversation-live">LIVE <span class="call-action leave" onclick="Metamaps.Realtime.leaveCall();">LEAVE</span><span class="call-action join" onclick="Metamaps.Realtime.joinCall();">JOIN</span></div>');
|
this.$conversationInProgress = $('<div class="conversation-live">LIVE <span class="call-action leave" onclick="Metamaps.Realtime.leaveCall();">LEAVE</span><span class="call-action join" onclick="Metamaps.Realtime.joinCall();">JOIN</span></div>');
|
||||||
this.$chatHeader = $('<div class="chat-header">CHAT</div>');
|
this.$chatHeader = $('<div class="chat-header">CHAT</div>');
|
||||||
this.$soundToggle = $('<div class="sound-toggle active"></div>');
|
this.$soundToggle = $('<div class="sound-toggle"></div>');
|
||||||
this.$messages = $('<div class="chat-messages"></div>');
|
this.$messages = $('<div class="chat-messages"></div>');
|
||||||
this.$container = $('<div class="chat-box"></div>');
|
this.$container = $('<div class="chat-box"></div>');
|
||||||
},
|
},
|
||||||
|
@ -109,7 +109,7 @@ Metamaps.Views.chatView = (function () {
|
||||||
this.$unread.html(this.unreadMessages);
|
this.$unread.html(this.unreadMessages);
|
||||||
this.$unread.show();
|
this.$unread.show();
|
||||||
},
|
},
|
||||||
addMessage: function(message, isInitial) {
|
addMessage: function(message, isInitial, wasMe) {
|
||||||
|
|
||||||
if (!this.isOpen && !isInitial) Private.incrementUnread.call(this);
|
if (!this.isOpen && !isInitial) Private.incrementUnread.call(this);
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ Metamaps.Views.chatView = (function () {
|
||||||
this.$messages.append($html);
|
this.$messages.append($html);
|
||||||
if (!isInitial) this.scrollMessages(200);
|
if (!isInitial) this.scrollMessages(200);
|
||||||
|
|
||||||
if (!isInitial && this.alertSound) this.sound.play('receivechat');
|
if (!wasMe && !isInitial && this.alertSound) this.sound.play('receivechat');
|
||||||
},
|
},
|
||||||
initialMessages: function() {
|
initialMessages: function() {
|
||||||
var messages = this.messages.models;
|
var messages = this.messages.models;
|
||||||
|
@ -207,7 +207,7 @@ Metamaps.Views.chatView = (function () {
|
||||||
this.messages = messages; // backbone collection
|
this.messages = messages; // backbone collection
|
||||||
|
|
||||||
this.isOpen = false;
|
this.isOpen = false;
|
||||||
this.alertSound = false; // whether to play sounds on arrival of new messages or not
|
this.alertSound = true; // whether to play sounds on arrival of new messages or not
|
||||||
this.cursorsShowing = true;
|
this.cursorsShowing = true;
|
||||||
this.videosShowing = true;
|
this.videosShowing = true;
|
||||||
this.unreadMessages = 0;
|
this.unreadMessages = 0;
|
||||||
|
@ -289,9 +289,9 @@ Metamaps.Views.chatView = (function () {
|
||||||
$(document).trigger(chatView.events.openTray);
|
$(document).trigger(chatView.events.openTray);
|
||||||
}
|
}
|
||||||
|
|
||||||
chatView.prototype.addMessage = function(message, isInitial) {
|
chatView.prototype.addMessage = function(message, isInitial, wasMe) {
|
||||||
this.messages.add(message);
|
this.messages.add(message);
|
||||||
Private.addMessage.call(this, message, isInitial);
|
Private.addMessage.call(this, message, isInitial, wasMe);
|
||||||
}
|
}
|
||||||
|
|
||||||
chatView.prototype.scrollMessages = function(duration) {
|
chatView.prototype.scrollMessages = function(duration) {
|
||||||
|
|
|
@ -164,7 +164,7 @@ Metamaps.Views.room = (function () {
|
||||||
});
|
});
|
||||||
m.save(null, {
|
m.save(null, {
|
||||||
success: function (model, response) {
|
success: function (model, response) {
|
||||||
self.addMessages(new Metamaps.Backbone.MessageCollection(model), true);
|
self.addMessages(new Metamaps.Backbone.MessageCollection(model), false, true);
|
||||||
$(document).trigger(room.events.newMessage, [model]);
|
$(document).trigger(room.events.newMessage, [model]);
|
||||||
},
|
},
|
||||||
error: function (model, response) {
|
error: function (model, response) {
|
||||||
|
@ -175,11 +175,11 @@ Metamaps.Views.room = (function () {
|
||||||
|
|
||||||
// they should be instantiated as backbone models before they get
|
// they should be instantiated as backbone models before they get
|
||||||
// passed to this function
|
// passed to this function
|
||||||
room.prototype.addMessages = function (messages, isInitial) {
|
room.prototype.addMessages = function (messages, isInitial, wasMe) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
messages.models.forEach(function (message) {
|
messages.models.forEach(function (message) {
|
||||||
self.chat.addMessage(message, isInitial);
|
self.chat.addMessage(message, isInitial, wasMe);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue