From 57d65555a43b4af1c17b54f90e3f64f940e7d399 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 1 Jun 2018 13:47:02 +0200 Subject: [PATCH] MOBILE-2425 siteplugins: Import addon providers and components --- src/addon/badges/badges.module.ts | 10 ++-- src/addon/calendar/calendar.module.ts | 12 +++-- src/addon/competency/competency.module.ts | 12 +++-- src/addon/files/files.module.ts | 12 +++-- .../messageoutput/messageoutput.module.ts | 9 ++-- src/addon/messages/messages.module.ts | 14 +++-- src/addon/mod/assign/assign.module.ts | 20 ++++--- src/addon/mod/book/book.module.ts | 10 ++-- src/addon/mod/chat/chat.module.ts | 10 ++-- src/addon/mod/choice/choice.module.ts | 16 +++--- src/addon/mod/data/data.module.ts | 18 ++++--- src/addon/mod/feedback/feedback.module.ts | 18 ++++--- src/addon/mod/folder/folder.module.ts | 12 +++-- src/addon/mod/forum/forum.module.ts | 18 ++++--- src/addon/mod/glossary/glossary.module.ts | 16 +++--- src/addon/mod/imscp/imscp.module.ts | 10 ++-- src/addon/mod/lesson/lesson.module.ts | 16 +++--- src/addon/mod/lti/lti.module.ts | 12 +++-- src/addon/mod/page/page.module.ts | 12 +++-- src/addon/mod/quiz/quiz.module.ts | 18 ++++--- src/addon/mod/resource/resource.module.ts | 10 ++-- src/addon/mod/scorm/scorm.module.ts | 16 +++--- src/addon/mod/survey/survey.module.ts | 18 ++++--- src/addon/mod/url/url.module.ts | 12 +++-- src/addon/mod/wiki/wiki.module.ts | 14 +++-- src/addon/notes/notes.module.ts | 14 +++-- .../notifications/notifications.module.ts | 10 ++-- .../pushnotifications.module.ts | 11 ++-- src/addon/remotethemes/remotethemes.module.ts | 9 ++-- src/core/compile/providers/compile.ts | 54 +++++++++++++++++-- 30 files changed, 302 insertions(+), 141 deletions(-) diff --git a/src/addon/badges/badges.module.ts b/src/addon/badges/badges.module.ts index b4416dfa3..3116a7880 100644 --- a/src/addon/badges/badges.module.ts +++ b/src/addon/badges/badges.module.ts @@ -20,17 +20,21 @@ import { AddonBadgesBadgeLinkHandler } from './providers/badge-link-handler'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreUserDelegate } from '@core/user/providers/user-delegate'; +// List of providers (without handlers). +export const ADDON_BADGES_PROVIDERS: any[] = [ + AddonBadgesProvider +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonBadgesProvider, + providers: ADDON_BADGES_PROVIDERS.concat([ AddonBadgesUserHandler, AddonBadgesMyBadgesLinkHandler, AddonBadgesBadgeLinkHandler - ] + ]) }) export class AddonBadgesModule { constructor(userDelegate: CoreUserDelegate, userHandler: AddonBadgesUserHandler, diff --git a/src/addon/calendar/calendar.module.ts b/src/addon/calendar/calendar.module.ts index 1f4bea922..fefb0c635 100644 --- a/src/addon/calendar/calendar.module.ts +++ b/src/addon/calendar/calendar.module.ts @@ -21,16 +21,20 @@ import { CoreInitDelegate } from '@providers/init'; import { CoreLocalNotificationsProvider } from '@providers/local-notifications'; import { CoreLoginHelperProvider } from '@core/login/providers/helper'; +// List of providers (without handlers). +export const ADDON_CALENDAR_PROVIDERS: any[] = [ + AddonCalendarProvider, + AddonCalendarHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonCalendarProvider, - AddonCalendarHelperProvider, + providers: ADDON_CALENDAR_PROVIDERS.concat([ AddonCalendarMainMenuHandler - ] + ]) }) export class AddonCalendarModule { constructor(mainMenuDelegate: CoreMainMenuDelegate, calendarHandler: AddonCalendarMainMenuHandler, diff --git a/src/addon/competency/competency.module.ts b/src/addon/competency/competency.module.ts index 7d31bae23..c6072bab1 100644 --- a/src/addon/competency/competency.module.ts +++ b/src/addon/competency/competency.module.ts @@ -23,19 +23,23 @@ import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delega import { CoreMainMenuDelegate } from '@core/mainmenu/providers/delegate'; import { CoreUserDelegate } from '@core/user/providers/user-delegate'; +// List of providers (without handlers). +export const ADDON_COMPETENCY_PROVIDERS: any[] = [ + AddonCompetencyProvider, + AddonCompetencyHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonCompetencyComponentsModule ], - providers: [ - AddonCompetencyProvider, - AddonCompetencyHelperProvider, + providers: ADDON_COMPETENCY_PROVIDERS.concat([ AddonCompetencyCourseOptionHandler, AddonCompetencyMainMenuHandler, AddonCompetencyUserHandler - ] + ]) }) export class AddonCompetencyModule { constructor(mainMenuDelegate: CoreMainMenuDelegate, mainMenuHandler: AddonCompetencyMainMenuHandler, diff --git a/src/addon/files/files.module.ts b/src/addon/files/files.module.ts index 25f500ee2..be727b94b 100644 --- a/src/addon/files/files.module.ts +++ b/src/addon/files/files.module.ts @@ -18,16 +18,20 @@ import { AddonFilesHelperProvider } from './providers/helper'; import { AddonFilesMainMenuHandler } from './providers/mainmenu-handler'; import { CoreMainMenuDelegate } from '@core/mainmenu/providers/delegate'; +// List of providers (without handlers). +export const ADDON_FILES_PROVIDERS: any[] = [ + AddonFilesProvider, + AddonFilesHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonFilesProvider, - AddonFilesHelperProvider, + providers: ADDON_FILES_PROVIDERS.concat([ AddonFilesMainMenuHandler - ] + ]) }) export class AddonFilesModule { constructor(mainMenuDelegate: CoreMainMenuDelegate, filesHandler: AddonFilesMainMenuHandler) { diff --git a/src/addon/messageoutput/messageoutput.module.ts b/src/addon/messageoutput/messageoutput.module.ts index 87552dc1d..7cf2e0a58 100644 --- a/src/addon/messageoutput/messageoutput.module.ts +++ b/src/addon/messageoutput/messageoutput.module.ts @@ -15,13 +15,16 @@ import { NgModule } from '@angular/core'; import { AddonMessageOutputDelegate } from './providers/delegate'; +// List of providers (without handlers). +export const ADDON_MESSAGEOUTPUT_PROVIDERS: any[] = [ + AddonMessageOutputDelegate +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonMessageOutputDelegate - ] + providers: ADDON_MESSAGEOUTPUT_PROVIDERS }) export class AddonMessageOutputModule {} diff --git a/src/addon/messages/messages.module.ts b/src/addon/messages/messages.module.ts index 31e009d6f..1517905ba 100644 --- a/src/addon/messages/messages.module.ts +++ b/src/addon/messages/messages.module.ts @@ -37,15 +37,19 @@ import { AddonMessagesSettingsHandler } from './providers/settings-handler'; import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate'; import { CoreUtilsProvider } from '@providers/utils/utils'; +// List of providers (without handlers). +export const ADDON_MESSAGES_PROVIDERS: any[] = [ + AddonMessagesProvider, + AddonMessagesOfflineProvider, + AddonMessagesSyncProvider +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonMessagesProvider, - AddonMessagesOfflineProvider, - AddonMessagesSyncProvider, + providers: ADDON_MESSAGES_PROVIDERS.concat([ AddonMessagesMainMenuHandler, AddonMessagesSendMessageUserHandler, AddonMessagesAddContactUserHandler, @@ -54,7 +58,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; AddonMessagesIndexLinkHandler, AddonMessagesSyncCronHandler, AddonMessagesSettingsHandler - ] + ]) }) export class AddonMessagesModule { constructor(mainMenuDelegate: CoreMainMenuDelegate, mainmenuHandler: AddonMessagesMainMenuHandler, diff --git a/src/addon/mod/assign/assign.module.ts b/src/addon/mod/assign/assign.module.ts index 145356eae..961dd18b5 100644 --- a/src/addon/mod/assign/assign.module.ts +++ b/src/addon/mod/assign/assign.module.ts @@ -30,6 +30,16 @@ import { AddonModAssignSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModAssignSubmissionModule } from './submission/submission.module'; import { AddonModAssignFeedbackModule } from './feedback/feedback.module'; +// List of providers (without handlers). +export const ADDON_MOD_ASSIGN_PROVIDERS: any[] = [ + AddonModAssignProvider, + AddonModAssignOfflineProvider, + AddonModAssignSyncProvider, + AddonModAssignHelperProvider, + AddonModAssignFeedbackDelegate, + AddonModAssignSubmissionDelegate +]; + @NgModule({ declarations: [ ], @@ -37,19 +47,13 @@ import { AddonModAssignFeedbackModule } from './feedback/feedback.module'; AddonModAssignSubmissionModule, AddonModAssignFeedbackModule ], - providers: [ - AddonModAssignProvider, - AddonModAssignOfflineProvider, - AddonModAssignSyncProvider, - AddonModAssignHelperProvider, - AddonModAssignFeedbackDelegate, - AddonModAssignSubmissionDelegate, + providers: ADDON_MOD_ASSIGN_PROVIDERS.concat([ AddonModAssignDefaultFeedbackHandler, AddonModAssignDefaultSubmissionHandler, AddonModAssignModuleHandler, AddonModAssignPrefetchHandler, AddonModAssignSyncCronHandler - ] + ]) }) export class AddonModAssignModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModAssignModuleHandler, diff --git a/src/addon/mod/book/book.module.ts b/src/addon/mod/book/book.module.ts index e2d43fe6c..bdd9ead55 100644 --- a/src/addon/mod/book/book.module.ts +++ b/src/addon/mod/book/book.module.ts @@ -22,18 +22,22 @@ import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_BOOK_PROVIDERS: any[] = [ + AddonModBookProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModBookComponentsModule ], - providers: [ - AddonModBookProvider, + providers: ADDON_MOD_BOOK_PROVIDERS.concat([ AddonModBookModuleHandler, AddonModBookLinkHandler, AddonModBookPrefetchHandler - ] + ]) }) export class AddonModBookModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModBookModuleHandler, diff --git a/src/addon/mod/chat/chat.module.ts b/src/addon/mod/chat/chat.module.ts index db9121dad..d61cf9154 100644 --- a/src/addon/mod/chat/chat.module.ts +++ b/src/addon/mod/chat/chat.module.ts @@ -20,17 +20,21 @@ import { AddonModChatProvider } from './providers/chat'; import { AddonModChatLinkHandler } from './providers/link-handler'; import { AddonModChatModuleHandler } from './providers/module-handler'; +// List of providers (without handlers). +export const ADDON_MOD_CHAT_PROVIDERS: any[] = [ + AddonModChatProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModChatComponentsModule ], - providers: [ - AddonModChatProvider, + providers: ADDON_MOD_CHAT_PROVIDERS.concat([ AddonModChatLinkHandler, AddonModChatModuleHandler, - ] + ]) }) export class AddonModChatModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChatModuleHandler, diff --git a/src/addon/mod/choice/choice.module.ts b/src/addon/mod/choice/choice.module.ts index 8cfe8a5d6..54731cb0a 100644 --- a/src/addon/mod/choice/choice.module.ts +++ b/src/addon/mod/choice/choice.module.ts @@ -26,21 +26,25 @@ import { AddonModChoiceSyncProvider } from './providers/sync'; import { AddonModChoiceSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModChoiceOfflineProvider } from './providers/offline'; +// List of providers (without handlers). +export const ADDON_MOD_CHOICE_PROVIDERS: any[] = [ + AddonModChoiceProvider, + AddonModChoiceSyncProvider, + AddonModChoiceOfflineProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModChoiceComponentsModule ], - providers: [ - AddonModChoiceProvider, + providers: ADDON_MOD_CHOICE_PROVIDERS.concat([ AddonModChoiceModuleHandler, AddonModChoicePrefetchHandler, AddonModChoiceLinkHandler, - AddonModChoiceSyncCronHandler, - AddonModChoiceSyncProvider, - AddonModChoiceOfflineProvider - ] + AddonModChoiceSyncCronHandler + ]) }) export class AddonModChoiceModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChoiceModuleHandler, diff --git a/src/addon/mod/data/data.module.ts b/src/addon/mod/data/data.module.ts index 6231d8e79..431ac084f 100644 --- a/src/addon/mod/data/data.module.ts +++ b/src/addon/mod/data/data.module.ts @@ -34,6 +34,15 @@ import { AddonModDataFieldsDelegate } from './providers/fields-delegate'; import { AddonModDataDefaultFieldHandler } from './providers/default-field-handler'; import { AddonModDataFieldModule } from './fields/field.module'; +// List of providers (without handlers). +export const ADDON_MOD_DATA_PROVIDERS: any[] = [ + AddonModDataProvider, + AddonModDataHelperProvider, + AddonModDataSyncProvider, + AddonModDataOfflineProvider, + AddonModDataFieldsDelegate +]; + @NgModule({ declarations: [ ], @@ -41,22 +50,17 @@ import { AddonModDataFieldModule } from './fields/field.module'; AddonModDataComponentsModule, AddonModDataFieldModule ], - providers: [ - AddonModDataProvider, + providers: ADDON_MOD_DATA_PROVIDERS.concat([ AddonModDataModuleHandler, AddonModDataPrefetchHandler, - AddonModDataHelperProvider, AddonModDataLinkHandler, AddonModDataApproveLinkHandler, AddonModDataDeleteLinkHandler, AddonModDataShowLinkHandler, AddonModDataEditLinkHandler, AddonModDataSyncCronHandler, - AddonModDataSyncProvider, - AddonModDataOfflineProvider, - AddonModDataFieldsDelegate, AddonModDataDefaultFieldHandler - ] + ]) }) export class AddonModDataModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModDataModuleHandler, diff --git a/src/addon/mod/feedback/feedback.module.ts b/src/addon/mod/feedback/feedback.module.ts index 494e1769d..d80fc9075 100644 --- a/src/addon/mod/feedback/feedback.module.ts +++ b/src/addon/mod/feedback/feedback.module.ts @@ -32,27 +32,31 @@ import { AddonModFeedbackSyncProvider } from './providers/sync'; import { AddonModFeedbackSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModFeedbackOfflineProvider } from './providers/offline'; +// List of providers (without handlers). +export const ADDON_MOD_FEEDBACK_PROVIDERS: any[] = [ + AddonModFeedbackProvider, + AddonModFeedbackHelperProvider, + AddonModFeedbackSyncProvider, + AddonModFeedbackOfflineProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModFeedbackComponentsModule ], - providers: [ - AddonModFeedbackProvider, + providers: ADDON_MOD_FEEDBACK_PROVIDERS.concat([ AddonModFeedbackModuleHandler, AddonModFeedbackPrefetchHandler, - AddonModFeedbackHelperProvider, AddonModFeedbackLinkHandler, AddonModFeedbackAnalysisLinkHandler, AddonModFeedbackShowEntriesLinkHandler, AddonModFeedbackShowNonRespondentsLinkHandler, AddonModFeedbackCompleteLinkHandler, AddonModFeedbackPrintLinkHandler, - AddonModFeedbackSyncCronHandler, - AddonModFeedbackSyncProvider, - AddonModFeedbackOfflineProvider - ] + AddonModFeedbackSyncCronHandler + ]) }) export class AddonModFeedbackModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModFeedbackModuleHandler, diff --git a/src/addon/mod/folder/folder.module.ts b/src/addon/mod/folder/folder.module.ts index 5cb35a2b5..defbc4ad4 100644 --- a/src/addon/mod/folder/folder.module.ts +++ b/src/addon/mod/folder/folder.module.ts @@ -25,20 +25,24 @@ import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate' import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; import { CorePluginFileDelegate } from '@providers/plugin-file-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_FOLDER_PROVIDERS: any[] = [ + AddonModFolderProvider, + AddonModFolderHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModFolderComponentsModule ], - providers: [ - AddonModFolderProvider, - AddonModFolderHelperProvider, + providers: ADDON_MOD_FOLDER_PROVIDERS.concat([ AddonModFolderModuleHandler, AddonModFolderPrefetchHandler, AddonModFolderLinkHandler, AddonModFolderPluginFileHandler - ] + ]) }) export class AddonModFolderModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModFolderModuleHandler, diff --git a/src/addon/mod/forum/forum.module.ts b/src/addon/mod/forum/forum.module.ts index 8c4717f54..67b9915dc 100644 --- a/src/addon/mod/forum/forum.module.ts +++ b/src/addon/mod/forum/forum.module.ts @@ -28,23 +28,27 @@ import { AddonModForumIndexLinkHandler } from './providers/index-link-handler'; import { AddonModForumDiscussionLinkHandler } from './providers/discussion-link-handler'; import { AddonModForumComponentsModule } from './components/components.module'; +// List of providers (without handlers). +export const ADDON_MOD_FORUM_PROVIDERS: any[] = [ + AddonModForumProvider, + AddonModForumOfflineProvider, + AddonModForumHelperProvider, + AddonModForumSyncProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModForumComponentsModule, ], - providers: [ - AddonModForumProvider, - AddonModForumOfflineProvider, - AddonModForumHelperProvider, - AddonModForumSyncProvider, + providers: ADDON_MOD_FORUM_PROVIDERS.concat([ AddonModForumModuleHandler, AddonModForumPrefetchHandler, AddonModForumSyncCronHandler, AddonModForumIndexLinkHandler, - AddonModForumDiscussionLinkHandler, - ] + AddonModForumDiscussionLinkHandler + ]) }) export class AddonModForumModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModForumModuleHandler, diff --git a/src/addon/mod/glossary/glossary.module.ts b/src/addon/mod/glossary/glossary.module.ts index 424f72bdb..7f606f5d4 100644 --- a/src/addon/mod/glossary/glossary.module.ts +++ b/src/addon/mod/glossary/glossary.module.ts @@ -28,23 +28,27 @@ import { AddonModGlossaryIndexLinkHandler } from './providers/index-link-handler import { AddonModGlossaryEntryLinkHandler } from './providers/entry-link-handler'; import { AddonModGlossaryComponentsModule } from './components/components.module'; +// List of providers (without handlers). +export const ADDON_MOD_GLOSSARY_PROVIDERS: any[] = [ + AddonModGlossaryProvider, + AddonModGlossaryOfflineProvider, + AddonModGlossaryHelperProvider, + AddonModGlossarySyncProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModGlossaryComponentsModule, ], - providers: [ - AddonModGlossaryProvider, - AddonModGlossaryOfflineProvider, - AddonModGlossaryHelperProvider, - AddonModGlossarySyncProvider, + providers: ADDON_MOD_GLOSSARY_PROVIDERS.concat([ AddonModGlossaryModuleHandler, AddonModGlossaryPrefetchHandler, AddonModGlossarySyncCronHandler, AddonModGlossaryIndexLinkHandler, AddonModGlossaryEntryLinkHandler, - ] + ]) }) export class AddonModGlossaryModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModGlossaryModuleHandler, diff --git a/src/addon/mod/imscp/imscp.module.ts b/src/addon/mod/imscp/imscp.module.ts index 577312484..2f5df6c07 100644 --- a/src/addon/mod/imscp/imscp.module.ts +++ b/src/addon/mod/imscp/imscp.module.ts @@ -24,19 +24,23 @@ import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; import { CorePluginFileDelegate } from '@providers/plugin-file-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_IMSCP_PROVIDERS: any[] = [ + AddonModImscpProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModImscpComponentsModule ], - providers: [ - AddonModImscpProvider, + providers: ADDON_MOD_IMSCP_PROVIDERS.concat([ AddonModImscpModuleHandler, AddonModImscpPrefetchHandler, AddonModImscpLinkHandler, AddonModImscpPluginFileHandler - ] + ]) }) export class AddonModImscpModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModImscpModuleHandler, diff --git a/src/addon/mod/lesson/lesson.module.ts b/src/addon/mod/lesson/lesson.module.ts index 7399c86a2..42a83b2d0 100644 --- a/src/addon/mod/lesson/lesson.module.ts +++ b/src/addon/mod/lesson/lesson.module.ts @@ -29,24 +29,28 @@ import { AddonModLessonIndexLinkHandler } from './providers/index-link-handler'; import { AddonModLessonGradeLinkHandler } from './providers/grade-link-handler'; import { AddonModLessonReportLinkHandler } from './providers/report-link-handler'; +// List of providers (without handlers). +export const ADDON_MOD_LESSON_PROVIDERS: any[] = [ + AddonModLessonProvider, + AddonModLessonOfflineProvider, + AddonModLessonSyncProvider, + AddonModLessonHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModLessonComponentsModule ], - providers: [ - AddonModLessonProvider, - AddonModLessonOfflineProvider, - AddonModLessonSyncProvider, - AddonModLessonHelperProvider, + providers: ADDON_MOD_LESSON_PROVIDERS.concat([ AddonModLessonModuleHandler, AddonModLessonPrefetchHandler, AddonModLessonSyncCronHandler, AddonModLessonIndexLinkHandler, AddonModLessonGradeLinkHandler, AddonModLessonReportLinkHandler - ] + ]) }) export class AddonModLessonModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModLessonModuleHandler, diff --git a/src/addon/mod/lti/lti.module.ts b/src/addon/mod/lti/lti.module.ts index 557775b5c..bf20a9a38 100644 --- a/src/addon/mod/lti/lti.module.ts +++ b/src/addon/mod/lti/lti.module.ts @@ -20,17 +20,21 @@ import { AddonModLtiLinkHandler } from './providers/link-handler'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_LTI_PROVIDERS: any[] = [ + AddonModLtiProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModLtiComponentsModule ], - providers: [ - AddonModLtiProvider, + providers: ADDON_MOD_LTI_PROVIDERS.concat([ AddonModLtiModuleHandler, - AddonModLtiLinkHandler, - ] + AddonModLtiLinkHandler + ]) }) export class AddonModLtiModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModLtiModuleHandler, diff --git a/src/addon/mod/page/page.module.ts b/src/addon/mod/page/page.module.ts index a009e6531..5fcc6c41a 100644 --- a/src/addon/mod/page/page.module.ts +++ b/src/addon/mod/page/page.module.ts @@ -25,20 +25,24 @@ import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; import { CorePluginFileDelegate } from '@providers/plugin-file-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_PAGE_PROVIDERS: any[] = [ + AddonModPageProvider, + AddonModPageHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModPageComponentsModule ], - providers: [ - AddonModPageProvider, + providers: ADDON_MOD_PAGE_PROVIDERS.concat([ AddonModPageModuleHandler, - AddonModPageHelperProvider, AddonModPagePrefetchHandler, AddonModPageLinkHandler, AddonModPagePluginFileHandler - ] + ]) }) export class AddonModPageModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModPageModuleHandler, diff --git a/src/addon/mod/quiz/quiz.module.ts b/src/addon/mod/quiz/quiz.module.ts index 4c0126ed6..0f5e2e8bc 100644 --- a/src/addon/mod/quiz/quiz.module.ts +++ b/src/addon/mod/quiz/quiz.module.ts @@ -41,6 +41,15 @@ import { AddonModQuizAccessSafeBrowserModule } from './accessrules/safebrowser/s import { AddonModQuizAccessSecureWindowModule } from './accessrules/securewindow/securewindow.module'; import { AddonModQuizAccessTimeLimitModule } from './accessrules/timelimit/timelimit.module'; +// List of providers (without handlers). +export const ADDON_MOD_QUIZ_PROVIDERS: any[] = [ + AddonModQuizAccessRuleDelegate, + AddonModQuizProvider, + AddonModQuizOfflineProvider, + AddonModQuizHelperProvider, + AddonModQuizSyncProvider +]; + @NgModule({ declarations: [ ], @@ -56,19 +65,14 @@ import { AddonModQuizAccessTimeLimitModule } from './accessrules/timelimit/timel AddonModQuizAccessSecureWindowModule, AddonModQuizAccessTimeLimitModule ], - providers: [ - AddonModQuizAccessRuleDelegate, - AddonModQuizProvider, - AddonModQuizOfflineProvider, - AddonModQuizHelperProvider, - AddonModQuizSyncProvider, + providers: ADDON_MOD_QUIZ_PROVIDERS.concat([ AddonModQuizModuleHandler, AddonModQuizPrefetchHandler, AddonModQuizSyncCronHandler, AddonModQuizIndexLinkHandler, AddonModQuizGradeLinkHandler, AddonModQuizReviewLinkHandler - ] + ]) }) export class AddonModQuizModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModQuizModuleHandler, diff --git a/src/addon/mod/resource/resource.module.ts b/src/addon/mod/resource/resource.module.ts index 5b738513e..b40c21000 100644 --- a/src/addon/mod/resource/resource.module.ts +++ b/src/addon/mod/resource/resource.module.ts @@ -25,20 +25,24 @@ import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; import { CorePluginFileDelegate } from '@providers/plugin-file-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_RESOURCE_PROVIDERS: any[] = [ + AddonModResourceProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModResourceComponentsModule ], - providers: [ - AddonModResourceProvider, + providers: ADDON_MOD_RESOURCE_PROVIDERS.concat([ AddonModResourceModuleHandler, AddonModResourceHelperProvider, AddonModResourcePrefetchHandler, AddonModResourceLinkHandler, AddonModResourcePluginFileHandler - ] + ]) }) export class AddonModResourceModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModResourceModuleHandler, diff --git a/src/addon/mod/scorm/scorm.module.ts b/src/addon/mod/scorm/scorm.module.ts index ea48f5699..11c0c6e12 100644 --- a/src/addon/mod/scorm/scorm.module.ts +++ b/src/addon/mod/scorm/scorm.module.ts @@ -28,23 +28,27 @@ import { AddonModScormGradeLinkHandler } from './providers/grade-link-handler'; import { AddonModScormSyncProvider } from './providers/scorm-sync'; import { AddonModScormComponentsModule } from './components/components.module'; +// List of providers (without handlers). +export const ADDON_MOD_SCORM_PROVIDERS: any[] = [ + AddonModScormProvider, + AddonModScormOfflineProvider, + AddonModScormHelperProvider, + AddonModScormSyncProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModScormComponentsModule ], - providers: [ - AddonModScormProvider, - AddonModScormOfflineProvider, - AddonModScormHelperProvider, - AddonModScormSyncProvider, + providers: ADDON_MOD_SCORM_PROVIDERS.concat([ AddonModScormModuleHandler, AddonModScormPrefetchHandler, AddonModScormSyncCronHandler, AddonModScormIndexLinkHandler, AddonModScormGradeLinkHandler - ] + ]) }) export class AddonModScormModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModScormModuleHandler, diff --git a/src/addon/mod/survey/survey.module.ts b/src/addon/mod/survey/survey.module.ts index beaea6d43..69b7a52bc 100644 --- a/src/addon/mod/survey/survey.module.ts +++ b/src/addon/mod/survey/survey.module.ts @@ -27,22 +27,26 @@ import { AddonModSurveySyncProvider } from './providers/sync'; import { AddonModSurveySyncCronHandler } from './providers/sync-cron-handler'; import { AddonModSurveyOfflineProvider } from './providers/offline'; +// List of providers (without handlers). +export const ADDON_MOD_SURVEY_PROVIDERS: any[] = [ + AddonModSurveyProvider, + AddonModSurveyHelperProvider, + AddonModSurveySyncProvider, + AddonModSurveyOfflineProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModSurveyComponentsModule ], - providers: [ - AddonModSurveyProvider, + providers: ADDON_MOD_SURVEY_PROVIDERS.concat([ AddonModSurveyModuleHandler, AddonModSurveyPrefetchHandler, - AddonModSurveyHelperProvider, AddonModSurveyLinkHandler, - AddonModSurveySyncCronHandler, - AddonModSurveySyncProvider, - AddonModSurveyOfflineProvider - ] + AddonModSurveySyncCronHandler + ]) }) export class AddonModSurveyModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModSurveyModuleHandler, diff --git a/src/addon/mod/url/url.module.ts b/src/addon/mod/url/url.module.ts index 3bdbc5912..c1115c578 100644 --- a/src/addon/mod/url/url.module.ts +++ b/src/addon/mod/url/url.module.ts @@ -21,18 +21,22 @@ import { AddonModUrlHelperProvider } from './providers/helper'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; +// List of providers (without handlers). +export const ADDON_MOD_URL_PROVIDERS: any[] = [ + AddonModUrlProvider, + AddonModUrlHelperProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModUrlComponentsModule ], - providers: [ - AddonModUrlProvider, + providers: ADDON_MOD_URL_PROVIDERS.concat([ AddonModUrlModuleHandler, - AddonModUrlHelperProvider, AddonModUrlLinkHandler - ] + ]) }) export class AddonModUrlModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModUrlModuleHandler, diff --git a/src/addon/mod/wiki/wiki.module.ts b/src/addon/mod/wiki/wiki.module.ts index a85ced279..8c9b4a2f1 100644 --- a/src/addon/mod/wiki/wiki.module.ts +++ b/src/addon/mod/wiki/wiki.module.ts @@ -29,16 +29,20 @@ import { AddonModWikiPageOrMapLinkHandler } from './providers/page-or-map-link-h import { AddonModWikiCreateLinkHandler } from './providers/create-link-handler'; import { AddonModWikiEditLinkHandler } from './providers/edit-link-handler'; +// List of providers (without handlers). +export const ADDON_MOD_WIKI_PROVIDERS: any[] = [ + AddonModWikiProvider, + AddonModWikiOfflineProvider, + AddonModWikiSyncProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonModWikiComponentsModule ], - providers: [ - AddonModWikiProvider, - AddonModWikiOfflineProvider, - AddonModWikiSyncProvider, + providers: ADDON_MOD_WIKI_PROVIDERS.concat([ AddonModWikiModuleHandler, AddonModWikiPrefetchHandler, AddonModWikiSyncCronHandler, @@ -46,7 +50,7 @@ import { AddonModWikiEditLinkHandler } from './providers/edit-link-handler'; AddonModWikiPageOrMapLinkHandler, AddonModWikiCreateLinkHandler, AddonModWikiEditLinkHandler - ] + ]) }) export class AddonModWikiModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModWikiModuleHandler, diff --git a/src/addon/notes/notes.module.ts b/src/addon/notes/notes.module.ts index 7dd83dc35..bcd775301 100644 --- a/src/addon/notes/notes.module.ts +++ b/src/addon/notes/notes.module.ts @@ -24,20 +24,24 @@ import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delega import { CoreCronDelegate } from '@providers/cron'; import { CoreUserDelegate } from '@core/user/providers/user-delegate'; +// List of providers (without handlers). +export const ADDON_NOTES_PROVIDERS: any[] = [ + AddonNotesProvider, + AddonNotesOfflineProvider, + AddonNotesSyncProvider +]; + @NgModule({ declarations: [ ], imports: [ AddonNotesComponentsModule ], - providers: [ - AddonNotesProvider, - AddonNotesOfflineProvider, - AddonNotesSyncProvider, + providers: ADDON_NOTES_PROVIDERS.concat([ AddonNotesCourseOptionHandler, AddonNotesSyncCronHandler, AddonNotesUserHandler - ] + ]) }) export class AddonNotesModule { constructor(courseOptionsDelegate: CoreCourseOptionsDelegate, courseOptionHandler: AddonNotesCourseOptionHandler, diff --git a/src/addon/notifications/notifications.module.ts b/src/addon/notifications/notifications.module.ts index 9591fef71..e194cc0f0 100644 --- a/src/addon/notifications/notifications.module.ts +++ b/src/addon/notifications/notifications.module.ts @@ -27,17 +27,21 @@ import { CoreSitesProvider } from '@providers/sites'; import { CoreUtilsProvider } from '@providers/utils/utils'; import { AddonPushNotificationsDelegate } from '@addon/pushnotifications/providers/delegate'; +// List of providers (without handlers). +export const ADDON_NOTIFICATIONS_PROVIDERS: any[] = [ + AddonNotificationsProvider +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonNotificationsProvider, + providers: ADDON_NOTIFICATIONS_PROVIDERS.concat([ AddonNotificationsMainMenuHandler, AddonNotificationsSettingsHandler, AddonNotificationsCronHandler, - ] + ]) }) export class AddonNotificationsModule { constructor(mainMenuDelegate: CoreMainMenuDelegate, mainMenuHandler: AddonNotificationsMainMenuHandler, diff --git a/src/addon/pushnotifications/pushnotifications.module.ts b/src/addon/pushnotifications/pushnotifications.module.ts index 56dfd1abb..6c94bec97 100644 --- a/src/addon/pushnotifications/pushnotifications.module.ts +++ b/src/addon/pushnotifications/pushnotifications.module.ts @@ -20,15 +20,18 @@ import { CoreEventsProvider } from '@providers/events'; import { CoreLoggerProvider } from '@providers/logger'; import { CoreLocalNotificationsProvider } from '@providers/local-notifications'; +// List of providers (without handlers). +export const ADDON_PUSHNOTIFICATIONS_PROVIDERS: any[] = [ + AddonPushNotificationsProvider, + AddonPushNotificationsDelegate +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonPushNotificationsProvider, - AddonPushNotificationsDelegate - ] + providers: ADDON_PUSHNOTIFICATIONS_PROVIDERS }) export class AddonPushNotificationsModule { constructor(platform: Platform, pushNotificationsProvider: AddonPushNotificationsProvider, eventsProvider: CoreEventsProvider, diff --git a/src/addon/remotethemes/remotethemes.module.ts b/src/addon/remotethemes/remotethemes.module.ts index 8b7b179ba..fdb21dfc3 100644 --- a/src/addon/remotethemes/remotethemes.module.ts +++ b/src/addon/remotethemes/remotethemes.module.ts @@ -19,14 +19,17 @@ import { CoreInitDelegate } from '@providers/init'; import { CoreLoggerProvider } from '@providers/logger'; import { CoreSitesProvider } from '@providers/sites'; +// List of providers (without handlers). +export const ADDON_REMOTETHEMES_PROVIDERS: any[] = [ + AddonRemoteThemesProvider +]; + @NgModule({ declarations: [ ], imports: [ ], - providers: [ - AddonRemoteThemesProvider - ] + providers: ADDON_REMOTETHEMES_PROVIDERS }) export class AddonRemoteThemesModule { constructor(initDelegate: CoreInitDelegate, remoteThemesProvider: AddonRemoteThemesProvider, eventsProvider: CoreEventsProvider, diff --git a/src/core/compile/providers/compile.ts b/src/core/compile/providers/compile.ts index 411b62fee..5daa6e4b9 100644 --- a/src/core/compile/providers/compile.ts +++ b/src/core/compile/providers/compile.ts @@ -57,7 +57,7 @@ import { CoreContentLinksModuleGradeHandler } from '@core/contentlinks/classes/m import { CoreContentLinksModuleIndexHandler } from '@core/contentlinks/classes/module-index-handler'; import { CoreCourseModulePrefetchHandlerBase } from '@core/course/classes/module-prefetch-handler'; -// Import all modules that define components, directives and pipes. +// Import all core modules that define components, directives and pipes. import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { CorePipesModule } from '@pipes/pipes.module'; @@ -82,6 +82,42 @@ import { CoreSitePluginsQuizAccessRuleComponent } from '@core/siteplugins/compon import { CoreSitePluginsAssignFeedbackComponent } from '@core/siteplugins/components/assign-feedback/assign-feedback'; import { CoreSitePluginsAssignSubmissionComponent } from '@core/siteplugins/components/assign-submission/assign-submission'; +// Import addon providers. Do not import database module because it causes circular dependencies. @todo workshop +import { ADDON_BADGES_PROVIDERS } from '@addon/badges/badges.module'; +import { ADDON_CALENDAR_PROVIDERS } from '@addon/calendar/calendar.module'; +import { ADDON_COMPETENCY_PROVIDERS } from '@addon/competency/competency.module'; +import { ADDON_FILES_PROVIDERS } from '@addon/files/files.module'; +import { ADDON_MESSAGEOUTPUT_PROVIDERS } from '@addon/messageoutput/messageoutput.module'; +import { ADDON_MESSAGES_PROVIDERS } from '@addon/messages/messages.module'; +import { ADDON_MOD_ASSIGN_PROVIDERS } from '@addon/mod/assign/assign.module'; +import { ADDON_MOD_BOOK_PROVIDERS } from '@addon/mod/book/book.module'; +import { ADDON_MOD_CHAT_PROVIDERS } from '@addon/mod/chat/chat.module'; +import { ADDON_MOD_CHOICE_PROVIDERS } from '@addon/mod/choice/choice.module'; +import { ADDON_MOD_FEEDBACK_PROVIDERS } from '@addon/mod/feedback/feedback.module'; +import { ADDON_MOD_FOLDER_PROVIDERS } from '@addon/mod/folder/folder.module'; +import { ADDON_MOD_FORUM_PROVIDERS } from '@addon/mod/forum/forum.module'; +import { ADDON_MOD_GLOSSARY_PROVIDERS } from '@addon/mod/glossary/glossary.module'; +import { ADDON_MOD_IMSCP_PROVIDERS } from '@addon/mod/imscp/imscp.module'; +import { ADDON_MOD_LESSON_PROVIDERS } from '@addon/mod/lesson/lesson.module'; +import { ADDON_MOD_LTI_PROVIDERS } from '@addon/mod/lti/lti.module'; +import { ADDON_MOD_PAGE_PROVIDERS } from '@addon/mod/page/page.module'; +import { ADDON_MOD_QUIZ_PROVIDERS } from '@addon/mod/quiz/quiz.module'; +import { ADDON_MOD_RESOURCE_PROVIDERS } from '@addon/mod/resource/resource.module'; +import { ADDON_MOD_SCORM_PROVIDERS } from '@addon/mod/scorm/scorm.module'; +import { ADDON_MOD_SURVEY_PROVIDERS } from '@addon/mod/survey/survey.module'; +import { ADDON_MOD_URL_PROVIDERS } from '@addon/mod/url/url.module'; +import { ADDON_MOD_WIKI_PROVIDERS } from '@addon/mod/wiki/wiki.module'; +import { ADDON_NOTES_PROVIDERS } from '@addon/notes/notes.module'; +import { ADDON_NOTIFICATIONS_PROVIDERS } from '@addon/notifications/notifications.module'; +import { ADDON_PUSHNOTIFICATIONS_PROVIDERS } from '@addon/pushnotifications/pushnotifications.module'; +import { ADDON_REMOTETHEMES_PROVIDERS } from '@addon/remotethemes/remotethemes.module'; + +// Import some addon modules that define components, directives and pipes. Only import the important ones. +import { AddonMessagesComponentsModule } from '@addon/messages/components/components.module'; +import { AddonModAssignComponentsModule } from '@addon/mod/assign/components/components.module'; +import { AddonModForumComponentsModule } from '@addon/mod/forum/components/components.module'; +import { AddonNotificationsComponentsModule } from '@addon/notifications/components/components.module'; + /** * Service to provide functionalities regarding compiling dynamic HTML and Javascript. */ @@ -100,7 +136,9 @@ export class CoreCompileProvider { protected IMPORTS = [ IonicModule, TranslateModule.forChild(), CoreComponentsModule, CoreDirectivesModule, CorePipesModule, CoreCourseComponentsModule, CoreCoursesComponentsModule, CoreSiteHomeComponentsModule, CoreUserComponentsModule, - CoreCourseDirectivesModule, CoreSitePluginsDirectivesModule, CoreQuestionComponentsModule + CoreCourseDirectivesModule, CoreSitePluginsDirectivesModule, CoreQuestionComponentsModule, AddonMessagesComponentsModule, + AddonModAssignComponentsModule, AddonModForumComponentsModule, + AddonNotificationsComponentsModule ]; constructor(protected injector: Injector, logger: CoreLoggerProvider, protected compiler: Compiler) { @@ -176,7 +214,17 @@ export class CoreCompileProvider { .concat(CORE_COURSES_PROVIDERS).concat(CORE_FILEUPLOADER_PROVIDERS).concat(CORE_GRADES_PROVIDERS) .concat(CORE_LOGIN_PROVIDERS).concat(CORE_MAINMENU_PROVIDERS).concat(CORE_SHAREDFILES_PROVIDERS) .concat(CORE_SITEHOME_PROVIDERS).concat([CoreSitePluginsProvider]).concat(CORE_USER_PROVIDERS) - .concat(CORE_QUESTION_PROVIDERS).concat(IONIC_NATIVE_PROVIDERS).concat(this.OTHER_PROVIDERS).concat(extraProviders); + .concat(CORE_QUESTION_PROVIDERS).concat(IONIC_NATIVE_PROVIDERS).concat(this.OTHER_PROVIDERS).concat(extraProviders) + .concat(ADDON_BADGES_PROVIDERS).concat(ADDON_CALENDAR_PROVIDERS).concat(ADDON_COMPETENCY_PROVIDERS) + .concat(ADDON_FILES_PROVIDERS).concat(ADDON_MESSAGEOUTPUT_PROVIDERS).concat(ADDON_MESSAGES_PROVIDERS) + .concat(ADDON_MOD_ASSIGN_PROVIDERS).concat(ADDON_MOD_BOOK_PROVIDERS).concat(ADDON_MOD_CHAT_PROVIDERS) + .concat(ADDON_MOD_CHOICE_PROVIDERS).concat(ADDON_MOD_FEEDBACK_PROVIDERS).concat(ADDON_MOD_FOLDER_PROVIDERS) + .concat(ADDON_MOD_FORUM_PROVIDERS).concat(ADDON_MOD_GLOSSARY_PROVIDERS).concat(ADDON_MOD_IMSCP_PROVIDERS) + .concat(ADDON_MOD_LESSON_PROVIDERS).concat(ADDON_MOD_LTI_PROVIDERS).concat(ADDON_MOD_PAGE_PROVIDERS) + .concat(ADDON_MOD_QUIZ_PROVIDERS).concat(ADDON_MOD_RESOURCE_PROVIDERS).concat(ADDON_MOD_SCORM_PROVIDERS) + .concat(ADDON_MOD_SURVEY_PROVIDERS).concat(ADDON_MOD_URL_PROVIDERS).concat(ADDON_MOD_WIKI_PROVIDERS) + .concat(ADDON_NOTES_PROVIDERS).concat(ADDON_NOTIFICATIONS_PROVIDERS) + .concat(ADDON_PUSHNOTIFICATIONS_PROVIDERS).concat(ADDON_REMOTETHEMES_PROVIDERS); // We cannot inject anything to this constructor. Use the Injector to inject all the providers into the instance. for (const i in providers) {