Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(reactions) Added metrics for disable reaction sounds

robertpin0182cc0504c8
diff --git a/react/features/analytics/AnalyticsEvents.js b/react/features/analytics/AnalyticsEvents.js
index 6d7056078a..566948939d 100644
--- a/react/features/analytics/AnalyticsEvents.js
+++ b/react/features/analytics/AnalyticsEvents.js
@@ -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.
*
@@ -830,12 +848,17 @@ export function createToolbarEvent(buttonName, attributes = {}) {
* sendAnalytics.
*/
export function createReactionMenuEvent(buttonName) {
- return {
- action: 'clicked',
- actionSubject: buttonName,
- source: 'reaction.button',
- type: TYPE_UI
- };
+ return createReactionEvent('clicked', buttonName, 'button');
+}
+
+/**
+ * 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');
}
/**
diff --git a/react/features/reactions/middleware.js b/react/features/reactions/middleware.js
index 7d5934a856..9834fc08a5 100644
--- a/react/features/reactions/middleware.js
+++ b/react/features/reactions/middleware.js
@@ -2,10 +2,11 @@
import { batch } from 'react-redux';
+import { createReactionSoundsDisabledEvent, sendAnalytics } from '../analytics';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
import { getParticipantCount } from '../base/participants';
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 { getDisabledSounds } from '../base/sounds/functions.any';
import { NOTIFICATION_TIMEOUT, showNotification } from '../notifications';
@@ -113,21 +114,6 @@ MiddlewareRegistry.register(store => next => action => {
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: {
const state = getState();
const { queue, notificationDisplayed } = state['features/reactions'];
@@ -152,6 +138,30 @@ MiddlewareRegistry.register(store => next => action => {
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: {
dispatch(showNotification({
titleKey: 'toolbar.disableReactionSounds',