forked from EVOgeek/Vmeda.Online
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 { CALENDAR_OFFLINE_SITE_SCHEMA } from './services/database/calendar-offline';
|
||||||
import { AddonCalendarComponentsModule } from './components/components.module';
|
import { AddonCalendarComponentsModule } from './components/components.module';
|
||||||
import { AddonCalendar } from './services/calendar';
|
import { AddonCalendar } from './services/calendar';
|
||||||
|
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||||
|
|
||||||
const mainMenuChildrenRoutes: Routes = [
|
const mainMenuChildrenRoutes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,7 @@ const mainMenuChildrenRoutes: Routes = [
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
CoreMainMenuTabRoutingModule.forChild(mainMenuChildrenRoutes),
|
||||||
CoreMainMenuRoutingModule.forChild({ children: mainMenuChildrenRoutes }),
|
CoreMainMenuRoutingModule.forChild({ children: mainMenuChildrenRoutes }),
|
||||||
AddonCalendarComponentsModule,
|
AddonCalendarComponentsModule,
|
||||||
],
|
],
|
||||||
|
|
|
@ -18,6 +18,7 @@ import { Routes } from '@angular/router';
|
||||||
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate';
|
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate';
|
||||||
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
|
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
|
||||||
import { AddonPrivateFilesMainMenuHandler, AddonPrivateFilesMainMenuHandlerService } from './services/handlers/mainmenu';
|
import { AddonPrivateFilesMainMenuHandler, AddonPrivateFilesMainMenuHandlerService } from './services/handlers/mainmenu';
|
||||||
|
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -27,7 +28,10 @@ const routes: Routes = [
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [CoreMainMenuRoutingModule.forChild({ children: routes })],
|
imports: [
|
||||||
|
CoreMainMenuTabRoutingModule.forChild(routes),
|
||||||
|
CoreMainMenuRoutingModule.forChild({ children: routes }),
|
||||||
|
],
|
||||||
exports: [CoreMainMenuRoutingModule],
|
exports: [CoreMainMenuRoutingModule],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { CoreLoginHelper } from '@features/login/services/login-helper';
|
||||||
import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../services/mainmenu-delegate';
|
import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../services/mainmenu-delegate';
|
||||||
import { CoreMainMenu, CoreMainMenuCustomItem } from '../../services/mainmenu';
|
import { CoreMainMenu, CoreMainMenuCustomItem } from '../../services/mainmenu';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
|
import { CoreNavigator } from '@services/navigator';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page that displays the main menu of the app.
|
* Page that displays the main menu of the app.
|
||||||
|
@ -131,10 +132,12 @@ export class CoreMainMenuMorePage implements OnInit, OnDestroy {
|
||||||
* Open a handler.
|
* Open a handler.
|
||||||
*
|
*
|
||||||
* @param handler Handler to open.
|
* @param handler Handler to open.
|
||||||
|
* @todo: use subPage?
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
openHandler(handler: CoreMainMenuHandlerData): void {
|
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.
|
* @param item Item to open.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
openItem(item: CoreMainMenuCustomItem): void {
|
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> {
|
async scanQR(): Promise<void> {
|
||||||
// Scan for a QR code.
|
// Scan for a QR code.
|
||||||
// @todo
|
// @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.
|
// @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 { CoreTagIndexLinkHandler } from './services/handlers/index-link';
|
||||||
import { CoreTagSearchLinkHandler } from './services/handlers/search-link';
|
import { CoreTagSearchLinkHandler } from './services/handlers/search-link';
|
||||||
import { CoreTagComponentsModule } from './components/components.module';
|
import { CoreTagComponentsModule } from './components/components.module';
|
||||||
|
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
|
@ -31,6 +32,7 @@ const routes: Routes = [
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
CoreMainMenuTabRoutingModule.forChild(routes),
|
||||||
CoreMainMenuRoutingModule.forChild({ children: routes }),
|
CoreMainMenuRoutingModule.forChild({ children: routes }),
|
||||||
CoreTagComponentsModule,
|
CoreTagComponentsModule,
|
||||||
],
|
],
|
||||||
|
|
|
@ -48,6 +48,7 @@ export type CoreNavigationOptions = {
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
params?: Params;
|
params?: Params;
|
||||||
reset?: boolean;
|
reset?: boolean;
|
||||||
|
preferCurrentTab?: boolean; // Default true.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -363,6 +364,10 @@ export class CoreNavigatorService {
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (options.preferCurrentTab === false && isMainMenuTab) {
|
||||||
|
return this.navigate(`/main/${path}`, options);
|
||||||
|
}
|
||||||
|
|
||||||
// Open the path within the current main tab.
|
// Open the path within the current main tab.
|
||||||
if (currentMainMenuTab && (!isMainMenuTab || pathRoot !== currentMainMenuTab)) {
|
if (currentMainMenuTab && (!isMainMenuTab || pathRoot !== currentMainMenuTab)) {
|
||||||
return this.navigate(`/main/${currentMainMenuTab}/${path}`, options);
|
return this.navigate(`/main/${currentMainMenuTab}/${path}`, options);
|
||||||
|
|
Loading…
Reference in New Issue