feat(reactions) Added metrics for disable reaction sounds
Reordered reactions middleware alphabetically
This commit is contained in:
parent
1dbfbb9786
commit
0182cc0504
|
@ -821,6 +821,24 @@ export function createToolbarEvent(buttonName, attributes = {}) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an event associated with reactions.
|
||||||
|
*
|
||||||
|
* @param {string} action - Event action.
|
||||||
|
* @param {string} name - Event name.
|
||||||
|
* @param {string} source - Event source.
|
||||||
|
* @returns {Object} The event in a format suitable for sending via
|
||||||
|
* sendAnalytics.
|
||||||
|
*/
|
||||||
|
function createReactionEvent(action, name, source) {
|
||||||
|
return {
|
||||||
|
action,
|
||||||
|
actionSubject: name,
|
||||||
|
source: `reaction.${source}`,
|
||||||
|
type: TYPE_UI
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an event associated with a reaction button being clicked/pressed.
|
* Creates an event associated with a reaction button being clicked/pressed.
|
||||||
*
|
*
|
||||||
|
@ -830,12 +848,17 @@ export function createToolbarEvent(buttonName, attributes = {}) {
|
||||||
* sendAnalytics.
|
* sendAnalytics.
|
||||||
*/
|
*/
|
||||||
export function createReactionMenuEvent(buttonName) {
|
export function createReactionMenuEvent(buttonName) {
|
||||||
return {
|
return createReactionEvent('clicked', buttonName, 'button');
|
||||||
action: 'clicked',
|
}
|
||||||
actionSubject: buttonName,
|
|
||||||
source: 'reaction.button',
|
/**
|
||||||
type: TYPE_UI
|
* Creates an event associated with disabling of reaction sounds.
|
||||||
};
|
*
|
||||||
|
* @returns {Object} The event in a format suitable for sending via
|
||||||
|
* sendAnalytics.
|
||||||
|
*/
|
||||||
|
export function createReactionSoundsDisabledEvent() {
|
||||||
|
return createReactionEvent('disabled', 'sounds', 'settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
import { batch } from 'react-redux';
|
import { batch } from 'react-redux';
|
||||||
|
|
||||||
|
import { createReactionSoundsDisabledEvent, sendAnalytics } from '../analytics';
|
||||||
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
||||||
import { getParticipantCount } from '../base/participants';
|
import { getParticipantCount } from '../base/participants';
|
||||||
import { MiddlewareRegistry } from '../base/redux';
|
import { MiddlewareRegistry } from '../base/redux';
|
||||||
import { updateSettings } from '../base/settings';
|
import { SETTINGS_UPDATED, updateSettings } from '../base/settings';
|
||||||
import { playSound, registerSound, unregisterSound } from '../base/sounds';
|
import { playSound, registerSound, unregisterSound } from '../base/sounds';
|
||||||
import { getDisabledSounds } from '../base/sounds/functions.any';
|
import { getDisabledSounds } from '../base/sounds/functions.any';
|
||||||
import { NOTIFICATION_TIMEOUT, showNotification } from '../notifications';
|
import { NOTIFICATION_TIMEOUT, showNotification } from '../notifications';
|
||||||
|
@ -113,21 +114,6 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SEND_REACTIONS: {
|
|
||||||
const state = getState();
|
|
||||||
const { buffer } = state['features/reactions'];
|
|
||||||
const { conference } = state['features/base/conference'];
|
|
||||||
|
|
||||||
if (conference) {
|
|
||||||
conference.sendEndpointMessage('', {
|
|
||||||
name: ENDPOINT_REACTION_NAME,
|
|
||||||
reactions: buffer,
|
|
||||||
timestamp: Date.now()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case PUSH_REACTIONS: {
|
case PUSH_REACTIONS: {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const { queue, notificationDisplayed } = state['features/reactions'];
|
const { queue, notificationDisplayed } = state['features/reactions'];
|
||||||
|
@ -152,6 +138,30 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SEND_REACTIONS: {
|
||||||
|
const state = getState();
|
||||||
|
const { buffer } = state['features/reactions'];
|
||||||
|
const { conference } = state['features/base/conference'];
|
||||||
|
|
||||||
|
if (conference) {
|
||||||
|
conference.sendEndpointMessage('', {
|
||||||
|
name: ENDPOINT_REACTION_NAME,
|
||||||
|
reactions: buffer,
|
||||||
|
timestamp: Date.now()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SETTINGS_UPDATED: {
|
||||||
|
const { soundsReactions } = getState()['features/base/settings'];
|
||||||
|
|
||||||
|
if (action.settings.soundsReactions === false && soundsReactions === true) {
|
||||||
|
sendAnalytics(createReactionSoundsDisabledEvent());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SHOW_SOUNDS_NOTIFICATION: {
|
case SHOW_SOUNDS_NOTIFICATION: {
|
||||||
dispatch(showNotification({
|
dispatch(showNotification({
|
||||||
titleKey: 'toolbar.disableReactionSounds',
|
titleKey: 'toolbar.disableReactionSounds',
|
||||||
|
|
Loading…
Reference in New Issue