MOBILE-2333 core: Export lists of providers

main
Dani Palou 2018-02-13 14:38:04 +01:00
parent 7d3162585c
commit 91c8be2167
13 changed files with 139 additions and 77 deletions

View File

@ -81,6 +81,36 @@ export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http, './assets/lang/', '.json'); return new TranslateHttpLoader(http, './assets/lang/', '.json');
} }
// List of providers.
export const CORE_PROVIDERS: any[] = [
CoreLoggerProvider,
CoreDbProvider,
CoreAppProvider,
CoreConfigProvider,
CoreLangProvider,
CoreTextUtilsProvider,
CoreDomUtilsProvider,
CoreTimeUtilsProvider,
CoreUrlUtilsProvider,
CoreUtilsProvider,
CoreMimetypeUtilsProvider,
CoreInitDelegate,
CoreFileProvider,
CoreWSProvider,
CoreEventsProvider,
CoreSitesFactoryProvider,
CoreSitesProvider,
CoreLocalNotificationsProvider,
CoreGroupsProvider,
CoreCronDelegate,
CoreFileSessionProvider,
CoreFilepoolProvider,
CoreUpdateManagerProvider,
CorePluginFileDelegate,
CoreSyncProvider,
CoreAddonManagerProvider
];
@NgModule({ @NgModule({
declarations: [ declarations: [
MoodleMobileApp MoodleMobileApp
@ -126,39 +156,13 @@ export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
entryComponents: [ entryComponents: [
MoodleMobileApp MoodleMobileApp
], ],
providers: [ providers: CORE_PROVIDERS.concat([
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: CoreInterceptor, useClass: CoreInterceptor,
multi: true, multi: true,
}, }
CoreLoggerProvider, ])
CoreDbProvider,
CoreAppProvider,
CoreConfigProvider,
CoreLangProvider,
CoreTextUtilsProvider,
CoreDomUtilsProvider,
CoreTimeUtilsProvider,
CoreUrlUtilsProvider,
CoreUtilsProvider,
CoreMimetypeUtilsProvider,
CoreInitDelegate,
CoreFileProvider,
CoreWSProvider,
CoreEventsProvider,
CoreSitesFactoryProvider,
CoreSitesProvider,
CoreLocalNotificationsProvider,
CoreGroupsProvider,
CoreCronDelegate,
CoreFileSessionProvider,
CoreFilepoolProvider,
CoreUpdateManagerProvider,
CorePluginFileDelegate,
CoreSyncProvider,
CoreAddonManagerProvider
]
}) })
export class AppModule { export class AppModule {
constructor(platform: Platform, initDelegate: CoreInitDelegate, updateManager: CoreUpdateManagerProvider, constructor(platform: Platform, initDelegate: CoreInitDelegate, updateManager: CoreUpdateManagerProvider,

View File

@ -16,14 +16,17 @@ import { NgModule } from '@angular/core';
import { CoreContentLinksDelegate } from './providers/delegate'; import { CoreContentLinksDelegate } from './providers/delegate';
import { CoreContentLinksHelperProvider } from './providers/helper'; import { CoreContentLinksHelperProvider } from './providers/helper';
// List of providers.
export const CORE_CONTENTLINKS_PROVIDERS = [
CoreContentLinksDelegate,
CoreContentLinksHelperProvider
];
@NgModule({ @NgModule({
declarations: [], declarations: [],
imports: [ imports: [
], ],
providers: [ providers: CORE_CONTENTLINKS_PROVIDERS,
CoreContentLinksDelegate,
CoreContentLinksHelperProvider
],
exports: [] exports: []
}) })
export class CoreContentLinksModule {} export class CoreContentLinksModule {}

View File

@ -25,6 +25,16 @@ import { CoreCourseFormatSocialModule } from './formats/social/social.module';
import { CoreCourseFormatTopicsModule } from './formats/topics/topics.module'; import { CoreCourseFormatTopicsModule } from './formats/topics/topics.module';
import { CoreCourseFormatWeeksModule } from './formats/weeks/weeks.module'; import { CoreCourseFormatWeeksModule } from './formats/weeks/weeks.module';
// List of providers (without handlers).
export const CORE_COURSE_PROVIDERS: any[] = [
CoreCourseProvider,
CoreCourseHelperProvider,
CoreCourseFormatDelegate,
CoreCourseModuleDelegate,
CoreCourseModulePrefetchDelegate,
CoreCourseOptionsDelegate
];
@NgModule({ @NgModule({
declarations: [], declarations: [],
imports: [ imports: [
@ -33,15 +43,9 @@ import { CoreCourseFormatWeeksModule } from './formats/weeks/weeks.module';
CoreCourseFormatWeeksModule, CoreCourseFormatWeeksModule,
CoreCourseFormatSocialModule CoreCourseFormatSocialModule
], ],
providers: [ providers: CORE_COURSE_PROVIDERS.concat([
CoreCourseProvider,
CoreCourseHelperProvider,
CoreCourseFormatDelegate,
CoreCourseModuleDelegate,
CoreCourseModulePrefetchDelegate,
CoreCourseOptionsDelegate,
CoreCourseFormatDefaultHandler CoreCourseFormatDefaultHandler
], ]),
exports: [] exports: []
}) })
export class CoreCourseModule {} export class CoreCourseModule {}

View File

@ -22,18 +22,22 @@ import { CoreCoursesMyOverviewLinkHandler } from './providers/my-overview-link-h
import { CoreMainMenuDelegate } from '../mainmenu/providers/delegate'; import { CoreMainMenuDelegate } from '../mainmenu/providers/delegate';
import { CoreContentLinksDelegate } from '../contentlinks/providers/delegate'; import { CoreContentLinksDelegate } from '../contentlinks/providers/delegate';
// List of providers (without handlers).
export const CORE_COURSES_PROVIDERS: any[] = [
CoreCoursesProvider,
CoreCoursesMyOverviewProvider
];
@NgModule({ @NgModule({
declarations: [], declarations: [],
imports: [ imports: [
], ],
providers: [ providers: CORE_COURSES_PROVIDERS.concat([
CoreCoursesProvider,
CoreCoursesMainMenuHandler, CoreCoursesMainMenuHandler,
CoreCoursesMyOverviewProvider,
CoreCoursesCourseLinkHandler, CoreCoursesCourseLinkHandler,
CoreCoursesIndexLinkHandler, CoreCoursesIndexLinkHandler,
CoreCoursesMyOverviewLinkHandler CoreCoursesMyOverviewLinkHandler
], ]),
exports: [] exports: []
}) })
export class CoreCoursesModule { export class CoreCoursesModule {

View File

@ -56,6 +56,24 @@ import { CoreUrlUtilsProvider } from '@providers/utils/url';
import { CoreUtilsProvider } from '@providers/utils/utils'; import { CoreUtilsProvider } from '@providers/utils/utils';
import { CoreInitDelegate } from '@providers/init'; import { CoreInitDelegate } from '@providers/init';
// List of Ionic Native providers.
export const IONIC_NATIVE_PROVIDERS = [
Camera,
Clipboard,
File,
FileTransfer,
Globalization,
InAppBrowser,
Keyboard,
LocalNotifications,
MediaCapture,
Network,
SplashScreen,
StatusBar,
SQLite,
Zip
];
/** /**
* This module handles the emulation of Cordova plugins in browser and desktop. * This module handles the emulation of Cordova plugins in browser and desktop.
* *

View File

@ -22,21 +22,25 @@ import { CoreFileUploaderCameraHandler } from './providers/camera-handler';
import { CoreFileUploaderFileHandler } from './providers/file-handler'; import { CoreFileUploaderFileHandler } from './providers/file-handler';
import { CoreFileUploaderVideoHandler } from './providers/video-handler'; import { CoreFileUploaderVideoHandler } from './providers/video-handler';
// List of providers (without handlers).
export const CORE_FILEUPLOADER_PROVIDERS: any[] = [
CoreFileUploaderProvider,
CoreFileUploaderHelperProvider,
CoreFileUploaderDelegate
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
], ],
providers: [ providers: CORE_FILEUPLOADER_PROVIDERS.concat([
CoreFileUploaderProvider,
CoreFileUploaderHelperProvider,
CoreFileUploaderDelegate,
CoreFileUploaderAlbumHandler, CoreFileUploaderAlbumHandler,
CoreFileUploaderAudioHandler, CoreFileUploaderAudioHandler,
CoreFileUploaderCameraHandler, CoreFileUploaderCameraHandler,
CoreFileUploaderFileHandler, CoreFileUploaderFileHandler,
CoreFileUploaderVideoHandler CoreFileUploaderVideoHandler
] ])
}) })
export class CoreFileUploaderModule { export class CoreFileUploaderModule {
constructor(delegate: CoreFileUploaderDelegate, albumHandler: CoreFileUploaderAlbumHandler, constructor(delegate: CoreFileUploaderDelegate, albumHandler: CoreFileUploaderAlbumHandler,

View File

@ -29,21 +29,25 @@ import { CoreEventsProvider } from '@providers/events';
import { CoreSitesProvider } from '@providers/sites'; import { CoreSitesProvider } from '@providers/sites';
import { CoreUserProvider } from '../user/providers/user'; import { CoreUserProvider } from '../user/providers/user';
// List of providers (without handlers).
export const CORE_GRADES_PROVIDERS: any[] = [
CoreGradesProvider,
CoreGradesHelperProvider
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
CoreGradesComponentsModule CoreGradesComponentsModule
], ],
providers: [ providers: CORE_GRADES_PROVIDERS.concat([
CoreGradesProvider,
CoreGradesHelperProvider,
CoreGradesMainMenuHandler, CoreGradesMainMenuHandler,
CoreGradesCourseOptionHandler, CoreGradesCourseOptionHandler,
CoreGradesUserLinkHandler, CoreGradesUserLinkHandler,
CoreGradesOverviewLinkHandler, CoreGradesOverviewLinkHandler,
CoreGradesUserHandler CoreGradesUserHandler
] ])
}) })
export class CoreGradesModule { export class CoreGradesModule {
constructor(mainMenuDelegate: CoreMainMenuDelegate, gradesMenuHandler: CoreGradesMainMenuHandler, constructor(mainMenuDelegate: CoreMainMenuDelegate, gradesMenuHandler: CoreGradesMainMenuHandler,

View File

@ -15,13 +15,16 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CoreLoginHelperProvider } from './providers/helper'; import { CoreLoginHelperProvider } from './providers/helper';
// List of providers.
export const CORE_LOGIN_PROVIDERS = [
CoreLoginHelperProvider
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
], ],
providers: [ providers: CORE_LOGIN_PROVIDERS
CoreLoginHelperProvider
]
}) })
export class CoreLoginModule {} export class CoreLoginModule {}

View File

@ -16,14 +16,17 @@ import { NgModule } from '@angular/core';
import { CoreMainMenuDelegate } from './providers/delegate'; import { CoreMainMenuDelegate } from './providers/delegate';
import { CoreMainMenuProvider } from './providers/mainmenu'; import { CoreMainMenuProvider } from './providers/mainmenu';
// List of providers.
export const CORE_MAINMENU_PROVIDERS = [
CoreMainMenuDelegate,
CoreMainMenuProvider
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
], ],
providers: [ providers: CORE_MAINMENU_PROVIDERS
CoreMainMenuDelegate,
CoreMainMenuProvider
]
}) })
export class CoreMainMenuModule {} export class CoreMainMenuModule {}

View File

@ -19,16 +19,20 @@ import { CoreSharedFilesHelperProvider } from './providers/helper';
import { CoreSharedFilesUploadHandler } from './providers/upload-handler'; import { CoreSharedFilesUploadHandler } from './providers/upload-handler';
import { CoreFileUploaderDelegate } from '../fileuploader/providers/delegate'; import { CoreFileUploaderDelegate } from '../fileuploader/providers/delegate';
// List of providers (without handlers).
export const CORE_SHAREDFILES_PROVIDERS: any[] = [
CoreSharedFilesProvider,
CoreSharedFilesHelperProvider
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
], ],
providers: [ providers: CORE_SHAREDFILES_PROVIDERS.concat([
CoreSharedFilesProvider,
CoreSharedFilesHelperProvider,
CoreSharedFilesUploadHandler CoreSharedFilesUploadHandler
] ])
}) })
export class CoreSharedFilesModule { export class CoreSharedFilesModule {
constructor(platform: Platform, delegate: CoreFileUploaderDelegate, handler: CoreSharedFilesUploadHandler, constructor(platform: Platform, delegate: CoreFileUploaderDelegate, handler: CoreSharedFilesUploadHandler,

View File

@ -16,13 +16,16 @@ import { NgModule } from '@angular/core';
import { Platform } from 'ionic-angular'; import { Platform } from 'ionic-angular';
import { CoreSiteAddonsProvider } from './providers/siteaddons'; import { CoreSiteAddonsProvider } from './providers/siteaddons';
// List of providers.
export const CORE_SITEADDONS_PROVIDERS = [
CoreSiteAddonsProvider
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
], ],
providers: [ providers: CORE_SITEADDONS_PROVIDERS
CoreSiteAddonsProvider
]
}) })
export class CoreSiteAddonsModule { } export class CoreSiteAddonsModule { }

View File

@ -19,15 +19,19 @@ import { CoreSiteHomeIndexLinkHandler } from './providers/index-link-handler';
import { CoreMainMenuDelegate } from '../mainmenu/providers/delegate'; import { CoreMainMenuDelegate } from '../mainmenu/providers/delegate';
import { CoreContentLinksDelegate } from '../contentlinks/providers/delegate'; import { CoreContentLinksDelegate } from '../contentlinks/providers/delegate';
// List of providers (without handlers).
export const CORE_SITEHOME_PROVIDERS: any[] = [
CoreSiteHomeProvider
];
@NgModule({ @NgModule({
declarations: [], declarations: [],
imports: [ imports: [
], ],
providers: [ providers: CORE_SITEHOME_PROVIDERS.concat([
CoreSiteHomeProvider,
CoreSiteHomeMainMenuHandler, CoreSiteHomeMainMenuHandler,
CoreSiteHomeIndexLinkHandler CoreSiteHomeIndexLinkHandler
], ]),
exports: [] exports: []
}) })
export class CoreSiteHomeModule { export class CoreSiteHomeModule {

View File

@ -27,22 +27,26 @@ import { CoreUserParticipantsLinkHandler } from './providers/participants-link-h
import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate'; import { CoreCourseOptionsDelegate } from '@core/course/providers/options-delegate';
import { CoreUserComponentsModule } from './components/components.module'; import { CoreUserComponentsModule } from './components/components.module';
// List of providers (without handlers).
export const CORE_USER_PROVIDERS: any[] = [
CoreUserDelegate,
CoreUserProfileFieldDelegate,
CoreUserProvider,
CoreUserHelperProvider,
];
@NgModule({ @NgModule({
declarations: [ declarations: [
], ],
imports: [ imports: [
CoreUserComponentsModule CoreUserComponentsModule
], ],
providers: [ providers: CORE_USER_PROVIDERS.concat([
CoreUserDelegate,
CoreUserProfileFieldDelegate,
CoreUserProfileMailHandler, CoreUserProfileMailHandler,
CoreUserProvider,
CoreUserHelperProvider,
CoreUserProfileLinkHandler, CoreUserProfileLinkHandler,
CoreUserParticipantsCourseOptionHandler, CoreUserParticipantsCourseOptionHandler,
CoreUserParticipantsLinkHandler CoreUserParticipantsLinkHandler
] ])
}) })
export class CoreUserModule { export class CoreUserModule {
constructor(userDelegate: CoreUserDelegate, userProfileMailHandler: CoreUserProfileMailHandler, constructor(userDelegate: CoreUserDelegate, userProfileMailHandler: CoreUserProfileMailHandler,