Files
jitsi-meet/react/features/toolbox/middleware.js
robertpin 601ee219e7 feat(reactions) Added Reactions (#9465)
* Created desktop reactions menu

Moved raise hand functionality to reactions menu

* Added reactions to chat

* Added animations

* Added reactions to the web mobile version

Redesigned the overflow menu. Added the reactions menu and reactions animations

* Make toolbar visible on animation start

* Bug fix

* Cleanup

* Fixed overflow menu desktop

* Revert mobile menu changes

* Removed unused CSS

* Fixed iOS safari issue

* Fixed overflow issue on mobile

* Added keyboard shortcuts for reactions

* Disabled double tap zoom on reaction buttons

* Refactored actions

* Updated option symbol for keyboard shortcuts

* Actions refactor

* Refactor

* Fixed linting errors

* Updated BottomSheet

* Added reactions on native

* Code cleanup

* Code review refactor

* Color fix

* Hide reactions on one participant

* Removed console log

* Lang fix

* Update schortcuts
2021-07-13 09:50:08 +03:00

103 lines
2.8 KiB
JavaScript

// @flow
import { MiddlewareRegistry } from '../base/redux';
import {
CLEAR_TOOLBOX_TIMEOUT,
SET_TOOLBOX_TIMEOUT,
SET_FULL_SCREEN
} from './actionTypes';
declare var APP: Object;
/**
* Middleware which intercepts Toolbox actions to handle changes to the
* visibility timeout of the Toolbox.
*
* @param {Store} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
case CLEAR_TOOLBOX_TIMEOUT: {
const { timeoutID } = store.getState()['features/toolbox'];
clearTimeout(timeoutID);
break;
}
case SET_FULL_SCREEN:
return _setFullScreen(next, action);
case SET_TOOLBOX_TIMEOUT: {
const { timeoutID } = store.getState()['features/toolbox'];
const { handler, timeoutMS } = action;
clearTimeout(timeoutID);
action.timeoutID = setTimeout(handler, timeoutMS);
break;
}
}
return next(action);
});
type DocumentElement = {
+requestFullscreen?: Function,
+mozRequestFullScreen?: Function,
+webkitRequestFullscreen?: Function
}
/**
* Makes an external request to enter or exit full screen mode.
*
* @param {Dispatch} next - The redux dispatch function to dispatch the
* specified action to the specified store.
* @param {Action} action - The redux action SET_FULL_SCREEN which is being
* dispatched in the specified store.
* @private
* @returns {Object} The value returned by {@code next(action)}.
*/
function _setFullScreen(next, action) {
if (typeof APP === 'object') {
const { fullScreen } = action;
if (fullScreen) {
const documentElement: DocumentElement
= document.documentElement || {};
if (typeof documentElement.requestFullscreen === 'function') {
documentElement.requestFullscreen();
} else if (
typeof documentElement.mozRequestFullScreen === 'function') {
documentElement.mozRequestFullScreen();
} else if (
typeof documentElement.webkitRequestFullscreen === 'function') {
documentElement.webkitRequestFullscreen();
}
} else {
/* eslint-disable no-lonely-if */
// $FlowFixMe
if (typeof document.exitFullscreen === 'function') {
document.exitFullscreen();
// $FlowFixMe
} else if (typeof document.mozCancelFullScreen === 'function') {
document.mozCancelFullScreen();
// $FlowFixMe
} else if (typeof document.webkitExitFullscreen === 'function') {
document.webkitExitFullscreen();
}
/* eslint-enable no-loney-if */
}
}
return next(action);
}