Merge pull request #2609 from NoelDeMartin/MOBILE-3320
MOBILE-3320: Refactor folder structure and extract modulesmain
commit
4c7545fb46
|
@ -93,7 +93,8 @@
|
|||
"options": {
|
||||
"lintFilePatterns": [
|
||||
"src/**/*.ts",
|
||||
"src/app/**/*.html"
|
||||
"src/core/**/*.html",
|
||||
"src/addons/**/*.html"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -18,15 +18,14 @@ const { resolve } = require('path');
|
|||
|
||||
module.exports = config => {
|
||||
config.resolve.alias['@'] = resolve('src');
|
||||
config.resolve.alias['@addon'] = resolve('src/app/addon');
|
||||
config.resolve.alias['@app'] = resolve('src/app');
|
||||
config.resolve.alias['@classes'] = resolve('src/app/classes');
|
||||
config.resolve.alias['@components'] = resolve('src/app/components');
|
||||
config.resolve.alias['@core'] = resolve('src/app/core');
|
||||
config.resolve.alias['@directives'] = resolve('src/app/directives');
|
||||
config.resolve.alias['@pipes'] = resolve('src/app/pipes');
|
||||
config.resolve.alias['@services'] = resolve('src/app/services');
|
||||
config.resolve.alias['@singletons'] = resolve('src/app/singletons');
|
||||
config.resolve.alias['@classes'] = resolve('src/core/classes');
|
||||
config.resolve.alias['@components'] = resolve('src/core/components');
|
||||
config.resolve.alias['@directives'] = resolve('src/core/directives');
|
||||
config.resolve.alias['@features'] = resolve('src/core/features');
|
||||
config.resolve.alias['@guards'] = resolve('src/core/guards');
|
||||
config.resolve.alias['@pipes'] = resolve('src/core/pipes');
|
||||
config.resolve.alias['@services'] = resolve('src/core/services');
|
||||
config.resolve.alias['@singletons'] = resolve('src/core/singletons');
|
||||
|
||||
config.plugins.push(
|
||||
new webpack.DefinePlugin({
|
||||
|
|
|
@ -136,48 +136,36 @@ class BuildLangTask {
|
|||
treatMergedData(data) {
|
||||
const merged = {};
|
||||
const mergedOrdered = {};
|
||||
const getPrefix = (path) => {
|
||||
const folders = path.split(/[\/\\]/);
|
||||
|
||||
switch (folders[0]) {
|
||||
case 'core':
|
||||
switch (folders[1]) {
|
||||
case 'lang':
|
||||
return 'core.';
|
||||
case 'features':
|
||||
return `core.${folders[2]}.`;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'addons':
|
||||
return `addon.${folders.slice(1, -2).join('_')}.`;
|
||||
case 'assets':
|
||||
return `assets.${folders[1]}.`;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
for (let filepath in data) {
|
||||
|
||||
const pathSplit = filepath.split(/[\/\\]/);
|
||||
let prefix;
|
||||
|
||||
pathSplit.pop();
|
||||
|
||||
switch (pathSplit[0]) {
|
||||
case 'lang':
|
||||
prefix = 'core';
|
||||
break;
|
||||
case 'core':
|
||||
if (pathSplit[1] == 'lang') {
|
||||
// Not used right now.
|
||||
prefix = 'core';
|
||||
} else {
|
||||
prefix = 'core.' + pathSplit[1];
|
||||
}
|
||||
break;
|
||||
case 'addon':
|
||||
// Remove final item 'lang'.
|
||||
pathSplit.pop();
|
||||
// Remove first item 'addon'.
|
||||
pathSplit.shift();
|
||||
|
||||
// For subplugins. We'll use plugin_subfolder_subfolder2_...
|
||||
// E.g. 'mod_assign_feedback_comments'.
|
||||
prefix = 'addon.' + pathSplit.join('_');
|
||||
break;
|
||||
case 'assets':
|
||||
prefix = 'assets.' + pathSplit[1];
|
||||
break;
|
||||
}
|
||||
const prefix = getPrefix(filepath);
|
||||
|
||||
if (prefix) {
|
||||
this.addProperties(merged, data[filepath], prefix + '.');
|
||||
this.addProperties(merged, data[filepath], prefix);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Force ordering by string key.
|
||||
Object.keys(merged).sort().forEach((key) => {
|
||||
mergedOrdered[key] = merged[key];
|
||||
|
|
11
gulpfile.js
11
gulpfile.js
|
@ -19,13 +19,12 @@ const gulp = require('gulp');
|
|||
|
||||
const paths = {
|
||||
lang: [
|
||||
'./src/app/lang/',
|
||||
'./src/app/core/**/lang/',
|
||||
'./src/app/addon/**/lang/',
|
||||
'./src/app/**/**/lang/',
|
||||
'./src/addons/**/lang/',
|
||||
'./src/assets/countries/',
|
||||
'./src/assets/mimetypes/'
|
||||
]
|
||||
'./src/assets/mimetypes/',
|
||||
'./src/core/features/**/lang/',
|
||||
'./src/core/lang/',
|
||||
],
|
||||
};
|
||||
|
||||
const args = Utils.getCommandLineArguments();
|
||||
|
|
|
@ -3,11 +3,11 @@ const { compilerOptions } = require('./tsconfig');
|
|||
|
||||
module.exports = {
|
||||
preset: 'jest-preset-angular',
|
||||
setupFilesAfterEnv: ['<rootDir>/src/tests/setup.ts'],
|
||||
setupFilesAfterEnv: ['<rootDir>/src/testing/setup.ts'],
|
||||
testMatch: ['**/?(*.)test.ts'],
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.{ts,html}',
|
||||
'!src/tests/**/*',
|
||||
'!src/testing/**/*',
|
||||
],
|
||||
transform: {
|
||||
'^.+\\.(ts|html)$': 'ts-jest',
|
||||
|
|
|
@ -12,10 +12,13 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
/**
|
||||
* Prevents Angular change detection from
|
||||
* running with certain Web Component callbacks
|
||||
*/
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
window.__Zone_disable_customElements = true;
|
||||
import { AddonPrivateFilesInitModule } from './privatefiles/privatefiles-init.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
AddonPrivateFilesInitModule,
|
||||
],
|
||||
})
|
||||
export class AddonsModule {}
|
|
@ -29,9 +29,9 @@ import {
|
|||
AddonPrivateFilesFile,
|
||||
AddonPrivateFilesGetUserInfoWSResult,
|
||||
AddonPrivateFilesGetFilesWSParams,
|
||||
} from '@addon/privatefiles/services/privatefiles';
|
||||
import { AddonPrivateFilesHelper } from '@addon/privatefiles/services/privatefiles.helper';
|
||||
import { CoreUtils } from '@/app/services/utils/utils';
|
||||
} from '@/addons/privatefiles/services/privatefiles';
|
||||
import { AddonPrivateFilesHelper } from '@/addons/privatefiles/services/privatefiles.helper';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
|
||||
/**
|
||||
* Page that displays the list of files.
|
|
@ -15,14 +15,14 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
import { CoreMainMenuDelegate } from '@core/mainmenu/services/mainmenu.delegate';
|
||||
import { CoreMainMenuRoutingModule } from '@core/mainmenu/mainmenu-routing.module';
|
||||
import { CoreMainMenuDelegate } from '@features/mainmenu/services/mainmenu.delegate';
|
||||
import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module';
|
||||
import { AddonPrivateFilesMainMenuHandler } from './services/handlers/mainmenu';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'addon-privatefiles',
|
||||
loadChildren: () => import('@addon/privatefiles/privatefiles.module').then(m => m.AddonPrivateFilesModule),
|
||||
loadChildren: () => import('@/addons/privatefiles/privatefiles.module').then(m => m.AddonPrivateFilesModule),
|
||||
},
|
||||
];
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@core/mainmenu/services/mainmenu.delegate';
|
||||
import { AddonPrivateFiles } from '@addon/privatefiles/services/privatefiles';
|
||||
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@features/mainmenu/services/mainmenu.delegate';
|
||||
import { AddonPrivateFiles } from '@/addons/privatefiles/services/privatefiles';
|
||||
|
||||
/**
|
||||
* Handler to inject an option into main menu.
|
|
@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
|
|||
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreFileUploaderHelper } from '@core/fileuploader/services/fileuploader.helper';
|
||||
import { CoreFileUploaderHelper } from '@features/fileuploader/services/fileuploader.helper';
|
||||
import { AddonPrivateFiles, AddonPrivateFilesGetUserInfoWSResult } from './privatefiles';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { makeSingleton, Translate } from '@singletons/core.singletons';
|
|
@ -20,15 +20,15 @@ import { AuthGuard } from '@guards/auth.guard';
|
|||
const routes: Routes = [
|
||||
{
|
||||
path: 'login',
|
||||
loadChildren: () => import('./core/login/login.module').then( m => m.CoreLoginModule),
|
||||
loadChildren: () => import('@features/login/login.module').then( m => m.CoreLoginModule),
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
loadChildren: () => import('./core/settings/settings.module').then( m => m.CoreSettingsModule),
|
||||
loadChildren: () => import('@features/settings/settings.module').then( m => m.CoreSettingsModule),
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('./core/mainmenu/mainmenu.module').then( m => m.CoreMainMenuModule),
|
||||
loadChildren: () => import('@features/mainmenu/mainmenu.module').then( m => m.CoreMainMenuModule),
|
||||
canActivate: [AuthGuard],
|
||||
canLoad: [AuthGuard],
|
||||
},
|
||||
|
|
|
@ -12,13 +12,15 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { NavController } from '@ionic/angular';
|
||||
|
||||
import { AppComponent } from '@app/app.component';
|
||||
import { AppComponent } from '@/app/app.component';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreLangProvider } from '@services/lang';
|
||||
import { Network, Platform, NgZone } from '@singletons/core.singletons';
|
||||
|
||||
import { mock, renderComponent, RenderConfig } from '@/tests/utils';
|
||||
import { mock, mockSingleton, renderComponent, RenderConfig } from '@/testing/utils';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
|
||||
|
@ -27,6 +29,10 @@ describe('AppComponent', () => {
|
|||
let config: Partial<RenderConfig>;
|
||||
|
||||
beforeEach(() => {
|
||||
mockSingleton(Network, { onChange: () => new Observable() });
|
||||
mockSingleton(Platform, { ready: () => Promise.resolve() });
|
||||
mockSingleton(NgZone, { run: jest.fn() });
|
||||
|
||||
langProvider = mock<CoreLangProvider>(['clearCustomStrings']);
|
||||
navController = mock<NavController>(['navigateRoot']);
|
||||
config = {
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Component, OnInit } from '@angular/core';
|
|||
import { NavController } from '@ionic/angular';
|
||||
|
||||
import { CoreLangProvider } from '@services/lang';
|
||||
import { CoreLoginHelperProvider } from '@core/login/services/login.helper';
|
||||
import { CoreLoginHelperProvider } from '@features/login/services/login.helper';
|
||||
import { CoreEvents, CoreEventSessionExpiredData } from '@singletons/events';
|
||||
import { Network, NgZone, Platform } from '@singletons/core.singletons';
|
||||
import { CoreApp } from '@services/app';
|
||||
|
|
|
@ -12,65 +12,22 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { NgModule, Injector } from '@angular/core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { RouteReuseStrategy } from '@angular/router';
|
||||
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
|
||||
import { IonicModule, IonicRouteStrategy, Platform } from '@ionic/angular';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { CoreInterceptor } from '@classes/interceptor';
|
||||
|
||||
// Import core services.
|
||||
import { CoreAppProvider } from '@services/app';
|
||||
import { CoreConfigProvider } from '@services/config';
|
||||
import { CoreCronDelegate } from '@services/cron';
|
||||
import { CoreDbProvider } from '@services/db';
|
||||
import { CoreFileHelperProvider } from '@services/file-helper';
|
||||
import { CoreFileSessionProvider } from '@services/file-session';
|
||||
import { CoreFileProvider, CoreFile } from '@services/file';
|
||||
import { CoreFilepoolProvider } from '@services/filepool';
|
||||
import { CoreGeolocationProvider } from '@services/geolocation';
|
||||
import { CoreGroupsProvider } from '@services/groups';
|
||||
import { CoreInitDelegate, CoreInit } from '@services/init';
|
||||
import { CoreLangProvider } from '@services/lang';
|
||||
import { CoreLocalNotificationsProvider } from '@services/local-notifications';
|
||||
import { CorePluginFileDelegate } from '@services/plugin-file.delegate';
|
||||
import { CoreSitesProvider, CoreSites } from '@services/sites';
|
||||
import { CoreSyncProvider } from '@services/sync';
|
||||
import { CoreUpdateManagerProvider, CoreUpdateManager } from '@services/update-manager';
|
||||
import { CoreWSProvider } from '@services/ws';
|
||||
import { CoreDomUtilsProvider } from '@services/utils/dom';
|
||||
import { CoreIframeUtilsProvider } from '@services/utils/iframe';
|
||||
import { CoreMimetypeUtilsProvider } from '@services/utils/mimetype';
|
||||
import { CoreTextUtilsProvider } from '@services/utils/text';
|
||||
import { CoreTimeUtilsProvider } from '@services/utils/time';
|
||||
import { CoreUrlUtilsProvider } from '@services/utils/url';
|
||||
import { CoreUtilsProvider } from '@services/utils/utils';
|
||||
|
||||
// Import init DB functions of core services.
|
||||
import { initCoreFilepoolDB } from '@services/filepool.db';
|
||||
import { initCoreSitesDB } from '@services/sites.db';
|
||||
import { initCoreSyncDB } from '@services/sync.db';
|
||||
import { initCoreSearchHistoryDB } from '@core/search/services/search.history.db';
|
||||
|
||||
// Import core modules.
|
||||
import { CoreEmulatorModule } from '@core/emulator/emulator.module';
|
||||
import { CoreLoginModule } from '@core/login/login.module';
|
||||
import { CoreCoursesModule } from '@core/courses/courses.module';
|
||||
import { CoreSettingsInitModule } from '@core/settings/settings-init.module';
|
||||
import { CoreFileUploaderInitModule } from '@core/fileuploader/fileuploader-init.module';
|
||||
|
||||
// Import addons init modules.
|
||||
import { AddonPrivateFilesInitModule } from '@addon/privatefiles/privatefiles-init.module';
|
||||
|
||||
import { setSingletonsInjector } from '@singletons/core.singletons';
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
|
||||
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
|
||||
|
||||
import { CoreModule } from '@/core/core.module';
|
||||
import { AddonsModule } from '@/addons/addons.module';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
// For translate loader. AoT requires an exported function for factories.
|
||||
export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
||||
return new TranslateHttpLoader(http, './assets/lang/', '.json');
|
||||
|
@ -91,93 +48,12 @@ export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
|||
},
|
||||
}),
|
||||
AppRoutingModule,
|
||||
CoreEmulatorModule,
|
||||
CoreLoginModule,
|
||||
CoreCoursesModule,
|
||||
CoreSettingsInitModule,
|
||||
CoreFileUploaderInitModule,
|
||||
AddonPrivateFilesInitModule,
|
||||
CoreModule,
|
||||
AddonsModule,
|
||||
],
|
||||
providers: [
|
||||
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: CoreInterceptor, multi: true },
|
||||
CoreAppProvider,
|
||||
CoreConfigProvider,
|
||||
CoreCronDelegate,
|
||||
CoreDbProvider,
|
||||
CoreFileHelperProvider,
|
||||
CoreFileSessionProvider,
|
||||
CoreFileProvider,
|
||||
CoreFilepoolProvider,
|
||||
CoreGeolocationProvider,
|
||||
CoreGroupsProvider,
|
||||
CoreInitDelegate,
|
||||
CoreLangProvider,
|
||||
CoreLocalNotificationsProvider,
|
||||
CorePluginFileDelegate,
|
||||
CoreSitesProvider,
|
||||
CoreSyncProvider,
|
||||
CoreUpdateManagerProvider,
|
||||
CoreWSProvider,
|
||||
CoreDomUtilsProvider,
|
||||
CoreIframeUtilsProvider,
|
||||
CoreMimetypeUtilsProvider,
|
||||
CoreTextUtilsProvider,
|
||||
CoreTimeUtilsProvider,
|
||||
CoreUrlUtilsProvider,
|
||||
CoreUtilsProvider,
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {
|
||||
|
||||
constructor(injector: Injector, platform: Platform) {
|
||||
// Set the injector.
|
||||
setSingletonsInjector(injector);
|
||||
|
||||
this.initCoreServicesDB();
|
||||
|
||||
// Register a handler for platform ready.
|
||||
CoreInit.instance.registerProcess({
|
||||
name: 'CorePlatformReady',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 400,
|
||||
blocking: true,
|
||||
load: async () => {
|
||||
await platform.ready();
|
||||
},
|
||||
});
|
||||
|
||||
// Register the update manager as an init process.
|
||||
CoreInit.instance.registerProcess(CoreUpdateManager.instance);
|
||||
|
||||
// Restore the user's session during the init process.
|
||||
CoreInit.instance.registerProcess({
|
||||
name: 'CoreRestoreSession',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 200,
|
||||
blocking: false,
|
||||
load: CoreSites.instance.restoreSession.bind(CoreSites.instance),
|
||||
});
|
||||
|
||||
// Register clear app tmp folder.
|
||||
CoreInit.instance.registerProcess({
|
||||
name: 'CoreClearTmpFolder',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 150,
|
||||
blocking: false,
|
||||
load: CoreFile.instance.clearTmpFolder.bind(CoreFile.instance),
|
||||
});
|
||||
|
||||
// Execute the init processes.
|
||||
CoreInit.instance.executeInitProcesses();
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the DB of core services.
|
||||
*/
|
||||
protected initCoreServicesDB(): void {
|
||||
initCoreFilepoolDB();
|
||||
initCoreSitesDB();
|
||||
initCoreSyncDB();
|
||||
initCoreSearchHistoryDB();
|
||||
}
|
||||
|
||||
}
|
||||
export class AppModule {}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { CoreEvents } from '../singletons/events';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreDelegate, CoreDelegateDisplayHandler, CoreDelegateToDisplay } from './delegate';
|
||||
|
||||
/**
|
||||
|
@ -101,4 +101,3 @@ export class CoreSortedDelegate<
|
|||
}
|
||||
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ describe('CoreError', () => {
|
|||
expect(error!.name).toEqual('CoreError');
|
||||
expect(error!.message).toEqual(message);
|
||||
expect(error!.stack).not.toBeNull();
|
||||
expect(error!.stack).toContain('src/app/classes/error.test.ts');
|
||||
expect(error!.stack).toContain('src/core/classes/error.test.ts');
|
||||
});
|
||||
|
||||
it('can be subclassed', () => {
|
||||
|
@ -70,7 +70,7 @@ describe('CoreError', () => {
|
|||
expect(error!.name).toEqual('CustomCoreError');
|
||||
expect(error!.message).toEqual(`Custom message: ${message}`);
|
||||
expect(error!.stack).not.toBeNull();
|
||||
expect(error!.stack).toContain('src/app/classes/error.test.ts');
|
||||
expect(error!.stack).toContain('src/core/classes/error.test.ts');
|
||||
});
|
||||
|
||||
});
|
|
@ -32,7 +32,7 @@ import { CoreTextUtils } from '@services/utils/text';
|
|||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreUrlUtils, CoreUrlParams } from '@services/utils/url';
|
||||
import { CoreUtils, PromiseDefer } from '@services/utils/utils';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
import { SQLiteDB } from '@classes/sqlitedb';
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreWSError } from '@classes/errors/wserror';
|
|
@ -31,8 +31,8 @@ import { CoreShowPasswordComponent } from './show-password/show-password';
|
|||
import { CoreEmptyBoxComponent } from './empty-box/empty-box';
|
||||
import { CoreTabsComponent } from './tabs/tabs';
|
||||
|
||||
import { CoreDirectivesModule } from '@app/directives/directives.module';
|
||||
import { CorePipesModule } from '@app/pipes/pipes.module';
|
||||
import { CoreDirectivesModule } from '@directives/directives.module';
|
||||
import { CorePipesModule } from '@pipes/pipes.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
|
@ -13,7 +13,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
|
||||
/**
|
||||
* Component to show a download button with refresh option, the spinner and the status of it.
|
|
@ -23,9 +23,9 @@ import { CoreMimetypeUtils } from '@services/utils/mimetype';
|
|||
import { CoreUrlUtils } from '@services/utils/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||
import { CoreWSExternalFile } from '@/app/services/ws';
|
||||
import { CoreWSExternalFile } from '@services/ws';
|
||||
|
||||
/**
|
||||
* Component to handle a remote file. Shows the file name, icon (depending on mimetype) and a button
|
|
@ -29,8 +29,8 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Subscription } from 'rxjs';
|
||||
import { CoreApp } from '@services/app';
|
||||
import { CoreConfig } from '@services/config';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreUtils } from '@/app/services/utils/utils';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { NavigationOptions } from '@ionic/angular/providers/nav-controller';
|
||||
import { Params } from '@angular/router';
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { CoreIconComponent } from '@components/icon/icon';
|
||||
|
||||
import { renderWrapperComponent } from '@/tests/utils';
|
||||
import { renderWrapperComponent } from '@/testing/utils';
|
||||
|
||||
describe('CoreIconComponent', () => {
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
// (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 { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { Injector, NgModule } from '@angular/core';
|
||||
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
import { CoreFeaturesModule } from './features/features.module';
|
||||
import { CoreFile } from './services/file';
|
||||
import { CoreInit, CoreInitDelegate } from './services/init';
|
||||
import { CoreInterceptor } from './classes/interceptor';
|
||||
import { CoreSites, CORE_SITE_SCHEMAS } from './services/sites';
|
||||
import { CoreUpdateManager } from './services/update-manager';
|
||||
import { setSingletonsInjector } from './singletons/core.singletons';
|
||||
import { SITE_SCHEMA as FILEPOOL_SITE_SCHEMA } from './services/filepool-db';
|
||||
import { SITE_SCHEMA as SITES_SITE_SCHEMA } from './services/sites-db';
|
||||
import { SITE_SCHEMA as SYNC_SITE_SCHEMA } from './services/sync-db';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CoreFeaturesModule,
|
||||
],
|
||||
providers: [
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: CoreInterceptor, multi: true },
|
||||
{
|
||||
provide: CORE_SITE_SCHEMAS,
|
||||
useValue: [
|
||||
FILEPOOL_SITE_SCHEMA,
|
||||
SITES_SITE_SCHEMA,
|
||||
SYNC_SITE_SCHEMA,
|
||||
],
|
||||
multi: true,
|
||||
},
|
||||
],
|
||||
})
|
||||
export class CoreModule {
|
||||
|
||||
constructor(platform: Platform, injector: Injector) {
|
||||
// Set the injector.
|
||||
setSingletonsInjector(injector);
|
||||
|
||||
// Register a handler for platform ready.
|
||||
CoreInit.instance.registerProcess({
|
||||
name: 'CorePlatformReady',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 400,
|
||||
blocking: true,
|
||||
load: async () => {
|
||||
await platform.ready();
|
||||
},
|
||||
});
|
||||
|
||||
// Register the update manager as an init process.
|
||||
CoreInit.instance.registerProcess(CoreUpdateManager.instance);
|
||||
|
||||
// Restore the user's session during the init process.
|
||||
CoreInit.instance.registerProcess({
|
||||
name: 'CoreRestoreSession',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 200,
|
||||
blocking: false,
|
||||
load: CoreSites.instance.restoreSession.bind(CoreSites.instance),
|
||||
});
|
||||
|
||||
// Register clear app tmp folder.
|
||||
CoreInit.instance.registerProcess({
|
||||
name: 'CoreClearTmpFolder',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 150,
|
||||
blocking: false,
|
||||
load: CoreFile.instance.clearTmpFolder.bind(CoreFile.instance),
|
||||
});
|
||||
|
||||
// Execute the init processes.
|
||||
CoreInit.instance.executeInitProcesses();
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
import { Directive, ElementRef, Input, OnChanges, SimpleChange } from '@angular/core';
|
||||
import { CoreLogger } from '@singletons/logger';
|
||||
import { Http } from '@singletons/core.singletons';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
|
||||
/**
|
||||
* Directive to enable font-awesome 5 as ionicons.
|
|
@ -21,7 +21,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { CoreUrlUtils } from '@services/utils/url';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreTextUtils } from '@services/utils/text';
|
||||
import { CoreConstants } from '@core/constants';
|
||||
import { CoreConstants } from '@/core/constants';
|
||||
|
||||
/**
|
||||
* Directive to open a link in external browser or in the app.
|
|
@ -27,7 +27,7 @@ import { CoreUrlUtils, CoreUrlUtilsProvider } from '@services/utils/url';
|
|||
import { CoreUtils, CoreUtilsProvider } from '@services/utils/utils';
|
||||
import { Platform } from '@singletons/core.singletons';
|
||||
|
||||
import { mock, mockSingleton, RenderConfig, renderWrapperComponent } from '@/tests/utils';
|
||||
import { mock, mockSingleton, RenderConfig, renderWrapperComponent } from '@/testing/utils';
|
||||
|
||||
describe('CoreFormatTextDirective', () => {
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { CoreLinkDirective } from '@directives/link';
|
||||
|
||||
import { renderTemplate } from '@/tests/utils';
|
||||
import { renderTemplate } from '@/testing/utils';
|
||||
|
||||
describe('CoreLinkDirective', () => {
|
||||
|
|
@ -16,7 +16,7 @@ import { CoreContentLinksAction } from '../services/contentlinks.delegate';
|
|||
import { CoreContentLinksHandlerBase } from './base-handler';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
// import { CoreCourseHelperProvider } from '@core/course/providers/helper';
|
||||
// import { CoreCourseHelperProvider } from '@features/course/providers/helper';
|
||||
import { Params } from '@angular/router';
|
||||
|
||||
/**
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
import { CoreContentLinksHelper } from '../services/contentlinks.helper';
|
||||
import { CoreContentLinksHandlerBase } from './base-handler';
|
||||
import { Translate } from '@/app/singletons/core.singletons';
|
||||
import { Translate } from '@singletons/core.singletons';
|
||||
import { Params } from '@angular/router';
|
||||
import { CoreContentLinksAction } from '../services/contentlinks.delegate';
|
||||
|
|
@ -17,7 +17,7 @@ import { NavController } from '@ionic/angular';
|
|||
import { CoreSiteBasicInfo, CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { Translate } from '@singletons/core.singletons';
|
||||
import { CoreLoginHelper } from '@core/login/services/login.helper';
|
||||
import { CoreLoginHelper } from '@features/login/services/login.helper';
|
||||
import { CoreContentLinksAction } from '../../services/contentlinks.delegate';
|
||||
import { CoreContentLinksHelper } from '../../services/contentlinks.helper';
|
||||
import { ActivatedRoute } from '@angular/router';
|
|
@ -17,10 +17,10 @@ import { NavController } from '@ionic/angular';
|
|||
import { CoreSites } from '@services/sites';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreLoginHelper } from '@core/login/services/login.helper';
|
||||
import { CoreLoginHelper } from '@features/login/services/login.helper';
|
||||
import { CoreContentLinksDelegate, CoreContentLinksAction } from './contentlinks.delegate';
|
||||
import { CoreSite } from '@classes/site';
|
||||
import { CoreMainMenu } from '@core/mainmenu/services/mainmenu';
|
||||
import { CoreMainMenu } from '@features/mainmenu/services/mainmenu';
|
||||
import { makeSingleton, NgZone, Translate } from '@singletons/core.singletons';
|
||||
import { Params } from '@angular/router';
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue