Browse Source

feat(e2ee): adds sounds for e2ee enabling/disabling

j8
tmoldovan8x8 3 years ago
parent
commit
b1d7debfb9
No account linked to committer's email address

+ 15
- 0
react/features/e2ee/constants.js View File

@@ -0,0 +1,15 @@
1
+// @flow
2
+
3
+/**
4
+ * The identifier of the sound to be played when e2ee is disabled.
5
+ *
6
+ * @type {string}
7
+ */
8
+export const E2EE_OFF_SOUND_ID = 'E2EE_OFF_SOUND';
9
+
10
+/**
11
+ * The identifier of the sound to be played when e2ee is enabled.
12
+ *
13
+ * @type {string}
14
+ */
15
+export const E2EE_ON_SOUND_ID = 'E2EE_ON_SOUND';

+ 23
- 0
react/features/e2ee/middleware.js View File

@@ -1,12 +1,16 @@
1 1
 // @flow
2 2
 
3
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
3 4
 import { getCurrentConference } from '../base/conference';
4 5
 import { getLocalParticipant, participantUpdated } from '../base/participants';
5 6
 import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
7
+import { playSound, registerSound, unregisterSound } from '../base/sounds';
6 8
 
7 9
 import { TOGGLE_E2EE } from './actionTypes';
8 10
 import { toggleE2EE } from './actions';
11
+import { E2EE_OFF_SOUND_ID, E2EE_ON_SOUND_ID } from './constants';
9 12
 import logger from './logger';
13
+import { E2EE_OFF_SOUND_FILE, E2EE_ON_SOUND_FILE } from './sounds';
10 14
 
11 15
 /**
12 16
  * Middleware that captures actions related to E2EE.
@@ -16,6 +20,21 @@ import logger from './logger';
16 20
  */
17 21
 MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
18 22
     switch (action.type) {
23
+    case APP_WILL_MOUNT:
24
+        dispatch(registerSound(
25
+            E2EE_OFF_SOUND_ID,
26
+            E2EE_OFF_SOUND_FILE));
27
+
28
+        dispatch(registerSound(
29
+            E2EE_ON_SOUND_ID,
30
+            E2EE_ON_SOUND_FILE));
31
+        break;
32
+
33
+    case APP_WILL_UNMOUNT:
34
+        dispatch(unregisterSound(E2EE_OFF_SOUND_ID));
35
+        dispatch(unregisterSound(E2EE_ON_SOUND_ID));
36
+        break;
37
+
19 38
     case TOGGLE_E2EE: {
20 39
         const conference = getCurrentConference(getState);
21 40
 
@@ -31,6 +50,10 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
31 50
                 id: participant.id,
32 51
                 local: true
33 52
             }));
53
+
54
+            const soundID = action.enabled ? E2EE_ON_SOUND_ID : E2EE_OFF_SOUND_ID;
55
+
56
+            dispatch(playSound(soundID));
34 57
         }
35 58
 
36 59
         break;

+ 15
- 0
react/features/e2ee/sounds.js View File

@@ -0,0 +1,15 @@
1
+// @flow
2
+
3
+/**
4
+ * The name of the bundled audio file which will be played when e2ee is disabled.
5
+ *
6
+ * @type {string}
7
+ */
8
+export const E2EE_OFF_SOUND_FILE = 'e2eeOff.mp3';
9
+
10
+/**
11
+ * The name of the bundled audio file which will be played when e2ee is enabled.
12
+ *
13
+ * @type {string}
14
+ */
15
+export const E2EE_ON_SOUND_FILE = 'e2eeOn.mp3';

BIN
sounds/e2eeOff.mp3 View File


BIN
sounds/e2eeOn.mp3 View File


Loading…
Cancel
Save