2019-07-01 12:02:25 +00:00
|
|
|
import {
|
|
|
|
appNavigate,
|
|
|
|
maybeRedirectToWelcomePage
|
2022-10-28 10:07:58 +00:00
|
|
|
} from '../app/actions';
|
2022-10-28 08:53:24 +00:00
|
|
|
import { IStore } from '../app/types';
|
|
|
|
import { conferenceLeft, setPassword } from '../base/conference/actions';
|
|
|
|
import { JITSI_CONFERENCE_URL_KEY } from '../base/conference/constants';
|
|
|
|
import { IJitsiConference } from '../base/conference/reducer';
|
|
|
|
import { hideDialog, openDialog } from '../base/dialog/actions';
|
|
|
|
// eslint-disable-next-line lines-around-comment
|
|
|
|
// @ts-ignore
|
2021-04-09 12:30:25 +00:00
|
|
|
import { SecurityDialog } from '../security/components/security-dialog';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
2022-10-28 08:53:24 +00:00
|
|
|
// @ts-ignore
|
2021-04-09 12:30:25 +00:00
|
|
|
import { PasswordRequiredPrompt } from './components';
|
2016-12-13 09:14:04 +00:00
|
|
|
|
2017-10-17 22:06:41 +00:00
|
|
|
/**
|
|
|
|
* Cancels a prompt for a password to join a specific conference/room.
|
|
|
|
*
|
|
|
|
* @param {JitsiConference} conference - The {@code JitsiConference} requesting
|
|
|
|
* the password to join.
|
|
|
|
* @protected
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
2022-10-28 08:53:24 +00:00
|
|
|
export function _cancelPasswordRequiredPrompt(conference: any) {
|
|
|
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
|
2019-07-01 12:02:25 +00:00
|
|
|
|
|
|
|
if (typeof APP !== 'undefined') {
|
|
|
|
// when we are redirecting the library should handle any
|
|
|
|
// unload and clean of the connection.
|
|
|
|
APP.API.notifyReadyToClose();
|
2022-10-28 10:07:58 +00:00
|
|
|
|
|
|
|
// @ts-ignore
|
2019-07-01 12:02:25 +00:00
|
|
|
dispatch(maybeRedirectToWelcomePage());
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-17 22:06:41 +00:00
|
|
|
// Canceling PasswordRequiredPrompt is to navigate the app/user to
|
|
|
|
// WelcomePage. In other words, the canceling invalidates the
|
|
|
|
// locationURL. Make sure that the canceling indeed has the intent to
|
|
|
|
// invalidate the locationURL.
|
|
|
|
const state = getState();
|
|
|
|
|
|
|
|
if (conference === state['features/base/conference'].passwordRequired
|
|
|
|
&& conference[JITSI_CONFERENCE_URL_KEY]
|
|
|
|
=== state['features/base/connection'].locationURL) {
|
|
|
|
// XXX The error associated with CONFERENCE_FAILED was marked as
|
|
|
|
// recoverable by the feature room-lock and, consequently,
|
|
|
|
// recoverable-aware features such as mobile's external-api did not
|
|
|
|
// deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since
|
|
|
|
// the app/user is going to nativate to WelcomePage, the SDK
|
|
|
|
// clients/consumers need an event.
|
|
|
|
dispatch(conferenceLeft(conference));
|
|
|
|
|
|
|
|
dispatch(appNavigate(undefined));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-12-13 09:14:04 +00:00
|
|
|
/**
|
|
|
|
* Ends a (user) request to lock a specific conference/room.
|
|
|
|
*
|
|
|
|
* @param {JitsiConference} conference - The JitsiConference to lock.
|
|
|
|
* @param {string|undefined} password - The password with which the specified
|
|
|
|
* conference is to be locked or undefined to cancel the (user) request to lock
|
|
|
|
* the specified conference.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
2017-10-04 22:36:09 +00:00
|
|
|
export function endRoomLockRequest(
|
2022-10-28 08:53:24 +00:00
|
|
|
conference: IJitsiConference,
|
|
|
|
password?: string) {
|
|
|
|
return (dispatch: IStore['dispatch']) => {
|
2016-12-13 09:14:04 +00:00
|
|
|
const setPassword_
|
|
|
|
= password
|
|
|
|
? dispatch(setPassword(conference, conference.lock, password))
|
|
|
|
: Promise.resolve();
|
2021-04-09 12:30:25 +00:00
|
|
|
const endRoomLockRequest_ = () => dispatch(hideDialog(SecurityDialog));
|
2016-12-13 09:14:04 +00:00
|
|
|
|
|
|
|
setPassword_.then(endRoomLockRequest_, endRoomLockRequest_);
|
|
|
|
};
|
|
|
|
}
|
2017-03-07 03:43:41 +00:00
|
|
|
|
|
|
|
/**
|
2017-10-17 22:06:41 +00:00
|
|
|
* Begins a prompt for a password to join a specific conference/room.
|
2017-03-07 03:43:41 +00:00
|
|
|
*
|
2017-10-17 22:06:41 +00:00
|
|
|
* @param {JitsiConference} conference - The {@code JitsiConference}
|
|
|
|
* requesting the password to join.
|
2017-03-07 03:43:41 +00:00
|
|
|
* @protected
|
|
|
|
* @returns {{
|
2017-03-07 16:02:52 +00:00
|
|
|
* type: OPEN_DIALOG,
|
2017-03-07 03:43:41 +00:00
|
|
|
* component: Component,
|
2017-09-27 21:23:31 +00:00
|
|
|
* props: PropTypes
|
2017-03-07 03:43:41 +00:00
|
|
|
* }}
|
|
|
|
*/
|
2022-10-28 08:53:24 +00:00
|
|
|
export function _openPasswordRequiredPrompt(conference: IJitsiConference) {
|
2017-03-07 03:43:41 +00:00
|
|
|
return openDialog(PasswordRequiredPrompt, { conference });
|
|
|
|
}
|
2018-05-17 15:47:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unlocks the current jitsi conference.
|
|
|
|
*
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
export function unlockRoom() {
|
2022-10-28 08:53:24 +00:00
|
|
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
|
2018-05-17 15:47:05 +00:00
|
|
|
const { conference } = getState()['features/base/conference'];
|
|
|
|
|
|
|
|
return dispatch(setPassword(
|
|
|
|
conference,
|
2022-10-28 08:53:24 +00:00
|
|
|
conference?.lock,
|
2018-05-17 15:47:05 +00:00
|
|
|
''
|
|
|
|
));
|
|
|
|
};
|
|
|
|
}
|
2021-04-09 12:30:25 +00:00
|
|
|
|
|
|
|
|