feat(mobile/navigation): reload now navigates to conference (#12919)

* feat(mobile/navigation): navigate back to same room when reload now is initiated
This commit is contained in:
Calinteodor 2023-02-17 17:40:01 +02:00 committed by GitHub
parent b52d5629e2
commit 00ed794c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 8 deletions

View File

@ -33,7 +33,7 @@ import { clearNotifications } from '../notifications/actions';
import { addTrackStateToURL, getDefaultURL } from './functions.native';
import logger from './logger';
import { IStore } from './types';
import { IReloadNowOptions, IStore } from './types';
export * from './actions.any';
@ -44,9 +44,10 @@ export * from './actions.any';
* @param {string|undefined} uri - The URI to which to navigate. It may be a
* full URL with an HTTP(S) scheme, a full or partial URI with the app-specific
* scheme, or a mere room name.
* @param {Object} [options] - Options.
* @returns {Function}
*/
export function appNavigate(uri?: string) {
export function appNavigate(uri?: string, options: IReloadNowOptions = {}) {
logger.info(`appNavigate to ${uri}`);
return async (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
@ -142,7 +143,10 @@ export function appNavigate(uri?: string) {
dispatch(createDesiredLocalTracks());
dispatch(clearNotifications());
if (isPrejoinPageEnabled(getState())) {
// @ts-ignore
const { hidePrejoin } = options;
if (!hidePrejoin && isPrejoinPageEnabled(getState())) {
navigateRoot(screen.preJoin);
} else {
dispatch(connect());
@ -185,6 +189,8 @@ export function reloadNow() {
logger.info(`Reloading the conference using URL: ${locationURL}`);
dispatch(appNavigate(toURLString(newURL)));
dispatch(appNavigate(toURLString(newURL), {
hidePrejoin: true
}));
};
}

View File

@ -165,3 +165,7 @@ export interface IReduxState {
'features/virtual-background': IVirtualBackground;
'features/whiteboard': IWhiteboardState;
}
export interface IReloadNowOptions {
hidePrejoin?: boolean;
}

View File

@ -33,12 +33,13 @@ type ErrorType = {
};
/**
* List of errors that are not fatal (or handled differently) so then the overlays won't kick in.
* List of errors that are not fatal (or handled differently) so then the page reload dialog won't kick in.
*/
const NON_OVERLAY_ERRORS = [
const RN_NO_RELOAD_DIALOG_ERRORS = [
JitsiConferenceErrors.CONFERENCE_ACCESS_DENIED,
JitsiConferenceErrors.CONFERENCE_DESTROYED,
JitsiConferenceErrors.CONNECTION_ERROR
JitsiConferenceErrors.CONNECTION_ERROR,
JitsiConferenceErrors.CONFERENCE_RESTARTED
];
const ERROR_TYPES = {
@ -109,7 +110,7 @@ StateListenerRegistry.register(
});
}
if (NON_OVERLAY_ERRORS.indexOf(error.name) === -1 && typeof error.recoverable === 'undefined') {
if (RN_NO_RELOAD_DIALOG_ERRORS.indexOf(error.name) === -1 && typeof error.recoverable === 'undefined') {
setTimeout(() => {
// @ts-ignore
store.dispatch(openPageReloadDialog());