handle DTMF_SUPPORT_CHANGED event

This commit is contained in:
isymchych 2015-12-10 13:57:18 +02:00
parent fc207ccf34
commit eeb390cd9d
3 changed files with 15 additions and 21 deletions

18
app.js
View File

@ -343,9 +343,6 @@ function initConference(localTracks, connection) {
room.setDisplayName(nickname); room.setDisplayName(nickname);
}); });
room.on(ConferenceErrors.PASSWORD_REQUIRED, function () {
// FIXME handle
});
room.on(ConferenceErrors.CONNECTION_ERROR, function () { room.on(ConferenceErrors.CONNECTION_ERROR, function () {
// FIXME handle // FIXME handle
}); });
@ -366,25 +363,26 @@ function initConference(localTracks, connection) {
); );
}); });
room.on(ConferenceEvents.DTMF_SUPPORT_CHANGED, function (isDTMFSupported) {
APP.UI.updateDTMFSupport(isDTMFSupported);
});
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
room.on(ConferenceEvents.CONFERENCE_JOINED, resolve); room.on(ConferenceEvents.CONFERENCE_JOINED, resolve);
room.on(ConferenceErrors.ROOM_PASSWORD_REQUIRED, function () { room.on(ConferenceErrors.PASSWORD_REQUIRED, function () {
APP.UI.markRoomLocked(true); APP.UI.markRoomLocked(true);
roomLocker.requirePassword().then(function () { roomLocker.requirePassword().then(function () {
room.join(roomLocker.password); room.join(roomLocker.password);
}); });
}); });
// FIXME handle errors here
APP.UI.closeAuthenticationDialog(); APP.UI.closeAuthenticationDialog();
room.join(); room.join();
}).catch(function (err) { }).catch(function (err) {
if (err[0] === ConferenceErrors.PASSWORD_REQUIRED) { // FIXME notify that we cannot conenct to the room
// FIXME ask for password and try again
return initConference(localTracks, connection);
}
// FIXME else notify that we cannot conenct to the room
throw new Error(err[0]); throw new Error(err[0]);
}); });

View File

@ -83,7 +83,7 @@ function notifyPasswordFailed() {
messageHandler.showError("dialog.lockTitle", "dialog.lockMessage"); messageHandler.showError("dialog.lockTitle", "dialog.lockMessage");
} }
const JitsiConferenceErrors = JitsiMeetJS.errors.conference; const ConferenceErrors = JitsiMeetJS.errors.conference;
export default function createRoomLocker (room) { export default function createRoomLocker (room) {
let password; let password;
@ -92,7 +92,7 @@ export default function createRoomLocker (room) {
return room.lock(newPass).then(function () { return room.lock(newPass).then(function () {
password = newPass; password = newPass;
}).catch(function (err) { }).catch(function (err) {
if (err === JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED) { if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
notifyPasswordNotSupported(); notifyPasswordNotSupported();
} else { } else {
notifyPasswordFailed(err); notifyPasswordFailed(err);

View File

@ -316,15 +316,6 @@ function initEtherpad(name) {
Etherpad.init(name); Etherpad.init(name);
} }
/**
* The dialpad button is shown iff there is at least one member that supports
* DTMF (e.g. jigasi).
*/
function onDtmfSupportChanged(dtmfSupport) {
//TODO: enable when the UI is ready
//Toolbar.showDialPadButton(dtmfSupport);
}
UI.addUser = function (jid, id, displayName) { UI.addUser = function (jid, id, displayName) {
messageHandler.notify( messageHandler.notify(
displayName,'notify.somebody', 'connected', 'notify.connected' displayName,'notify.somebody', 'connected', 'notify.connected'
@ -621,4 +612,9 @@ UI.addMessage = function (from, displayName, message, stamp) {
Chat.updateChatConversation(from, displayName, message, stamp); Chat.updateChatConversation(from, displayName, message, stamp);
}; };
UI.updateDTMFSupport = function (isDTMFSupported) {
//TODO: enable when the UI is ready
//Toolbar.showDialPadButton(dtmfSupport);
};
module.exports = UI; module.exports = UI;