2017-11-14 07:58:20 +00:00
|
|
|
// (C) Copyright 2015 Martin Dougiamas
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
2017-10-18 10:20:40 +00:00
|
|
|
import { BrowserModule } from '@angular/platform-browser';
|
2018-02-14 16:19:09 +00:00
|
|
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
2018-06-12 12:11:52 +00:00
|
|
|
import { NgModule, COMPILER_OPTIONS } from '@angular/core';
|
2018-06-13 14:48:48 +00:00
|
|
|
import { IonicApp, IonicModule, Platform, Content, ScrollEvent, Config } from 'ionic-angular';
|
2018-05-16 06:27:17 +00:00
|
|
|
import { assert } from 'ionic-angular/util/util';
|
2017-11-30 14:42:36 +00:00
|
|
|
import { HttpModule } from '@angular/http';
|
2017-11-27 08:51:15 +00:00
|
|
|
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
2018-06-12 12:11:52 +00:00
|
|
|
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
|
2018-06-15 08:55:58 +00:00
|
|
|
import { LocationStrategy } from '@angular/common';
|
|
|
|
import { MockLocationStrategy } from '@angular/common/testing';
|
2017-10-26 13:03:08 +00:00
|
|
|
|
|
|
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
|
|
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
2017-10-18 10:20:40 +00:00
|
|
|
|
2018-01-08 13:42:08 +00:00
|
|
|
import { MoodleMobileApp } from './app.component';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { CoreInterceptor } from '@classes/interceptor';
|
2018-06-13 14:48:48 +00:00
|
|
|
import { CorePageTransition } from '@classes/page-transition';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { CoreLoggerProvider } from '@providers/logger';
|
|
|
|
import { CoreDbProvider } from '@providers/db';
|
|
|
|
import { CoreAppProvider } from '@providers/app';
|
|
|
|
import { CoreConfigProvider } from '@providers/config';
|
|
|
|
import { CoreLangProvider } from '@providers/lang';
|
|
|
|
import { CoreTextUtilsProvider } from '@providers/utils/text';
|
|
|
|
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
2018-07-27 10:43:57 +00:00
|
|
|
import { CoreIframeUtilsProvider } from '@providers/utils/iframe';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { CoreTimeUtilsProvider } from '@providers/utils/time';
|
|
|
|
import { CoreUrlUtilsProvider } from '@providers/utils/url';
|
|
|
|
import { CoreUtilsProvider } from '@providers/utils/utils';
|
|
|
|
import { CoreMimetypeUtilsProvider } from '@providers/utils/mimetype';
|
|
|
|
import { CoreInitDelegate } from '@providers/init';
|
|
|
|
import { CoreFileProvider } from '@providers/file';
|
|
|
|
import { CoreWSProvider } from '@providers/ws';
|
|
|
|
import { CoreEventsProvider } from '@providers/events';
|
|
|
|
import { CoreSitesFactoryProvider } from '@providers/sites-factory';
|
|
|
|
import { CoreSitesProvider } from '@providers/sites';
|
|
|
|
import { CoreLocalNotificationsProvider } from '@providers/local-notifications';
|
|
|
|
import { CoreGroupsProvider } from '@providers/groups';
|
|
|
|
import { CoreCronDelegate } from '@providers/cron';
|
|
|
|
import { CoreFileSessionProvider } from '@providers/file-session';
|
|
|
|
import { CoreFilepoolProvider } from '@providers/filepool';
|
|
|
|
import { CoreUpdateManagerProvider } from '@providers/update-manager';
|
|
|
|
import { CorePluginFileDelegate } from '@providers/plugin-file-delegate';
|
|
|
|
import { CoreSyncProvider } from '@providers/sync';
|
2018-02-15 09:06:57 +00:00
|
|
|
import { CoreFileHelperProvider } from '@providers/file-helper';
|
2017-10-26 13:03:08 +00:00
|
|
|
|
2017-12-29 08:18:17 +00:00
|
|
|
// Core modules.
|
2018-02-23 12:02:56 +00:00
|
|
|
import { CoreComponentsModule } from '@components/components.module';
|
|
|
|
import { CoreEmulatorModule } from '@core/emulator/emulator.module';
|
|
|
|
import { CoreLoginModule } from '@core/login/login.module';
|
|
|
|
import { CoreMainMenuModule } from '@core/mainmenu/mainmenu.module';
|
|
|
|
import { CoreCoursesModule } from '@core/courses/courses.module';
|
|
|
|
import { CoreFileUploaderModule } from '@core/fileuploader/fileuploader.module';
|
|
|
|
import { CoreSharedFilesModule } from '@core/sharedfiles/sharedfiles.module';
|
|
|
|
import { CoreCourseModule } from '@core/course/course.module';
|
|
|
|
import { CoreSiteHomeModule } from '@core/sitehome/sitehome.module';
|
|
|
|
import { CoreContentLinksModule } from '@core/contentlinks/contentlinks.module';
|
|
|
|
import { CoreUserModule } from '@core/user/user.module';
|
|
|
|
import { CoreGradesModule } from '@core/grades/grades.module';
|
2018-02-26 16:41:04 +00:00
|
|
|
import { CoreSettingsModule } from '@core/settings/settings.module';
|
2018-03-09 13:36:30 +00:00
|
|
|
import { CoreSitePluginsModule } from '@core/siteplugins/siteplugins.module';
|
2018-02-21 15:18:03 +00:00
|
|
|
import { CoreCompileModule } from '@core/compile/compile.module';
|
2018-03-14 14:45:05 +00:00
|
|
|
import { CoreQuestionModule } from '@core/question/question.module';
|
2018-03-29 12:22:42 +00:00
|
|
|
import { CoreCommentsModule } from '@core/comments/comments.module';
|
2017-12-29 08:18:17 +00:00
|
|
|
|
|
|
|
// Addon modules.
|
2018-02-14 11:46:40 +00:00
|
|
|
import { AddonBadgesModule } from '@addon/badges/badges.module';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { AddonCalendarModule } from '@addon/calendar/calendar.module';
|
2018-02-14 11:46:40 +00:00
|
|
|
import { AddonCompetencyModule } from '@addon/competency/competency.module';
|
2018-06-15 16:50:00 +00:00
|
|
|
import { AddonCourseCompletionModule } from '@addon/coursecompletion/coursecompletion.module';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { AddonUserProfileFieldModule } from '@addon/userprofilefield/userprofilefield.module';
|
|
|
|
import { AddonFilesModule } from '@addon/files/files.module';
|
2018-10-10 14:16:41 +00:00
|
|
|
import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module';
|
|
|
|
import { AddonBlockTimelineModule } from '@addon/block/timeline/timeline.module';
|
2018-04-09 10:07:29 +00:00
|
|
|
import { AddonModAssignModule } from '@addon/mod/assign/assign.module';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { AddonModBookModule } from '@addon/mod/book/book.module';
|
2018-04-11 11:01:56 +00:00
|
|
|
import { AddonModChatModule } from '@addon/mod/chat/chat.module';
|
2018-04-16 13:34:43 +00:00
|
|
|
import { AddonModChoiceModule } from '@addon/mod/choice/choice.module';
|
2018-04-12 12:56:51 +00:00
|
|
|
import { AddonModDataModule } from '@addon/mod/data/data.module';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { AddonModLabelModule } from '@addon/mod/label/label.module';
|
2018-05-15 11:28:18 +00:00
|
|
|
import { AddonModLtiModule } from '@addon/mod/lti/lti.module';
|
2018-03-02 15:59:39 +00:00
|
|
|
import { AddonModResourceModule } from '@addon/mod/resource/resource.module';
|
2018-03-16 12:44:57 +00:00
|
|
|
import { AddonModFeedbackModule } from '@addon/mod/feedback/feedback.module';
|
2018-03-05 16:42:54 +00:00
|
|
|
import { AddonModFolderModule } from '@addon/mod/folder/folder.module';
|
2018-05-14 08:18:21 +00:00
|
|
|
import { AddonModForumModule } from '@addon/mod/forum/forum.module';
|
2018-05-25 13:35:03 +00:00
|
|
|
import { AddonModGlossaryModule } from '@addon/mod/glossary/glossary.module';
|
2018-05-01 07:34:24 +00:00
|
|
|
import { AddonModLessonModule } from '@addon/mod/lesson/lesson.module';
|
2018-03-06 11:47:51 +00:00
|
|
|
import { AddonModPageModule } from '@addon/mod/page/page.module';
|
2018-03-22 13:51:00 +00:00
|
|
|
import { AddonModQuizModule } from '@addon/mod/quiz/quiz.module';
|
2018-04-24 14:50:15 +00:00
|
|
|
import { AddonModScormModule } from '@addon/mod/scorm/scorm.module';
|
2018-03-06 14:28:52 +00:00
|
|
|
import { AddonModUrlModule } from '@addon/mod/url/url.module';
|
2018-03-09 11:29:11 +00:00
|
|
|
import { AddonModSurveyModule } from '@addon/mod/survey/survey.module';
|
2018-05-30 14:03:36 +00:00
|
|
|
import { AddonModWorkshopModule } from '@addon/mod/workshop/workshop.module';
|
2018-04-19 15:10:49 +00:00
|
|
|
import { AddonModImscpModule } from '@addon/mod/imscp/imscp.module';
|
2018-05-24 10:33:53 +00:00
|
|
|
import { AddonModWikiModule } from '@addon/mod/wiki/wiki.module';
|
2018-03-27 11:27:55 +00:00
|
|
|
import { AddonMessageOutputModule } from '@addon/messageoutput/messageoutput.module';
|
|
|
|
import { AddonMessageOutputAirnotifierModule } from '@addon/messageoutput/airnotifier/airnotifier.module';
|
2018-02-23 12:02:56 +00:00
|
|
|
import { AddonMessagesModule } from '@addon/messages/messages.module';
|
2018-03-20 10:47:59 +00:00
|
|
|
import { AddonNotesModule } from '../addon/notes/notes.module';
|
2018-02-23 13:44:17 +00:00
|
|
|
import { AddonPushNotificationsModule } from '@addon/pushnotifications/pushnotifications.module';
|
2018-03-27 11:27:55 +00:00
|
|
|
import { AddonNotificationsModule } from '@addon/notifications/notifications.module';
|
2018-03-13 09:21:36 +00:00
|
|
|
import { AddonRemoteThemesModule } from '@addon/remotethemes/remotethemes.module';
|
2018-03-16 09:40:20 +00:00
|
|
|
import { AddonQbehaviourModule } from '@addon/qbehaviour/qbehaviour.module';
|
2018-03-16 12:20:03 +00:00
|
|
|
import { AddonQtypeModule } from '@addon/qtype/qtype.module';
|
2018-01-16 14:52:07 +00:00
|
|
|
|
2017-10-26 13:03:08 +00:00
|
|
|
// For translate loader. AoT requires an exported function for factories.
|
2018-01-29 09:05:20 +00:00
|
|
|
export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
2017-11-02 11:38:01 +00:00
|
|
|
return new TranslateHttpLoader(http, './assets/lang/', '.json');
|
2017-10-26 13:03:08 +00:00
|
|
|
}
|
2017-10-18 10:20:40 +00:00
|
|
|
|
2018-02-13 13:38:04 +00:00
|
|
|
// List of providers.
|
|
|
|
export const CORE_PROVIDERS: any[] = [
|
|
|
|
CoreLoggerProvider,
|
|
|
|
CoreDbProvider,
|
|
|
|
CoreAppProvider,
|
|
|
|
CoreConfigProvider,
|
|
|
|
CoreLangProvider,
|
|
|
|
CoreTextUtilsProvider,
|
|
|
|
CoreDomUtilsProvider,
|
2018-07-27 10:43:57 +00:00
|
|
|
CoreIframeUtilsProvider,
|
2018-02-13 13:38:04 +00:00
|
|
|
CoreTimeUtilsProvider,
|
|
|
|
CoreUrlUtilsProvider,
|
|
|
|
CoreUtilsProvider,
|
|
|
|
CoreMimetypeUtilsProvider,
|
|
|
|
CoreInitDelegate,
|
|
|
|
CoreFileProvider,
|
|
|
|
CoreWSProvider,
|
|
|
|
CoreEventsProvider,
|
|
|
|
CoreSitesFactoryProvider,
|
|
|
|
CoreSitesProvider,
|
|
|
|
CoreLocalNotificationsProvider,
|
|
|
|
CoreGroupsProvider,
|
|
|
|
CoreCronDelegate,
|
|
|
|
CoreFileSessionProvider,
|
|
|
|
CoreFilepoolProvider,
|
|
|
|
CoreUpdateManagerProvider,
|
|
|
|
CorePluginFileDelegate,
|
|
|
|
CoreSyncProvider,
|
2018-02-15 09:06:57 +00:00
|
|
|
CoreFileHelperProvider
|
2018-02-13 13:38:04 +00:00
|
|
|
];
|
|
|
|
|
2017-10-18 10:20:40 +00:00
|
|
|
@NgModule({
|
2017-10-26 13:03:08 +00:00
|
|
|
declarations: [
|
2018-01-08 13:42:08 +00:00
|
|
|
MoodleMobileApp
|
2017-10-26 13:03:08 +00:00
|
|
|
],
|
|
|
|
imports: [
|
|
|
|
BrowserModule,
|
2018-02-14 16:19:09 +00:00
|
|
|
BrowserAnimationsModule,
|
2017-11-30 14:42:36 +00:00
|
|
|
HttpClientModule, // HttpClient is used to make JSON requests. It fails for HEAD requests because there is no content.
|
|
|
|
HttpModule,
|
2018-01-08 13:42:08 +00:00
|
|
|
IonicModule.forRoot(MoodleMobileApp, {
|
2018-06-13 14:48:48 +00:00
|
|
|
pageTransition: 'core-page-transition'
|
2017-11-24 11:31:09 +00:00
|
|
|
}),
|
2017-10-26 13:03:08 +00:00
|
|
|
TranslateModule.forRoot({
|
|
|
|
loader: {
|
|
|
|
provide: TranslateLoader,
|
|
|
|
useFactory: (createTranslateLoader),
|
|
|
|
deps: [HttpClient]
|
|
|
|
}
|
2017-10-30 15:40:50 +00:00
|
|
|
}),
|
2017-12-29 08:18:17 +00:00
|
|
|
CoreComponentsModule,
|
2017-12-08 07:23:52 +00:00
|
|
|
CoreEmulatorModule,
|
2017-12-11 08:21:01 +00:00
|
|
|
CoreLoginModule,
|
2017-12-11 10:38:13 +00:00
|
|
|
CoreMainMenuModule,
|
2017-12-22 07:06:01 +00:00
|
|
|
CoreCoursesModule,
|
2018-01-09 07:52:27 +00:00
|
|
|
CoreFileUploaderModule,
|
2018-01-10 07:52:08 +00:00
|
|
|
CoreSharedFilesModule,
|
2017-12-29 08:18:17 +00:00
|
|
|
CoreCourseModule,
|
2018-01-19 08:00:59 +00:00
|
|
|
CoreSiteHomeModule,
|
2018-01-23 10:26:21 +00:00
|
|
|
CoreContentLinksModule,
|
2018-01-12 12:57:53 +00:00
|
|
|
CoreUserModule,
|
2018-01-30 09:02:04 +00:00
|
|
|
CoreGradesModule,
|
2018-02-26 16:41:04 +00:00
|
|
|
CoreSettingsModule,
|
2018-03-09 13:36:30 +00:00
|
|
|
CoreSitePluginsModule,
|
2018-02-21 15:18:03 +00:00
|
|
|
CoreCompileModule,
|
2018-03-14 14:45:05 +00:00
|
|
|
CoreQuestionModule,
|
2018-03-29 12:22:42 +00:00
|
|
|
CoreCommentsModule,
|
2018-02-14 11:46:40 +00:00
|
|
|
AddonBadgesModule,
|
2018-01-16 14:52:07 +00:00
|
|
|
AddonCalendarModule,
|
2018-03-09 14:21:18 +00:00
|
|
|
AddonCompetencyModule,
|
2018-06-15 16:50:00 +00:00
|
|
|
AddonCourseCompletionModule,
|
2018-01-23 14:29:00 +00:00
|
|
|
AddonUserProfileFieldModule,
|
2018-01-31 10:38:16 +00:00
|
|
|
AddonFilesModule,
|
2018-10-10 14:16:41 +00:00
|
|
|
AddonBlockMyOverviewModule,
|
|
|
|
AddonBlockTimelineModule,
|
2018-04-09 10:07:29 +00:00
|
|
|
AddonModAssignModule,
|
2018-01-31 14:17:41 +00:00
|
|
|
AddonModBookModule,
|
2018-04-11 11:01:56 +00:00
|
|
|
AddonModChatModule,
|
2018-04-16 13:34:43 +00:00
|
|
|
AddonModChoiceModule,
|
2018-04-12 12:56:51 +00:00
|
|
|
AddonModDataModule,
|
2018-02-09 09:02:14 +00:00
|
|
|
AddonModLabelModule,
|
2018-05-01 07:34:24 +00:00
|
|
|
AddonModLessonModule,
|
2018-03-02 15:59:39 +00:00
|
|
|
AddonModResourceModule,
|
2018-03-16 12:44:57 +00:00
|
|
|
AddonModFeedbackModule,
|
2018-03-05 16:42:54 +00:00
|
|
|
AddonModFolderModule,
|
2018-05-14 08:18:21 +00:00
|
|
|
AddonModForumModule,
|
2018-05-25 13:35:03 +00:00
|
|
|
AddonModGlossaryModule,
|
2018-05-15 11:28:18 +00:00
|
|
|
AddonModLtiModule,
|
2018-03-06 11:47:51 +00:00
|
|
|
AddonModPageModule,
|
2018-03-22 13:51:00 +00:00
|
|
|
AddonModQuizModule,
|
2018-04-24 14:50:15 +00:00
|
|
|
AddonModScormModule,
|
2018-03-06 14:28:52 +00:00
|
|
|
AddonModUrlModule,
|
2018-03-09 11:29:11 +00:00
|
|
|
AddonModSurveyModule,
|
2018-05-30 14:03:36 +00:00
|
|
|
AddonModWorkshopModule,
|
2018-04-19 15:10:49 +00:00
|
|
|
AddonModImscpModule,
|
2018-05-24 10:33:53 +00:00
|
|
|
AddonModWikiModule,
|
2018-03-27 11:27:55 +00:00
|
|
|
AddonMessageOutputModule,
|
|
|
|
AddonMessageOutputAirnotifierModule,
|
2018-02-23 13:44:17 +00:00
|
|
|
AddonMessagesModule,
|
2018-03-20 10:47:59 +00:00
|
|
|
AddonNotesModule,
|
2018-03-27 11:27:55 +00:00
|
|
|
AddonNotificationsModule,
|
2018-03-13 09:21:36 +00:00
|
|
|
AddonPushNotificationsModule,
|
2018-03-16 09:40:20 +00:00
|
|
|
AddonRemoteThemesModule,
|
2018-03-16 12:20:03 +00:00
|
|
|
AddonQbehaviourModule,
|
|
|
|
AddonQtypeModule
|
2017-10-26 13:03:08 +00:00
|
|
|
],
|
|
|
|
bootstrap: [IonicApp],
|
|
|
|
entryComponents: [
|
2018-01-08 13:42:08 +00:00
|
|
|
MoodleMobileApp
|
2017-10-26 13:03:08 +00:00
|
|
|
],
|
2018-06-08 07:03:48 +00:00
|
|
|
providers: [
|
|
|
|
CoreLoggerProvider,
|
|
|
|
CoreDbProvider,
|
|
|
|
CoreAppProvider,
|
|
|
|
CoreConfigProvider,
|
|
|
|
CoreLangProvider,
|
|
|
|
CoreTextUtilsProvider,
|
|
|
|
CoreDomUtilsProvider,
|
2018-07-27 10:43:57 +00:00
|
|
|
CoreIframeUtilsProvider,
|
2018-06-08 07:03:48 +00:00
|
|
|
CoreTimeUtilsProvider,
|
|
|
|
CoreUrlUtilsProvider,
|
|
|
|
CoreUtilsProvider,
|
|
|
|
CoreMimetypeUtilsProvider,
|
|
|
|
CoreInitDelegate,
|
|
|
|
CoreFileProvider,
|
|
|
|
CoreWSProvider,
|
|
|
|
CoreEventsProvider,
|
|
|
|
CoreSitesFactoryProvider,
|
|
|
|
CoreSitesProvider,
|
|
|
|
CoreLocalNotificationsProvider,
|
|
|
|
CoreGroupsProvider,
|
|
|
|
CoreCronDelegate,
|
|
|
|
CoreFileSessionProvider,
|
|
|
|
CoreFilepoolProvider,
|
|
|
|
CoreUpdateManagerProvider,
|
|
|
|
CorePluginFileDelegate,
|
|
|
|
CoreSyncProvider,
|
|
|
|
CoreFileHelperProvider,
|
2017-11-27 08:51:15 +00:00
|
|
|
{
|
|
|
|
provide: HTTP_INTERCEPTORS,
|
|
|
|
useClass: CoreInterceptor,
|
|
|
|
multi: true,
|
2018-06-12 12:11:52 +00:00
|
|
|
},
|
|
|
|
{provide: COMPILER_OPTIONS, useValue: {}, multi: true},
|
2018-06-15 08:55:58 +00:00
|
|
|
{provide: JitCompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS]},
|
|
|
|
{provide: LocationStrategy, useClass: MockLocationStrategy},
|
2018-06-08 07:03:48 +00:00
|
|
|
]
|
2017-10-18 10:20:40 +00:00
|
|
|
})
|
2017-11-07 12:01:32 +00:00
|
|
|
export class AppModule {
|
2018-06-13 14:48:48 +00:00
|
|
|
constructor(platform: Platform, initDelegate: CoreInitDelegate, updateManager: CoreUpdateManagerProvider, config: Config,
|
2018-04-26 13:59:23 +00:00
|
|
|
sitesProvider: CoreSitesProvider, fileProvider: CoreFileProvider) {
|
2017-12-08 07:23:52 +00:00
|
|
|
// Register a handler for platform ready.
|
|
|
|
initDelegate.registerProcess({
|
2017-11-07 12:01:32 +00:00
|
|
|
name: 'CorePlatformReady',
|
2017-11-21 08:56:16 +00:00
|
|
|
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 400,
|
2017-11-07 12:01:32 +00:00
|
|
|
blocking: true,
|
|
|
|
load: platform.ready
|
2017-12-08 07:23:52 +00:00
|
|
|
});
|
2017-11-07 12:01:32 +00:00
|
|
|
|
2017-11-21 08:56:16 +00:00
|
|
|
// Register the update manager as an init process.
|
|
|
|
initDelegate.registerProcess(updateManager);
|
|
|
|
|
2017-12-08 07:23:52 +00:00
|
|
|
// Restore the user's session during the init process.
|
|
|
|
initDelegate.registerProcess({
|
|
|
|
name: 'CoreRestoreSession',
|
|
|
|
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 200,
|
|
|
|
blocking: false,
|
|
|
|
load: sitesProvider.restoreSession.bind(sitesProvider)
|
|
|
|
});
|
|
|
|
|
2018-04-26 13:59:23 +00:00
|
|
|
// Register clear app tmp folder.
|
|
|
|
initDelegate.registerProcess({
|
|
|
|
name: 'CoreClearTmpFolder',
|
|
|
|
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 150,
|
|
|
|
blocking: false,
|
|
|
|
load: fileProvider.clearTmpFolder.bind(fileProvider)
|
|
|
|
});
|
|
|
|
|
2017-11-07 12:01:32 +00:00
|
|
|
// Execute the init processes.
|
|
|
|
initDelegate.executeInitProcesses();
|
2018-05-16 06:27:17 +00:00
|
|
|
|
2018-06-13 14:48:48 +00:00
|
|
|
// Set transition animation.
|
|
|
|
config.setTransition('core-page-transition', CorePageTransition);
|
|
|
|
|
2018-05-16 06:27:17 +00:00
|
|
|
// Decorate ion-content.
|
|
|
|
this.decorateIonContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decorate ion-content to make our ion-tabs work.
|
|
|
|
* https://github.com/ionic-team/ionic/issues/14483
|
|
|
|
*/
|
|
|
|
protected decorateIonContent(): void {
|
|
|
|
|
|
|
|
const parsePxUnit = (val: string): number => {
|
|
|
|
return (val.indexOf('px') > 0) ? parseInt(val, 10) : 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// We need to convert the prototype to any because _readDimensions is private.
|
|
|
|
// tslint:disable: typedef
|
|
|
|
(<any> Content.prototype)._readDimensions = function() {
|
|
|
|
const cachePaddingTop = this._pTop;
|
|
|
|
const cachePaddingRight = this._pRight;
|
|
|
|
const cachePaddingBottom = this._pBottom;
|
|
|
|
const cachePaddingLeft = this._pLeft;
|
|
|
|
const cacheHeaderHeight = this._hdrHeight;
|
|
|
|
const cacheFooterHeight = this._ftrHeight;
|
|
|
|
const cacheTabsPlacement = this._tabsPlacement;
|
|
|
|
let tabsTop = 0;
|
|
|
|
let scrollEvent: ScrollEvent;
|
|
|
|
this._pTop = 0;
|
|
|
|
this._pRight = 0;
|
|
|
|
this._pBottom = 0;
|
|
|
|
this._pLeft = 0;
|
|
|
|
this._hdrHeight = 0;
|
|
|
|
this._ftrHeight = 0;
|
|
|
|
this._tabsPlacement = null;
|
|
|
|
this._tTop = 0;
|
|
|
|
this._fTop = 0;
|
|
|
|
this._fBottom = 0;
|
|
|
|
|
|
|
|
// In certain cases this._scroll is undefined, if that is the case then we should just return.
|
|
|
|
if (!this._scroll) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scrollEvent = this._scroll.ev;
|
|
|
|
|
|
|
|
let ele: HTMLElement = this.getNativeElement();
|
|
|
|
if (!ele) {
|
|
|
|
assert(false, 'ele should be valid');
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let computedStyle: any;
|
|
|
|
let tagName: string;
|
|
|
|
const parentEle: HTMLElement = ele.parentElement;
|
|
|
|
const children = parentEle.children;
|
|
|
|
for (let i = children.length - 1; i >= 0; i--) {
|
|
|
|
ele = <HTMLElement> children[i];
|
|
|
|
tagName = ele.tagName;
|
|
|
|
if (tagName === 'ION-CONTENT') {
|
|
|
|
scrollEvent.contentElement = ele;
|
|
|
|
|
|
|
|
if (this._fullscreen) {
|
|
|
|
// ******** DOM READ ****************
|
|
|
|
computedStyle = getComputedStyle(ele);
|
|
|
|
this._pTop = parsePxUnit(computedStyle.paddingTop);
|
|
|
|
this._pBottom = parsePxUnit(computedStyle.paddingBottom);
|
|
|
|
this._pRight = parsePxUnit(computedStyle.paddingRight);
|
|
|
|
this._pLeft = parsePxUnit(computedStyle.paddingLeft);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (tagName === 'ION-HEADER') {
|
|
|
|
scrollEvent.headerElement = ele;
|
|
|
|
|
|
|
|
// ******** DOM READ ****************
|
|
|
|
this._hdrHeight = ele.clientHeight;
|
|
|
|
|
|
|
|
} else if (tagName === 'ION-FOOTER') {
|
|
|
|
scrollEvent.footerElement = ele;
|
|
|
|
|
|
|
|
// ******** DOM READ ****************
|
|
|
|
this._ftrHeight = ele.clientHeight;
|
|
|
|
this._footerEle = ele;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ele = parentEle;
|
|
|
|
let tabbarEle: HTMLElement;
|
|
|
|
|
|
|
|
while (ele && ele.tagName !== 'ION-MODAL' && !ele.classList.contains('tab-subpage')) {
|
|
|
|
|
|
|
|
if (ele.tagName.indexOf('ION-TABS') != -1) {
|
|
|
|
tabbarEle = <HTMLElement> ele.firstElementChild;
|
|
|
|
// ******** DOM READ ****************
|
|
|
|
this._tabbarHeight = tabbarEle.clientHeight;
|
|
|
|
|
|
|
|
if (this._tabsPlacement === null) {
|
|
|
|
// This is the first tabbar found, remember its position.
|
|
|
|
this._tabsPlacement = ele.getAttribute('tabsplacement');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ele = ele.parentElement;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tabs top
|
|
|
|
if (this._tabs && this._tabsPlacement === 'top') {
|
|
|
|
this._tTop = this._hdrHeight;
|
|
|
|
tabsTop = this._tabs._top;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Toolbar height
|
|
|
|
this._cTop = this._hdrHeight;
|
|
|
|
this._cBottom = this._ftrHeight;
|
|
|
|
|
|
|
|
// Tabs height
|
|
|
|
if (this._tabsPlacement === 'top') {
|
|
|
|
this._cTop += this._tabbarHeight;
|
|
|
|
|
|
|
|
} else if (this._tabsPlacement === 'bottom') {
|
|
|
|
this._cBottom += this._tabbarHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Refresher uses a border which should be hidden unless pulled
|
|
|
|
if (this._hasRefresher) {
|
|
|
|
this._cTop -= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Fixed content shouldn't include content padding
|
|
|
|
this._fTop = this._cTop;
|
|
|
|
this._fBottom = this._cBottom;
|
|
|
|
|
|
|
|
// Handle fullscreen viewport (padding vs margin)
|
|
|
|
if (this._fullscreen) {
|
|
|
|
this._cTop += this._pTop;
|
|
|
|
this._cBottom += this._pBottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ******** DOM READ ****************
|
|
|
|
const contentDimensions = this.getContentDimensions();
|
|
|
|
scrollEvent.scrollHeight = contentDimensions.scrollHeight;
|
|
|
|
scrollEvent.scrollWidth = contentDimensions.scrollWidth;
|
|
|
|
scrollEvent.contentHeight = contentDimensions.contentHeight;
|
|
|
|
scrollEvent.contentWidth = contentDimensions.contentWidth;
|
|
|
|
scrollEvent.contentTop = contentDimensions.contentTop;
|
|
|
|
scrollEvent.contentBottom = contentDimensions.contentBottom;
|
|
|
|
|
|
|
|
this._dirty = (
|
|
|
|
cachePaddingTop !== this._pTop ||
|
|
|
|
cachePaddingBottom !== this._pBottom ||
|
|
|
|
cachePaddingLeft !== this._pLeft ||
|
|
|
|
cachePaddingRight !== this._pRight ||
|
|
|
|
cacheHeaderHeight !== this._hdrHeight ||
|
|
|
|
cacheFooterHeight !== this._ftrHeight ||
|
|
|
|
cacheTabsPlacement !== this._tabsPlacement ||
|
|
|
|
tabsTop !== this._tTop ||
|
|
|
|
this._cTop !== this.contentTop ||
|
|
|
|
this._cBottom !== this.contentBottom
|
|
|
|
);
|
|
|
|
|
|
|
|
this._scroll.init(this.getScrollElement(), this._cTop, this._cBottom);
|
|
|
|
|
|
|
|
// Initial imgs refresh.
|
|
|
|
this.imgsUpdate();
|
|
|
|
};
|
2017-11-07 12:01:32 +00:00
|
|
|
}
|
|
|
|
}
|