MOBILE-3496 login: Reset nav stack on login
parent
4fb220661f
commit
9d0be0e7f8
|
@ -167,7 +167,10 @@ export class CoreNavigatorService {
|
||||||
* @return Whether navigation suceeded.
|
* @return Whether navigation suceeded.
|
||||||
*/
|
*/
|
||||||
async navigateToSiteHome(options: Omit<CoreNavigationOptions, 'reset'> & { siteId?: string } = {}): Promise<boolean> {
|
async navigateToSiteHome(options: Omit<CoreNavigationOptions, 'reset'> & { siteId?: string } = {}): Promise<boolean> {
|
||||||
return this.navigateToSitePath(DEFAULT_MAIN_MENU_TAB, options);
|
return this.navigateToSitePath(DEFAULT_MAIN_MENU_TAB, {
|
||||||
|
...options,
|
||||||
|
reset: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,7 +182,7 @@ export class CoreNavigatorService {
|
||||||
*/
|
*/
|
||||||
async navigateToSitePath(
|
async navigateToSitePath(
|
||||||
path: string,
|
path: string,
|
||||||
options: Omit<CoreNavigationOptions, 'reset'> & { siteId?: string } = {},
|
options: CoreNavigationOptions & { siteId?: string } = {},
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const siteId = options.siteId ?? CoreSites.getCurrentSiteId();
|
const siteId = options.siteId ?? CoreSites.getCurrentSiteId();
|
||||||
const navigationOptions: CoreNavigationOptions = CoreObject.without(options, ['siteId']);
|
const navigationOptions: CoreNavigationOptions = CoreObject.without(options, ['siteId']);
|
||||||
|
@ -391,7 +394,7 @@ export class CoreNavigatorService {
|
||||||
* @param options Navigation options.
|
* @param options Navigation options.
|
||||||
* @return Whether navigation suceeded.
|
* @return Whether navigation suceeded.
|
||||||
*/
|
*/
|
||||||
protected async navigateToMainMenuPath(path: string, options: Omit<CoreNavigationOptions, 'reset'> = {}): Promise<boolean> {
|
protected async navigateToMainMenuPath(path: string, options: CoreNavigationOptions = {}): Promise<boolean> {
|
||||||
// Due to DeepLinker, we need to remove the path from the URL before going to main menu.
|
// Due to DeepLinker, we need to remove the path from the URL before going to main menu.
|
||||||
// IonTabs checks the URL to determine which path to load for deep linking, so we clear the URL.
|
// IonTabs checks the URL to determine which path to load for deep linking, so we clear the URL.
|
||||||
// @todo this.location.replaceState('');
|
// @todo this.location.replaceState('');
|
||||||
|
|
|
@ -146,7 +146,7 @@ describe('CoreNavigator', () => {
|
||||||
const success = await navigator.navigateToSiteHome();
|
const success = await navigator.navigateToSiteHome();
|
||||||
|
|
||||||
expect(success).toBe(true);
|
expect(success).toBe(true);
|
||||||
expect(navControllerMock.navigateForward).toHaveBeenCalledWith(['/main/home'], {});
|
expect(navControllerMock.navigateRoot).toHaveBeenCalledWith(['/main/home'], {});
|
||||||
});
|
});
|
||||||
|
|
||||||
it.todo('navigates to a different site');
|
it.todo('navigates to a different site');
|
||||||
|
|
Loading…
Reference in New Issue