MOBILE-4497 competency: Decouple competency services

main
Pau Ferrer Ocaña 2024-02-29 16:49:30 +01:00
parent ff0108d796
commit f5d31d8eb4
2 changed files with 17 additions and 9 deletions

View File

@ -17,8 +17,6 @@ import { CoreContentLinksDelegate } from '@features/contentlinks/services/conten
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
import { CoreUserDelegate } from '@features/user/services/user-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 { AddonCompetencyCompetencyLinkHandler } from './services/handlers/competency-link';
import { AddonCompetencyCourseOptionHandler } from './services/handlers/course-option'; import { AddonCompetencyCourseOptionHandler } from './services/handlers/course-option';
import { AddonCompetencyPlanLinkHandler } from './services/handlers/plan-link'; import { AddonCompetencyPlanLinkHandler } from './services/handlers/plan-link';
@ -33,11 +31,20 @@ import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.mo
import { COURSE_PAGE_NAME } from '@features/course/course.module'; import { COURSE_PAGE_NAME } from '@features/course/course.module';
import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module'; import { PARTICIPANTS_PAGE_NAME } from '@features/user/user.module';
// List of providers (without handlers). /**
export const ADDON_COMPETENCY_SERVICES: Type<unknown>[] = [ * Get competency services.
*
* @returns Competency services.
*/
export async function getCompetencyServices(): Promise<Type<unknown>[]> {
const { AddonCompetencyProvider } = await import('@addons/competency/services/competency');
const { AddonCompetencyHelperProvider } = await import('@addons/competency/services/competency-helper');
return [
AddonCompetencyProvider, AddonCompetencyProvider,
AddonCompetencyHelperProvider, AddonCompetencyHelperProvider,
]; ];
}
export const ADDON_COMPETENCY_LEARNING_PLANS_PAGE = 'learning-plans'; export const ADDON_COMPETENCY_LEARNING_PLANS_PAGE = 'learning-plans';
export const ADDON_COMPETENCY_COMPETENCIES_PAGE = 'competencies'; export const ADDON_COMPETENCY_COMPETENCIES_PAGE = 'competencies';

View File

@ -127,7 +127,7 @@ import { CoreSitePluginsAssignSubmissionComponent } from '@features/siteplugins/
import { ADDON_BADGES_SERVICES } from '@addons/badges/badges.module'; import { ADDON_BADGES_SERVICES } from '@addons/badges/badges.module';
import { ADDON_CALENDAR_SERVICES } from '@addons/calendar/calendar.module'; import { ADDON_CALENDAR_SERVICES } from '@addons/calendar/calendar.module';
import { getCourseCompletionServices } from '@addons/coursecompletion/coursecompletion.module'; import { getCourseCompletionServices } from '@addons/coursecompletion/coursecompletion.module';
import { ADDON_COMPETENCY_SERVICES } from '@addons/competency/competency.module'; import { getCompetencyServices } from '@addons/competency/competency.module';
import { ADDON_MESSAGEOUTPUT_SERVICES } from '@addons/messageoutput/messageoutput.module'; import { ADDON_MESSAGEOUTPUT_SERVICES } from '@addons/messageoutput/messageoutput.module';
import { ADDON_MESSAGES_SERVICES } from '@addons/messages/messages.module'; import { ADDON_MESSAGES_SERVICES } from '@addons/messages/messages.module';
import { ADDON_MOD_ASSIGN_SERVICES } from '@addons/mod/assign/assign.module'; import { ADDON_MOD_ASSIGN_SERVICES } from '@addons/mod/assign/assign.module';
@ -307,7 +307,6 @@ export class CoreCompileProvider {
...extraProviders, ...extraProviders,
...ADDON_BADGES_SERVICES, ...ADDON_BADGES_SERVICES,
...ADDON_CALENDAR_SERVICES, ...ADDON_CALENDAR_SERVICES,
...ADDON_COMPETENCY_SERVICES,
...ADDON_MESSAGEOUTPUT_SERVICES, ...ADDON_MESSAGEOUTPUT_SERVICES,
...ADDON_MESSAGES_SERVICES, ...ADDON_MESSAGES_SERVICES,
...ADDON_MOD_ASSIGN_SERVICES, ...ADDON_MOD_ASSIGN_SERVICES,
@ -407,6 +406,7 @@ export class CoreCompileProvider {
*/ */
async getLazyLibraries(): Promise<Type<unknown>[]> { async getLazyLibraries(): Promise<Type<unknown>[]> {
const ADDON_MOD_WORKSHOP_SERVICES = await getWorkshopServices(); const ADDON_MOD_WORKSHOP_SERVICES = await getWorkshopServices();
const ADDON_COMPETENCY_SERVICES = await getCompetencyServices();
const ADDON_COURSECOMPLETION_SERVICES = await getCourseCompletionServices(); const ADDON_COURSECOMPLETION_SERVICES = await getCourseCompletionServices();
const CORE_COMMENTS_SERVICES = await getCommentsServices(); const CORE_COMMENTS_SERVICES = await getCommentsServices();
@ -414,6 +414,7 @@ export class CoreCompileProvider {
return [ return [
...ADDON_MOD_WORKSHOP_SERVICES, ...ADDON_MOD_WORKSHOP_SERVICES,
...ADDON_COMPETENCY_SERVICES,
...ADDON_COURSECOMPLETION_SERVICES, ...ADDON_COURSECOMPLETION_SERVICES,
...CORE_COMMENTS_SERVICES, ...CORE_COMMENTS_SERVICES,
...CORE_TAG_SERVICES, ...CORE_TAG_SERVICES,