create action to handle video-conf calls

This commit is contained in:
GleidsonDaniel 2023-03-07 18:25:50 -03:00
parent 0cb9897bdf
commit c6658d570b
5 changed files with 65 additions and 1 deletions

View File

@ -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']);

16
app/actions/videoConf.ts Normal file
View File

@ -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
};
}

View File

@ -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 = () => {

View File

@ -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()
]);
};

38
app/sagas/videoConf.js Normal file
View File

@ -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;