fix(external-api) send AUDIO_MUTED_CHANGED event only when value changed

This commit is contained in:
tmoldovan8x8 2021-11-26 12:09:21 +02:00 committed by GitHub
parent 6cd6c0a043
commit 73fb586d59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -93,6 +93,7 @@ const eventEmitter = new NativeEventEmitter(ExternalAPI);
* @returns {Function}
*/
MiddlewareRegistry.register(store => next => action => {
const oldAudioMuted = store.getState()['features/base/media'].audio.muted;
const result = next(action);
const { type } = action;
@ -198,12 +199,14 @@ MiddlewareRegistry.register(store => next => action => {
break;
case SET_AUDIO_MUTED:
if (action.muted !== oldAudioMuted) {
sendEvent(
store,
'AUDIO_MUTED_CHANGED',
/* data */ {
muted: action.muted
});
}
break;
case SET_PAGE_RELOAD_OVERLAY_CANCELED: