зеркало из https://github.com/nextcloud/spreed.git
Set room left/deleted message as a response to events
The "Connection" object should not change the UI directly, so now the empty content message when the current room is left or deleted it is set as a response to the "leaveCurrentRoom" and "destroy" events. As the "deleter" parameter of "leaveCurrentRoom" was only used to show one message or the other it is no longer needed, so it was removed. The empty content message set when the room is deleted was also updated to match the initial empty content message. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Родитель
9e42d26fb0
Коммит
3a9a407fc2
21
js/app.js
21
js/app.js
|
@ -483,6 +483,8 @@
|
|||
|
||||
var participants;
|
||||
if (OC.getCurrentUser().uid) {
|
||||
self.stopListening(self.activeRoom, 'destroy', self.setInitialEmptyContentMessage);
|
||||
|
||||
roomChannel.trigger('active', token);
|
||||
|
||||
self._rooms.forEach(function(room) {
|
||||
|
@ -492,6 +494,8 @@
|
|||
});
|
||||
participants = self.activeRoom.get('participants');
|
||||
self.setEmptyContentMessageWhenWaitingForOthersToJoinTheCall();
|
||||
|
||||
self.listenTo(self.activeRoom, 'destroy', self.setInitialEmptyContentMessage);
|
||||
} else {
|
||||
// The public page supports only a single room, so the
|
||||
// active room is already the room for the given token.
|
||||
|
@ -620,6 +624,13 @@
|
|||
$emptyContent.find('h2').html(message);
|
||||
$emptyContent.find('p').text(messageAdditional ? messageAdditional : '');
|
||||
},
|
||||
setInitialEmptyContentMessage: function() {
|
||||
OCA.SpreedMe.app.setEmptyContentMessage(
|
||||
'icon-talk',
|
||||
t('spreed', 'Join a conversation or start a new one'),
|
||||
t('spreed', 'Say hi to your friends and colleagues!')
|
||||
);
|
||||
},
|
||||
setEmptyContentMessageWhenWaitingForOthersToJoinTheCall: function() {
|
||||
var icon = '';
|
||||
var message = '';
|
||||
|
@ -696,6 +707,12 @@
|
|||
t('spreed', 'Please, give your browser access to use your camera and microphone in order to use this app.')
|
||||
);
|
||||
},
|
||||
setEmptyContentMessageWhenConversationEnded: function() {
|
||||
OCA.SpreedMe.app.setEmptyContentMessage(
|
||||
'icon-video-off',
|
||||
t('spreed', 'This conversation has ended')
|
||||
);
|
||||
},
|
||||
initialize: function() {
|
||||
this._sidebarView = new OCA.SpreedMe.Views.SidebarView();
|
||||
$('#content').append(this._sidebarView.$el);
|
||||
|
@ -811,6 +828,8 @@
|
|||
});
|
||||
|
||||
this.listenTo(roomChannel, 'leaveCurrentRoom', function() {
|
||||
this.setEmptyContentMessageWhenConversationEnded();
|
||||
|
||||
this._chatView.$el.detach();
|
||||
this._chatViewInMainView = false;
|
||||
|
||||
|
@ -837,7 +856,7 @@
|
|||
}.bind(this));
|
||||
|
||||
$(window).unload(function () {
|
||||
this.connection.leaveCurrentRoom(false);
|
||||
this.connection.leaveCurrentRoom();
|
||||
this.signaling.disconnect();
|
||||
}.bind(this));
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
});
|
||||
|
||||
this.app.signaling.on('roomChanged', function() {
|
||||
this.leaveCurrentRoom(false);
|
||||
this.leaveCurrentRoom();
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
|
@ -97,14 +97,14 @@
|
|||
this.app.syncAndSetActiveRoom(token);
|
||||
$('#video-fullscreen').removeClass('hidden');
|
||||
},
|
||||
leaveCurrentRoom: function(deleter) {
|
||||
leaveCurrentRoom: function() {
|
||||
$('#video-fullscreen').addClass('hidden');
|
||||
this.app.signaling.leaveCurrentRoom();
|
||||
if (!OCA.Talk.PublicShareAuth) {
|
||||
OC.Util.History.pushState({}, OC.generateUrl('/apps/spreed'));
|
||||
}
|
||||
$('#app-content, #talk-sidebar').removeClass('incall');
|
||||
this.showRoomDeletedMessage(deleter);
|
||||
|
||||
roomsChannel.trigger('leaveCurrentRoom');
|
||||
},
|
||||
joinCall: function(token) {
|
||||
|
@ -134,19 +134,6 @@
|
|||
this.app.signaling.syncRooms();
|
||||
$('#app-content, #talk-sidebar').removeClass('incall');
|
||||
},
|
||||
showRoomDeletedMessage: function(deleter) {
|
||||
if (deleter) {
|
||||
this.app.setEmptyContentMessage(
|
||||
'icon-video',
|
||||
t('spreed', 'Join a conversation or start a new one')
|
||||
);
|
||||
} else {
|
||||
this.app.setEmptyContentMessage(
|
||||
'icon-video-off',
|
||||
t('spreed', 'This conversation has ended')
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})(OCA, OC, $);
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
this.connection = new OCA.Talk.Connection(this);
|
||||
|
||||
$(window).unload(function () {
|
||||
this.connection.leaveCurrentRoom(false);
|
||||
this.connection.leaveCurrentRoom();
|
||||
this.signaling.disconnect();
|
||||
}.bind(this));
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
OCA.SpreedMe.app.connection.leaveCurrentRoom(true);
|
||||
OCA.SpreedMe.app.connection.leaveCurrentRoom();
|
||||
},
|
||||
removeSelf: function() {
|
||||
this.destroy({
|
||||
|
|
|
@ -629,7 +629,7 @@
|
|||
// Request has been aborted. Ignore.
|
||||
} else if (this.currentRoomToken) {
|
||||
if (this.pullMessagesFails >= 3) {
|
||||
OCA.SpreedMe.app.connection.leaveCurrentRoom(false);
|
||||
OCA.SpreedMe.app.connection.leaveCurrentRoom();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче