ref(subtitles): remove logic around dialing transcriber (#4011)

This commit is contained in:
virtuacoplenny 2019-04-16 12:27:17 -07:00 committed by GitHub
parent 69a12395d2
commit 866dc4dbc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 127 deletions

View File

@ -1,23 +1,3 @@
/**
* The type of Redux action triggering the transcriber to join (be 'dialed' in)
*
* {
* type: DIAL_TRANSCRIBER
* }
* @public
*/
export const DIAL_TRANSCRIBER = 'DIAL_TRANSCRIBER';
/**
* The type of Redux action triggering the transcriber to leave.
*
* {
* type: STOP_TRANSCRBIBING
* }
* @public
*/
export const STOP_TRANSCRIBING = 'STOP_TRANSCRBIBING';
/**
* The type of Redux action triggering storage of participantId of transcriber,
* so that it can later be kicked
@ -53,16 +33,6 @@ export const _TRANSCRIBER_LEFT = 'TRANSCRIBER_LEFT';
export const _POTENTIAL_TRANSCRIBER_JOINED
= 'POTENTIAL_TRANSCRIBER_JOINED';
/**
* The type of a Redux action signalling that dialing the transcriber failed.
*
* {
* type: _DIAL_ERROR,
* }
* @private
*/
export const _DIAL_ERROR = 'DIAL_ERROR';
/**
* The type of Redux action which sets the pending transcribing notification UID
* to use it for when hiding the notification is necessary, or unsets it when

View File

@ -1,13 +1,10 @@
// @flow
import {
_DIAL_ERROR,
_POTENTIAL_TRANSCRIBER_JOINED,
_TRANSCRIBER_JOINED,
_TRANSCRIBER_LEFT,
DIAL_TRANSCRIBER,
SET_PENDING_TRANSCRIBING_NOTIFICATION_UID,
STOP_TRANSCRIBING
SET_PENDING_TRANSCRIBING_NOTIFICATION_UID
} from './actionTypes';
import {
NOTIFICATION_TIMEOUT,
@ -16,33 +13,6 @@ import {
showNotification
} from '../notifications';
/**
* Dial the transcriber into the room.
*
* @public
* @returns {{
* type: DIAL_TRANSCRIBER
* }}
*/
export function dialTranscriber() {
return {
type: DIAL_TRANSCRIBER
};
}
/**
* Stop the transcribing by kicking the transcriber participant.
*
* @returns {{
* type: STOP_TRANSCRIBING
* }}
*/
export function stopTranscribing() {
return {
type: STOP_TRANSCRIBING
};
}
/**
* Notify that the transcriber, with a unique ID, has joined.
*
@ -91,19 +61,6 @@ export function potentialTranscriberJoined(participantId: string) {
};
}
/**
* Notify that dialing the transcriber resulted in an error.
*
* @returns {{
* type: _DIAL_ERROR
* }}
*/
export function dialError() {
return {
type: _DIAL_ERROR
};
}
/**
* Signals that the pending transcribing notification should be shown on the
* screen.

View File

@ -3,17 +3,12 @@
import { MiddlewareRegistry } from '../base/redux';
import {
_TRANSCRIBER_LEFT,
DIAL_TRANSCRIBER,
STOP_TRANSCRIBING
_TRANSCRIBER_LEFT
} from './actionTypes';
import {
dialError,
hidePendingTranscribingNotification,
potentialTranscriberJoined,
showPendingTranscribingNotification,
showStoppedTranscribingNotification,
showTranscribingError,
transcriberJoined,
transcriberLeft
} from './actions';
@ -23,9 +18,6 @@ import {
PARTICIPANT_UPDATED
} from './../base/participants';
declare var APP: Object;
const TRANSCRIBER_DIAL_COMMAND = 'jitsi_meet_transcribe';
const TRANSCRIBER_DISPLAY_NAME = 'Transcriber';
/**
@ -37,35 +29,11 @@ const TRANSCRIBER_DISPLAY_NAME = 'Transcriber';
// eslint-disable-next-line no-unused-vars
MiddlewareRegistry.register(store => next => action => {
const {
isDialing,
isTranscribing,
transcriberJID,
potentialTranscriberJIDs
} = store.getState()['features/transcribing'];
const { conference } = store.getState()['features/base/conference'];
switch (action.type) {
case DIAL_TRANSCRIBER:
if (!(isDialing || isTranscribing)) {
store.dispatch(showPendingTranscribingNotification());
conference.room.dial(TRANSCRIBER_DIAL_COMMAND).catch(
() => {
store.dispatch(dialError());
store.dispatch(hidePendingTranscribingNotification());
store.dispatch(showTranscribingError());
}
);
}
break;
case STOP_TRANSCRIBING:
if (isTranscribing) {
const participant = conference.getParticipantById(transcriberJID);
conference.room.kick(participant.getJid());
}
break;
case _TRANSCRIBER_LEFT:
store.dispatch(showStoppedTranscribingNotification());
break;

View File

@ -1,12 +1,9 @@
import { ReducerRegistry } from '../base/redux';
import {
_DIAL_ERROR,
_TRANSCRIBER_JOINED,
_TRANSCRIBER_LEFT,
_POTENTIAL_TRANSCRIBER_JOINED,
DIAL_TRANSCRIBER,
SET_PENDING_TRANSCRIBING_NOTIFICATION_UID,
STOP_TRANSCRIBING
SET_PENDING_TRANSCRIBING_NOTIFICATION_UID
} from '../transcribing/actionTypes';
/**
@ -66,22 +63,6 @@ function _getInitialState() {
ReducerRegistry.register('features/transcribing',
(state = _getInitialState(), action) => {
switch (action.type) {
case DIAL_TRANSCRIBER:
return {
...state,
isDialing: true
};
case STOP_TRANSCRIBING:
return {
...state,
isTerminating: true
};
case _DIAL_ERROR:
return {
...state,
isDialing: false,
potentialTranscriberJIDs: []
};
case _TRANSCRIBER_JOINED:
return {
...state,