From 8190e638f054b8afc341dec66bbe14d27aa11f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 28 Feb 2024 16:51:00 +0100 Subject: [PATCH] MOBILE-4498 tag: Decouple course tag services --- src/core/features/compile/services/compile.ts | 7 +++--- src/core/features/tag/tag.module.ts | 24 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/core/features/compile/services/compile.ts b/src/core/features/compile/services/compile.ts index 708cf9f01..77149f3a8 100644 --- a/src/core/features/compile/services/compile.ts +++ b/src/core/features/compile/services/compile.ts @@ -62,7 +62,7 @@ import { CORE_RATING_SERVICES } from '@features/rating/rating.module'; import { CORE_SEARCH_SERVICES } from '@features/search/search.module'; import { CORE_SETTINGS_SERVICES } from '@features/settings/settings.module'; import { CORE_SITEHOME_SERVICES } from '@features/sitehome/sitehome.module'; -import { CORE_TAG_SERVICES } from '@features/tag/tag.module'; +import { getTagServices } from '@features/tag/tag.module'; import { CORE_STYLE_SERVICES } from '@features/styles/styles.module'; import { CORE_USER_SERVICES } from '@features/user/user.module'; import { CORE_XAPI_SERVICES } from '@features/xapi/xapi.module'; @@ -299,7 +299,6 @@ export class CoreCompileProvider { ...CORE_SHAREDFILES_SERVICES, ...CORE_SITEHOME_SERVICES, CoreSitePluginsProvider, - ...CORE_TAG_SERVICES, ...CORE_STYLE_SERVICES, ...CORE_USER_SERVICES, ...CORE_XAPI_SERVICES, @@ -411,11 +410,13 @@ export class CoreCompileProvider { const ADDON_COURSECOMPLETION_SERVICES = await getCourseCompletionServices(); const CORE_COMMENTS_SERVICES = await getCommentsServices(); + const CORE_TAG_SERVICES = await getTagServices(); return [ ...ADDON_MOD_WORKSHOP_SERVICES, - ...CORE_COMMENTS_SERVICES, ...ADDON_COURSECOMPLETION_SERVICES, + ...CORE_COMMENTS_SERVICES, + ...CORE_TAG_SERVICES, ]; } diff --git a/src/core/features/tag/tag.module.ts b/src/core/features/tag/tag.module.ts index 4286e7b1a..5bdc0dd31 100644 --- a/src/core/features/tag/tag.module.ts +++ b/src/core/features/tag/tag.module.ts @@ -22,15 +22,23 @@ 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'; -import { CoreTagAreaDelegateService } from './services/tag-area-delegate'; -import { CoreTagHelperProvider } from './services/tag-helper'; -import { CoreTagProvider } from './services/tag'; -export const CORE_TAG_SERVICES: Type[] = [ - CoreTagAreaDelegateService, - CoreTagHelperProvider, - CoreTagProvider, -]; +/** + * Get tags services. + * + * @returns Tags services. + */ +export async function getTagServices(): Promise[]> { + const { CoreTagAreaDelegateService } = await import('@features/tag/services/tag-area-delegate'); + const { CoreTagHelperProvider } = await import('@features/tag/services/tag-helper'); + const { CoreTagProvider } = await import('@features/tag/services/tag'); + + return [ + CoreTagAreaDelegateService, + CoreTagHelperProvider, + CoreTagProvider, + ]; +} const routes: Routes = [ {