mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-16 02:37:47 +00:00
*Hang-up button is calling both appNavigate and conferenceWillLeave synchronously and something is interfering. appNavigate is async and something is calling it again before conferenceWillLeave completes.
67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
import { appNavigate } from '../../app/actions.native';
|
|
import { IStore } from '../../app/types';
|
|
import { getCustomerDetails } from '../../jaas/actions.any';
|
|
import { getJaasJWT, isVpaasMeeting } from '../../jaas/functions';
|
|
import { navigateRoot } from '../../mobile/navigation/rootNavigationContainerRef';
|
|
import { screen } from '../../mobile/navigation/routes';
|
|
import { conferenceLeft } from '../conference/actions.native';
|
|
import { setJWT } from '../jwt/actions';
|
|
import { JitsiConnectionErrors } from '../lib-jitsi-meet';
|
|
|
|
import { _connectInternal } from './actions.native';
|
|
import logger from './logger';
|
|
|
|
export * from './actions.any';
|
|
|
|
/**
|
|
* Opens new connection.
|
|
*
|
|
* @param {string} [id] - The XMPP user's ID (e.g. {@code user@server.com}).
|
|
* @param {string} [password] - The XMPP user's password.
|
|
* @returns {Function}
|
|
*/
|
|
export function connect(id?: string, password?: string) {
|
|
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
|
|
const state = getState();
|
|
const { jwt } = state['features/base/jwt'];
|
|
|
|
if (isVpaasMeeting(state)) {
|
|
return dispatch(getCustomerDetails())
|
|
.then(() => {
|
|
if (!jwt) {
|
|
return getJaasJWT(state);
|
|
}
|
|
})
|
|
.then(j => {
|
|
j && dispatch(setJWT(j));
|
|
|
|
return dispatch(_connectInternal(id, password));
|
|
}).catch(e => {
|
|
logger.error('Connection error', e);
|
|
});
|
|
}
|
|
|
|
dispatch(_connectInternal(id, password))
|
|
|
|
.catch(error => {
|
|
if (error === JitsiConnectionErrors.NOT_LIVE_ERROR) {
|
|
navigateRoot(screen.visitorsQueue);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Hangup.
|
|
*
|
|
* @param {boolean} [_requestFeedback] - Whether to attempt showing a
|
|
* request for call feedback.
|
|
* @returns {Function}
|
|
*/
|
|
export function hangup(_requestFeedback = false) {
|
|
return (dispatch: IStore['dispatch']) => {
|
|
dispatch(appNavigate(undefined));
|
|
dispatch(conferenceLeft());
|
|
};
|
|
}
|