From 23e1d99f05783b015f6e009150342854f2ee38f8 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 30 Sep 2021 16:35:16 +0200 Subject: [PATCH] MOBILE-3798 competency: Remove learning plans from main menu --- .../learningplans/services/block-handler.ts | 4 +- .../competency/competency-lazy.module.ts | 7 --- src/addons/competency/competency.module.ts | 10 ++-- .../competency/pages/competency/competency.ts | 4 +- .../competencysummary/competencysummary.ts | 4 +- .../coursecompetencies.page.ts | 6 +-- src/addons/competency/pages/plan/plan.ts | 4 +- .../services/handlers/competency-link.ts | 4 +- .../services/handlers/course-option.ts | 4 +- .../competency/services/handlers/mainmenu.ts | 54 ------------------- .../competency/services/handlers/plan-link.ts | 4 +- .../services/handlers/plans-link.ts | 4 +- .../services/handlers/push-click.ts | 8 +-- .../services/handlers/user-competency-link.ts | 4 +- .../competency/services/handlers/user.ts | 6 +-- 15 files changed, 32 insertions(+), 95 deletions(-) delete mode 100644 src/addons/competency/services/handlers/mainmenu.ts diff --git a/src/addons/block/learningplans/services/block-handler.ts b/src/addons/block/learningplans/services/block-handler.ts index 2ab12f1a1..316884f45 100644 --- a/src/addons/block/learningplans/services/block-handler.ts +++ b/src/addons/block/learningplans/services/block-handler.ts @@ -17,7 +17,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate'; import { CoreBlockOnlyTitleComponent } from '@features/block/components/only-title-block/only-title-block'; import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler'; import { makeSingleton } from '@singletons'; -import { AddonCompetencyMainMenuHandlerService } from '@addons/competency/services/handlers/mainmenu'; +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; /** * Block handler. @@ -38,7 +38,7 @@ export class AddonBlockLearningPlansHandlerService extends CoreBlockBaseHandler title: 'addon.block_learningplans.pluginname', class: 'addon-block-learning-plans', component: CoreBlockOnlyTitleComponent, - link: AddonCompetencyMainMenuHandlerService.PAGE_NAME, + link: ADDON_COMPETENCY_MAIN_PAGE_NAME, navOptions: { preferCurrentTab: false, }, diff --git a/src/addons/competency/competency-lazy.module.ts b/src/addons/competency/competency-lazy.module.ts index 65be44eb5..09dce93a7 100644 --- a/src/addons/competency/competency-lazy.module.ts +++ b/src/addons/competency/competency-lazy.module.ts @@ -25,15 +25,11 @@ import { AddonCompetencyCompetencyPage } from './pages/competency/competency'; import { AddonCompetencyCompetencySummaryPage } from './pages/competencysummary/competencysummary'; import { AddonCompetencyCourseCompetenciesPage } from './pages/coursecompetencies/coursecompetencies.page'; import { AddonCompetencyCourseCompetenciesPageModule } from './pages/coursecompetencies/coursecompetencies.module'; -import { AddonCompetencyMainMenuHandlerService } from './services/handlers/mainmenu'; const mobileRoutes: Routes = [ { path: '', pathMatch: 'full', - data: { - mainMenuTabRoot: AddonCompetencyMainMenuHandlerService.PAGE_NAME, - }, component: AddonCompetencyPlanListPage, }, { @@ -79,9 +75,6 @@ const tabletRoutes: Routes = [ }, { path: '', - data: { - mainMenuTabRoot: AddonCompetencyMainMenuHandlerService.PAGE_NAME, - }, component: AddonCompetencyPlanListPage, children: [ { diff --git a/src/addons/competency/competency.module.ts b/src/addons/competency/competency.module.ts index 9e08180da..a20438615 100644 --- a/src/addons/competency/competency.module.ts +++ b/src/addons/competency/competency.module.ts @@ -15,14 +15,12 @@ import { APP_INITIALIZER, NgModule, Type } from '@angular/core'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; -import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; import { CoreUserDelegate } from '@features/user/services/user-delegate'; import { AddonCompetencyProvider } from './services/competency'; import { AddonCompetencyHelperProvider } from './services/competency-helper'; import { AddonCompetencyCompetencyLinkHandler } from './services/handlers/competency-link'; import { AddonCompetencyCourseOptionHandler } from './services/handlers/course-option'; -import { AddonCompetencyMainMenuHandler, AddonCompetencyMainMenuHandlerService } from './services/handlers/mainmenu'; import { AddonCompetencyPlanLinkHandler } from './services/handlers/plan-link'; import { AddonCompetencyPlansLinkHandler } from './services/handlers/plans-link'; import { AddonCompetencyPushClickHandler } from './services/handlers/push-click'; @@ -39,16 +37,18 @@ export const ADDON_COMPETENCY_SERVICES: Type[] = [ AddonCompetencyHelperProvider, ]; +export const ADDON_COMPETENCY_MAIN_PAGE_NAME = 'competency'; + const mainMenuChildrenRoutes: Routes = [ { - path: AddonCompetencyMainMenuHandlerService.PAGE_NAME, + path: ADDON_COMPETENCY_MAIN_PAGE_NAME, loadChildren: () => import('./competency-lazy.module').then(m => m.AddonCompetencyLazyModule), }, ]; const courseIndexRoutes: Routes = [ { - path: AddonCompetencyMainMenuHandlerService.PAGE_NAME, + path: ADDON_COMPETENCY_MAIN_PAGE_NAME, loadChildren: () => import('@addons/competency/competency-course-lazy.module').then(m => m.AddonCompetencyCourseLazyModule), }, ]; @@ -56,7 +56,6 @@ const courseIndexRoutes: Routes = [ @NgModule({ imports: [ CoreMainMenuTabRoutingModule.forChild(mainMenuChildrenRoutes), - CoreMainMenuRoutingModule.forChild({ children: mainMenuChildrenRoutes }), CoreCourseIndexRoutingModule.forChild({ children: courseIndexRoutes }), ], exports: [CoreMainMenuRoutingModule], @@ -69,7 +68,6 @@ const courseIndexRoutes: Routes = [ CoreContentLinksDelegate.registerHandler(AddonCompetencyPlanLinkHandler.instance); CoreContentLinksDelegate.registerHandler(AddonCompetencyPlansLinkHandler.instance); CoreContentLinksDelegate.registerHandler(AddonCompetencyUserCompetencyLinkHandler.instance); - CoreMainMenuDelegate.registerHandler(AddonCompetencyMainMenuHandler.instance); CoreUserDelegate.registerHandler(AddonCompetencyUserHandler.instance); CoreCourseOptionsDelegate.registerHandler(AddonCompetencyCourseOptionHandler.instance); CorePushNotificationsDelegate.registerClickHandler(AddonCompetencyPushClickHandler.instance); diff --git a/src/addons/competency/pages/competency/competency.ts b/src/addons/competency/pages/competency/competency.ts index f9bd310cc..dba3905e4 100644 --- a/src/addons/competency/pages/competency/competency.ts +++ b/src/addons/competency/pages/competency/competency.ts @@ -32,7 +32,7 @@ import { CoreNavigator } from '@services/navigator'; import { IonRefresher } from '@ionic/angular'; import { ContextLevel } from '@/core/constants'; import { CoreUtils } from '@services/utils/utils'; -import { AddonCompetencyMainMenuHandlerService } from '@addons/competency/services/handlers/mainmenu'; +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; /** * Page that displays the competency information. @@ -184,7 +184,7 @@ export class AddonCompetencyCompetencyPage implements OnInit { */ openCompetencySummary(competencyId: number): void { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/summary/' + competencyId, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + competencyId, { params: { contextLevel: this.contextLevel, contextInstanceId: this.contextInstanceId }, }, diff --git a/src/addons/competency/pages/competencysummary/competencysummary.ts b/src/addons/competency/pages/competencysummary/competencysummary.ts index 2d150eb4e..fa810bf2b 100644 --- a/src/addons/competency/pages/competencysummary/competencysummary.ts +++ b/src/addons/competency/pages/competencysummary/competencysummary.ts @@ -19,7 +19,7 @@ import { IonRefresher } from '@ionic/angular'; import { CoreNavigator } from '@services/navigator'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; -import { AddonCompetencyMainMenuHandlerService } from '@addons/competency/services/handlers/mainmenu'; +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; /** * Page that displays the competency summary. @@ -102,7 +102,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit { */ openCompetencySummary(competencyId: number): void { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/summary/' + competencyId, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + competencyId, { params: { contextLevel: this.contextLevel, contextInstanceId: this.contextInstanceId }, }, diff --git a/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts b/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts index cbe9a49eb..96e98da36 100644 --- a/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts +++ b/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts @@ -19,8 +19,8 @@ import { CoreUserProfile } from '@features/user/services/user'; import { IonRefresher } from '@ionic/angular'; import { CoreNavigator } from '@services/navigator'; import { CoreDomUtils } from '@services/utils/dom'; -import { AddonCompetencyMainMenuHandlerService } from '@addons/competency/services/handlers/mainmenu'; import { ContextLevel } from '@/core/constants'; +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; /** * Page that displays the list of competencies of a course. @@ -81,7 +81,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit { */ openCompetency(competencyId: number): void { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/competencies/' + competencyId, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + competencyId, { params: { courseId: this.courseId, userId: this.userId }, }, @@ -94,7 +94,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit { * @param competencyId */ openCompetencySummary(competencyId: number): void { - CoreNavigator.navigateToSitePath('/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/summary/' + competencyId, { + CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + competencyId, { params: { contextLevel: ContextLevel.COURSE, contextInstanceId: this.courseId, diff --git a/src/addons/competency/pages/plan/plan.ts b/src/addons/competency/pages/plan/plan.ts index bf86a1a46..aafe9c4d8 100644 --- a/src/addons/competency/pages/plan/plan.ts +++ b/src/addons/competency/pages/plan/plan.ts @@ -19,7 +19,7 @@ import { AddonCompetencyHelper } from '../../services/competency-helper'; import { CoreNavigator } from '@services/navigator'; import { CoreUserProfile } from '@features/user/services/user'; import { IonRefresher } from '@ionic/angular'; -import { AddonCompetencyMainMenuHandlerService } from '@addons/competency/services/handlers/mainmenu'; +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; /** * Page that displays a learning plan. @@ -80,7 +80,7 @@ export class AddonCompetencyPlanPage implements OnInit { */ openCompetency(competencyId: number): void { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/competencies/' + competencyId, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + competencyId, { params: { planId: this.planId } }, ); } diff --git a/src/addons/competency/services/handlers/competency-link.ts b/src/addons/competency/services/handlers/competency-link.ts index dbbdd1df6..2ae81e974 100644 --- a/src/addons/competency/services/handlers/competency-link.ts +++ b/src/addons/competency/services/handlers/competency-link.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; import { Injectable } from '@angular/core'; import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreNavigator } from '@services/navigator'; import { makeSingleton } from '@singletons'; import { AddonCompetency } from '../competency'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; /** * Handler to treat links to a competency in a plan or in a course. @@ -44,7 +44,7 @@ export class AddonCompetencyCompetencyLinkHandlerService extends CoreContentLink }; CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/competencies/' + params.competencyid, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + params.competencyid, { params: pageParams, siteId }, ); diff --git a/src/addons/competency/services/handlers/course-option.ts b/src/addons/competency/services/handlers/course-option.ts index e5f1e5364..7051064ff 100644 --- a/src/addons/competency/services/handlers/course-option.ts +++ b/src/addons/competency/services/handlers/course-option.ts @@ -25,7 +25,7 @@ import { CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/service import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '@features/courses/services/courses-helper'; import { CoreFilterHelper } from '@features/filter/services/filter-helper'; import { ContextLevel } from '@/core/constants'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; /** * Course nav handler. @@ -75,7 +75,7 @@ export class AddonCompetencyCourseOptionHandlerService implements CoreCourseOpti return { title: 'addon.competency.competencies', class: 'addon-competency-course-handler', - page: AddonCompetencyMainMenuHandlerService.PAGE_NAME, + page: ADDON_COMPETENCY_MAIN_PAGE_NAME, }; } diff --git a/src/addons/competency/services/handlers/mainmenu.ts b/src/addons/competency/services/handlers/mainmenu.ts deleted file mode 100644 index 8c4130b83..000000000 --- a/src/addons/competency/services/handlers/mainmenu.ts +++ /dev/null @@ -1,54 +0,0 @@ -// (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. - -import { Injectable } from '@angular/core'; -import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@features/mainmenu/services/mainmenu-delegate'; -import { makeSingleton } from '@singletons'; -import { AddonCompetency } from '../competency'; - -/** - * Handler to inject an option into main menu. - */ -@Injectable( { providedIn: 'root' }) -export class AddonCompetencyMainMenuHandlerService implements CoreMainMenuHandler { - - static readonly PAGE_NAME = 'competency'; - - name = 'AddonCompetency'; - priority = 500; - - /** - * @inheritdoc - */ - async isEnabled(): Promise { - // Check the user has at least one learn plan available. - const plans = await AddonCompetency.getLearningPlans(); - - return plans.length > 0; - } - - /** - * @inheritdoc - */ - getDisplayData(): CoreMainMenuHandlerData { - return { - icon: 'fas-route', - title: 'addon.competency.myplans', - page: AddonCompetencyMainMenuHandlerService.PAGE_NAME, - class: 'addon-competency-handler', - }; - } - -} -export const AddonCompetencyMainMenuHandler = makeSingleton(AddonCompetencyMainMenuHandlerService); diff --git a/src/addons/competency/services/handlers/plan-link.ts b/src/addons/competency/services/handlers/plan-link.ts index ca4ab179b..7ac937d62 100644 --- a/src/addons/competency/services/handlers/plan-link.ts +++ b/src/addons/competency/services/handlers/plan-link.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; import { Injectable } from '@angular/core'; import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreNavigator } from '@services/navigator'; import { makeSingleton } from '@singletons'; import { AddonCompetency } from '../competency'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; /** * Handler to treat links to a plan. @@ -36,7 +36,7 @@ export class AddonCompetencyPlanLinkHandlerService extends CoreContentLinksHandl return [{ action: (siteId: string): void => { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/' + params.id, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/' + params.id, { siteId }, ); }, diff --git a/src/addons/competency/services/handlers/plans-link.ts b/src/addons/competency/services/handlers/plans-link.ts index e7d377f61..bfa9e8fd5 100644 --- a/src/addons/competency/services/handlers/plans-link.ts +++ b/src/addons/competency/services/handlers/plans-link.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; import { Injectable } from '@angular/core'; import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreNavigator } from '@services/navigator'; import { makeSingleton } from '@singletons'; import { AddonCompetency } from '../competency'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; /** * Handler to treat links to user plans. @@ -36,7 +36,7 @@ export class AddonCompetencyPlansLinkHandlerService extends CoreContentLinksHand return [{ action: (siteId: string): void => { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME, + ADDON_COMPETENCY_MAIN_PAGE_NAME, { params: { userId: params.userid }, siteId }, ); diff --git a/src/addons/competency/services/handlers/push-click.ts b/src/addons/competency/services/handlers/push-click.ts index 7966bbf66..12f2f7a4c 100644 --- a/src/addons/competency/services/handlers/push-click.ts +++ b/src/addons/competency/services/handlers/push-click.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; import { Injectable } from '@angular/core'; import { CorePushNotificationsClickHandler } from '@features/pushnotifications/services/push-delegate'; import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifications/services/pushnotifications'; @@ -20,7 +21,6 @@ import { CoreUrlUtils } from '@services/utils/url'; import { CoreUtils } from '@services/utils/utils'; import { makeSingleton } from '@singletons'; import { AddonCompetency } from '../competency'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; /** * Handler for competencies push notifications clicks. @@ -56,7 +56,7 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlan(planId, notification.site)); - await CoreNavigator.navigateToSitePath('/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/' + planId, { + await CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME + '/' + planId, { siteId: notification.site, }); @@ -72,7 +72,7 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat await CoreUtils.ignoreErrors(AddonCompetency.invalidateCompetencyInPlan(planId, competencyId, notification.site)); await CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/competencies/' + competencyId, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/competencies/' + competencyId, { params: { planId, courseId, userId }, siteId: notification.site, @@ -87,7 +87,7 @@ export class AddonCompetencyPushClickHandlerService implements CorePushNotificat await CoreUtils.ignoreErrors(AddonCompetency.invalidateLearningPlans(userId, notification.site)); - await CoreNavigator.navigateToSitePath('/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME, { + await CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME, { params: { userId }, siteId: notification.site, }); diff --git a/src/addons/competency/services/handlers/user-competency-link.ts b/src/addons/competency/services/handlers/user-competency-link.ts index 7a1380f3a..537984f28 100644 --- a/src/addons/competency/services/handlers/user-competency-link.ts +++ b/src/addons/competency/services/handlers/user-competency-link.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; import { Injectable } from '@angular/core'; import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler'; import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreNavigator } from '@services/navigator'; import { makeSingleton } from '@singletons'; import { AddonCompetency } from '../competency'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; /** * Handler to treat links to a usr competency. @@ -37,7 +37,7 @@ export class AddonCompetencyUserCompetencyLinkHandlerService extends CoreContent return [{ action: (siteId: string): void => { CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/summary/' + params.id, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/summary/' + params.id, { siteId }, ); diff --git a/src/addons/competency/services/handlers/user.ts b/src/addons/competency/services/handlers/user.ts index 1500085ee..356fbf94d 100644 --- a/src/addons/competency/services/handlers/user.ts +++ b/src/addons/competency/services/handlers/user.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { ADDON_COMPETENCY_MAIN_PAGE_NAME } from '@addons/competency/competency.module'; import { Injectable } from '@angular/core'; import { CoreUserProfile } from '@features/user/services/user'; import { CoreUserProfileHandler, CoreUserDelegateService, CoreUserProfileHandlerData } from '@features/user/services/user-delegate'; import { CoreNavigator } from '@services/navigator'; import { makeSingleton } from '@singletons'; import { AddonCompetency } from '../competency'; -import { AddonCompetencyMainMenuHandlerService } from './mainmenu'; /** * Profile competencies handler. @@ -69,7 +69,7 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler event.preventDefault(); event.stopPropagation(); CoreNavigator.navigateToSitePath( - '/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME + '/course/' + courseId, + ADDON_COMPETENCY_MAIN_PAGE_NAME + '/course/' + courseId, { params: { userId: user.id }, }, @@ -85,7 +85,7 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler action: (event, user): void => { event.preventDefault(); event.stopPropagation(); - CoreNavigator.navigateToSitePath('/' + AddonCompetencyMainMenuHandlerService.PAGE_NAME, { + CoreNavigator.navigateToSitePath(ADDON_COMPETENCY_MAIN_PAGE_NAME, { params: { userId: user.id }, }); },