MOBILE-3637 core: Fix some navigation to tabs problems
parent
11dafc92c3
commit
b3d380c9c2
|
@ -28,6 +28,7 @@ import { CALENDAR_SITE_SCHEMA } from './services/database/calendar';
|
|||
import { CALENDAR_OFFLINE_SITE_SCHEMA } from './services/database/calendar-offline';
|
||||
import { AddonCalendarComponentsModule } from './components/components.module';
|
||||
import { AddonCalendar } from './services/calendar';
|
||||
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||
|
||||
const mainMenuChildrenRoutes: Routes = [
|
||||
{
|
||||
|
@ -38,6 +39,7 @@ const mainMenuChildrenRoutes: Routes = [
|
|||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CoreMainMenuTabRoutingModule.forChild(mainMenuChildrenRoutes),
|
||||
CoreMainMenuRoutingModule.forChild({ children: mainMenuChildrenRoutes }),
|
||||
AddonCalendarComponentsModule,
|
||||
],
|
||||
|
|
|
@ -18,6 +18,7 @@ import { Routes } from '@angular/router';
|
|||
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate';
|
||||
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
|
||||
import { AddonPrivateFilesMainMenuHandler, AddonPrivateFilesMainMenuHandlerService } from './services/handlers/mainmenu';
|
||||
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
|
@ -27,7 +28,10 @@ const routes: Routes = [
|
|||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [CoreMainMenuRoutingModule.forChild({ children: routes })],
|
||||
imports: [
|
||||
CoreMainMenuTabRoutingModule.forChild(routes),
|
||||
CoreMainMenuRoutingModule.forChild({ children: routes }),
|
||||
],
|
||||
exports: [CoreMainMenuRoutingModule],
|
||||
providers: [
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ import { CoreLoginHelper } from '@features/login/services/login-helper';
|
|||
import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../services/mainmenu-delegate';
|
||||
import { CoreMainMenu, CoreMainMenuCustomItem } from '../../services/mainmenu';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { CoreNavigator } from '@services/navigator';
|
||||
|
||||
/**
|
||||
* Page that displays the main menu of the app.
|
||||
|
@ -131,10 +132,12 @@ export class CoreMainMenuMorePage implements OnInit, OnDestroy {
|
|||
* Open a handler.
|
||||
*
|
||||
* @param handler Handler to open.
|
||||
* @todo: use subPage?
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
openHandler(handler: CoreMainMenuHandlerData): void {
|
||||
// @todo
|
||||
const params = handler.pageParams;
|
||||
|
||||
CoreNavigator.instance.navigateToSitePath(handler.page, { params });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,9 +145,11 @@ export class CoreMainMenuMorePage implements OnInit, OnDestroy {
|
|||
*
|
||||
* @param item Item to open.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
openItem(item: CoreMainMenuCustomItem): void {
|
||||
// @todo
|
||||
// @todo CoreNavigator.instance.navigateToSitePath('CoreViewerIframePage', {title: item.label, url: item.url});
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('openItem not implemented', item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,6 +158,9 @@ export class CoreMainMenuMorePage implements OnInit, OnDestroy {
|
|||
async scanQR(): Promise<void> {
|
||||
// Scan for a QR code.
|
||||
// @todo
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('scanQR not implemented');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ export class CoreTagListComponent {
|
|||
};
|
||||
|
||||
// @todo: Check split view to navigate on the outlet if any.
|
||||
CoreNavigator.instance.navigate('/tag/index', { params });
|
||||
CoreNavigator.instance.navigateToSitePath('/tag/index', { params, preferCurrentTab: false });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import { CoreTagMainMenuHandler, CoreTagMainMenuHandlerService } from './service
|
|||
import { CoreTagIndexLinkHandler } from './services/handlers/index-link';
|
||||
import { CoreTagSearchLinkHandler } from './services/handlers/search-link';
|
||||
import { CoreTagComponentsModule } from './components/components.module';
|
||||
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
|
@ -31,6 +32,7 @@ const routes: Routes = [
|
|||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CoreMainMenuTabRoutingModule.forChild(routes),
|
||||
CoreMainMenuRoutingModule.forChild({ children: routes }),
|
||||
CoreTagComponentsModule,
|
||||
],
|
||||
|
|
|
@ -48,6 +48,7 @@ export type CoreNavigationOptions = {
|
|||
animated?: boolean;
|
||||
params?: Params;
|
||||
reset?: boolean;
|
||||
preferCurrentTab?: boolean; // Default true.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -363,6 +364,10 @@ export class CoreNavigatorService {
|
|||
false,
|
||||
);
|
||||
|
||||
if (options.preferCurrentTab === false && isMainMenuTab) {
|
||||
return this.navigate(`/main/${path}`, options);
|
||||
}
|
||||
|
||||
// Open the path within the current main tab.
|
||||
if (currentMainMenuTab && (!isMainMenuTab || pathRoot !== currentMainMenuTab)) {
|
||||
return this.navigate(`/main/${currentMainMenuTab}/${path}`, options);
|
||||
|
|
Loading…
Reference in New Issue