jiti-meet/react/features/invite/actions.js

89 lines
2.3 KiB
JavaScript
Raw Normal View History

// @flow
import { openDialog } from '../../features/base/dialog';
import {
SET_INFO_DIALOG_VISIBILITY,
UPDATE_DIAL_IN_NUMBERS_FAILED,
UPDATE_DIAL_IN_NUMBERS_SUCCESS
} from './actionTypes';
WiP(invite-ui): Initial move of invite UI to invite button (#1950) * WiP(invite-ui): Initial move of invite UI to invite button * Adjusts styling to fit both horizontal and vertical filmstrip * Removes comment and functions not needed * [squash] Addressing various review comments * [squash] Move invite options to a separate config * [squash] Adjust invite button styles until we fix the whole UI theme * [squash] Fix the remote videos scroll * [squash]:Do not show popup menu when 1 option is available * [squash]: Disable the invite button in filmstrip mode * feat(connection-indicator): implement automatic hiding on good connection (#2009) * ref(connection-stats): use PropTypes package * feat(connection-stats): display a summary of the connection quality * feat(connection-indicator): show empty bars for interrupted connection * feat(connection-indicator): change background color based on status * feat(connection-indicator): implement automatic hiding on good connection * fix(connection-indicator): explicitly set font size Currently non-react code will set an icon size on ConnectionIndicator. This doesn't work on initial call join in vertical filmstrip after some changes to support hiding the indicator. The chosen fix is passing in the icon size to mirror what would happe with full filmstrip reactification. * ref(connection-stats): rename statuses * feat(connection-indicator): make hiding behavior configurable The original implementation made the auto hiding of the indicator configured in interfaceConfig. * fix(connection-indicator): readd class expected by torture tests * fix(connection-indicator): change connection quality display styling Bold the connection summary in the stats popover so it stands out. Change the summaries so there are only three--strong, nonoptimal, poor. * fix(connection-indicator): gray background on lost connection * feat(icons): add new gsm bars icon * feat(connection-indicator): use new 3-bar icon * ref(icons): remove icon-connection and icon-connection-lost Both have been replaced by icon-gsm-bars so they are not being referenced anymore. Mobile looks to have connect-lost as a separate icon in font-icons/jitsi.json. * fix(defaultToolbarButtons): Fixes unresolved InfoDialogButton component problem * [squash]: Makes invite button fit the container * [squash]:Addressing invite truncate, remote menu position and comment * [squash]:Fix z-index in horizontal mode, z-index in lonely call * [squash]: Fix filmstripOnly property, remove important from css
2017-10-03 16:30:42 +00:00
import { InviteDialog } from './components';
declare var $: Function;
/**
* Opens the Invite Dialog.
*
* @returns {Function}
*/
export function openInviteDialog() {
return openDialog(InviteDialog);
}
/**
* Opens the inline conference info dialog.
*
* @param {boolean} visible - Whether or not the dialog should be displayed.
* @param {boolean} autoClose - Whether or not the dialog should automatically
* close after a set period of time.
* @returns {{
* type: SET_INFO_DIALOG_VISIBILITY,
* autoClose: boolean,
* visible: boolean
* }}
*/
export function setInfoDialogVisibility(
visible: boolean,
autoClose: boolean = false) {
return {
type: SET_INFO_DIALOG_VISIBILITY,
autoClose,
visible
};
}
/**
* Sends AJAX requests for dial-in numbers and conference ID.
*
* @returns {Function}
*/
export function updateDialInNumbers() {
return (dispatch: Dispatch<*>, getState: Function) => {
const state = getState();
2017-05-19 23:06:10 +00:00
const { dialInConfCodeUrl, dialInNumbersUrl, hosts }
= state['features/base/config'];
const mucURL = hosts && hosts.muc;
if (!dialInConfCodeUrl || !dialInNumbersUrl || !mucURL) {
// URLs for fetching dial in numbers not defined
return;
}
const { room } = state['features/base/conference'];
const conferenceIDURL
= `${dialInConfCodeUrl}?conference=${room}@${mucURL}`;
Promise.all([
2017-05-19 23:06:10 +00:00
$.getJSON(dialInNumbersUrl),
$.getJSON(conferenceIDURL)
])
.then(([ dialInNumbers, { conference, id, message } ]) => {
if (!conference || !id) {
return Promise.reject(message);
}
dispatch({
type: UPDATE_DIAL_IN_NUMBERS_SUCCESS,
conferenceID: id,
dialInNumbers
});
})
.catch(error => {
dispatch({
type: UPDATE_DIAL_IN_NUMBERS_FAILED,
error
});
});
};
}