MOBILE-3664 compile: Implement compile

main
Dani Palou 2021-03-01 16:12:38 +01:00
parent fd314eb4d8
commit 9cc7c73b31
43 changed files with 1200 additions and 50 deletions

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { AddonBadgesMyBadgesLinkHandler } from './services/handlers/mybadges-link'; import { AddonBadgesMyBadgesLinkHandler } from './services/handlers/mybadges-link';
@ -23,6 +23,11 @@ import { AddonBadgesUserHandler } from './services/handlers/user';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
import { AddonBadgesPushClickHandler } from './services/handlers/push-click'; import { AddonBadgesPushClickHandler } from './services/handlers/push-click';
import { AddonBadgesProvider } from './services/badges';
export const ADDON_BADGES_SERVICES: Type<unknown>[] = [
AddonBadgesProvider,
];
const mainMenuRoutes: Routes = [ const mainMenuRoutes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
@ -27,8 +27,18 @@ import { CORE_SITE_SCHEMAS } from '@services/sites';
import { CALENDAR_SITE_SCHEMA } from './services/database/calendar'; import { CALENDAR_SITE_SCHEMA } from './services/database/calendar';
import { CALENDAR_OFFLINE_SITE_SCHEMA } from './services/database/calendar-offline'; import { CALENDAR_OFFLINE_SITE_SCHEMA } from './services/database/calendar-offline';
import { AddonCalendarComponentsModule } from './components/components.module'; import { AddonCalendarComponentsModule } from './components/components.module';
import { AddonCalendar } from './services/calendar'; import { AddonCalendar, AddonCalendarProvider } from './services/calendar';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { AddonCalendarOfflineProvider } from './services/calendar-offline';
import { AddonCalendarHelperProvider } from './services/calendar-helper';
import { AddonCalendarSyncProvider } from './services/calendar-sync';
export const ADDON_CALENDAR_SERVICES: Type<unknown>[] = [
AddonCalendarProvider,
AddonCalendarOfflineProvider,
AddonCalendarHelperProvider,
AddonCalendarSyncProvider,
];
const mainMenuChildrenRoutes: Routes = [ const mainMenuChildrenRoutes: Routes = [
{ {

View File

@ -12,9 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { NgModule } from '@angular/core'; import { NgModule, Type } from '@angular/core';
import { AddonMessageOutputAirnotifierModule } from './airnotifier/airnotifier.module'; import { AddonMessageOutputAirnotifierModule } from './airnotifier/airnotifier.module';
import { AddonMessageOutputDelegateService } from './services/messageoutput-delegate';
export const ADDON_MESSAGEOUTPUT_SERVICES: Type<unknown>[] = [
AddonMessageOutputDelegateService,
];
@NgModule({ @NgModule({
declarations: [ declarations: [

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
@ -33,9 +33,17 @@ import { AddonMessagesPushClickHandler } from './services/handlers/push-click';
import { CoreUserDelegate } from '@features/user/services/user-delegate'; import { CoreUserDelegate } from '@features/user/services/user-delegate';
import { AddonMessagesSendMessageUserHandler } from './services/handlers/user-send-message'; import { AddonMessagesSendMessageUserHandler } from './services/handlers/user-send-message';
import { Network, NgZone } from '@singletons'; import { Network, NgZone } from '@singletons';
import { AddonMessagesSync } from './services/messages-sync'; import { AddonMessagesSync, AddonMessagesSyncProvider } from './services/messages-sync';
import { AddonMessagesSyncCronHandler } from './services/handlers/sync-cron'; import { AddonMessagesSyncCronHandler } from './services/handlers/sync-cron';
import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing';
import { AddonMessagesProvider } from './services/messages';
import { AddonMessagesOfflineProvider } from './services/messages-offline';
export const ADDON_MESSAGES_SERVICES: Type<unknown>[] = [
AddonMessagesProvider,
AddonMessagesOfflineProvider,
AddonMessagesSyncProvider,
];
const mainMenuChildrenRoutes: Routes = [ const mainMenuChildrenRoutes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -23,15 +23,30 @@ import { CoreCronDelegate } from '@services/cron';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { AddonModAssignComponentsModule } from './components/components.module'; import { AddonModAssignComponentsModule } from './components/components.module';
import { AddonModAssignFeedbackModule } from './feedback/feedback.module'; import { AddonModAssignFeedbackModule } from './feedback/feedback.module';
import { AddonModAssignProvider } from './services/assign';
import { AddonModAssignHelperProvider } from './services/assign-helper';
import { AddonModAssignOfflineProvider } from './services/assign-offline';
import { AddonModAssignSyncProvider } from './services/assign-sync';
import { OFFLINE_SITE_SCHEMA } from './services/database/assign'; import { OFFLINE_SITE_SCHEMA } from './services/database/assign';
import { AddonModAssignFeedbackDelegateService } from './services/feedback-delegate';
import { AddonModAssignIndexLinkHandler } from './services/handlers/index-link'; import { AddonModAssignIndexLinkHandler } from './services/handlers/index-link';
import { AddonModAssignListLinkHandler } from './services/handlers/list-link'; import { AddonModAssignListLinkHandler } from './services/handlers/list-link';
import { AddonModAssignModuleHandler, AddonModAssignModuleHandlerService } from './services/handlers/module'; import { AddonModAssignModuleHandler, AddonModAssignModuleHandlerService } from './services/handlers/module';
import { AddonModAssignPrefetchHandler } from './services/handlers/prefetch'; import { AddonModAssignPrefetchHandler } from './services/handlers/prefetch';
import { AddonModAssignPushClickHandler } from './services/handlers/push-click'; import { AddonModAssignPushClickHandler } from './services/handlers/push-click';
import { AddonModAssignSyncCronHandler } from './services/handlers/sync-cron'; import { AddonModAssignSyncCronHandler } from './services/handlers/sync-cron';
import { AddonModAssignSubmissionDelegateService } from './services/submission-delegate';
import { AddonModAssignSubmissionModule } from './submission/submission.module'; import { AddonModAssignSubmissionModule } from './submission/submission.module';
export const ADDON_MOD_ASSIGN_SERVICES: Type<unknown>[] = [
AddonModAssignProvider,
AddonModAssignOfflineProvider,
AddonModAssignSyncProvider,
AddonModAssignHelperProvider,
AddonModAssignFeedbackDelegateService,
AddonModAssignSubmissionDelegateService,
];
const routes: Routes = [ const routes: Routes = [
{ {
path: AddonModAssignModuleHandlerService.PAGE_NAME, path: AddonModAssignModuleHandlerService.PAGE_NAME,

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -25,6 +25,11 @@ import { AddonModBookIndexLinkHandler } from './services/handlers/index-link';
import { AddonModBookListLinkHandler } from './services/handlers/list-link'; import { AddonModBookListLinkHandler } from './services/handlers/list-link';
import { AddonModBookPrefetchHandler } from './services/handlers/prefetch'; import { AddonModBookPrefetchHandler } from './services/handlers/prefetch';
import { AddonModBookTagAreaHandler } from './services/handlers/tag-area'; import { AddonModBookTagAreaHandler } from './services/handlers/tag-area';
import { AddonModBookProvider } from './services/book';
export const ADDON_MOD_BOOK_SERVICES: Type<unknown>[] = [
AddonModBookProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -20,12 +20,19 @@ import { CoreCourseModulePrefetchDelegate } from '@features/course/services/modu
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CorePluginFileDelegate } from '@services/plugin-file-delegate'; import { CorePluginFileDelegate } from '@services/plugin-file-delegate';
import { AddonModFolderComponentsModule } from './components/components.module'; import { AddonModFolderComponentsModule } from './components/components.module';
import { AddonModFolderProvider } from './services/folder';
import { AddonModFolderHelperProvider } from './services/folder-helper';
import { AddonModFolderIndexLinkHandler } from './services/handlers/index-link'; import { AddonModFolderIndexLinkHandler } from './services/handlers/index-link';
import { AddonModFolderListLinkHandler } from './services/handlers/list-link'; import { AddonModFolderListLinkHandler } from './services/handlers/list-link';
import { AddonModFolderModuleHandler, AddonModFolderModuleHandlerService } from './services/handlers/module'; import { AddonModFolderModuleHandler, AddonModFolderModuleHandlerService } from './services/handlers/module';
import { AddonModFolderPluginFileHandler } from './services/handlers/pluginfile'; import { AddonModFolderPluginFileHandler } from './services/handlers/pluginfile';
import { AddonModFolderPrefetchHandler } from './services/handlers/prefetch'; import { AddonModFolderPrefetchHandler } from './services/handlers/prefetch';
export const ADDON_MOD_FOLDER_SERVICES: Type<unknown>[] = [
AddonModFolderProvider,
AddonModFolderHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {
path: AddonModFolderModuleHandlerService.PAGE_NAME, path: AddonModFolderModuleHandlerService.PAGE_NAME,

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { conditionalRoutes } from '@/app/app-routing.module'; import { conditionalRoutes } from '@/app/app-routing.module';
@ -38,6 +38,17 @@ import { CoreTagAreaDelegate } from '@features/tag/services/tag-area-delegate';
import { AddonModForumTagAreaHandler } from './services/handlers/tag-area'; import { AddonModForumTagAreaHandler } from './services/handlers/tag-area';
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
import { AddonModForumPushClickHandler } from './services/handlers/push-click'; import { AddonModForumPushClickHandler } from './services/handlers/push-click';
import { AddonModForumProvider } from './services/forum';
import { AddonModForumOfflineProvider } from './services/offline';
import { AddonModForumHelperProvider } from './services/helper';
import { AddonModForumSyncProvider } from './services/sync';
export const ADDON_MOD_FORUM_SERVICES: Type<unknown>[] = [
AddonModForumProvider,
AddonModForumOfflineProvider,
AddonModForumHelperProvider,
AddonModForumSyncProvider,
];
const mainMenuRoutes: Routes = [ const mainMenuRoutes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -25,6 +25,11 @@ import { AddonModImscpListLinkHandler } from './services/handlers/list-link';
import { AddonModImscpModuleHandler, AddonModImscpModuleHandlerService } from './services/handlers/module'; import { AddonModImscpModuleHandler, AddonModImscpModuleHandlerService } from './services/handlers/module';
import { AddonModImscpPluginFileHandler } from './services/handlers/pluginfile'; import { AddonModImscpPluginFileHandler } from './services/handlers/pluginfile';
import { AddonModImscpPrefetchHandler } from './services/handlers/prefetch'; import { AddonModImscpPrefetchHandler } from './services/handlers/prefetch';
import { AddonModImscpProvider } from './services/imscp';
export const ADDON_MOD_IMSCP_SERVICES: Type<unknown>[] = [
AddonModImscpProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -32,6 +32,17 @@ import { AddonModLessonPrefetchHandler } from './services/handlers/prefetch';
import { AddonModLessonPushClickHandler } from './services/handlers/push-click'; import { AddonModLessonPushClickHandler } from './services/handlers/push-click';
import { AddonModLessonReportLinkHandler } from './services/handlers/report-link'; import { AddonModLessonReportLinkHandler } from './services/handlers/report-link';
import { AddonModLessonSyncCronHandler } from './services/handlers/sync-cron'; import { AddonModLessonSyncCronHandler } from './services/handlers/sync-cron';
import { AddonModLessonProvider } from './services/lesson';
import { AddonModLessonHelperProvider } from './services/lesson-helper';
import { AddonModLessonOfflineProvider } from './services/lesson-offline';
import { AddonModLessonSyncProvider } from './services/lesson-sync';
export const ADDON_MOD_LESSON_SERVICES: Type<unknown>[] = [
AddonModLessonProvider,
AddonModLessonOfflineProvider,
AddonModLessonSyncProvider,
AddonModLessonHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -25,6 +25,13 @@ import { AddonModPageListLinkHandler } from './services/handlers/list-link';
import { AddonModPageModuleHandler, AddonModPageModuleHandlerService } from './services/handlers/module'; import { AddonModPageModuleHandler, AddonModPageModuleHandlerService } from './services/handlers/module';
import { AddonModPagePluginFileHandler } from './services/handlers/pluginfile'; import { AddonModPagePluginFileHandler } from './services/handlers/pluginfile';
import { AddonModPagePrefetchHandler } from './services/handlers/prefetch'; import { AddonModPagePrefetchHandler } from './services/handlers/prefetch';
import { AddonModPageProvider } from './services/page';
import { AddonModPageHelperProvider } from './services/page-helper';
export const ADDON_MOD_PAGE_SERVICES: Type<unknown>[] = [
AddonModPageProvider,
AddonModPageHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
@ -24,6 +24,7 @@ import { CoreCronDelegate } from '@services/cron';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { AddonModQuizAccessRulesModule } from './accessrules/accessrules.module'; import { AddonModQuizAccessRulesModule } from './accessrules/accessrules.module';
import { AddonModQuizComponentsModule } from './components/components.module'; import { AddonModQuizComponentsModule } from './components/components.module';
import { AddonModQuizAccessRuleDelegateService } from './services/access-rules-delegate';
import { SITE_SCHEMA } from './services/database/quiz'; import { SITE_SCHEMA } from './services/database/quiz';
import { AddonModQuizGradeLinkHandler } from './services/handlers/grade-link'; import { AddonModQuizGradeLinkHandler } from './services/handlers/grade-link';
import { AddonModQuizIndexLinkHandler } from './services/handlers/index-link'; import { AddonModQuizIndexLinkHandler } from './services/handlers/index-link';
@ -33,6 +34,18 @@ import { AddonModQuizPrefetchHandler } from './services/handlers/prefetch';
import { AddonModQuizPushClickHandler } from './services/handlers/push-click'; import { AddonModQuizPushClickHandler } from './services/handlers/push-click';
import { AddonModQuizReviewLinkHandler } from './services/handlers/review-link'; import { AddonModQuizReviewLinkHandler } from './services/handlers/review-link';
import { AddonModQuizSyncCronHandler } from './services/handlers/sync-cron'; import { AddonModQuizSyncCronHandler } from './services/handlers/sync-cron';
import { AddonModQuizProvider } from './services/quiz';
import { AddonModQuizHelperProvider } from './services/quiz-helper';
import { AddonModQuizOfflineProvider } from './services/quiz-offline';
import { AddonModQuizSyncProvider } from './services/quiz-sync';
export const ADDON_MOD_QUIZ_SERVICES: Type<unknown>[] = [
AddonModQuizAccessRuleDelegateService,
AddonModQuizProvider,
AddonModQuizOfflineProvider,
AddonModQuizHelperProvider,
AddonModQuizSyncProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -25,6 +25,11 @@ import { AddonModResourceListLinkHandler } from './services/handlers/list-link';
import { AddonModResourceModuleHandlerService, AddonModResourceModuleHandler } from './services/handlers/module'; import { AddonModResourceModuleHandlerService, AddonModResourceModuleHandler } from './services/handlers/module';
import { AddonModResourcePluginFileHandler } from './services/handlers/pluginfile'; import { AddonModResourcePluginFileHandler } from './services/handlers/pluginfile';
import { AddonModResourcePrefetchHandler } from './services/handlers/prefetch'; import { AddonModResourcePrefetchHandler } from './services/handlers/prefetch';
import { AddonModResourceProvider } from './services/resource';
export const ADDON_MOD_RESOURCE_SERVICES: Type<unknown>[] = [
AddonModResourceProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@ -23,6 +23,13 @@ import { AddonModUrlIndexLinkHandler } from './services/handlers/index-link';
import { AddonModUrlListLinkHandler } from './services/handlers/list-link'; import { AddonModUrlListLinkHandler } from './services/handlers/list-link';
import { AddonModUrlModuleHandler, AddonModUrlModuleHandlerService } from './services/handlers/module'; import { AddonModUrlModuleHandler, AddonModUrlModuleHandlerService } from './services/handlers/module';
import { AddonModUrlPrefetchHandler } from './services/handlers/prefetch'; import { AddonModUrlPrefetchHandler } from './services/handlers/prefetch';
import { AddonModUrlProvider } from './services/url';
import { AddonModUrlHelperProvider } from './services/url-helper';
export const ADDON_MOD_URL_SERVICES: Type<unknown>[] = [
AddonModUrlProvider,
AddonModUrlHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreCronDelegate } from '@services/cron'; import { CoreCronDelegate } from '@services/cron';
@ -26,6 +26,13 @@ import { AddonNotificationsCronHandler } from './services/handlers/cron';
import { AddonNotificationsPushClickHandler } from './services/handlers/push-click'; import { AddonNotificationsPushClickHandler } from './services/handlers/push-click';
import { AddonNotificationsSettingsHandler, AddonNotificationsSettingsHandlerService } from './services/handlers/settings'; import { AddonNotificationsSettingsHandler, AddonNotificationsSettingsHandlerService } from './services/handlers/settings';
import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing'; import { CoreSitePreferencesRoutingModule } from '@features/settings/pages/site/site-routing';
import { AddonNotificationsProvider } from './services/notifications';
import { AddonNotificationsHelperProvider } from './services/notifications-helper';
export const ADDON_NOTIFICATIONS_SERVICES: Type<unknown>[] = [
AddonNotificationsProvider,
AddonNotificationsHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,13 +12,20 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate'; import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate';
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
import { AddonPrivateFilesMainMenuHandler, AddonPrivateFilesMainMenuHandlerService } from './services/handlers/mainmenu'; import { AddonPrivateFilesMainMenuHandler, AddonPrivateFilesMainMenuHandlerService } from './services/handlers/mainmenu';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { AddonPrivateFilesProvider } from './services/privatefiles';
import { AddonPrivateFilesHelperProvider } from './services/privatefiles-helper';
export const ADDON_PRIVATEFILES_SERVICES: Type<unknown>[] = [
AddonPrivateFilesProvider,
AddonPrivateFilesHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { NgModule } from '@angular/core'; import { COMPILER_OPTIONS, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouteReuseStrategy } from '@angular/router'; import { RouteReuseStrategy } from '@angular/router';
@ -28,6 +28,7 @@ import { AddonsModule } from '@/addons/addons.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
// For translate loader. AoT requires an exported function for factories. // For translate loader. AoT requires an exported function for factories.
export function createTranslateLoader(http: HttpClient): TranslateHttpLoader { export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
@ -55,6 +56,8 @@ export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
], ],
providers: [ providers: [
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
{ provide: COMPILER_OPTIONS, useValue: {}, multi: true },
{ provide: JitCompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS] },
], ],
bootstrap: [AppComponent], bootstrap: [AppComponent],
}) })

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { ApplicationInitStatus, Injector, NgModule } from '@angular/core'; import { ApplicationInitStatus, Injector, NgModule, Type } from '@angular/core';
import { CoreApplicationInitStatus } from './classes/application-init-status'; import { CoreApplicationInitStatus } from './classes/application-init-status';
import { CoreFeaturesModule } from './features/features.module'; import { CoreFeaturesModule } from './features/features.module';
@ -21,6 +21,63 @@ import { CoreInterceptor } from './classes/interceptor';
import { getDatabaseProviders } from './services/database'; import { getDatabaseProviders } from './services/database';
import { getInitializerProviders } from './initializers'; import { getInitializerProviders } from './initializers';
import { CoreDbProvider } from '@services/db';
import { CoreAppProvider } from '@services/app';
import { CoreConfigProvider } from '@services/config';
import { CoreLangProvider } from '@services/lang';
import { CoreTextUtilsProvider } from '@services/utils/text';
import { CoreDomUtilsProvider } from '@services/utils/dom';
import { CoreIframeUtilsProvider } from '@services/utils/iframe';
import { CoreTimeUtilsProvider } from '@services/utils/time';
import { CoreUrlUtilsProvider } from '@services/utils/url';
import { CoreUtilsProvider } from '@services/utils/utils';
import { CoreMimetypeUtilsProvider } from '@services/utils/mimetype';
import { CoreFileProvider } from '@services/file';
import { CoreWSProvider } from '@services/ws';
import { CoreSitesProvider } from '@services/sites';
import { CoreLocalNotificationsProvider } from '@services/local-notifications';
import { CoreGroupsProvider } from '@services/groups';
import { CoreCronDelegateService } from '@services/cron';
import { CoreFileSessionProvider } from '@services/file-session';
import { CoreFilepoolProvider } from '@services/filepool';
import { CoreUpdateManagerProvider } from '@services/update-manager';
import { CorePluginFileDelegateService } from '@services/plugin-file-delegate';
import { CoreSyncProvider } from '@services/sync';
import { CoreFileHelperProvider } from '@services/file-helper';
import { CoreGeolocationProvider } from '@services/geolocation';
import { CoreNavigatorService } from '@services/navigator';
import { CoreScreenService } from '@services/screen';
export const CORE_SERVICES: Type<unknown>[] = [
CoreAppProvider,
CoreConfigProvider,
CoreCronDelegateService,
// @todo CoreCustomURLSchemesProvider,
CoreDbProvider,
CoreFileHelperProvider,
CoreFileSessionProvider,
CoreFileProvider,
CoreFilepoolProvider,
CoreGeolocationProvider,
CoreGroupsProvider,
CoreLangProvider,
CoreLocalNotificationsProvider,
CoreNavigatorService,
CorePluginFileDelegateService,
CoreScreenService,
CoreSitesProvider,
CoreSyncProvider,
CoreUpdateManagerProvider,
CoreDomUtilsProvider,
CoreIframeUtilsProvider,
CoreMimetypeUtilsProvider,
CoreTextUtilsProvider,
CoreTimeUtilsProvider,
CoreUrlUtilsProvider,
CoreUtilsProvider,
CoreWSProvider,
];
@NgModule({ @NgModule({
imports: [ imports: [
CoreFeaturesModule, CoreFeaturesModule,

View File

@ -12,13 +12,17 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { NgModule } from '@angular/core'; import { NgModule, Type } from '@angular/core';
import { CoreBlockDefaultHandler } from './services/handlers/default-block';
import { CoreBlockDelegateService } from './services/block-delegate';
import { CoreBlockHelperProvider } from './services/block-helper';
export const CORE_BLOCK_SERVICES: Type<unknown>[] = [
CoreBlockDelegateService,
CoreBlockHelperProvider,
];
@NgModule({ @NgModule({
providers: [ providers: [],
CoreBlockDefaultHandler,
],
}) })
export class CoreBlockModule { export class CoreBlockModule {}
}

View File

@ -18,7 +18,7 @@ import { CoreBlockBaseHandler } from '../../classes/base-block-handler';
/** /**
* Default handler used when a block type doesn't have a specific implementation. * Default handler used when a block type doesn't have a specific implementation.
*/ */
@Injectable() @Injectable({ providedIn: 'root' })
export class CoreBlockDefaultHandler extends CoreBlockBaseHandler { export class CoreBlockDefaultHandler extends CoreBlockBaseHandler {
name = 'CoreBlockDefault'; name = 'CoreBlockDefault';

View File

@ -12,16 +12,24 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
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 } from './services/comments'; import { CoreComments, CoreCommentsProvider } 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>[] = [
CoreCommentsOfflineProvider,
CoreCommentsSyncProvider,
CoreCommentsProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {
path: 'comments', path: 'comments',

View File

@ -0,0 +1,30 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { NgModule } from '@angular/core';
import { CoreCompileHtmlComponent } from './compile-html';
import { CoreSharedModule } from '@/core/shared.module';
@NgModule({
declarations: [
CoreCompileHtmlComponent,
],
imports: [
CoreSharedModule,
],
exports: [
CoreCompileHtmlComponent,
],
})
export class CoreCompileHtmlComponentModule {}

View File

@ -0,0 +1,291 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import {
Component,
Input,
OnInit,
OnChanges,
OnDestroy,
ViewContainerRef,
ViewChild,
ComponentRef,
SimpleChange,
ChangeDetectorRef,
ElementRef,
Output,
EventEmitter,
DoCheck,
KeyValueDiffers,
AfterContentInit,
AfterViewInit,
Type,
KeyValueDiffer,
} from '@angular/core';
import { CoreCompile } from '@features/compile/services/compile';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
/**
* This component has a behaviour similar to $compile for AngularJS. Given an HTML code, it will compile it so all its
* components and directives are instantiated.
*
* IMPORTANT: Use this component only if it is a must. It will create and compile a new component and module everytime this
* component is used, so it can slow down the app.
*
* This component has its own module to prevent circular dependencies. If you want to use it,
* you need to import CoreCompileHtmlComponentModule.
*
* You can provide some Javascript code (as text) to be executed inside the component. The context of the javascript code (this)
* will be the component instance created to compile the template. This means your javascript code can interact with the template.
* The component instance will have most of the providers so you can use them in the javascript code. E.g. if you want to use
* CoreAppProvider, you can do it with "this.CoreAppProvider".
*/
@Component({
selector: 'core-compile-html',
template: '<core-loading [hideUntil]="loaded"><ng-container #dynamicComponent></ng-container></core-loading>',
})
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
@Input() text!: string; // The HTML text to display.
@Input() javascript?: string; // The Javascript to execute in the component.
@Input() jsData?: Record<string, unknown>; // Data to pass to the fake component.
@Input() extraImports: unknown[] = []; // Extra import modules.
@Input() extraProviders: Type<unknown>[] = []; // Extra providers.
@Input() forceCompile?: boolean; // Set it to true to force compile even if the text/javascript hasn't changed.
@Output() created = new EventEmitter<unknown>(); // Will emit an event when the component is instantiated.
@Output() compiling = new EventEmitter<boolean>(); // Event that indicates whether the template is being compiled.
// Get the container where to put the content.
@ViewChild('dynamicComponent', { read: ViewContainerRef }) container?: ViewContainerRef;
loaded?: boolean;
componentInstance?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
protected componentRef?: ComponentRef<unknown>;
protected element: HTMLElement;
protected differ: KeyValueDiffer<unknown, unknown>; // To detect changes in the jsData input.
protected creatingComponent = false;
protected pendingCalls = {};
constructor(
protected changeDetector: ChangeDetectorRef,
element: ElementRef,
differs: KeyValueDiffers,
) {
this.element = element.nativeElement;
this.differ = differs.find([]).create();
}
/**
* Detect and act upon changes that Angular cant or wont detect on its own (objects and arrays).
*/
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
ngDoCheck(): void {
if (!this.componentInstance || this.creatingComponent) {
return;
}
// Check if there's any change in the jsData object.
const changes = this.differ.diff(this.jsData || {});
if (changes) {
this.setInputData();
if (this.componentInstance.ngOnChanges) {
this.componentInstance.ngOnChanges(CoreDomUtils.createChangesFromKeyValueDiff(changes));
}
}
}
/**
* Detect changes on input properties.
*/
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
async ngOnChanges(changes: Record<string, SimpleChange>): Promise<void> {
// Only compile if text/javascript has changed or the forceCompile flag has been set to true.
if (this.text && (changes.text || changes.javascript ||
(changes.forceCompile && CoreUtils.isTrueOrOne(this.forceCompile)))) {
// Create a new component and a new module.
this.creatingComponent = true;
this.compiling.emit(true);
try {
const factory = await CoreCompile.createAndCompileComponent(
this.text,
this.getComponentClass(),
this.extraImports,
);
// Destroy previous components.
this.componentRef?.destroy();
if (factory) {
// Create the component.
this.componentRef = this.container?.createComponent(factory);
this.componentRef && this.created.emit(this.componentRef.instance);
}
this.loaded = true;
} catch (error) {
CoreDomUtils.showErrorModal(error);
this.loaded = true;
} finally {
this.creatingComponent = false;
this.compiling.emit(false);
}
}
}
/**
* Component destroyed.
*/
// eslint-disable-next-line @angular-eslint/no-conflicting-lifecycle
ngOnDestroy(): void {
this.componentRef?.destroy();
}
/**
* Get a class that defines the dynamic component.
*
* @return The component class.
*/
protected getComponentClass(): Type<unknown> {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const compileInstance = this;
// Create the component, using the text as the template.
return class CoreCompileHtmlFakeComponent implements OnInit, AfterContentInit, AfterViewInit, OnDestroy {
constructor() {
// Store this instance so it can be accessed by the outer component.
compileInstance.componentInstance = this;
// Create 2 empty properties that can be used by the template to store data.
this['dataObject'] = {};
this['dataArray'] = [];
// Inject the libraries.
CoreCompile.injectLibraries(this, compileInstance.extraProviders);
// Always add these elements, they could be needed on component init (componentObservable).
this['ChangeDetectorRef'] = compileInstance.changeDetector;
this['componentContainer'] = compileInstance.element;
// Add the data passed to the component.
compileInstance.setInputData();
}
/**
* Component being initialized.
*/
ngOnInit(): void {
// If there is some javascript to run, do it now.
if (compileInstance.javascript) {
CoreCompile.executeJavascript(this, compileInstance.javascript);
}
// Call the pending functions.
for (const name in compileInstance.pendingCalls) {
const pendingCall = compileInstance.pendingCalls[name];
if (typeof this[name] == 'function') {
// Call the function.
Promise.resolve(this[name].apply(this, pendingCall.params)).then(pendingCall.defer.resolve)
.catch(pendingCall.defer.reject);
} else {
// Function not defined, resolve the promise.
pendingCall.defer.resolve();
}
}
compileInstance.pendingCalls = {};
}
/**
* Content has been initialized.
*/
ngAfterContentInit(): void {
// To be overridden.
}
/**
* View has been initialized.
*/
ngAfterViewInit(): void {
// To be overridden.
}
/**
* Component destroyed.
*/
ngOnDestroy(): void {
// To be overridden.
}
};
}
/**
* Set the JS data as input data of the component instance.
*/
protected setInputData(): void {
if (!this.componentInstance) {
return;
}
for (const name in this.jsData) {
this.componentInstance[name] = this.jsData[name];
}
}
/**
* Call a certain function on the component instance.
*
* @param name Name of the function to call.
* @param params List of params to send to the function.
* @param callWhenCreated If this param is true and the component hasn't been created yet, call the function
* once the component has been created.
* @return Result of the call. Undefined if no component instance or the function doesn't exist.
*/
callComponentFunction(name: string, params?: unknown[], callWhenCreated: boolean = true): unknown {
if (this.componentInstance) {
if (typeof this.componentInstance[name] == 'function') {
return this.componentInstance[name].apply(this.componentInstance, params);
}
} else if (callWhenCreated) {
// Call it when the component is created.
if (this.pendingCalls[name]) {
// Call already pending, just update the params (allow only 1 call per function until it's initialized).
this.pendingCalls[name].params = params;
return this.pendingCalls[name].defer.promise;
}
const defer = CoreUtils.promiseDefer();
this.pendingCalls[name] = {
params,
defer,
};
return defer.promise;
}
}
}

View File

@ -0,0 +1,390 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import {
Injectable,
Injector,
Component,
NgModule,
Compiler,
ComponentFactory,
ComponentRef,
NgModuleRef,
NO_ERRORS_SCHEMA,
Type,
} from '@angular/core';
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
import {
Platform,
ActionSheetController,
AlertController,
LoadingController,
ModalController,
PopoverController,
ToastController,
} from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { CoreLogger } from '@singletons/logger';
import { CoreEvents } from '@singletons/events';
import { makeSingleton } from '@singletons';
// Import core services.
import { CORE_SERVICES } from '@/core/core.module';
import { CORE_BLOCK_SERVICES } from '@features/block/block.module';
import { CORE_COMMENTS_SERVICES } from '@features/comments/comments.module';
import { CORE_CONTENTLINKS_SERVICES } from '@features/contentlinks/contentlinks.module';
import { CORE_COURSE_SERVICES } from '@features/course/course.module';
import { CORE_COURSES_SERVICES } from '@features/courses/courses.module';
import { CORE_EDITOR_SERVICES } from '@features/editor/editor.module';
import { IONIC_NATIVE_SERVICES } from '@features/emulator/emulator.module';
import { CORE_FILEUPLOADER_SERVICES } from '@features/fileuploader/fileuploader.module';
import { CORE_FILTER_SERVICES } from '@features/filter/filter.module';
import { CORE_GRADES_SERVICES } from '@features/grades/grades.module';
import { CORE_H5P_SERVICES } from '@features/h5p/h5p.module';
import { CORE_LOGIN_SERVICES } from '@features/login/login.module';
import { CORE_MAINMENU_SERVICES } from '@features/mainmenu/mainmenu.module';
import { CORE_PUSHNOTIFICATIONS_SERVICES } from '@features/pushnotifications/pushnotifications.module';
import { CORE_QUESTION_SERVICES } from '@features/question/question.module';
// @todo import { CORE_SHAREDFILES_SERVICES } from '@features/sharedfiles/sharedfiles.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 { CORE_USER_SERVICES } from '@features/user/user.module';
import { CORE_XAPI_SERVICES } from '@features/xapi/xapi.module';
// @todo import { CoreSitePluginsProvider } from '@features/siteplugins/services/siteplugins';
// Import other libraries and providers.
import { DomSanitizer } from '@angular/platform-browser';
import { FormBuilder, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { CoreConstants } from '@/core/constants';
import moment from 'moment';
import { Md5 } from 'ts-md5/dist/md5';
// Import core classes that can be useful for site plugins.
import { CoreSyncBaseProvider } from '@classes/base-sync';
import { CoreArray } from '@singletons/array';
import { CoreUrl } from '@singletons/url';
import { CoreWindow } from '@singletons/window';
import { CoreCache } from '@classes/cache';
import { CoreDelegate } from '@classes/delegate';
import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base-handler';
import { CoreContentLinksModuleGradeHandler } from '@features/contentlinks/classes/module-grade-handler';
import { CoreContentLinksModuleIndexHandler } from '@features/contentlinks/classes/module-index-handler';
import { CoreCourseActivityPrefetchHandlerBase } from '@features/course/classes/activity-prefetch-handler';
import { CoreCourseResourcePrefetchHandlerBase } from '@features/course/classes/resource-prefetch-handler';
import { CoreGeolocationError, CoreGeolocationErrorReason } from '@services/geolocation';
// Import all core modules that define components, directives and pipes.
import { CoreSharedModule } from '@/core/shared.module';
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
import { CoreCourseDirectivesModule } from '@features/course/directives/directives.module';
import { CoreCoursesComponentsModule } from '@features/courses/components/components.module';
// @todo import { CoreSitePluginsDirectivesModule } from '@features/siteplugins/directives/directives.module';
import { CoreUserComponentsModule } from '@features/user/components/components.module';
import { CoreQuestionComponentsModule } from '@features/question/components/components.module';
import { CoreBlockComponentsModule } from '@features/block/components/components.module';
import { CoreEditorComponentsModule } from '@features/editor/components/components.module';
import { CoreSearchComponentsModule } from '@features/search/components/components.module';
// Import some components so they can be injected dynamically.
import { CoreCourseUnsupportedModuleComponent } from '@features/course/components/unsupported-module/unsupported-module';
import { CoreCourseFormatSingleActivityComponent } from '@features/course/format/singleactivity/components/singleactivity';
// @todo
// import { CoreSitePluginsModuleIndexComponent } from '@features/siteplugins/components/module-index/module-index';
// import { CoreSitePluginsBlockComponent } from '@features/siteplugins/components/block/block';
// import { CoreSitePluginsCourseOptionComponent } from '@features/siteplugins/components/course-option/course-option';
// import { CoreSitePluginsCourseFormatComponent } from '@features/siteplugins/components/course-format/course-format';
// import { CoreSitePluginsQuestionComponent } from '@features/siteplugins/components/question/question';
// import { CoreSitePluginsQuestionBehaviourComponent } from '@features/siteplugins/components/question-behaviour/question-behaviour';
// import { CoreSitePluginsUserProfileFieldComponent } from '@features/siteplugins/components/user-profile-field/user-profile-field';
// import { CoreSitePluginsQuizAccessRuleComponent } from '@features/siteplugins/components/quiz-access-rule/quiz-access-rule';
// import { CoreSitePluginsAssignFeedbackComponent } from '@features/siteplugins/components/assign-feedback/assign-feedback';
// import { CoreSitePluginsAssignSubmissionComponent } from '@features/siteplugins/components/assign-submission/assign-submission';
// 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';
// @todo 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';
import { ADDON_MOD_ASSIGN_SERVICES } from '@addons/mod/assign/assign.module';
import { ADDON_MOD_BOOK_SERVICES } from '@addons/mod/book/book.module';
// @todo import { ADDON_MOD_CHAT_SERVICES } from '@addons/mod/chat/chat.module';
// @todo import { ADDON_MOD_CHOICE_SERVICES } from '@addons/mod/choice/choice.module';
// @todo import { ADDON_MOD_FEEDBACK_SERVICES } from '@addons/mod/feedback/feedback.module';
import { ADDON_MOD_FOLDER_SERVICES } from '@addons/mod/folder/folder.module';
import { ADDON_MOD_FORUM_SERVICES } from '@addons/mod/forum/forum.module';
// @todo import { ADDON_MOD_GLOSSARY_SERVICES } from '@addons/mod/glossary/glossary.module';
// @todo import { ADDON_MOD_H5P_ACTIVITY_SERVICES } from '@addons/mod/h5pactivity/h5pactivity.module';
import { ADDON_MOD_IMSCP_SERVICES } from '@addons/mod/imscp/imscp.module';
import { ADDON_MOD_LESSON_SERVICES } from '@addons/mod/lesson/lesson.module';
// @todo import { ADDON_MOD_LTI_SERVICES } from '@addons/mod/lti/lti.module';
import { ADDON_MOD_PAGE_SERVICES } from '@addons/mod/page/page.module';
import { ADDON_MOD_QUIZ_SERVICES } from '@addons/mod/quiz/quiz.module';
import { ADDON_MOD_RESOURCE_SERVICES } from '@addons/mod/resource/resource.module';
// @todo import { ADDON_MOD_SCORM_SERVICES } from '@addons/mod/scorm/scorm.module';
// @todo import { ADDON_MOD_SURVEY_SERVICES } from '@addons/mod/survey/survey.module';
import { ADDON_MOD_URL_SERVICES } from '@addons/mod/url/url.module';
// @todo import { ADDON_MOD_WIKI_SERVICES } from '@addons/mod/wiki/wiki.module';
// @todo import { ADDON_MOD_WORKSHOP_SERVICES } from '@addons/mod/workshop/workshop.module';
// @todo import { ADDON_NOTES_SERVICES } from '@addons/notes/notes.module';
import { ADDON_NOTIFICATIONS_SERVICES } from '@addons/notifications/notifications.module';
import { ADDON_PRIVATEFILES_SERVICES } from '@addons/privatefiles/privatefiles.module';
// @todo import { ADDON_REMOTETHEMES_SERVICES } from '@addons/remotethemes/remotethemes.module';
// Import some addon modules that define components, directives and pipes. Only import the important ones.
import { AddonModAssignComponentsModule } from '@addons/mod/assign/components/components.module';
// @todo import { AddonModWorkshopComponentsModule } from '@addons/mod/workshop/components/components.module';
/**
* Service to provide functionalities regarding compiling dynamic HTML and Javascript.
*/
@Injectable({ providedIn: 'root' })
export class CoreCompileProvider {
protected logger: CoreLogger;
protected compiler: Compiler;
// Other Ionic/Angular providers that don't depend on where they are injected.
protected readonly OTHER_SERVICES: unknown[] = [
TranslateService, HttpClient, Platform, DomSanitizer, ActionSheetController, AlertController, LoadingController,
ModalController, PopoverController, ToastController, FormBuilder,
];
// List of imports for dynamic module. Since the template can have any component we need to import all core components modules.
protected readonly IMPORTS = [
CoreSharedModule, CoreCourseComponentsModule, CoreCoursesComponentsModule, CoreUserComponentsModule,
CoreCourseDirectivesModule, CoreQuestionComponentsModule, AddonModAssignComponentsModule,
CoreBlockComponentsModule, CoreEditorComponentsModule, CoreSearchComponentsModule,
// @todo AddonModWorkshopComponentsModule, CoreSitePluginsDirectivesModule,
];
constructor(protected injector: Injector, compilerFactory: JitCompilerFactory) {
this.logger = CoreLogger.getInstance('CoreCompileProvider');
this.compiler = compilerFactory.createCompiler();
}
/**
* Create and compile a dynamic component.
*
* @param template The template of the component.
* @param componentClass The JS class of the component.
* @param extraImports Extra imported modules if needed and not imported by this class.
* @return Promise resolved with the factory to instantiate the component.
*/
async createAndCompileComponent<T = unknown>(
template: string,
componentClass: Type<T>,
extraImports: any[] = [], // eslint-disable-line @typescript-eslint/no-explicit-any
): Promise<ComponentFactory<T> | undefined> {
// Create the component using the template and the class.
const component = Component({ template })(componentClass);
const imports = [
...this.IMPORTS,
...extraImports,
];
// Now create the module containing the component.
const module = NgModule({ imports, declarations: [component], schemas: [NO_ERRORS_SCHEMA] })(class {});
try {
// Compile the module and the component.
const factories = await this.compiler.compileModuleAndAllComponentsAsync(module);
// Search and return the factory of the component we just created.
return factories.componentFactories.find(factory => factory.componentType == component);
} catch (error) {
this.logger.error('Error compiling template', template);
this.logger.error(error);
error.message = 'Template has some errors and cannot be displayed.';
throw error;
}
}
/**
* Eval some javascript using the context of the function.
*
* @param javascript The javascript to eval.
* @return Result of the eval.
*/
protected evalInContext(javascript: string): unknown {
// eslint-disable-next-line no-eval
return eval(javascript);
}
/**
* Execute some javascript code, using a certain instance as the context.
*
* @param instance Instance to use as the context. In the JS code, "this" will be this instance.
* @param javascript The javascript code to eval.
* @return Result of the javascript execution.
*/
executeJavascript(instance: unknown, javascript: string): unknown {
try {
return this.evalInContext.call(instance, javascript);
} catch (ex) {
this.logger.error('Error evaluating javascript', ex);
}
}
/**
* Inject all the core libraries in a certain object.
*
* @param instance The instance where to inject the libraries.
* @param extraProviders Extra imported providers if needed and not imported by this class.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
injectLibraries(instance: any, extraProviders: Type<unknown>[] = []): void {
const providers = [
...CORE_SERVICES,
...CORE_BLOCK_SERVICES,
...CORE_COMMENTS_SERVICES,
...CORE_CONTENTLINKS_SERVICES,
...CORE_COURSE_SERVICES,
...CORE_COURSES_SERVICES,
...CORE_EDITOR_SERVICES,
...CORE_FILEUPLOADER_SERVICES,
...CORE_FILTER_SERVICES,
...CORE_GRADES_SERVICES,
...CORE_H5P_SERVICES,
...CORE_MAINMENU_SERVICES,
...CORE_LOGIN_SERVICES,
...CORE_QUESTION_SERVICES,
...CORE_PUSHNOTIFICATIONS_SERVICES,
...CORE_SEARCH_SERVICES,
...CORE_SETTINGS_SERVICES,
// @todo ...CORE_SHAREDFILES_SERVICES,
...CORE_SITEHOME_SERVICES,
// @todo ...CoreSitePluginsProvider,
...CORE_TAG_SERVICES,
...CORE_USER_SERVICES,
...CORE_XAPI_SERVICES,
...IONIC_NATIVE_SERVICES,
...this.OTHER_SERVICES,
...extraProviders,
...ADDON_BADGES_SERVICES,
...ADDON_CALENDAR_SERVICES,
// @todo ...ADDON_COMPETENCY_SERVICES,
...ADDON_MESSAGEOUTPUT_SERVICES,
...ADDON_MESSAGES_SERVICES,
...ADDON_MOD_ASSIGN_SERVICES,
...ADDON_MOD_BOOK_SERVICES,
// @todo ...ADDON_MOD_CHAT_SERVICES,
// @todo ...ADDON_MOD_CHOICE_SERVICES,
// @todo ...ADDON_MOD_FEEDBACK_SERVICES,
...ADDON_MOD_FOLDER_SERVICES,
...ADDON_MOD_FORUM_SERVICES,
// @todo ...ADDON_MOD_GLOSSARY_SERVICES,
// @todo ...ADDON_MOD_H5P_ACTIVITY_SERVICES,
...ADDON_MOD_IMSCP_SERVICES,
...ADDON_MOD_LESSON_SERVICES,
// @todo ...ADDON_MOD_LTI_SERVICES,
...ADDON_MOD_PAGE_SERVICES,
...ADDON_MOD_QUIZ_SERVICES,
...ADDON_MOD_RESOURCE_SERVICES,
// @todo ...ADDON_MOD_SCORM_SERVICES,
// @todo ...ADDON_MOD_SURVEY_SERVICES,
...ADDON_MOD_URL_SERVICES,
// @todo ...ADDON_MOD_WIKI_SERVICES,
// @todo ...ADDON_MOD_WORKSHOP_SERVICES,
// @todo ...ADDON_NOTES_SERVICES,
...ADDON_NOTIFICATIONS_SERVICES,
...ADDON_PRIVATEFILES_SERVICES,
// @todo ...ADDON_REMOTETHEMES_SERVICES,
];
// We cannot inject anything to this constructor. Use the Injector to inject all the providers into the instance.
for (const i in providers) {
const providerDef = providers[i];
if (typeof providerDef == 'function' && providerDef.name) {
try {
// Inject the provider to the instance. We use the class name as the property name.
instance[providerDef.name.replace(/DelegateService$/, 'Delegate')] = this.injector.get(providerDef);
} catch (ex) {
this.logger.warn('Error injecting provider', providerDef.name, ex);
}
}
}
// Inject current service.
instance['CoreCompileProvider'] = this;
// Add some final classes.
instance['injector'] = this.injector;
instance['Validators'] = Validators;
instance['CoreConstants'] = CoreConstants;
instance['CoreConfigConstants'] = CoreConstants.CONFIG;
instance['CoreEventsProvider'] = CoreEvents;
instance['CoreLoggerProvider'] = CoreLogger;
instance['moment'] = moment;
instance['Md5'] = Md5;
instance['CoreSyncBaseProvider'] = CoreSyncBaseProvider;
instance['CoreArray'] = CoreArray;
instance['CoreUrl'] = CoreUrl;
instance['CoreWindow'] = CoreWindow;
instance['CoreCache'] = CoreCache;
instance['CoreDelegate'] = CoreDelegate;
instance['CoreContentLinksHandlerBase'] = CoreContentLinksHandlerBase;
instance['CoreContentLinksModuleGradeHandler'] = CoreContentLinksModuleGradeHandler;
instance['CoreContentLinksModuleIndexHandler'] = CoreContentLinksModuleIndexHandler;
instance['CoreCourseActivityPrefetchHandlerBase'] = CoreCourseActivityPrefetchHandlerBase;
instance['CoreCourseResourcePrefetchHandlerBase'] = CoreCourseResourcePrefetchHandlerBase;
instance['CoreCourseUnsupportedModuleComponent'] = CoreCourseUnsupportedModuleComponent;
instance['CoreCourseFormatSingleActivityComponent'] = CoreCourseFormatSingleActivityComponent;
// @todo instance['CoreSitePluginsModuleIndexComponent'] = CoreSitePluginsModuleIndexComponent;
// instance['CoreSitePluginsBlockComponent'] = CoreSitePluginsBlockComponent;
// instance['CoreSitePluginsCourseOptionComponent'] = CoreSitePluginsCourseOptionComponent;
// instance['CoreSitePluginsCourseFormatComponent'] = CoreSitePluginsCourseFormatComponent;
// instance['CoreSitePluginsQuestionComponent'] = CoreSitePluginsQuestionComponent;
// instance['CoreSitePluginsQuestionBehaviourComponent'] = CoreSitePluginsQuestionBehaviourComponent;
// instance['CoreSitePluginsUserProfileFieldComponent'] = CoreSitePluginsUserProfileFieldComponent;
// instance['CoreSitePluginsQuizAccessRuleComponent'] = CoreSitePluginsQuizAccessRuleComponent;
// instance['CoreSitePluginsAssignFeedbackComponent'] = CoreSitePluginsAssignFeedbackComponent;
// instance['CoreSitePluginsAssignSubmissionComponent'] = CoreSitePluginsAssignSubmissionComponent;
instance['CoreGeolocationError'] = CoreGeolocationError;
instance['CoreGeolocationErrorReason'] = CoreGeolocationErrorReason;
}
/**
* Instantiate a dynamic component.
*
* @param template The template of the component.
* @param componentClass The JS class of the component.
* @param injector The injector to use. It's recommended to pass it so NavController and similar can be injected.
* @return Promise resolved with the component instance.
*/
async instantiateDynamicComponent<T = unknown>(
template: string,
componentClass: Type<T>,
injector?: Injector,
): Promise<ComponentRef<T> | undefined> {
injector = injector || this.injector;
const factory = await this.createAndCompileComponent(template, componentClass);
if (factory) {
// Create and return the component.
return factory.create(injector, undefined, undefined, injector.get(NgModuleRef));
}
}
}
export const CoreCompile = makeSingleton(CoreCompileProvider);

View File

@ -0,0 +1,31 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { NgModule, Type } from '@angular/core';
import { CoreContentLinksDelegateService } from './services/contentlinks-delegate';
import { CoreContentLinksHelperProvider } from './services/contentlinks-helper';
export const CORE_CONTENTLINKS_SERVICES: Type<unknown>[] = [
CoreContentLinksDelegateService,
CoreContentLinksHelperProvider,
];
@NgModule({
declarations: [],
imports: [],
providers: [],
exports: [],
})
export class CoreContentLinksModule {}

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
@ -24,14 +24,33 @@ import { SITE_SCHEMA, OFFLINE_SITE_SCHEMA } from './services/database/course';
import { SITE_SCHEMA as LOG_SITE_SCHEMA } from './services/database/log'; import { SITE_SCHEMA as LOG_SITE_SCHEMA } from './services/database/log';
import { SITE_SCHEMA as PREFETCH_SITE_SCHEMA } from './services/database/module-prefetch'; import { SITE_SCHEMA as PREFETCH_SITE_SCHEMA } from './services/database/module-prefetch';
import { CoreCourseIndexRoutingModule } from './pages/index/index-routing.module'; import { CoreCourseIndexRoutingModule } from './pages/index/index-routing.module';
import { CoreCourseModulePrefetchDelegate } from './services/module-prefetch-delegate'; import { CoreCourseModulePrefetchDelegate, CoreCourseModulePrefetchDelegateService } from './services/module-prefetch-delegate';
import { CoreCronDelegate } from '@services/cron'; import { CoreCronDelegate } from '@services/cron';
import { CoreCourseLogCronHandler } from './services/handlers/log-cron'; import { CoreCourseLogCronHandler } from './services/handlers/log-cron';
import { CoreCourseSyncCronHandler } from './services/handlers/sync-cron'; import { CoreCourseSyncCronHandler } from './services/handlers/sync-cron';
import { CoreTagAreaDelegate } from '@features/tag/services/tag-area-delegate'; import { CoreTagAreaDelegate } from '@features/tag/services/tag-area-delegate';
import { CoreCourseTagAreaHandler } from './services/handlers/course-tag-area'; import { CoreCourseTagAreaHandler } from './services/handlers/course-tag-area';
import { CoreCourseModulesTagAreaHandler } from './services/handlers/modules-tag-area'; import { CoreCourseModulesTagAreaHandler } from './services/handlers/modules-tag-area';
import { CoreCourse } from './services/course'; import { CoreCourse, CoreCourseProvider } from './services/course';
import { CoreCourseHelperProvider } from './services/course-helper';
import { CoreCourseLogHelperProvider } from './services/log-helper';
import { CoreCourseFormatDelegateService } from './services/format-delegate';
import { CoreCourseModuleDelegateService } from './services/module-delegate';
import { CoreCourseOptionsDelegateService } from './services/course-options-delegate';
import { CoreCourseOfflineProvider } from './services/course-offline';
import { CoreCourseSyncProvider } from './services/sync';
export const CORE_COURSE_SERVICES: Type<unknown>[] = [
CoreCourseProvider,
CoreCourseHelperProvider,
CoreCourseLogHelperProvider,
CoreCourseFormatDelegateService,
CoreCourseModuleDelegateService,
CoreCourseModulePrefetchDelegateService,
CoreCourseOptionsDelegateService,
CoreCourseOfflineProvider,
CoreCourseSyncProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,13 +12,16 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module'; import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module';
import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate'; import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate';
import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate'; import { CorePushNotificationsDelegate } from '@features/pushnotifications/services/push-delegate';
import { CoreCoursesProvider } from './services/courses';
import { CoreCoursesHelperProvider } from './services/courses-helper';
import { CoreCoursesDashboardProvider } from './services/dashboard';
import { CoreCoursesCourseLinkHandler } from './services/handlers/course-link'; import { CoreCoursesCourseLinkHandler } from './services/handlers/course-link';
import { CoreCoursesIndexLinkHandler } from './services/handlers/courses-index-link'; import { CoreCoursesIndexLinkHandler } from './services/handlers/courses-index-link';
@ -28,6 +31,12 @@ import { CoreCoursesEnrolPushClickHandler } from './services/handlers/enrol-push
import { CoreCoursesMyCoursesHomeHandler, CoreCoursesMyCoursesHomeHandlerService } from './services/handlers/my-courses-home'; import { CoreCoursesMyCoursesHomeHandler, CoreCoursesMyCoursesHomeHandlerService } from './services/handlers/my-courses-home';
import { CoreCoursesRequestPushClickHandler } from './services/handlers/request-push-click'; import { CoreCoursesRequestPushClickHandler } from './services/handlers/request-push-click';
export const CORE_COURSES_SERVICES: Type<unknown>[] = [
CoreCoursesProvider,
CoreCoursesDashboardProvider,
CoreCoursesHelperProvider,
];
const mainMenuHomeChildrenRoutes: Routes = [ const mainMenuHomeChildrenRoutes: Routes = [
{ {
path: '', path: '',

View File

@ -12,11 +12,16 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { NgModule } from '@angular/core'; import { NgModule, Type } from '@angular/core';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { CoreEditorComponentsModule } from './components/components.module'; import { CoreEditorComponentsModule } from './components/components.module';
import { SITE_SCHEMA } from './services/database/editor'; import { SITE_SCHEMA } from './services/database/editor';
import { CoreEditorOfflineProvider } from './services/editor-offline';
export const CORE_EDITOR_SERVICES: Type<unknown>[] = [
CoreEditorOfflineProvider,
];
@NgModule({ @NgModule({
declarations: [ declarations: [

View File

@ -45,6 +45,33 @@ import { StatusBar } from '@ionic-native/status-bar/ngx';
import { WebIntent } from '@ionic-native/web-intent/ngx'; import { WebIntent } from '@ionic-native/web-intent/ngx';
import { Zip } from '@ionic-native/zip/ngx'; import { Zip } from '@ionic-native/zip/ngx';
export const IONIC_NATIVE_SERVICES = [
Badge,
Camera,
Chooser,
Clipboard,
Device,
Diagnostic,
File,
FileOpener,
FileTransfer,
Geolocation,
HTTP,
InAppBrowser,
Keyboard,
LocalNotifications,
Media,
MediaCapture,
Network,
Push,
QRScanner,
SplashScreen,
StatusBar,
SQLite,
WebIntent,
WebView,
Zip,
];
// Mock services. // Mock services.
import { CameraMock } from './services/camera'; import { CameraMock } from './services/camera';
import { ClipboardMock } from './services/clipboard'; import { ClipboardMock } from './services/clipboard';

View File

@ -12,15 +12,22 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { CoreFileUploaderDelegate } from './services/fileuploader-delegate'; import { CoreFileUploaderProvider } from './services/fileuploader';
import { CoreFileUploaderDelegate, CoreFileUploaderDelegateService } from './services/fileuploader-delegate';
import { CoreFileUploaderHelperProvider } from './services/fileuploader-helper';
import { CoreFileUploaderAlbumHandler } from './services/handlers/album'; import { CoreFileUploaderAlbumHandler } from './services/handlers/album';
import { CoreFileUploaderAudioHandler } from './services/handlers/audio'; import { CoreFileUploaderAudioHandler } from './services/handlers/audio';
import { CoreFileUploaderCameraHandler } from './services/handlers/camera'; import { CoreFileUploaderCameraHandler } from './services/handlers/camera';
import { CoreFileUploaderFileHandler } from './services/handlers/file'; import { CoreFileUploaderFileHandler } from './services/handlers/file';
import { CoreFileUploaderVideoHandler } from './services/handlers/video'; import { CoreFileUploaderVideoHandler } from './services/handlers/video';
export const CORE_FILEUPLOADER_SERVICES: Type<unknown>[] = [
CoreFileUploaderProvider,
CoreFileUploaderHelperProvider,
CoreFileUploaderDelegateService,
];
@NgModule({ @NgModule({
imports: [], imports: [],

View File

@ -0,0 +1,31 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { NgModule, Type } from '@angular/core';
import { CoreFilterProvider } from './services/filter';
import { CoreFilterDelegateService } from './services/filter-delegate';
import { CoreFilterHelperProvider } from './services/filter-helper';
export const CORE_FILTER_SERVICES: Type<unknown>[] = [
CoreFilterProvider,
CoreFilterDelegateService,
CoreFilterHelperProvider,
];
@NgModule({
declarations: [],
imports: [],
providers: [],
})
export class CoreFilterModule { }

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module';
@ -21,12 +21,19 @@ import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.m
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate'; import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate';
import { CoreUserDelegate } from '@features/user/services/user-delegate'; import { CoreUserDelegate } from '@features/user/services/user-delegate';
import { CoreGradesProvider } from './services/grades';
import { CoreGradesHelperProvider } from './services/grades-helper';
import { CoreGradesCourseOptionHandler } from './services/handlers/course-option'; import { CoreGradesCourseOptionHandler } from './services/handlers/course-option';
import { CoreGradesMainMenuHandler, CoreGradesMainMenuHandlerService } from './services/handlers/mainmenu'; import { CoreGradesMainMenuHandler, CoreGradesMainMenuHandlerService } from './services/handlers/mainmenu';
import { CoreGradesOverviewLinkHandler } from './services/handlers/overview-link'; import { CoreGradesOverviewLinkHandler } from './services/handlers/overview-link';
import { CoreGradesUserHandler } from './services/handlers/user'; import { CoreGradesUserHandler } from './services/handlers/user';
import { CoreGradesUserLinkHandler } from './services/handlers/user-link'; import { CoreGradesUserLinkHandler } from './services/handlers/user-link';
export const CORE_GRADES_SERVICES: Type<unknown>[] = [
CoreGradesProvider,
CoreGradesHelperProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {
path: CoreGradesMainMenuHandlerService.PAGE_NAME, path: CoreGradesMainMenuHandlerService.PAGE_NAME,

View File

@ -12,14 +12,19 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { CorePluginFileDelegate } from '@services/plugin-file-delegate'; import { CorePluginFileDelegate } from '@services/plugin-file-delegate';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { CoreH5PComponentsModule } from './components/components.module'; import { CoreH5PComponentsModule } from './components/components.module';
import { SITE_SCHEMA } from './services/database/h5p'; import { SITE_SCHEMA } from './services/database/h5p';
import { CoreH5PProvider } from './services/h5p';
import { CoreH5PPluginFileHandler } from './services/handlers/pluginfile'; import { CoreH5PPluginFileHandler } from './services/handlers/pluginfile';
export const CORE_H5P_SERVICES: Type<unknown>[] = [
CoreH5PProvider,
];
@NgModule({ @NgModule({
imports: [ imports: [
CoreH5PComponentsModule, CoreH5PComponentsModule,

View File

@ -16,6 +16,11 @@ import { NgModule } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { AppRoutingModule } from '@/app/app-routing.module'; import { AppRoutingModule } from '@/app/app-routing.module';
import { CoreLoginHelperProvider } from './services/login-helper';
export const CORE_LOGIN_SERVICES = [
CoreLoginHelperProvider,
];
const appRoutes: Routes = [ const appRoutes: Routes = [
{ {

View File

@ -18,8 +18,16 @@ import { CoreMainMenuAuthGuard } from '@features/mainmenu/guards/auth';
import { AppRoutingModule } from '@/app/app-routing.module'; import { AppRoutingModule } from '@/app/app-routing.module';
import { CoreMainMenuDelegate } from './services/mainmenu-delegate'; import { CoreMainMenuDelegate, CoreMainMenuDelegateService } from './services/mainmenu-delegate';
import { CoreMainMenuHomeHandler } from './services/handlers/mainmenu'; import { CoreMainMenuHomeHandler } from './services/handlers/mainmenu';
import { CoreMainMenuProvider } from './services/mainmenu';
import { CoreMainMenuHomeDelegateService } from './services/home-delegate';
export const CORE_MAINMENU_SERVICES = [
CoreMainMenuHomeDelegateService,
CoreMainMenuDelegateService,
CoreMainMenuProvider,
];
const appRoutes: Routes = [ const appRoutes: Routes = [
{ {

View File

@ -12,14 +12,20 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
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 { SITE_SCHEMA } from './services/database/pushnotifications'; import { SITE_SCHEMA } from './services/database/pushnotifications';
import { CorePushNotificationsRegisterCronHandler } from './services/handlers/register-cron'; import { CorePushNotificationsRegisterCronHandler } from './services/handlers/register-cron';
import { CorePushNotificationsUnregisterCronHandler } from './services/handlers/unregister-cron'; import { CorePushNotificationsUnregisterCronHandler } from './services/handlers/unregister-cron';
import { CorePushNotifications } from './services/pushnotifications'; import { CorePushNotificationsDelegateService } from './services/push-delegate';
import { CorePushNotifications, CorePushNotificationsProvider } from './services/pushnotifications';
export const CORE_PUSHNOTIFICATIONS_SERVICES: Type<unknown>[] = [
CorePushNotificationsProvider,
CorePushNotificationsDelegateService,
];
@NgModule({ @NgModule({
declarations: [ declarations: [

View File

@ -0,0 +1,34 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { NgModule, Type } from '@angular/core';
import { CoreQuestionBehaviourDelegateService } from './services/behaviour-delegate';
import { CoreQuestionProvider } from './services/question';
import { CoreQuestionDelegateService } from './services/question-delegate';
import { CoreQuestionHelperProvider } from './services/question-helper';
export const CORE_QUESTION_SERVICES: Type<unknown>[] = [
CoreQuestionProvider,
CoreQuestionDelegateService,
CoreQuestionBehaviourDelegateService,
CoreQuestionHelperProvider,
];
@NgModule({
declarations: [],
imports: [],
providers: [],
exports: [],
})
export class CoreQuestionModule {}

View File

@ -12,12 +12,17 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { NgModule } from '@angular/core'; import { NgModule, Type } from '@angular/core';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { CoreSearchComponentsModule } from './components/components.module'; import { CoreSearchComponentsModule } from './components/components.module';
import { SITE_SCHEMA } from './services/search-history-db'; import { SITE_SCHEMA } from './services/search-history-db';
import { CoreSearchHistoryProvider } from './services/search-history.service';
export const CORE_SEARCH_SERVICES: Type<unknown>[] = [
CoreSearchHistoryProvider,
];
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -12,13 +12,18 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { AppRoutingModule } from '@/app/app-routing.module'; import { AppRoutingModule } from '@/app/app-routing.module';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CoreSettingsHelperProvider } from './services/settings-helper'; import { CoreSettingsHelperProvider } from './services/settings-helper';
import { CoreSettingsDelegateService } from './services/settings-delegate';
export const CORE_SETTINGS_SERVICES: Type<unknown>[] = [
CoreSettingsDelegateService,
CoreSettingsHelperProvider,
];
const appRoutes: Routes = [ const appRoutes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreSiteHomeIndexLinkHandler } from './services/handlers/index-link'; import { CoreSiteHomeIndexLinkHandler } from './services/handlers/index-link';
@ -20,6 +20,11 @@ import { CoreContentLinksDelegate } from '@features/contentlinks/services/conten
import { CoreSiteHomeHomeHandler, CoreSiteHomeHomeHandlerService } from './services/handlers/sitehome-home'; import { CoreSiteHomeHomeHandler, CoreSiteHomeHomeHandlerService } from './services/handlers/sitehome-home';
import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate'; import { CoreMainMenuHomeDelegate } from '@features/mainmenu/services/home-delegate';
import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module'; import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/pages/home/home-routing.module';
import { CoreSiteHomeProvider } from './services/sitehome';
export const CORE_SITEHOME_SERVICES: Type<unknown>[] = [
CoreSiteHomeProvider,
];
const mainMenuHomeRoutes: Routes = [ const mainMenuHomeRoutes: Routes = [
{ {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate'; import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu-delegate';
import { CoreMainMenuRoutingModule } from '../mainmenu/mainmenu-routing.module'; import { CoreMainMenuRoutingModule } from '../mainmenu/mainmenu-routing.module';
@ -22,6 +22,15 @@ import { CoreTagIndexLinkHandler } from './services/handlers/index-link';
import { CoreTagSearchLinkHandler } from './services/handlers/search-link'; import { CoreTagSearchLinkHandler } from './services/handlers/search-link';
import { CoreTagComponentsModule } from './components/components.module'; import { CoreTagComponentsModule } from './components/components.module';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.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<unknown>[] = [
CoreTagAreaDelegateService,
CoreTagHelperProvider,
CoreTagProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { APP_INITIALIZER, NgModule } from '@angular/core'; import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
import { Routes } from '@angular/router'; import { Routes } from '@angular/router';
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { SITE_SCHEMA, OFFLINE_SITE_SCHEMA } from './services/database/user'; import { SITE_SCHEMA, OFFLINE_SITE_SCHEMA } from './services/database/user';
import { CoreUserComponentsModule } from './components/components.module'; import { CoreUserComponentsModule } from './components/components.module';
import { CoreUserDelegate } from './services/user-delegate'; import { CoreUserDelegate, CoreUserDelegateService } from './services/user-delegate';
import { CoreUserProfileMailHandler } from './services/handlers/profile-mail'; import { CoreUserProfileMailHandler } from './services/handlers/profile-mail';
import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate';
import { CoreUserProfileLinkHandler } from './services/handlers/profile-link'; import { CoreUserProfileLinkHandler } from './services/handlers/profile-link';
@ -30,6 +30,20 @@ import { CoreTagAreaDelegate } from '@features/tag/services/tag-area-delegate';
import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module'; import { CoreCourseIndexRoutingModule } from '@features/course/pages/index/index-routing.module';
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate'; import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';
import { CoreUserCourseOptionHandler } from './services/handlers/course-option'; import { CoreUserCourseOptionHandler } from './services/handlers/course-option';
import { CoreUserProfileFieldDelegateService } from './services/user-profile-field-delegate';
import { CoreUserProvider } from './services/user';
import { CoreUserHelperProvider } from './services/user-helper';
import { CoreUserOfflineProvider } from './services/user-offline';
import { CoreUserSyncProvider } from './services/user-sync';
export const CORE_USER_SERVICES: Type<unknown>[] = [
CoreUserDelegateService,
CoreUserProfileFieldDelegateService,
CoreUserProvider,
CoreUserHelperProvider,
CoreUserOfflineProvider,
CoreUserSyncProvider,
];
const routes: Routes = [ const routes: Routes = [
{ {

View File

@ -12,10 +12,17 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { NgModule } from '@angular/core'; import { NgModule, Type } from '@angular/core';
import { CORE_SITE_SCHEMAS } from '@services/sites'; import { CORE_SITE_SCHEMAS } from '@services/sites';
import { SITE_SCHEMA } from './services/database/xapi'; import { SITE_SCHEMA } from './services/database/xapi';
import { CoreXAPIOfflineProvider } from './services/offline';
import { CoreXAPIProvider } from './services/xapi';
export const CORE_XAPI_SERVICES: Type<unknown>[] = [
CoreXAPIProvider,
CoreXAPIOfflineProvider,
];
@NgModule({ @NgModule({
imports: [], imports: [],