2022-09-01 14:00:49 +03:00
|
|
|
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
2022-04-08 15:24:58 +03:00
|
|
|
|
2018-07-26 18:33:40 +02:00
|
|
|
import {
|
2024-10-02 18:59:04 -05:00
|
|
|
TRANSCRIBER_JOINED,
|
|
|
|
|
TRANSCRIBER_LEFT
|
2022-04-08 15:24:58 +03:00
|
|
|
} from './actionTypes';
|
2018-07-26 18:33:40 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns initial state for transcribing feature part of Redux store.
|
|
|
|
|
*
|
|
|
|
|
* @returns {{
|
|
|
|
|
* isTranscribing: boolean,
|
2024-10-02 18:59:04 -05:00
|
|
|
* transcriberJID: null
|
2018-07-26 18:33:40 +02:00
|
|
|
* }}
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
function _getInitialState() {
|
|
|
|
|
return {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates whether there is currently an active transcriber in the
|
2021-11-04 22:10:43 +01:00
|
|
|
* room.
|
2018-07-26 18:33:40 +02:00
|
|
|
*
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
isTranscribing: false,
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-04 22:10:43 +01:00
|
|
|
* The JID of the active transcriber.
|
2018-07-26 18:33:40 +02:00
|
|
|
*
|
|
|
|
|
* @type { string }
|
|
|
|
|
*/
|
2024-10-02 18:59:04 -05:00
|
|
|
transcriberJID: null
|
2018-07-26 18:33:40 +02:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-01 14:00:49 +03:00
|
|
|
export interface ITranscribingState {
|
|
|
|
|
isTranscribing: boolean;
|
2022-09-08 12:52:36 +03:00
|
|
|
transcriberJID?: string | null;
|
2022-09-01 14:00:49 +03:00
|
|
|
}
|
|
|
|
|
|
2018-07-26 18:33:40 +02:00
|
|
|
/**
|
|
|
|
|
* Reduces the Redux actions of the feature features/transcribing.
|
|
|
|
|
*/
|
2022-09-05 12:05:07 +03:00
|
|
|
ReducerRegistry.register<ITranscribingState>('features/transcribing',
|
|
|
|
|
(state = _getInitialState(), action): ITranscribingState => {
|
2018-07-26 18:33:40 +02:00
|
|
|
switch (action.type) {
|
2024-10-02 18:59:04 -05:00
|
|
|
case TRANSCRIBER_JOINED:
|
2018-07-26 18:33:40 +02:00
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
isTranscribing: true,
|
|
|
|
|
transcriberJID: action.transcriberJID
|
|
|
|
|
};
|
2024-10-02 18:59:04 -05:00
|
|
|
case TRANSCRIBER_LEFT:
|
2018-07-26 18:33:40 +02:00
|
|
|
return {
|
|
|
|
|
...state,
|
|
|
|
|
isTranscribing: false,
|
2024-10-02 18:59:04 -05:00
|
|
|
transcriberJID: undefined
|
2018-07-26 18:33:40 +02:00
|
|
|
};
|
|
|
|
|
default:
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
});
|