MOBILE-4498 completion: Decouple course completion services

main
Pau Ferrer Ocaña 2024-02-28 16:48:05 +01:00
parent 40c47b9148
commit 0efd23f019
2 changed files with 15 additions and 6 deletions

View File

@ -19,14 +19,22 @@ import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.mo
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CoreUserDelegate } from '@features/user/services/user-delegate';
import { AddonCourseCompletionProvider } from './services/coursecompletion';
import { AddonCourseCompletionStatusLinkHandler } from './services/handlers/completionstatus-link';
import { AddonCourseCompletionCourseOptionHandler } from './services/handlers/course-option';
import { AddonCourseCompletionUserHandler } from './services/handlers/user';
export const ADDON_COURSECOMPLETION_SERVICES: Type<unknown>[] = [
AddonCourseCompletionProvider,
];
/**
* Get course completion services.
*
* @returns Course completion services.
*/
export async function getCourseCompletionServices(): Promise<Type<unknown>[]> {
const { AddonCourseCompletionProvider } = await import('@addons/coursecompletion/services/coursecompletion');
return [
AddonCourseCompletionProvider,
];
}
const routes: Routes = [
{

View File

@ -126,7 +126,7 @@ import { CoreSitePluginsAssignSubmissionComponent } from '@features/siteplugins/
// Import addon providers. Do not import database module because it causes circular dependencies.
import { ADDON_BADGES_SERVICES } from '@addons/badges/badges.module';
import { ADDON_CALENDAR_SERVICES } from '@addons/calendar/calendar.module';
import { ADDON_COURSECOMPLETION_SERVICES } from '@addons/coursecompletion/coursecompletion.module';
import { getCourseCompletionServices } from '@addons/coursecompletion/coursecompletion.module';
import { ADDON_COMPETENCY_SERVICES } from '@addons/competency/competency.module';
import { ADDON_MESSAGEOUTPUT_SERVICES } from '@addons/messageoutput/messageoutput.module';
import { ADDON_MESSAGES_SERVICES } from '@addons/messages/messages.module';
@ -308,7 +308,6 @@ export class CoreCompileProvider {
...extraProviders,
...ADDON_BADGES_SERVICES,
...ADDON_CALENDAR_SERVICES,
...ADDON_COURSECOMPLETION_SERVICES,
...ADDON_COMPETENCY_SERVICES,
...ADDON_MESSAGEOUTPUT_SERVICES,
...ADDON_MESSAGES_SERVICES,
@ -409,12 +408,14 @@ export class CoreCompileProvider {
*/
async getLazyLibraries(): Promise<Type<unknown>[]> {
const ADDON_MOD_WORKSHOP_SERVICES = await getWorkshopServices();
const ADDON_COURSECOMPLETION_SERVICES = await getCourseCompletionServices();
const CORE_COMMENTS_SERVICES = await getCommentsServices();
return [
...ADDON_MOD_WORKSHOP_SERVICES,
...CORE_COMMENTS_SERVICES,
...ADDON_COURSECOMPLETION_SERVICES,
];
}