| 
				
			 | 
			
			
				
				@@ -28,9 +28,16 @@ import { 
			 | 
		
		
	
		
			
			| 
				28
			 | 
			
				28
			 | 
			
			
				
				     updateRecordingSessionData 
			 | 
		
		
	
		
			
			| 
				29
			 | 
			
				29
			 | 
			
			
				
				 } from './actions'; 
			 | 
		
		
	
		
			
			| 
				30
			 | 
			
				30
			 | 
			
			
				
				 import { RECORDING_SESSION_UPDATED } from './actionTypes'; 
			 | 
		
		
	
		
			
			| 
				31
			 | 
			
				
			 | 
			
			
				
				-import { RECORDING_OFF_SOUND_ID, RECORDING_ON_SOUND_ID } from './constants'; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				
				+import { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				
				+    LIVE_STREAMING_OFF_SOUND_ID, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				
				+    LIVE_STREAMING_ON_SOUND_ID, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				
				+    RECORDING_OFF_SOUND_ID, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				
				+    RECORDING_ON_SOUND_ID 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				
				+} from './constants'; 
			 | 
		
		
	
		
			
			| 
				32
			 | 
			
				37
			 | 
			
			
				
				 import { getSessionById } from './functions'; 
			 | 
		
		
	
		
			
			| 
				33
			 | 
			
				38
			 | 
			
			
				
				 import { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				
				+    LIVE_STREAMING_OFF_SOUND_FILE, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				
				+    LIVE_STREAMING_ON_SOUND_FILE, 
			 | 
		
		
	
		
			
			| 
				34
			 | 
			
				41
			 | 
			
			
				
				     RECORDING_OFF_SOUND_FILE, 
			 | 
		
		
	
		
			
			| 
				35
			 | 
			
				42
			 | 
			
			
				
				     RECORDING_ON_SOUND_FILE 
			 | 
		
		
	
		
			
			| 
				36
			 | 
			
				43
			 | 
			
			
				
				 } from './sounds'; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -66,6 +73,14 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { 
			 | 
		
		
	
		
			
			| 
				66
			 | 
			
				73
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				67
			 | 
			
				74
			 | 
			
			
				
				     switch (action.type) { 
			 | 
		
		
	
		
			
			| 
				68
			 | 
			
				75
			 | 
			
			
				
				     case APP_WILL_MOUNT: 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				
				+        dispatch(registerSound( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				
				+            LIVE_STREAMING_OFF_SOUND_ID, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				78
			 | 
			
			
				
				+            LIVE_STREAMING_OFF_SOUND_FILE)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				79
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				80
			 | 
			
			
				
				+        dispatch(registerSound( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				
				+            LIVE_STREAMING_ON_SOUND_ID, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				82
			 | 
			
			
				
				+            LIVE_STREAMING_ON_SOUND_FILE)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				69
			 | 
			
				84
			 | 
			
			
				
				         dispatch(registerSound( 
			 | 
		
		
	
		
			
			| 
				70
			 | 
			
				85
			 | 
			
			
				
				             RECORDING_OFF_SOUND_ID, 
			 | 
		
		
	
		
			
			| 
				71
			 | 
			
				86
			 | 
			
			
				
				             RECORDING_OFF_SOUND_FILE)); 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -77,6 +92,8 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { 
			 | 
		
		
	
		
			
			| 
				77
			 | 
			
				92
			 | 
			
			
				
				         break; 
			 | 
		
		
	
		
			
			| 
				78
			 | 
			
				93
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				79
			 | 
			
				94
			 | 
			
			
				
				     case APP_WILL_UNMOUNT: 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				95
			 | 
			
			
				
				+        dispatch(unregisterSound(LIVE_STREAMING_OFF_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				
				+        dispatch(unregisterSound(LIVE_STREAMING_ON_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				80
			 | 
			
				97
			 | 
			
			
				
				         dispatch(unregisterSound(RECORDING_OFF_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				81
			 | 
			
				98
			 | 
			
			
				
				         dispatch(unregisterSound(RECORDING_ON_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				82
			 | 
			
				99
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -114,41 +131,51 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { 
			 | 
		
		
	
		
			
			| 
				114
			 | 
			
				131
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				115
			 | 
			
				132
			 | 
			
			
				
				         const updatedSessionData 
			 | 
		
		
	
		
			
			| 
				116
			 | 
			
				133
			 | 
			
			
				
				             = getSessionById(getState(), action.sessionData.id); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				
				+        const { mode } = updatedSessionData; 
			 | 
		
		
	
		
			
			| 
				117
			 | 
			
				135
			 | 
			
			
				
				         const { PENDING, OFF, ON } = JitsiRecordingConstants.status; 
			 | 
		
		
	
		
			
			| 
				118
			 | 
			
				136
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				119
			 | 
			
				137
			 | 
			
			
				
				         if (updatedSessionData.status === PENDING 
			 | 
		
		
	
		
			
			| 
				120
			 | 
			
				138
			 | 
			
			
				
				             && (!oldSessionData || oldSessionData.status !== PENDING)) { 
			 | 
		
		
	
		
			
			| 
				121
			 | 
			
				
			 | 
			
			
				
				-            dispatch( 
			 | 
		
		
	
		
			
			| 
				122
			 | 
			
				
			 | 
			
			
				
				-                showPendingRecordingNotification(updatedSessionData.mode)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				
				+            dispatch(showPendingRecordingNotification(mode)); 
			 | 
		
		
	
		
			
			| 
				123
			 | 
			
				140
			 | 
			
			
				
				         } else if (updatedSessionData.status !== PENDING) { 
			 | 
		
		
	
		
			
			| 
				124
			 | 
			
				
			 | 
			
			
				
				-            dispatch( 
			 | 
		
		
	
		
			
			| 
				125
			 | 
			
				
			 | 
			
			
				
				-                hidePendingRecordingNotification(updatedSessionData.mode)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				141
			 | 
			
			
				
				+            dispatch(hidePendingRecordingNotification(mode)); 
			 | 
		
		
	
		
			
			| 
				126
			 | 
			
				142
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				127
			 | 
			
				143
			 | 
			
			
				
				             if (updatedSessionData.status === ON 
			 | 
		
		
	
		
			
			| 
				128
			 | 
			
				
			 | 
			
			
				
				-                && (!oldSessionData || oldSessionData.status !== ON) 
			 | 
		
		
	
		
			
			| 
				129
			 | 
			
				
			 | 
			
			
				
				-                && updatedSessionData.mode 
			 | 
		
		
	
		
			
			| 
				130
			 | 
			
				
			 | 
			
			
				
				-                    === JitsiRecordingConstants.mode.FILE) { 
			 | 
		
		
	
		
			
			| 
				131
			 | 
			
				
			 | 
			
			
				
				-                sendAnalytics(createRecordingEvent('start', 'file')); 
			 | 
		
		
	
		
			
			| 
				132
			 | 
			
				
			 | 
			
			
				
				-                dispatch(playSound(RECORDING_ON_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				144
			 | 
			
			
				
				+                && (!oldSessionData || oldSessionData.status !== ON)) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				145
			 | 
			
			
				
				+                let soundID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				147
			 | 
			
			
				
				+                if (mode === JitsiRecordingConstants.mode.FILE) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				148
			 | 
			
			
				
				+                    soundID = RECORDING_ON_SOUND_ID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				
				+                } else if (mode === JitsiRecordingConstants.mode.STREAM) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				
				+                    soundID = LIVE_STREAMING_ON_SOUND_ID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				
				+                } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				
				+                if (soundID) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				
				+                    sendAnalytics(createRecordingEvent('start', mode)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				
				+                    dispatch(playSound(soundID)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				156
			 | 
			
			
				
				+                } 
			 | 
		
		
	
		
			
			| 
				133
			 | 
			
				157
			 | 
			
			
				
				             } else if (updatedSessionData.status === OFF 
			 | 
		
		
	
		
			
			| 
				134
			 | 
			
				158
			 | 
			
			
				
				                 && (!oldSessionData || oldSessionData.status !== OFF)) { 
			 | 
		
		
	
		
			
			| 
				135
			 | 
			
				
			 | 
			
			
				
				-                dispatch( 
			 | 
		
		
	
		
			
			| 
				136
			 | 
			
				
			 | 
			
			
				
				-                    showStoppedRecordingNotification( 
			 | 
		
		
	
		
			
			| 
				137
			 | 
			
				
			 | 
			
			
				
				-                        updatedSessionData.mode)); 
			 | 
		
		
	
		
			
			| 
				138
			 | 
			
				
			 | 
			
			
				
				- 
			 | 
		
		
	
		
			
			| 
				139
			 | 
			
				
			 | 
			
			
				
				-                if (updatedSessionData.mode 
			 | 
		
		
	
		
			
			| 
				140
			 | 
			
				
			 | 
			
			
				
				-                        === JitsiRecordingConstants.mode.FILE) { 
			 | 
		
		
	
		
			
			| 
				141
			 | 
			
				
			 | 
			
			
				
				-                    let duration = 0; 
			 | 
		
		
	
		
			
			| 
				142
			 | 
			
				
			 | 
			
			
				
				- 
			 | 
		
		
	
		
			
			| 
				143
			 | 
			
				
			 | 
			
			
				
				-                    // eslint-disable-next-line max-depth 
			 | 
		
		
	
		
			
			| 
				144
			 | 
			
				
			 | 
			
			
				
				-                    if (oldSessionData && oldSessionData.timestamp) { 
			 | 
		
		
	
		
			
			| 
				145
			 | 
			
				
			 | 
			
			
				
				-                        duration 
			 | 
		
		
	
		
			
			| 
				146
			 | 
			
				
			 | 
			
			
				
				-                            = (Date.now() / 1000) - oldSessionData.timestamp; 
			 | 
		
		
	
		
			
			| 
				147
			 | 
			
				
			 | 
			
			
				
				-                    } 
			 | 
		
		
	
		
			
			| 
				148
			 | 
			
				
			 | 
			
			
				
				-                    sendAnalytics( 
			 | 
		
		
	
		
			
			| 
				149
			 | 
			
				
			 | 
			
			
				
				-                        createRecordingEvent('stop', 'file', duration)); 
			 | 
		
		
	
		
			
			| 
				150
			 | 
			
				
			 | 
			
			
				
				-                    dispatch(stopSound(RECORDING_ON_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				151
			 | 
			
				
			 | 
			
			
				
				-                    dispatch(playSound(RECORDING_OFF_SOUND_ID)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				159
			 | 
			
			
				
				+                dispatch(showStoppedRecordingNotification(mode)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				
				+                let duration = 0, soundOff, soundOn; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				161
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				162
			 | 
			
			
				
				+                if (oldSessionData && oldSessionData.timestamp) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				163
			 | 
			
			
				
				+                    duration 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				164
			 | 
			
			
				
				+                        = (Date.now() / 1000) - oldSessionData.timestamp; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				165
			 | 
			
			
				
				+                } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				166
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				167
			 | 
			
			
				
				+                if (mode === JitsiRecordingConstants.mode.FILE) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				168
			 | 
			
			
				
				+                    soundOff = RECORDING_OFF_SOUND_ID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				169
			 | 
			
			
				
				+                    soundOn = RECORDING_ON_SOUND_ID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				170
			 | 
			
			
				
				+                } else if (mode === JitsiRecordingConstants.mode.STREAM) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				171
			 | 
			
			
				
				+                    soundOff = LIVE_STREAMING_OFF_SOUND_ID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				
				+                    soundOn = LIVE_STREAMING_ON_SOUND_ID; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				
				+                } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				
				+                if (soundOff && soundOn) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				
				+                    sendAnalytics(createRecordingEvent('stop', mode, duration)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				177
			 | 
			
			
				
				+                    dispatch(stopSound(soundOn)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				
				+                    dispatch(playSound(soundOff)); 
			 | 
		
		
	
		
			
			| 
				152
			 | 
			
				179
			 | 
			
			
				
				                 } 
			 | 
		
		
	
		
			
			| 
				153
			 | 
			
				180
			 | 
			
			
				
				             } 
			 | 
		
		
	
		
			
			| 
				154
			 | 
			
				181
			 | 
			
			
				
				         } 
			 |