mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-20 03:07:47 +00:00
Update Android build to support gif Use GIF format instead of animated webp Show GIFs in chat messages Display GIF over tile Add Giphy button in reactions menu Added Giphy dialog Fix isGifMessage to also allow upper case
61 lines
1.7 KiB
JavaScript
61 lines
1.7 KiB
JavaScript
import { MiddlewareRegistry } from '../base/redux';
|
|
|
|
import { ADD_GIF_FOR_PARTICIPANT, HIDE_GIF_FOR_PARTICIPANT, SHOW_GIF_FOR_PARTICIPANT } from './actionTypes';
|
|
import { removeGif } from './actions';
|
|
import { GIF_DEFAULT_TIMEOUT } from './constants';
|
|
import { getGifForParticipant } from './functions';
|
|
|
|
/**
|
|
* Middleware which intercepts Gifs actions to handle changes to the
|
|
* visibility timeout of the Gifs.
|
|
*
|
|
* @param {Store} store - The redux store.
|
|
* @returns {Function}
|
|
*/
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
const { dispatch, getState } = store;
|
|
const state = getState();
|
|
|
|
switch (action.type) {
|
|
case ADD_GIF_FOR_PARTICIPANT: {
|
|
const id = action.participantId;
|
|
const { giphy } = state['features/base/config'];
|
|
|
|
_clearGifTimeout(state, id);
|
|
const timeoutID = setTimeout(() => dispatch(removeGif(id)), giphy?.tileTime || GIF_DEFAULT_TIMEOUT);
|
|
|
|
action.timeoutID = timeoutID;
|
|
break;
|
|
}
|
|
case SHOW_GIF_FOR_PARTICIPANT: {
|
|
const id = action.participantId;
|
|
|
|
_clearGifTimeout(state, id);
|
|
break;
|
|
}
|
|
case HIDE_GIF_FOR_PARTICIPANT: {
|
|
const { giphy } = state['features/base/config'];
|
|
const id = action.participantId;
|
|
const timeoutID = setTimeout(() => dispatch(removeGif(id)), giphy?.tileTime || GIF_DEFAULT_TIMEOUT);
|
|
|
|
action.timeoutID = timeoutID;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return next(action);
|
|
});
|
|
|
|
/**
|
|
* Clears GIF timeout.
|
|
*
|
|
* @param {Object} state - Redux state.
|
|
* @param {string} id - Id of the participant for whom to clear the timeout.
|
|
* @returns {void}
|
|
*/
|
|
function _clearGifTimeout(state, id) {
|
|
const gif = getGifForParticipant(state, id);
|
|
|
|
clearTimeout(gif?.timeoutID);
|
|
}
|