2020-10-26 13:10:46 +01:00
|
|
|
// (C) Copyright 2015 Moodle Pty Ltd.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2020-12-09 16:42:21 +01:00
|
|
|
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
2020-11-30 17:25:48 +01:00
|
|
|
import { Routes } from '@angular/router';
|
2021-02-03 14:47:02 +01:00
|
|
|
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
|
2020-11-30 17:25:48 +01:00
|
|
|
|
|
|
|
import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module';
|
|
|
|
import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate';
|
2021-02-03 14:47:02 +01:00
|
|
|
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
|
|
|
|
import { CoreCoursesCourseLinkHandler } from './services/handlers/course-link';
|
|
|
|
import { CoreCoursesIndexLinkHandler } from './services/handlers/courses-index-link';
|
2020-11-30 17:25:48 +01:00
|
|
|
|
2020-12-09 16:42:21 +01:00
|
|
|
import { CoreDashboardHomeHandler, CoreDashboardHomeHandlerService } from './services/handlers/dashboard-home';
|
2021-02-03 14:47:02 +01:00
|
|
|
import { CoreCoursesDashboardLinkHandler } from './services/handlers/dashboard-link';
|
|
|
|
import { CoreCoursesEnrolPushClickHandler } from './services/handlers/enrol-push-click';
|
2020-12-07 15:31:39 +01:00
|
|
|
import { CoreCoursesMyCoursesHomeHandler, CoreCoursesMyCoursesHomeHandlerService } from './services/handlers/my-courses-home';
|
2021-02-03 14:47:02 +01:00
|
|
|
import { CoreCoursesRequestPushClickHandler } from './services/handlers/request-push-click';
|
2020-11-03 08:37:59 +01:00
|
|
|
|
2020-11-30 17:25:48 +01:00
|
|
|
const mainMenuHomeChildrenRoutes: Routes = [
|
2020-11-03 08:37:59 +01:00
|
|
|
{
|
2020-11-30 17:25:48 +01:00
|
|
|
path: '',
|
|
|
|
pathMatch: 'full',
|
2020-12-09 16:42:21 +01:00
|
|
|
redirectTo: CoreDashboardHomeHandlerService.PAGE_NAME,
|
2020-11-03 08:37:59 +01:00
|
|
|
},
|
2020-11-20 15:35:45 +01:00
|
|
|
{
|
2020-12-09 16:42:21 +01:00
|
|
|
path: CoreDashboardHomeHandlerService.PAGE_NAME,
|
2020-11-30 17:25:48 +01:00
|
|
|
loadChildren: () => import('./pages/dashboard/dashboard.module').then(m => m.CoreCoursesDashboardPageModule),
|
|
|
|
},
|
|
|
|
{
|
2020-12-09 16:42:21 +01:00
|
|
|
path: CoreCoursesMyCoursesHomeHandlerService.PAGE_NAME,
|
2020-11-30 17:25:48 +01:00
|
|
|
loadChildren: () => import('./pages/my-courses/my-courses.module').then(m => m.CoreCoursesMyCoursesPageModule),
|
2020-11-20 15:35:45 +01:00
|
|
|
},
|
2020-11-03 08:37:59 +01:00
|
|
|
];
|
2020-10-26 13:10:46 +01:00
|
|
|
|
2020-11-30 17:25:48 +01:00
|
|
|
const mainMenuHomeSiblingRoutes: Routes = [
|
2020-11-20 12:03:44 +01:00
|
|
|
{
|
|
|
|
path: 'courses',
|
2020-11-30 17:25:48 +01:00
|
|
|
loadChildren: () => import('./courses-lazy.module').then(m => m.CoreCoursesLazyModule),
|
2020-11-20 12:03:44 +01:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2020-10-26 13:10:46 +01:00
|
|
|
@NgModule({
|
2020-11-20 12:03:44 +01:00
|
|
|
imports: [
|
2020-11-30 17:25:48 +01:00
|
|
|
CoreMainMenuHomeRoutingModule.forChild({
|
|
|
|
children: mainMenuHomeChildrenRoutes,
|
|
|
|
siblings: mainMenuHomeSiblingRoutes,
|
|
|
|
}),
|
2020-11-20 12:03:44 +01:00
|
|
|
],
|
2020-11-12 13:46:57 +01:00
|
|
|
providers: [
|
2020-12-09 16:42:21 +01:00
|
|
|
{
|
|
|
|
provide: APP_INITIALIZER,
|
|
|
|
multi: true,
|
|
|
|
deps: [],
|
|
|
|
useFactory: () => () => {
|
2021-03-02 11:41:04 +01:00
|
|
|
CoreMainMenuHomeDelegate.registerHandler(CoreDashboardHomeHandler.instance);
|
|
|
|
CoreMainMenuHomeDelegate.registerHandler(CoreCoursesMyCoursesHomeHandler.instance);
|
|
|
|
CoreContentLinksDelegate.registerHandler(CoreCoursesCourseLinkHandler.instance);
|
|
|
|
CoreContentLinksDelegate.registerHandler(CoreCoursesIndexLinkHandler.instance);
|
|
|
|
CoreContentLinksDelegate.registerHandler(CoreCoursesDashboardLinkHandler.instance);
|
|
|
|
CorePushNotificationsDelegate.registerClickHandler(CoreCoursesEnrolPushClickHandler.instance);
|
|
|
|
CorePushNotificationsDelegate.registerClickHandler(CoreCoursesRequestPushClickHandler.instance);
|
2020-12-09 16:42:21 +01:00
|
|
|
},
|
|
|
|
},
|
2020-11-12 13:46:57 +01:00
|
|
|
],
|
2020-10-26 13:10:46 +01:00
|
|
|
})
|
2020-12-09 16:42:21 +01:00
|
|
|
export class CoreCoursesModule {}
|