feat(e2ee): adds sounds for e2ee enabling/disabling
This commit is contained in:
parent
b826fc1d5a
commit
b1d7debfb9
|
@ -0,0 +1,15 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the sound to be played when e2ee is disabled.
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const E2EE_OFF_SOUND_ID = 'E2EE_OFF_SOUND';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The identifier of the sound to be played when e2ee is enabled.
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const E2EE_ON_SOUND_ID = 'E2EE_ON_SOUND';
|
|
@ -1,12 +1,16 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
|
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
||||||
import { getCurrentConference } from '../base/conference';
|
import { getCurrentConference } from '../base/conference';
|
||||||
import { getLocalParticipant, participantUpdated } from '../base/participants';
|
import { getLocalParticipant, participantUpdated } from '../base/participants';
|
||||||
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
||||||
|
import { playSound, registerSound, unregisterSound } from '../base/sounds';
|
||||||
|
|
||||||
import { TOGGLE_E2EE } from './actionTypes';
|
import { TOGGLE_E2EE } from './actionTypes';
|
||||||
import { toggleE2EE } from './actions';
|
import { toggleE2EE } from './actions';
|
||||||
|
import { E2EE_OFF_SOUND_ID, E2EE_ON_SOUND_ID } from './constants';
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
import { E2EE_OFF_SOUND_FILE, E2EE_ON_SOUND_FILE } from './sounds';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Middleware that captures actions related to E2EE.
|
* Middleware that captures actions related to E2EE.
|
||||||
|
@ -16,6 +20,21 @@ import logger from './logger';
|
||||||
*/
|
*/
|
||||||
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
case APP_WILL_MOUNT:
|
||||||
|
dispatch(registerSound(
|
||||||
|
E2EE_OFF_SOUND_ID,
|
||||||
|
E2EE_OFF_SOUND_FILE));
|
||||||
|
|
||||||
|
dispatch(registerSound(
|
||||||
|
E2EE_ON_SOUND_ID,
|
||||||
|
E2EE_ON_SOUND_FILE));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case APP_WILL_UNMOUNT:
|
||||||
|
dispatch(unregisterSound(E2EE_OFF_SOUND_ID));
|
||||||
|
dispatch(unregisterSound(E2EE_ON_SOUND_ID));
|
||||||
|
break;
|
||||||
|
|
||||||
case TOGGLE_E2EE: {
|
case TOGGLE_E2EE: {
|
||||||
const conference = getCurrentConference(getState);
|
const conference = getCurrentConference(getState);
|
||||||
|
|
||||||
|
@ -31,6 +50,10 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
id: participant.id,
|
id: participant.id,
|
||||||
local: true
|
local: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const soundID = action.enabled ? E2EE_ON_SOUND_ID : E2EE_OFF_SOUND_ID;
|
||||||
|
|
||||||
|
dispatch(playSound(soundID));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the bundled audio file which will be played when e2ee is disabled.
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const E2EE_OFF_SOUND_FILE = 'e2eeOff.mp3';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the bundled audio file which will be played when e2ee is enabled.
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const E2EE_ON_SOUND_FILE = 'e2eeOn.mp3';
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue