create action to handle video-conf calls
This commit is contained in:
parent
0cb9897bdf
commit
c6658d570b
|
@ -84,3 +84,5 @@ export const ENCRYPTION = createRequestTypes('ENCRYPTION', ['INIT', 'STOP', 'DEC
|
|||
|
||||
export const PERMISSIONS = createRequestTypes('PERMISSIONS', ['SET', 'UPDATE']);
|
||||
export const ROLES = createRequestTypes('ROLES', ['SET', 'UPDATE', 'REMOVE']);
|
||||
export const VIDEO_CONF = createRequestTypes('VIDEO_CONF', ['HANDLE_INCOMING_WEBSOCKET_MESSAGES']);
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import { Action } from 'redux';
|
||||
|
||||
import { VIDEO_CONF } from './actionsTypes';
|
||||
|
||||
export interface IVideoConfGenericAction extends Action {
|
||||
data: any;
|
||||
}
|
||||
|
||||
export type TActionUserTyping = IVideoConfGenericAction & Action;
|
||||
|
||||
export function handleVideoConfIncomingWebsocketMessages(data: any): IVideoConfGenericAction {
|
||||
return {
|
||||
type: VIDEO_CONF.HANDLE_INCOMING_WEBSOCKET_MESSAGES,
|
||||
data
|
||||
};
|
||||
}
|
|
@ -34,6 +34,7 @@ import { E2E_MESSAGE_TYPE } from '../../constants';
|
|||
import { getRoom } from '../getRoom';
|
||||
import { merge } from '../helpers/mergeSubscriptionsRooms';
|
||||
import { getRoomAvatar, getRoomTitle, getSenderName, random } from '../helpers';
|
||||
import { handleVideoConfIncomingWebsocketMessages } from '../../../actions/videoConf';
|
||||
|
||||
const removeListener = (listener: { stop: () => void }) => listener.stop();
|
||||
|
||||
|
@ -402,6 +403,11 @@ export default function subscribeRooms() {
|
|||
log(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (/video-conference/.test(ev)) {
|
||||
const [action, params] = ddpMessage.fields.args;
|
||||
store.dispatch(handleVideoConfIncomingWebsocketMessages({ action, params }));
|
||||
}
|
||||
});
|
||||
|
||||
const stop = () => {
|
||||
|
|
|
@ -13,6 +13,7 @@ import deepLinking from './deepLinking';
|
|||
import inviteLinks from './inviteLinks';
|
||||
import createDiscussion from './createDiscussion';
|
||||
import encryption from './encryption';
|
||||
import videoConf from './videoConf';
|
||||
|
||||
const root = function* root() {
|
||||
yield all([
|
||||
|
@ -28,7 +29,8 @@ const root = function* root() {
|
|||
inviteLinks(),
|
||||
createDiscussion(),
|
||||
inquiry(),
|
||||
encryption()
|
||||
encryption(),
|
||||
videoConf()
|
||||
]);
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
import { takeLatest } from 'redux-saga/effects';
|
||||
|
||||
import { VIDEO_CONF } from '../actions/actionsTypes';
|
||||
|
||||
const handleVideoConfIncomingWebsocketMessages = function* handleVideoConfIncomingWebsocketMessages({ data }) {
|
||||
const { action, params } = data.action;
|
||||
|
||||
if (!action || typeof action !== 'string') {
|
||||
return;
|
||||
}
|
||||
if (!params || typeof params !== 'object' || !params.callId || !params.uid || !params.rid) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(action, params);
|
||||
// switch (action) {
|
||||
// case 'call':
|
||||
// return this.onDirectCall(params);
|
||||
// case 'canceled':
|
||||
// return this.onDirectCallCanceled(params);
|
||||
// case 'accepted':
|
||||
// return this.onDirectCallAccepted(params);
|
||||
// case 'rejected':
|
||||
// return this.onDirectCallRejected(params);
|
||||
// case 'confirmed':
|
||||
// return this.onDirectCallConfirmed(params);
|
||||
// case 'join':
|
||||
// return this.onDirectCallJoined(params);
|
||||
// case 'end':
|
||||
// return this.onDirectCallEnded(params);
|
||||
// }
|
||||
};
|
||||
|
||||
const root = function* root() {
|
||||
yield takeLatest(VIDEO_CONF.HANDLE_INCOMING_WEBSOCKET_MESSAGES, handleVideoConfIncomingWebsocketMessages);
|
||||
};
|
||||
|
||||
export default root;
|
Loading…
Reference in New Issue