ref(remotecontrol): Moves hangup logic to remote control module
This commit is contained in:
parent
1f7c5529e9
commit
bd98d661d3
|
@ -0,0 +1,4 @@
|
|||
/**
|
||||
* Notifies interested parties that hangup procedure will start.
|
||||
*/
|
||||
export const BEFORE_HANGUP = "conference.before_hangup";
|
|
@ -14,11 +14,11 @@ import {reportError} from './modules/util/helpers';
|
|||
|
||||
import UIEvents from './service/UI/UIEvents';
|
||||
import UIUtil from './modules/UI/util/UIUtil';
|
||||
import * as JitsiMeetConferenceEvents from './ConferenceEvents';
|
||||
|
||||
import analytics from './modules/analytics/analytics';
|
||||
|
||||
// For remote control testing:
|
||||
// import remoteControlReceiver from './modules/remotecontrol/Receiver';
|
||||
import EventEmitter from "events";
|
||||
|
||||
const ConnectionEvents = JitsiMeetJS.events.connection;
|
||||
const ConnectionErrors = JitsiMeetJS.errors.connection;
|
||||
|
@ -31,6 +31,8 @@ const TrackErrors = JitsiMeetJS.errors.track;
|
|||
|
||||
const ConnectionQualityEvents = JitsiMeetJS.events.connectionQuality;
|
||||
|
||||
const eventEmitter = new EventEmitter();
|
||||
|
||||
let room, connection, localAudio, localVideo;
|
||||
|
||||
/**
|
||||
|
@ -1783,8 +1785,8 @@ export default {
|
|||
* requested
|
||||
*/
|
||||
hangup (requestFeedback = false) {
|
||||
eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
|
||||
APP.UI.hideRingOverLay();
|
||||
APP.remoteControl.receiver.enable(false);
|
||||
let requestFeedbackPromise = requestFeedback
|
||||
? APP.UI.requestFeedbackOnHangup()
|
||||
// false - because the thank you dialog shouldn't be displayed
|
||||
|
@ -1846,5 +1848,24 @@ export default {
|
|||
*/
|
||||
sendEndpointMessage (to, payload) {
|
||||
room.sendEndpointMessage(to, payload);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds new listener.
|
||||
* @param {String} eventName the name of the event
|
||||
* @param {Function} listener the listener.
|
||||
*/
|
||||
addListener (eventName, listener) {
|
||||
eventEmitter.addListener(eventName, listener);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes listener.
|
||||
* @param {String} eventName the name of the event that triggers the
|
||||
* listener
|
||||
* @param {Function} listener the listener.
|
||||
*/
|
||||
removeListener (eventName, listener) {
|
||||
eventEmitter.removeListener(eventName, listener);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@ const logger = require("jitsi-meet-logger").getLogger(__filename);
|
|||
import {DISCO_REMOTE_CONTROL_FEATURE, REMOTE_CONTROL_EVENT_TYPE, EVENT_TYPES,
|
||||
PERMISSIONS_ACTIONS} from "../../service/remotecontrol/Constants";
|
||||
import RemoteControlParticipant from "./RemoteControlParticipant";
|
||||
import * as JitsiMeetConferenceEvents from '../../ConferenceEvents';
|
||||
|
||||
const ConferenceEvents = JitsiMeetJS.events.conference;
|
||||
|
||||
|
@ -23,6 +24,7 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
this._remoteControlEventsListener
|
||||
= this._onRemoteControlEvent.bind(this);
|
||||
this._userLeftListener = this._onUserLeft.bind(this);
|
||||
this._hangupListener = this._onHangup.bind(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,6 +42,8 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
APP.conference.addConferenceListener(
|
||||
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
|
||||
this._remoteControlEventsListener);
|
||||
APP.conference.addListener(JitsiMeetConferenceEvents.BEFORE_HANGUP,
|
||||
this._hangupListener);
|
||||
} else {
|
||||
logger.log("Remote control receiver disabled.");
|
||||
this._stop(true);
|
||||
|
@ -47,6 +51,9 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
APP.conference.removeConferenceListener(
|
||||
ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
|
||||
this._remoteControlEventsListener);
|
||||
APP.conference.removeListener(
|
||||
JitsiMeetConferenceEvents.BEFORE_HANGUP,
|
||||
this._hangupListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,4 +181,11 @@ export default class Receiver extends RemoteControlParticipant {
|
|||
this._stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles hangup events. Disables the receiver.
|
||||
*/
|
||||
_onHangup() {
|
||||
this.enable(false);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue