MOBILE-4498 comments: Decouple comments services

main
Pau Ferrer Ocaña 2024-02-28 16:23:51 +01:00
parent 6a52b02eeb
commit d5be19ad9d
2 changed files with 21 additions and 10 deletions

View File

@ -18,17 +18,26 @@ import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-ro
import { CoreCronDelegate } from '@services/cron'; import { CoreCronDelegate } from '@services/cron';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { CoreCommentsComponentsModule } from './components/components.module'; import { CoreCommentsComponentsModule } from './components/components.module';
import { CoreComments, CoreCommentsProvider } from './services/comments'; import { CoreComments } from './services/comments';
import { CoreCommentsOfflineProvider } from './services/comments-offline';
import { CoreCommentsSyncProvider } from './services/comments-sync';
import { COMMENTS_OFFLINE_SITE_SCHEMA } from './services/database/comments'; import { COMMENTS_OFFLINE_SITE_SCHEMA } from './services/database/comments';
import { CoreCommentsSyncCronHandler } from './services/handlers/sync-cron'; import { CoreCommentsSyncCronHandler } from './services/handlers/sync-cron';
export const CORE_COMMENTS_SERVICES: Type<unknown>[] = [ /**
* Get comments services.
*
* @returns Comments services.
*/
export async function getCommentsServices(): Promise<Type<unknown>[]> {
const { CoreCommentsOfflineProvider } = await import('@features/comments/services/comments-offline');
const { CoreCommentsSyncProvider } = await import('@features/comments/services/comments-sync');
const { CoreCommentsProvider } = await import('@features/comments/services/comments');
return [
CoreCommentsOfflineProvider, CoreCommentsOfflineProvider,
CoreCommentsSyncProvider, CoreCommentsSyncProvider,
CoreCommentsProvider, CoreCommentsProvider,
]; ];
}
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -42,7 +42,7 @@ import { makeSingleton } from '@singletons';
// Import core services. // Import core services.
import { CORE_SERVICES } from '@/core/core.module'; import { CORE_SERVICES } from '@/core/core.module';
import { CORE_BLOCK_SERVICES } from '@features/block/block.module'; import { CORE_BLOCK_SERVICES } from '@features/block/block.module';
import { CORE_COMMENTS_SERVICES } from '@features/comments/comments.module'; import { getCommentsServices } from '@features/comments/comments.module';
import { CORE_CONTENTLINKS_SERVICES } from '@features/contentlinks/contentlinks.module'; import { CORE_CONTENTLINKS_SERVICES } from '@features/contentlinks/contentlinks.module';
import { CORE_COURSE_SERVICES } from '@features/course/course.module'; import { CORE_COURSE_SERVICES } from '@features/course/course.module';
import { CORE_COURSES_SERVICES } from '@features/courses/courses.module'; import { CORE_COURSES_SERVICES } from '@features/courses/courses.module';
@ -280,7 +280,6 @@ export class CoreCompileProvider {
...CORE_SERVICES, ...CORE_SERVICES,
CoreAutoLogoutService, CoreAutoLogoutService,
...CORE_BLOCK_SERVICES, ...CORE_BLOCK_SERVICES,
...CORE_COMMENTS_SERVICES,
...CORE_CONTENTLINKS_SERVICES, ...CORE_CONTENTLINKS_SERVICES,
...CORE_COURSE_SERVICES, ...CORE_COURSE_SERVICES,
...CORE_COURSES_SERVICES, ...CORE_COURSES_SERVICES,
@ -411,8 +410,11 @@ 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 CORE_COMMENTS_SERVICES = await getCommentsServices();
return [ return [
...ADDON_MOD_WORKSHOP_SERVICES, ...ADDON_MOD_WORKSHOP_SERVICES,
...CORE_COMMENTS_SERVICES,
]; ];
} }