2022-07-01 09:32:39 +00:00
|
|
|
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
2019-05-21 10:32:20 +00:00
|
|
|
|
|
|
|
import { UPDATE_LOCAL_TRACKS_DURATION } from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initial state.
|
|
|
|
*/
|
|
|
|
const DEFAULT_STATE = {
|
|
|
|
localTracksDuration: {
|
|
|
|
audio: {
|
|
|
|
startedTime: -1,
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
video: {
|
|
|
|
camera: {
|
|
|
|
startedTime: -1,
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
desktop: {
|
|
|
|
startedTime: -1,
|
|
|
|
value: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
conference: {
|
|
|
|
startedTime: -1,
|
|
|
|
value: 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
interface IValue {
|
2022-09-08 09:52:36 +00:00
|
|
|
startedTime: number;
|
|
|
|
value: number;
|
2022-07-01 09:32:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface IAnalyticsState {
|
|
|
|
localTracksDuration: {
|
2022-10-20 09:11:27 +00:00
|
|
|
audio: IValue;
|
|
|
|
conference: IValue;
|
2022-07-01 09:32:39 +00:00
|
|
|
video: {
|
2022-10-20 09:11:27 +00:00
|
|
|
camera: IValue;
|
|
|
|
desktop: IValue;
|
2022-09-08 09:52:36 +00:00
|
|
|
};
|
|
|
|
};
|
2022-07-01 09:32:39 +00:00
|
|
|
}
|
|
|
|
|
2019-05-21 10:32:20 +00:00
|
|
|
/**
|
|
|
|
* Listen for actions which changes the state of the analytics feature.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state of the feature features/analytics.
|
|
|
|
* @param {Object} action - Action object.
|
|
|
|
* @param {string} action.type - Type of action.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2022-09-05 09:05:07 +00:00
|
|
|
ReducerRegistry.register<IAnalyticsState>('features/analytics',
|
|
|
|
(state = DEFAULT_STATE, action): IAnalyticsState => {
|
2019-05-21 10:32:20 +00:00
|
|
|
switch (action.type) {
|
|
|
|
case UPDATE_LOCAL_TRACKS_DURATION:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
localTracksDuration: action.localTracksDuration
|
|
|
|
};
|
|
|
|
default:
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
});
|