diff --git a/angular.json b/angular.json index 7bbf70116..b7952db75 100644 --- a/angular.json +++ b/angular.json @@ -93,7 +93,8 @@ "options": { "lintFilePatterns": [ "src/**/*.ts", - "src/app/**/*.html" + "src/core/**/*.html", + "src/addons/**/*.html" ] } }, diff --git a/config/webpack.config.js b/config/webpack.config.js index 8a850f580..27266089c 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -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({ diff --git a/gulp/task-build-lang.js b/gulp/task-build-lang.js index 980bf52a4..5927aa535 100644 --- a/gulp/task-build-lang.js +++ b/gulp/task-build-lang.js @@ -136,47 +136,35 @@ class BuildLangTask { treatMergedData(data) { const merged = {}; const mergedOrdered = {}; + const getPrefix = (path) => { + const folders = path.split(/[\/\\]/); - for (let filepath in data) { - - const pathSplit = filepath.split(/[\/\\]/); - let prefix; - - pathSplit.pop(); - - switch (pathSplit[0]) { - case 'lang': - prefix = 'core'; - break; + switch (folders[0]) { case 'core': - if (pathSplit[1] == 'lang') { - // Not used right now. - prefix = 'core'; - } else { - prefix = 'core.' + pathSplit[1]; + switch (folders[1]) { + case 'lang': + return 'core.'; + case 'features': + return `core.${folders[2]}.`; } - 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 'addons': + return `addon.${folders.slice(1, -2).join('_')}.`; case 'assets': - prefix = 'assets.' + pathSplit[1]; - break; + return `assets.${folders[1]}.`; } - if (prefix) { - this.addProperties(merged, data[filepath], prefix + '.'); - } + return null; } + for (let filepath in data) { + const prefix = getPrefix(filepath); + if (prefix) { + this.addProperties(merged, data[filepath], prefix); + } + } // Force ordering by string key. Object.keys(merged).sort().forEach((key) => { diff --git a/gulpfile.js b/gulpfile.js index 7a08d6c88..e8efdd7a6 100644 --- a/gulpfile.js +++ b/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(); diff --git a/jest.config.js b/jest.config.js index 255dd66b3..f464ae96e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,11 +3,11 @@ const { compilerOptions } = require('./tsconfig'); module.exports = { preset: 'jest-preset-angular', - setupFilesAfterEnv: ['/src/tests/setup.ts'], + setupFilesAfterEnv: ['/src/testing/setup.ts'], testMatch: ['**/?(*.)test.ts'], collectCoverageFrom: [ 'src/**/*.{ts,html}', - '!src/tests/**/*', + '!src/testing/**/*', ], transform: { '^.+\\.(ts|html)$': 'ts-jest', diff --git a/src/zone-flags.ts b/src/addons/addons.module.ts similarity index 71% rename from src/zone-flags.ts rename to src/addons/addons.module.ts index 2ebf40170..c73da06f0 100644 --- a/src/zone-flags.ts +++ b/src/addons/addons.module.ts @@ -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 {} diff --git a/src/app/addon/privatefiles/lang/en.json b/src/addons/privatefiles/lang/en.json similarity index 100% rename from src/app/addon/privatefiles/lang/en.json rename to src/addons/privatefiles/lang/en.json diff --git a/src/app/addon/privatefiles/pages/index/index.html b/src/addons/privatefiles/pages/index/index.html similarity index 100% rename from src/app/addon/privatefiles/pages/index/index.html rename to src/addons/privatefiles/pages/index/index.html diff --git a/src/app/addon/privatefiles/pages/index/index.page.module.ts b/src/addons/privatefiles/pages/index/index.page.module.ts similarity index 100% rename from src/app/addon/privatefiles/pages/index/index.page.module.ts rename to src/addons/privatefiles/pages/index/index.page.module.ts diff --git a/src/app/addon/privatefiles/pages/index/index.page.ts b/src/addons/privatefiles/pages/index/index.page.ts similarity index 97% rename from src/app/addon/privatefiles/pages/index/index.page.ts rename to src/addons/privatefiles/pages/index/index.page.ts index ca20a6df2..d6c6c868c 100644 --- a/src/app/addon/privatefiles/pages/index/index.page.ts +++ b/src/addons/privatefiles/pages/index/index.page.ts @@ -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. diff --git a/src/app/addon/privatefiles/privatefiles-init.module.ts b/src/addons/privatefiles/privatefiles-init.module.ts similarity index 81% rename from src/app/addon/privatefiles/privatefiles-init.module.ts rename to src/addons/privatefiles/privatefiles-init.module.ts index b09af1fd2..8c7c3d67b 100644 --- a/src/app/addon/privatefiles/privatefiles-init.module.ts +++ b/src/addons/privatefiles/privatefiles-init.module.ts @@ -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), }, ]; diff --git a/src/app/addon/privatefiles/privatefiles-routing.module.ts b/src/addons/privatefiles/privatefiles-routing.module.ts similarity index 100% rename from src/app/addon/privatefiles/privatefiles-routing.module.ts rename to src/addons/privatefiles/privatefiles-routing.module.ts diff --git a/src/app/addon/privatefiles/privatefiles.module.ts b/src/addons/privatefiles/privatefiles.module.ts similarity index 100% rename from src/app/addon/privatefiles/privatefiles.module.ts rename to src/addons/privatefiles/privatefiles.module.ts diff --git a/src/app/addon/privatefiles/services/handlers/mainmenu.ts b/src/addons/privatefiles/services/handlers/mainmenu.ts similarity index 88% rename from src/app/addon/privatefiles/services/handlers/mainmenu.ts rename to src/addons/privatefiles/services/handlers/mainmenu.ts index d7c5c33d5..f3859f456 100644 --- a/src/app/addon/privatefiles/services/handlers/mainmenu.ts +++ b/src/addons/privatefiles/services/handlers/mainmenu.ts @@ -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. diff --git a/src/app/addon/privatefiles/services/privatefiles.helper.ts b/src/addons/privatefiles/services/privatefiles.helper.ts similarity index 96% rename from src/app/addon/privatefiles/services/privatefiles.helper.ts rename to src/addons/privatefiles/services/privatefiles.helper.ts index 2dbd3e5d9..e37992cc8 100644 --- a/src/app/addon/privatefiles/services/privatefiles.helper.ts +++ b/src/addons/privatefiles/services/privatefiles.helper.ts @@ -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'; diff --git a/src/app/addon/privatefiles/services/privatefiles.ts b/src/addons/privatefiles/services/privatefiles.ts similarity index 100% rename from src/app/addon/privatefiles/services/privatefiles.ts rename to src/addons/privatefiles/services/privatefiles.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 2a8d0f660..2bcc80750 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -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], }, diff --git a/src/app/app.component.test.ts b/src/app/app.component.test.ts index 9036f4b7b..f2f11836d 100644 --- a/src/app/app.component.test.ts +++ b/src/app/app.component.test.ts @@ -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; beforeEach(() => { + mockSingleton(Network, { onChange: () => new Observable() }); + mockSingleton(Platform, { ready: () => Promise.resolve() }); + mockSingleton(NgZone, { run: jest.fn() }); + langProvider = mock(['clearCustomStrings']); navController = mock(['navigateRoot']); config = { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index ce97f3c93..1bd3a63de 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -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'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 953bc83ef..0206d2dde 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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 {} diff --git a/src/app/classes/delegate-sorted.ts b/src/core/classes/delegate-sorted.ts similarity index 98% rename from src/app/classes/delegate-sorted.ts rename to src/core/classes/delegate-sorted.ts index 1b8c121e6..751573574 100644 --- a/src/app/classes/delegate-sorted.ts +++ b/src/core/classes/delegate-sorted.ts @@ -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< } } - diff --git a/src/app/classes/delegate.ts b/src/core/classes/delegate.ts similarity index 100% rename from src/app/classes/delegate.ts rename to src/core/classes/delegate.ts diff --git a/src/app/classes/error.test.ts b/src/core/classes/error.test.ts similarity index 93% rename from src/app/classes/error.test.ts rename to src/core/classes/error.test.ts index e7f0e9cf5..005da6c67 100644 --- a/src/app/classes/error.test.ts +++ b/src/core/classes/error.test.ts @@ -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'); }); }); diff --git a/src/app/classes/errors/ajaxerror.ts b/src/core/classes/errors/ajaxerror.ts similarity index 100% rename from src/app/classes/errors/ajaxerror.ts rename to src/core/classes/errors/ajaxerror.ts diff --git a/src/app/classes/errors/ajaxwserror.ts b/src/core/classes/errors/ajaxwserror.ts similarity index 100% rename from src/app/classes/errors/ajaxwserror.ts rename to src/core/classes/errors/ajaxwserror.ts diff --git a/src/app/classes/errors/cancelederror.ts b/src/core/classes/errors/cancelederror.ts similarity index 100% rename from src/app/classes/errors/cancelederror.ts rename to src/core/classes/errors/cancelederror.ts diff --git a/src/app/classes/errors/captureerror.ts b/src/core/classes/errors/captureerror.ts similarity index 100% rename from src/app/classes/errors/captureerror.ts rename to src/core/classes/errors/captureerror.ts diff --git a/src/app/classes/errors/error.ts b/src/core/classes/errors/error.ts similarity index 100% rename from src/app/classes/errors/error.ts rename to src/core/classes/errors/error.ts diff --git a/src/app/classes/errors/silenterror.ts b/src/core/classes/errors/silenterror.ts similarity index 100% rename from src/app/classes/errors/silenterror.ts rename to src/core/classes/errors/silenterror.ts diff --git a/src/app/classes/errors/siteerror.ts b/src/core/classes/errors/siteerror.ts similarity index 100% rename from src/app/classes/errors/siteerror.ts rename to src/core/classes/errors/siteerror.ts diff --git a/src/app/classes/errors/wserror.ts b/src/core/classes/errors/wserror.ts similarity index 100% rename from src/app/classes/errors/wserror.ts rename to src/core/classes/errors/wserror.ts diff --git a/src/app/classes/interceptor.ts b/src/core/classes/interceptor.ts similarity index 100% rename from src/app/classes/interceptor.ts rename to src/core/classes/interceptor.ts diff --git a/src/app/classes/ion-loading.ts b/src/core/classes/ion-loading.ts similarity index 100% rename from src/app/classes/ion-loading.ts rename to src/core/classes/ion-loading.ts diff --git a/src/app/classes/native-to-angular-http.ts b/src/core/classes/native-to-angular-http.ts similarity index 100% rename from src/app/classes/native-to-angular-http.ts rename to src/core/classes/native-to-angular-http.ts diff --git a/src/app/classes/queue-runner.ts b/src/core/classes/queue-runner.ts similarity index 100% rename from src/app/classes/queue-runner.ts rename to src/core/classes/queue-runner.ts diff --git a/src/app/classes/singletons-factory.ts b/src/core/classes/singletons-factory.ts similarity index 100% rename from src/app/classes/singletons-factory.ts rename to src/core/classes/singletons-factory.ts diff --git a/src/app/classes/site.ts b/src/core/classes/site.ts similarity index 99% rename from src/app/classes/site.ts rename to src/core/classes/site.ts index 9e875a91d..de721524d 100644 --- a/src/app/classes/site.ts +++ b/src/core/classes/site.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'; diff --git a/src/app/classes/sqlitedb.ts b/src/core/classes/sqlitedb.ts similarity index 100% rename from src/app/classes/sqlitedb.ts rename to src/core/classes/sqlitedb.ts diff --git a/src/app/components/chrono/chrono.ts b/src/core/components/chrono/chrono.ts similarity index 100% rename from src/app/components/chrono/chrono.ts rename to src/core/components/chrono/chrono.ts diff --git a/src/app/components/chrono/core-chrono.html b/src/core/components/chrono/core-chrono.html similarity index 100% rename from src/app/components/chrono/core-chrono.html rename to src/core/components/chrono/core-chrono.html diff --git a/src/app/components/components.module.ts b/src/core/components/components.module.ts similarity index 95% rename from src/app/components/components.module.ts rename to src/core/components/components.module.ts index b67263e6a..0137d6548 100644 --- a/src/app/components/components.module.ts +++ b/src/core/components/components.module.ts @@ -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: [ diff --git a/src/app/components/download-refresh/core-download-refresh.html b/src/core/components/download-refresh/core-download-refresh.html similarity index 100% rename from src/app/components/download-refresh/core-download-refresh.html rename to src/core/components/download-refresh/core-download-refresh.html diff --git a/src/app/components/download-refresh/download-refresh.scss b/src/core/components/download-refresh/download-refresh.scss similarity index 100% rename from src/app/components/download-refresh/download-refresh.scss rename to src/core/components/download-refresh/download-refresh.scss diff --git a/src/app/components/download-refresh/download-refresh.ts b/src/core/components/download-refresh/download-refresh.ts similarity index 97% rename from src/app/components/download-refresh/download-refresh.ts rename to src/core/components/download-refresh/download-refresh.ts index ad7b9d7c9..0b96d9102 100644 --- a/src/app/components/download-refresh/download-refresh.ts +++ b/src/core/components/download-refresh/download-refresh.ts @@ -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. diff --git a/src/app/components/empty-box/core-empty-box.html b/src/core/components/empty-box/core-empty-box.html similarity index 100% rename from src/app/components/empty-box/core-empty-box.html rename to src/core/components/empty-box/core-empty-box.html diff --git a/src/app/components/empty-box/empty-box.scss b/src/core/components/empty-box/empty-box.scss similarity index 100% rename from src/app/components/empty-box/empty-box.scss rename to src/core/components/empty-box/empty-box.scss diff --git a/src/app/components/empty-box/empty-box.ts b/src/core/components/empty-box/empty-box.ts similarity index 100% rename from src/app/components/empty-box/empty-box.ts rename to src/core/components/empty-box/empty-box.ts diff --git a/src/app/components/file/core-file.html b/src/core/components/file/core-file.html similarity index 100% rename from src/app/components/file/core-file.html rename to src/core/components/file/core-file.html diff --git a/src/app/components/file/file.scss b/src/core/components/file/file.scss similarity index 100% rename from src/app/components/file/file.scss rename to src/core/components/file/file.scss diff --git a/src/app/components/file/file.ts b/src/core/components/file/file.ts similarity index 98% rename from src/app/components/file/file.ts rename to src/core/components/file/file.ts index 7b006e8ae..5b73eabe7 100644 --- a/src/app/components/file/file.ts +++ b/src/core/components/file/file.ts @@ -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 diff --git a/src/app/components/icon/icon.scss b/src/core/components/icon/icon.scss similarity index 100% rename from src/app/components/icon/icon.scss rename to src/core/components/icon/icon.scss diff --git a/src/app/components/icon/icon.ts b/src/core/components/icon/icon.ts similarity index 100% rename from src/app/components/icon/icon.ts rename to src/core/components/icon/icon.ts diff --git a/src/app/components/iframe/core-iframe.html b/src/core/components/iframe/core-iframe.html similarity index 100% rename from src/app/components/iframe/core-iframe.html rename to src/core/components/iframe/core-iframe.html diff --git a/src/app/components/iframe/iframe.scss b/src/core/components/iframe/iframe.scss similarity index 100% rename from src/app/components/iframe/iframe.scss rename to src/core/components/iframe/iframe.scss diff --git a/src/app/components/iframe/iframe.ts b/src/core/components/iframe/iframe.ts similarity index 100% rename from src/app/components/iframe/iframe.ts rename to src/core/components/iframe/iframe.ts diff --git a/src/app/components/input-errors/core-input-errors.html b/src/core/components/input-errors/core-input-errors.html similarity index 100% rename from src/app/components/input-errors/core-input-errors.html rename to src/core/components/input-errors/core-input-errors.html diff --git a/src/app/components/input-errors/input-errors.scss b/src/core/components/input-errors/input-errors.scss similarity index 100% rename from src/app/components/input-errors/input-errors.scss rename to src/core/components/input-errors/input-errors.scss diff --git a/src/app/components/input-errors/input-errors.ts b/src/core/components/input-errors/input-errors.ts similarity index 100% rename from src/app/components/input-errors/input-errors.ts rename to src/core/components/input-errors/input-errors.ts diff --git a/src/app/components/loading/core-loading.html b/src/core/components/loading/core-loading.html similarity index 100% rename from src/app/components/loading/core-loading.html rename to src/core/components/loading/core-loading.html diff --git a/src/app/components/loading/loading.scss b/src/core/components/loading/loading.scss similarity index 100% rename from src/app/components/loading/loading.scss rename to src/core/components/loading/loading.scss diff --git a/src/app/components/loading/loading.ts b/src/core/components/loading/loading.ts similarity index 100% rename from src/app/components/loading/loading.ts rename to src/core/components/loading/loading.ts diff --git a/src/app/components/mark-required/core-mark-required.html b/src/core/components/mark-required/core-mark-required.html similarity index 100% rename from src/app/components/mark-required/core-mark-required.html rename to src/core/components/mark-required/core-mark-required.html diff --git a/src/app/components/mark-required/mark-required.scss b/src/core/components/mark-required/mark-required.scss similarity index 100% rename from src/app/components/mark-required/mark-required.scss rename to src/core/components/mark-required/mark-required.scss diff --git a/src/app/components/mark-required/mark-required.ts b/src/core/components/mark-required/mark-required.ts similarity index 100% rename from src/app/components/mark-required/mark-required.ts rename to src/core/components/mark-required/mark-required.ts diff --git a/src/app/components/recaptcha/core-recaptcha.html b/src/core/components/recaptcha/core-recaptcha.html similarity index 100% rename from src/app/components/recaptcha/core-recaptcha.html rename to src/core/components/recaptcha/core-recaptcha.html diff --git a/src/app/components/recaptcha/core-recaptchamodal.html b/src/core/components/recaptcha/core-recaptchamodal.html similarity index 100% rename from src/app/components/recaptcha/core-recaptchamodal.html rename to src/core/components/recaptcha/core-recaptchamodal.html diff --git a/src/app/components/recaptcha/recaptcha.ts b/src/core/components/recaptcha/recaptcha.ts similarity index 100% rename from src/app/components/recaptcha/recaptcha.ts rename to src/core/components/recaptcha/recaptcha.ts diff --git a/src/app/components/recaptcha/recaptchamodal.ts b/src/core/components/recaptcha/recaptchamodal.ts similarity index 100% rename from src/app/components/recaptcha/recaptchamodal.ts rename to src/core/components/recaptcha/recaptchamodal.ts diff --git a/src/app/components/show-password/core-show-password.html b/src/core/components/show-password/core-show-password.html similarity index 100% rename from src/app/components/show-password/core-show-password.html rename to src/core/components/show-password/core-show-password.html diff --git a/src/app/components/show-password/show-password.scss b/src/core/components/show-password/show-password.scss similarity index 100% rename from src/app/components/show-password/show-password.scss rename to src/core/components/show-password/show-password.scss diff --git a/src/app/components/show-password/show-password.ts b/src/core/components/show-password/show-password.ts similarity index 100% rename from src/app/components/show-password/show-password.ts rename to src/core/components/show-password/show-password.ts diff --git a/src/app/components/tabs/core-tabs.html b/src/core/components/tabs/core-tabs.html similarity index 100% rename from src/app/components/tabs/core-tabs.html rename to src/core/components/tabs/core-tabs.html diff --git a/src/app/components/tabs/tabs.scss b/src/core/components/tabs/tabs.scss similarity index 100% rename from src/app/components/tabs/tabs.scss rename to src/core/components/tabs/tabs.scss diff --git a/src/app/components/tabs/tabs.ts b/src/core/components/tabs/tabs.ts similarity index 99% rename from src/app/components/tabs/tabs.ts rename to src/core/components/tabs/tabs.ts index 10b3add1c..734139814 100644 --- a/src/app/components/tabs/tabs.ts +++ b/src/core/components/tabs/tabs.ts @@ -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'; diff --git a/src/app/components/tests/icon.test.ts b/src/core/components/tests/icon.test.ts similarity index 95% rename from src/app/components/tests/icon.test.ts rename to src/core/components/tests/icon.test.ts index 531bbc9fc..0153b35cc 100644 --- a/src/app/components/tests/icon.test.ts +++ b/src/core/components/tests/icon.test.ts @@ -14,7 +14,7 @@ import { CoreIconComponent } from '@components/icon/icon'; -import { renderWrapperComponent } from '@/tests/utils'; +import { renderWrapperComponent } from '@/testing/utils'; describe('CoreIconComponent', () => { diff --git a/src/app/components/tests/iframe.test.ts b/src/core/components/tests/iframe.test.ts similarity index 100% rename from src/app/components/tests/iframe.test.ts rename to src/core/components/tests/iframe.test.ts diff --git a/src/app/components/tests/user-avatar.test.ts b/src/core/components/tests/user-avatar.test.ts similarity index 100% rename from src/app/components/tests/user-avatar.test.ts rename to src/core/components/tests/user-avatar.test.ts diff --git a/src/app/core/constants.ts b/src/core/constants.ts similarity index 100% rename from src/app/core/constants.ts rename to src/core/constants.ts diff --git a/src/core/core.module.ts b/src/core/core.module.ts new file mode 100644 index 000000000..839c48171 --- /dev/null +++ b/src/core/core.module.ts @@ -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(); + } + +} diff --git a/src/app/directives/auto-focus.ts b/src/core/directives/auto-focus.ts similarity index 100% rename from src/app/directives/auto-focus.ts rename to src/core/directives/auto-focus.ts diff --git a/src/app/directives/directives.module.ts b/src/core/directives/directives.module.ts similarity index 100% rename from src/app/directives/directives.module.ts rename to src/core/directives/directives.module.ts diff --git a/src/app/directives/external-content.ts b/src/core/directives/external-content.ts similarity index 100% rename from src/app/directives/external-content.ts rename to src/core/directives/external-content.ts diff --git a/src/app/directives/fa-icon.ts b/src/core/directives/fa-icon.ts similarity index 98% rename from src/app/directives/fa-icon.ts rename to src/core/directives/fa-icon.ts index ba6df3247..38298a46b 100644 --- a/src/app/directives/fa-icon.ts +++ b/src/core/directives/fa-icon.ts @@ -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. diff --git a/src/app/directives/fab.ts b/src/core/directives/fab.ts similarity index 100% rename from src/app/directives/fab.ts rename to src/core/directives/fab.ts diff --git a/src/app/directives/format-text.ts b/src/core/directives/format-text.ts similarity index 100% rename from src/app/directives/format-text.ts rename to src/core/directives/format-text.ts diff --git a/src/app/directives/link.ts b/src/core/directives/link.ts similarity index 99% rename from src/app/directives/link.ts rename to src/core/directives/link.ts index 0bc60d88a..35d491e9b 100644 --- a/src/app/directives/link.ts +++ b/src/core/directives/link.ts @@ -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. diff --git a/src/app/directives/long-press.ts b/src/core/directives/long-press.ts similarity index 100% rename from src/app/directives/long-press.ts rename to src/core/directives/long-press.ts diff --git a/src/app/directives/supress-events.ts b/src/core/directives/supress-events.ts similarity index 100% rename from src/app/directives/supress-events.ts rename to src/core/directives/supress-events.ts diff --git a/src/app/directives/tests/format-text.test.ts b/src/core/directives/tests/format-text.test.ts similarity index 99% rename from src/app/directives/tests/format-text.test.ts rename to src/core/directives/tests/format-text.test.ts index 3f7d858e9..71120ea9e 100644 --- a/src/app/directives/tests/format-text.test.ts +++ b/src/core/directives/tests/format-text.test.ts @@ -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', () => { diff --git a/src/app/directives/tests/link.test.ts b/src/core/directives/tests/link.test.ts similarity index 96% rename from src/app/directives/tests/link.test.ts rename to src/core/directives/tests/link.test.ts index 30a99db90..00bdbab0f 100644 --- a/src/app/directives/tests/link.test.ts +++ b/src/core/directives/tests/link.test.ts @@ -14,7 +14,7 @@ import { CoreLinkDirective } from '@directives/link'; -import { renderTemplate } from '@/tests/utils'; +import { renderTemplate } from '@/testing/utils'; describe('CoreLinkDirective', () => { diff --git a/src/app/core/contentlinks/classes/base-handler.ts b/src/core/features/contentlinks/classes/base-handler.ts similarity index 100% rename from src/app/core/contentlinks/classes/base-handler.ts rename to src/core/features/contentlinks/classes/base-handler.ts diff --git a/src/app/core/contentlinks/classes/module-grade-handler.ts b/src/core/features/contentlinks/classes/module-grade-handler.ts similarity index 98% rename from src/app/core/contentlinks/classes/module-grade-handler.ts rename to src/core/features/contentlinks/classes/module-grade-handler.ts index d48da8311..ad19f4906 100644 --- a/src/app/core/contentlinks/classes/module-grade-handler.ts +++ b/src/core/features/contentlinks/classes/module-grade-handler.ts @@ -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'; /** diff --git a/src/app/core/contentlinks/classes/module-index-handler.ts b/src/core/features/contentlinks/classes/module-index-handler.ts similarity index 100% rename from src/app/core/contentlinks/classes/module-index-handler.ts rename to src/core/features/contentlinks/classes/module-index-handler.ts diff --git a/src/app/core/contentlinks/classes/module-list-handler.ts b/src/core/features/contentlinks/classes/module-list-handler.ts similarity index 97% rename from src/app/core/contentlinks/classes/module-list-handler.ts rename to src/core/features/contentlinks/classes/module-list-handler.ts index b206af783..9ba7f7078 100644 --- a/src/app/core/contentlinks/classes/module-list-handler.ts +++ b/src/core/features/contentlinks/classes/module-list-handler.ts @@ -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'; diff --git a/src/app/core/contentlinks/lang/en.json b/src/core/features/contentlinks/lang/en.json similarity index 100% rename from src/app/core/contentlinks/lang/en.json rename to src/core/features/contentlinks/lang/en.json diff --git a/src/app/core/contentlinks/pages/choose-site/choose-site.html b/src/core/features/contentlinks/pages/choose-site/choose-site.html similarity index 100% rename from src/app/core/contentlinks/pages/choose-site/choose-site.html rename to src/core/features/contentlinks/pages/choose-site/choose-site.html diff --git a/src/app/core/contentlinks/pages/choose-site/choose-site.page.module.ts b/src/core/features/contentlinks/pages/choose-site/choose-site.page.module.ts similarity index 100% rename from src/app/core/contentlinks/pages/choose-site/choose-site.page.module.ts rename to src/core/features/contentlinks/pages/choose-site/choose-site.page.module.ts diff --git a/src/app/core/contentlinks/pages/choose-site/choose-site.page.ts b/src/core/features/contentlinks/pages/choose-site/choose-site.page.ts similarity index 98% rename from src/app/core/contentlinks/pages/choose-site/choose-site.page.ts rename to src/core/features/contentlinks/pages/choose-site/choose-site.page.ts index ebc2b9a95..89812d320 100644 --- a/src/app/core/contentlinks/pages/choose-site/choose-site.page.ts +++ b/src/core/features/contentlinks/pages/choose-site/choose-site.page.ts @@ -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'; diff --git a/src/app/core/contentlinks/services/contentlinks.delegate.ts b/src/core/features/contentlinks/services/contentlinks.delegate.ts similarity index 100% rename from src/app/core/contentlinks/services/contentlinks.delegate.ts rename to src/core/features/contentlinks/services/contentlinks.delegate.ts diff --git a/src/app/core/contentlinks/services/contentlinks.helper.ts b/src/core/features/contentlinks/services/contentlinks.helper.ts similarity index 98% rename from src/app/core/contentlinks/services/contentlinks.helper.ts rename to src/core/features/contentlinks/services/contentlinks.helper.ts index dd9b835c3..18cf9e33f 100644 --- a/src/app/core/contentlinks/services/contentlinks.helper.ts +++ b/src/core/features/contentlinks/services/contentlinks.helper.ts @@ -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'; diff --git a/src/app/core/courses/courses.module.ts b/src/core/features/courses/courses.module.ts similarity index 91% rename from src/app/core/courses/courses.module.ts rename to src/core/features/courses/courses.module.ts index c38b25679..570eb5569 100644 --- a/src/app/core/courses/courses.module.ts +++ b/src/core/features/courses/courses.module.ts @@ -22,7 +22,7 @@ const routes: Routes = [ { path: 'dashboard', loadChildren: () => - import('@core/courses/pages/dashboard/dashboard.page.module').then(m => m.CoreCoursesDashboardPageModule), + import('@features/courses/pages/dashboard/dashboard.page.module').then(m => m.CoreCoursesDashboardPageModule), }, ]; diff --git a/src/app/core/courses/lang/en.json b/src/core/features/courses/lang/en.json similarity index 100% rename from src/app/core/courses/lang/en.json rename to src/core/features/courses/lang/en.json diff --git a/src/app/core/courses/pages/dashboard/dashboard.html b/src/core/features/courses/pages/dashboard/dashboard.html similarity index 100% rename from src/app/core/courses/pages/dashboard/dashboard.html rename to src/core/features/courses/pages/dashboard/dashboard.html diff --git a/src/app/core/courses/pages/dashboard/dashboard.page.module.ts b/src/core/features/courses/pages/dashboard/dashboard.page.module.ts similarity index 100% rename from src/app/core/courses/pages/dashboard/dashboard.page.module.ts rename to src/core/features/courses/pages/dashboard/dashboard.page.module.ts diff --git a/src/app/core/courses/pages/dashboard/dashboard.page.ts b/src/core/features/courses/pages/dashboard/dashboard.page.ts similarity index 100% rename from src/app/core/courses/pages/dashboard/dashboard.page.ts rename to src/core/features/courses/pages/dashboard/dashboard.page.ts diff --git a/src/app/core/courses/pages/dashboard/dashboard.scss b/src/core/features/courses/pages/dashboard/dashboard.scss similarity index 100% rename from src/app/core/courses/pages/dashboard/dashboard.scss rename to src/core/features/courses/pages/dashboard/dashboard.scss diff --git a/src/app/core/courses/services/handlers/dashboard.home.ts b/src/core/features/courses/services/handlers/dashboard.home.ts similarity index 94% rename from src/app/core/courses/services/handlers/dashboard.home.ts rename to src/core/features/courses/services/handlers/dashboard.home.ts index cfdbb8ab3..3c9505e2f 100644 --- a/src/app/core/courses/services/handlers/dashboard.home.ts +++ b/src/core/features/courses/services/handlers/dashboard.home.ts @@ -13,7 +13,7 @@ // limitations under the License. import { Injectable } from '@angular/core'; -import { CoreHomeHandler, CoreHomeHandlerToDisplay } from '@core/mainmenu/services/home.delegate'; +import { CoreHomeHandler, CoreHomeHandlerToDisplay } from '@features/mainmenu/services/home.delegate'; /** * Handler to add Home into main menu. diff --git a/src/app/core/emulator/classes/sqlitedb.ts b/src/core/features/emulator/classes/sqlitedb.ts similarity index 100% rename from src/app/core/emulator/classes/sqlitedb.ts rename to src/core/features/emulator/classes/sqlitedb.ts diff --git a/src/app/core/emulator/components/capture-media/capture-media.html b/src/core/features/emulator/components/capture-media/capture-media.html similarity index 100% rename from src/app/core/emulator/components/capture-media/capture-media.html rename to src/core/features/emulator/components/capture-media/capture-media.html diff --git a/src/app/core/emulator/components/capture-media/capture-media.scss b/src/core/features/emulator/components/capture-media/capture-media.scss similarity index 100% rename from src/app/core/emulator/components/capture-media/capture-media.scss rename to src/core/features/emulator/components/capture-media/capture-media.scss diff --git a/src/app/core/emulator/components/capture-media/capture-media.ts b/src/core/features/emulator/components/capture-media/capture-media.ts similarity index 100% rename from src/app/core/emulator/components/capture-media/capture-media.ts rename to src/core/features/emulator/components/capture-media/capture-media.ts diff --git a/src/app/core/emulator/components/components.module.ts b/src/core/features/emulator/components/components.module.ts similarity index 85% rename from src/app/core/emulator/components/components.module.ts rename to src/core/features/emulator/components/components.module.ts index c5d5c3e34..831546f26 100644 --- a/src/app/core/emulator/components/components.module.ts +++ b/src/core/features/emulator/components/components.module.ts @@ -17,9 +17,9 @@ import { CommonModule } from '@angular/common'; import { IonicModule } from '@ionic/angular'; import { TranslateModule } from '@ngx-translate/core'; -import { CoreComponentsModule } from '@app/components/components.module'; -import { CoreDirectivesModule } from '@app/directives/directives.module'; -import { CorePipesModule } from '@app/pipes/pipes.module'; +import { CoreComponentsModule } from '@components/components.module'; +import { CoreDirectivesModule } from '@directives/directives.module'; +import { CorePipesModule } from '@pipes/pipes.module'; import { CoreEmulatorCaptureMediaComponent } from './capture-media/capture-media'; @NgModule({ diff --git a/src/app/core/emulator/emulator.module.ts b/src/core/features/emulator/emulator.module.ts similarity index 100% rename from src/app/core/emulator/emulator.module.ts rename to src/core/features/emulator/emulator.module.ts diff --git a/src/app/core/emulator/services/camera.ts b/src/core/features/emulator/services/camera.ts similarity index 100% rename from src/app/core/emulator/services/camera.ts rename to src/core/features/emulator/services/camera.ts diff --git a/src/app/core/emulator/services/capture.helper.ts b/src/core/features/emulator/services/capture.helper.ts similarity index 100% rename from src/app/core/emulator/services/capture.helper.ts rename to src/core/features/emulator/services/capture.helper.ts diff --git a/src/app/core/emulator/services/clipboard.ts b/src/core/features/emulator/services/clipboard.ts similarity index 100% rename from src/app/core/emulator/services/clipboard.ts rename to src/core/features/emulator/services/clipboard.ts diff --git a/src/app/core/emulator/services/emulator.helper.ts b/src/core/features/emulator/services/emulator.helper.ts similarity index 100% rename from src/app/core/emulator/services/emulator.helper.ts rename to src/core/features/emulator/services/emulator.helper.ts diff --git a/src/app/core/emulator/services/file-opener.ts b/src/core/features/emulator/services/file-opener.ts similarity index 100% rename from src/app/core/emulator/services/file-opener.ts rename to src/core/features/emulator/services/file-opener.ts diff --git a/src/app/core/emulator/services/file-transfer.ts b/src/core/features/emulator/services/file-transfer.ts similarity index 99% rename from src/app/core/emulator/services/file-transfer.ts rename to src/core/features/emulator/services/file-transfer.ts index 13b6b119d..da4e1bc34 100644 --- a/src/app/core/emulator/services/file-transfer.ts +++ b/src/core/features/emulator/services/file-transfer.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { CoreTextUtils } from '@/app/services/utils/text'; +import { CoreTextUtils } from '@services/utils/text'; import { Injectable } from '@angular/core'; import { FileTransfer, FileTransferObject, FileUploadResult, FileTransferError } from '@ionic-native/file-transfer/ngx'; diff --git a/src/app/core/emulator/services/file.ts b/src/core/features/emulator/services/file.ts similarity index 100% rename from src/app/core/emulator/services/file.ts rename to src/core/features/emulator/services/file.ts diff --git a/src/app/core/emulator/services/geolocation.ts b/src/core/features/emulator/services/geolocation.ts similarity index 100% rename from src/app/core/emulator/services/geolocation.ts rename to src/core/features/emulator/services/geolocation.ts diff --git a/src/app/core/emulator/services/inappbrowser.ts b/src/core/features/emulator/services/inappbrowser.ts similarity index 100% rename from src/app/core/emulator/services/inappbrowser.ts rename to src/core/features/emulator/services/inappbrowser.ts diff --git a/src/app/core/emulator/services/media-capture.ts b/src/core/features/emulator/services/media-capture.ts similarity index 100% rename from src/app/core/emulator/services/media-capture.ts rename to src/core/features/emulator/services/media-capture.ts diff --git a/src/app/core/emulator/services/network.ts b/src/core/features/emulator/services/network.ts similarity index 100% rename from src/app/core/emulator/services/network.ts rename to src/core/features/emulator/services/network.ts diff --git a/src/app/core/emulator/services/zip.ts b/src/core/features/emulator/services/zip.ts similarity index 100% rename from src/app/core/emulator/services/zip.ts rename to src/core/features/emulator/services/zip.ts diff --git a/src/core/features/features.module.ts b/src/core/features/features.module.ts new file mode 100644 index 000000000..ff3633baf --- /dev/null +++ b/src/core/features/features.module.ts @@ -0,0 +1,32 @@ +// (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 { CoreCoursesModule } from './courses/courses.module'; +import { CoreEmulatorModule } from './emulator/emulator.module'; +import { CoreFileUploaderInitModule } from './fileuploader/fileuploader-init.module'; +import { CoreLoginModule } from './login/login.module'; +import { CoreSettingsInitModule } from './settings/settings-init.module'; + +@NgModule({ + imports: [ + CoreEmulatorModule, + CoreLoginModule, + CoreCoursesModule, + CoreSettingsInitModule, + CoreFileUploaderInitModule, + ], +}) +export class CoreFeaturesModule {} diff --git a/src/app/core/fileuploader/fileuploader-init.module.ts b/src/core/features/fileuploader/fileuploader-init.module.ts similarity index 100% rename from src/app/core/fileuploader/fileuploader-init.module.ts rename to src/core/features/fileuploader/fileuploader-init.module.ts diff --git a/src/app/core/fileuploader/lang/en.json b/src/core/features/fileuploader/lang/en.json similarity index 100% rename from src/app/core/fileuploader/lang/en.json rename to src/core/features/fileuploader/lang/en.json diff --git a/src/app/core/fileuploader/services/fileuploader.delegate.ts b/src/core/features/fileuploader/services/fileuploader.delegate.ts similarity index 100% rename from src/app/core/fileuploader/services/fileuploader.delegate.ts rename to src/core/features/fileuploader/services/fileuploader.delegate.ts diff --git a/src/app/core/fileuploader/services/fileuploader.helper.ts b/src/core/features/fileuploader/services/fileuploader.helper.ts similarity index 99% rename from src/app/core/fileuploader/services/fileuploader.helper.ts rename to src/core/features/fileuploader/services/fileuploader.helper.ts index 9aa8c431a..b056ac40a 100644 --- a/src/app/core/fileuploader/services/fileuploader.helper.ts +++ b/src/core/features/fileuploader/services/fileuploader.helper.ts @@ -31,9 +31,9 @@ import { CoreCanceledError } from '@classes/errors/cancelederror'; import { CoreError } from '@classes/errors/error'; import { CoreFileUploader, CoreFileUploaderProvider, CoreFileUploaderOptions } from './fileuploader'; import { CoreFileUploaderDelegate } from './fileuploader.delegate'; -import { CoreCaptureError } from '@/app/classes/errors/captureerror'; -import { CoreIonLoadingElement } from '@/app/classes/ion-loading'; -import { CoreWSUploadFileResult } from '@/app/services/ws'; +import { CoreCaptureError } from '@classes/errors/captureerror'; +import { CoreIonLoadingElement } from '@classes/ion-loading'; +import { CoreWSUploadFileResult } from '@services/ws'; /** * Helper service to upload files. diff --git a/src/app/core/fileuploader/services/fileuploader.ts b/src/core/features/fileuploader/services/fileuploader.ts similarity index 99% rename from src/app/core/fileuploader/services/fileuploader.ts rename to src/core/features/fileuploader/services/fileuploader.ts index 38eda6f6f..c5e4369e4 100644 --- a/src/app/core/fileuploader/services/fileuploader.ts +++ b/src/core/features/fileuploader/services/fileuploader.ts @@ -29,8 +29,8 @@ import { CoreUtils } from '@services/utils/utils'; import { CoreWSExternalFile, CoreWSFileUploadOptions, CoreWSUploadFileResult } from '@services/ws'; import { makeSingleton, Translate, MediaCapture, ModalController, Camera } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; -import { CoreEmulatorCaptureMediaComponent } from '@core/emulator/components/capture-media/capture-media'; -import { CoreError } from '@/app/classes/errors/error'; +import { CoreEmulatorCaptureMediaComponent } from '@features/emulator/components/capture-media/capture-media'; +import { CoreError } from '@classes/errors/error'; /** * File upload options. diff --git a/src/app/core/fileuploader/services/handlers/album.ts b/src/core/features/fileuploader/services/handlers/album.ts similarity index 100% rename from src/app/core/fileuploader/services/handlers/album.ts rename to src/core/features/fileuploader/services/handlers/album.ts diff --git a/src/app/core/fileuploader/services/handlers/audio.ts b/src/core/features/fileuploader/services/handlers/audio.ts similarity index 100% rename from src/app/core/fileuploader/services/handlers/audio.ts rename to src/core/features/fileuploader/services/handlers/audio.ts diff --git a/src/app/core/fileuploader/services/handlers/camera.ts b/src/core/features/fileuploader/services/handlers/camera.ts similarity index 100% rename from src/app/core/fileuploader/services/handlers/camera.ts rename to src/core/features/fileuploader/services/handlers/camera.ts diff --git a/src/app/core/fileuploader/services/handlers/file.ts b/src/core/features/fileuploader/services/handlers/file.ts similarity index 100% rename from src/app/core/fileuploader/services/handlers/file.ts rename to src/core/features/fileuploader/services/handlers/file.ts diff --git a/src/app/core/fileuploader/services/handlers/video.ts b/src/core/features/fileuploader/services/handlers/video.ts similarity index 100% rename from src/app/core/fileuploader/services/handlers/video.ts rename to src/core/features/fileuploader/services/handlers/video.ts diff --git a/src/app/core/login/components/site-help/site-help.html b/src/core/features/login/components/site-help/site-help.html similarity index 100% rename from src/app/core/login/components/site-help/site-help.html rename to src/core/features/login/components/site-help/site-help.html diff --git a/src/app/core/login/components/site-help/site-help.scss b/src/core/features/login/components/site-help/site-help.scss similarity index 100% rename from src/app/core/login/components/site-help/site-help.scss rename to src/core/features/login/components/site-help/site-help.scss diff --git a/src/app/core/login/components/site-help/site-help.ts b/src/core/features/login/components/site-help/site-help.ts similarity index 95% rename from src/app/core/login/components/site-help/site-help.ts rename to src/core/features/login/components/site-help/site-help.ts index 0a99681bd..8be6c64b6 100644 --- a/src/app/core/login/components/site-help/site-help.ts +++ b/src/core/features/login/components/site-help/site-help.ts @@ -16,7 +16,7 @@ import { Component } from '@angular/core'; import { CoreUtils } from '@services/utils/utils'; import { ModalController, Translate } from '@singletons/core.singletons'; -import { CoreLoginHelperProvider } from '@core/login/services/login.helper'; +import { CoreLoginHelperProvider } from '@features/login/services/login.helper'; /** * Component that displays help to connect to a site. diff --git a/src/app/core/login/components/site-onboarding/site-onboarding.html b/src/core/features/login/components/site-onboarding/site-onboarding.html similarity index 100% rename from src/app/core/login/components/site-onboarding/site-onboarding.html rename to src/core/features/login/components/site-onboarding/site-onboarding.html diff --git a/src/app/core/login/components/site-onboarding/site-onboarding.scss b/src/core/features/login/components/site-onboarding/site-onboarding.scss similarity index 100% rename from src/app/core/login/components/site-onboarding/site-onboarding.scss rename to src/core/features/login/components/site-onboarding/site-onboarding.scss diff --git a/src/app/core/login/components/site-onboarding/site-onboarding.ts b/src/core/features/login/components/site-onboarding/site-onboarding.ts similarity index 96% rename from src/app/core/login/components/site-onboarding/site-onboarding.ts rename to src/core/features/login/components/site-onboarding/site-onboarding.ts index d9d6d6144..7c9f8a873 100644 --- a/src/app/core/login/components/site-onboarding/site-onboarding.ts +++ b/src/core/features/login/components/site-onboarding/site-onboarding.ts @@ -16,7 +16,7 @@ import { Component } from '@angular/core'; import { CoreConfig } from '@services/config'; import { CoreUtils } from '@services/utils/utils'; -import { CoreLoginHelperProvider } from '@core/login/services/login.helper'; +import { CoreLoginHelperProvider } from '@features/login/services/login.helper'; import { ModalController } from '@singletons/core.singletons'; /** diff --git a/src/app/core/login/lang/en.json b/src/core/features/login/lang/en.json similarity index 100% rename from src/app/core/login/lang/en.json rename to src/core/features/login/lang/en.json diff --git a/src/app/core/login/login-routing.module.ts b/src/core/features/login/login-routing.module.ts similarity index 100% rename from src/app/core/login/login-routing.module.ts rename to src/core/features/login/login-routing.module.ts diff --git a/src/app/core/login/login.module.ts b/src/core/features/login/login.module.ts similarity index 100% rename from src/app/core/login/login.module.ts rename to src/core/features/login/login.module.ts diff --git a/src/app/core/login/login.scss b/src/core/features/login/login.scss similarity index 100% rename from src/app/core/login/login.scss rename to src/core/features/login/login.scss diff --git a/src/app/core/login/pages/change-password/change-password.html b/src/core/features/login/pages/change-password/change-password.html similarity index 100% rename from src/app/core/login/pages/change-password/change-password.html rename to src/core/features/login/pages/change-password/change-password.html diff --git a/src/app/core/login/pages/change-password/change-password.page.module.ts b/src/core/features/login/pages/change-password/change-password.page.module.ts similarity index 100% rename from src/app/core/login/pages/change-password/change-password.page.module.ts rename to src/core/features/login/pages/change-password/change-password.page.module.ts diff --git a/src/app/core/login/pages/change-password/change-password.page.ts b/src/core/features/login/pages/change-password/change-password.page.ts similarity index 96% rename from src/app/core/login/pages/change-password/change-password.page.ts rename to src/core/features/login/pages/change-password/change-password.page.ts index 88564ff77..2f1a13c1d 100644 --- a/src/app/core/login/pages/change-password/change-password.page.ts +++ b/src/core/features/login/pages/change-password/change-password.page.ts @@ -16,7 +16,7 @@ import { Component } from '@angular/core'; import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; -import { CoreLoginHelper } from '@core/login/services/login.helper'; +import { CoreLoginHelper } from '@features/login/services/login.helper'; import { Translate } from '@singletons/core.singletons'; /** diff --git a/src/app/core/login/pages/credentials/credentials.html b/src/core/features/login/pages/credentials/credentials.html similarity index 100% rename from src/app/core/login/pages/credentials/credentials.html rename to src/core/features/login/pages/credentials/credentials.html diff --git a/src/app/core/login/pages/credentials/credentials.page.module.ts b/src/core/features/login/pages/credentials/credentials.page.module.ts similarity index 100% rename from src/app/core/login/pages/credentials/credentials.page.module.ts rename to src/core/features/login/pages/credentials/credentials.page.module.ts diff --git a/src/app/core/login/pages/credentials/credentials.page.ts b/src/core/features/login/pages/credentials/credentials.page.ts similarity index 98% rename from src/app/core/login/pages/credentials/credentials.page.ts rename to src/core/features/login/pages/credentials/credentials.page.ts index 9d0f92491..fe3e0884a 100644 --- a/src/app/core/login/pages/credentials/credentials.page.ts +++ b/src/core/features/login/pages/credentials/credentials.page.ts @@ -21,8 +21,8 @@ import { CoreApp } from '@services/app'; import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; -import { CoreLoginHelper, CoreLoginHelperProvider } from '@core/login/services/login.helper'; -import { CoreConstants } from '@core/constants'; +import { CoreLoginHelper, CoreLoginHelperProvider } from '@features/login/services/login.helper'; +import { CoreConstants } from '@/core/constants'; import { Translate } from '@singletons/core.singletons'; import { CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@classes/site'; import { CoreEvents } from '@singletons/events'; diff --git a/src/app/core/login/pages/email-signup/email-signup.html b/src/core/features/login/pages/email-signup/email-signup.html similarity index 100% rename from src/app/core/login/pages/email-signup/email-signup.html rename to src/core/features/login/pages/email-signup/email-signup.html diff --git a/src/app/core/login/pages/email-signup/email-signup.page.module.ts b/src/core/features/login/pages/email-signup/email-signup.page.module.ts similarity index 100% rename from src/app/core/login/pages/email-signup/email-signup.page.module.ts rename to src/core/features/login/pages/email-signup/email-signup.page.module.ts diff --git a/src/app/core/login/pages/email-signup/email-signup.page.ts b/src/core/features/login/pages/email-signup/email-signup.page.ts similarity index 98% rename from src/app/core/login/pages/email-signup/email-signup.page.ts rename to src/core/features/login/pages/email-signup/email-signup.page.ts index 1aff70a6d..10891d231 100644 --- a/src/app/core/login/pages/email-signup/email-signup.page.ts +++ b/src/core/features/login/pages/email-signup/email-signup.page.ts @@ -22,11 +22,16 @@ import { CoreDomUtils } from '@services/utils/dom'; import { CoreTextUtils } from '@services/utils/text'; import { CoreCountry, CoreUtils } from '@services/utils/utils'; import { CoreWS, CoreWSExternalWarning } from '@services/ws'; -import { AuthEmailSignupProfileFieldsCategory, AuthEmailSignupSettings, CoreLoginHelper } from '@core/login/services/login.helper'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { Translate } from '@singletons/core.singletons'; import { CoreSitePublicConfigResponse } from '@classes/site'; +import { + AuthEmailSignupProfileFieldsCategory, + AuthEmailSignupSettings, + CoreLoginHelper, +} from '@features/login/services/login.helper'; + /** * Page to signup using email. */ diff --git a/src/app/core/login/pages/forgotten-password/forgotten-password.html b/src/core/features/login/pages/forgotten-password/forgotten-password.html similarity index 100% rename from src/app/core/login/pages/forgotten-password/forgotten-password.html rename to src/core/features/login/pages/forgotten-password/forgotten-password.html diff --git a/src/app/core/login/pages/forgotten-password/forgotten-password.page.module.ts b/src/core/features/login/pages/forgotten-password/forgotten-password.page.module.ts similarity index 100% rename from src/app/core/login/pages/forgotten-password/forgotten-password.page.module.ts rename to src/core/features/login/pages/forgotten-password/forgotten-password.page.module.ts diff --git a/src/app/core/login/pages/forgotten-password/forgotten-password.page.ts b/src/core/features/login/pages/forgotten-password/forgotten-password.page.ts similarity index 98% rename from src/app/core/login/pages/forgotten-password/forgotten-password.page.ts rename to src/core/features/login/pages/forgotten-password/forgotten-password.page.ts index ffb021905..b44f968a2 100644 --- a/src/app/core/login/pages/forgotten-password/forgotten-password.page.ts +++ b/src/core/features/login/pages/forgotten-password/forgotten-password.page.ts @@ -18,7 +18,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NavController } from '@ionic/angular'; import { CoreDomUtils } from '@services/utils/dom'; -import { CoreLoginHelper } from '@core/login/services/login.helper'; +import { CoreLoginHelper } from '@features/login/services/login.helper'; import { Translate, Platform } from '@singletons/core.singletons'; import { CoreWSExternalWarning } from '@services/ws'; diff --git a/src/app/core/login/pages/init/init.html b/src/core/features/login/pages/init/init.html similarity index 100% rename from src/app/core/login/pages/init/init.html rename to src/core/features/login/pages/init/init.html diff --git a/src/app/core/login/pages/init/init.page.module.ts b/src/core/features/login/pages/init/init.page.module.ts similarity index 100% rename from src/app/core/login/pages/init/init.page.module.ts rename to src/core/features/login/pages/init/init.page.module.ts diff --git a/src/app/core/login/pages/init/init.page.ts b/src/core/features/login/pages/init/init.page.ts similarity index 95% rename from src/app/core/login/pages/init/init.page.ts rename to src/core/features/login/pages/init/init.page.ts index 936d8dcb2..e1d64bdbf 100644 --- a/src/app/core/login/pages/init/init.page.ts +++ b/src/core/features/login/pages/init/init.page.ts @@ -18,9 +18,9 @@ import { NavController } from '@ionic/angular'; import { CoreApp, CoreRedirectData } from '@services/app'; import { CoreInit } from '@services/init'; import { SplashScreen } from '@singletons/core.singletons'; -import { CoreConstants } from '@core/constants'; -import { CoreSites } from '@/app/services/sites'; -import { CoreLoginHelper } from '@/app/core/login/services/login.helper'; +import { CoreConstants } from '@/core/constants'; +import { CoreSites } from '@services/sites'; +import { CoreLoginHelper } from '@features/login/services/login.helper'; /** * Page that displays a "splash screen" while the app is being initialized. diff --git a/src/app/core/login/pages/init/init.scss b/src/core/features/login/pages/init/init.scss similarity index 88% rename from src/app/core/login/pages/init/init.scss rename to src/core/features/login/pages/init/init.scss index 12ed653de..688408424 100644 --- a/src/app/core/login/pages/init/init.scss +++ b/src/core/features/login/pages/init/init.scss @@ -1,7 +1,7 @@ ion-content::part(background) { --background: var(--core-splash-screen-background, #ffffff); - background-image: url("../../../../../assets/img/splash.png"); + background-image: url("~@/assets/img/splash.png"); background-repeat: no-repeat; background-size: 100%; background-size: var(--core-splash-bgsize, 100vmax); diff --git a/src/app/core/login/pages/reconnect/reconnect.html b/src/core/features/login/pages/reconnect/reconnect.html similarity index 100% rename from src/app/core/login/pages/reconnect/reconnect.html rename to src/core/features/login/pages/reconnect/reconnect.html diff --git a/src/app/core/login/pages/reconnect/reconnect.page.module.ts b/src/core/features/login/pages/reconnect/reconnect.page.module.ts similarity index 100% rename from src/app/core/login/pages/reconnect/reconnect.page.module.ts rename to src/core/features/login/pages/reconnect/reconnect.page.module.ts diff --git a/src/app/core/login/pages/reconnect/reconnect.page.ts b/src/core/features/login/pages/reconnect/reconnect.page.ts similarity index 99% rename from src/app/core/login/pages/reconnect/reconnect.page.ts rename to src/core/features/login/pages/reconnect/reconnect.page.ts index 449939627..70c0b2afd 100644 --- a/src/app/core/login/pages/reconnect/reconnect.page.ts +++ b/src/core/features/login/pages/reconnect/reconnect.page.ts @@ -21,7 +21,7 @@ import { CoreApp } from '@services/app'; 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 { CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@classes/site'; import { CoreEvents } from '@singletons/events'; import { CoreError } from '@classes/errors/error'; diff --git a/src/app/core/login/pages/site-policy/site-policy.html b/src/core/features/login/pages/site-policy/site-policy.html similarity index 100% rename from src/app/core/login/pages/site-policy/site-policy.html rename to src/core/features/login/pages/site-policy/site-policy.html diff --git a/src/app/core/login/pages/site-policy/site-policy.page.module.ts b/src/core/features/login/pages/site-policy/site-policy.page.module.ts similarity index 100% rename from src/app/core/login/pages/site-policy/site-policy.page.module.ts rename to src/core/features/login/pages/site-policy/site-policy.page.module.ts diff --git a/src/app/core/login/pages/site-policy/site-policy.page.ts b/src/core/features/login/pages/site-policy/site-policy.page.ts similarity index 98% rename from src/app/core/login/pages/site-policy/site-policy.page.ts rename to src/core/features/login/pages/site-policy/site-policy.page.ts index 4a5f87f1f..57c6d5066 100644 --- a/src/app/core/login/pages/site-policy/site-policy.page.ts +++ b/src/core/features/login/pages/site-policy/site-policy.page.ts @@ -20,7 +20,7 @@ import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; import { CoreMimetypeUtils } from '@services/utils/mimetype'; -import { CoreLoginHelper } from '@core/login/services/login.helper'; +import { CoreLoginHelper } from '@features/login/services/login.helper'; import { CoreSite } from '@classes/site'; /** diff --git a/src/app/core/login/pages/site/site.html b/src/core/features/login/pages/site/site.html similarity index 100% rename from src/app/core/login/pages/site/site.html rename to src/core/features/login/pages/site/site.html diff --git a/src/app/core/login/pages/site/site.page.module.ts b/src/core/features/login/pages/site/site.page.module.ts similarity index 100% rename from src/app/core/login/pages/site/site.page.module.ts rename to src/core/features/login/pages/site/site.page.module.ts diff --git a/src/app/core/login/pages/site/site.page.ts b/src/core/features/login/pages/site/site.page.ts similarity index 98% rename from src/app/core/login/pages/site/site.page.ts rename to src/core/features/login/pages/site/site.page.ts index 7470dca99..f96186bef 100644 --- a/src/app/core/login/pages/site/site.page.ts +++ b/src/core/features/login/pages/site/site.page.ts @@ -22,15 +22,15 @@ import { CoreConfig } from '@services/config'; import { CoreSites, CoreSiteCheckResponse, CoreLoginSiteInfo, CoreSitesDemoSiteData } from '@services/sites'; import { CoreUtils } from '@services/utils/utils'; import { CoreDomUtils } from '@services/utils/dom'; -import { CoreLoginHelper, CoreLoginHelperProvider } from '@core/login/services/login.helper'; +import { CoreLoginHelper, CoreLoginHelperProvider } from '@features/login/services/login.helper'; import { CoreSite } from '@classes/site'; import { CoreError } from '@classes/errors/error'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { Translate, ModalController } from '@singletons/core.singletons'; import { CoreUrl } from '@singletons/url'; import { CoreUrlUtils } from '@services/utils/url'; -import { CoreLoginSiteHelpComponent } from '@core/login/components/site-help/site-help'; -import { CoreLoginSiteOnboardingComponent } from '@core/login/components/site-onboarding/site-onboarding'; +import { CoreLoginSiteHelpComponent } from '@features/login/components/site-help/site-help'; +import { CoreLoginSiteOnboardingComponent } from '@features/login/components/site-onboarding/site-onboarding'; /** * Page that displays a "splash screen" while the app is being initialized. diff --git a/src/app/core/login/pages/site/site.scss b/src/core/features/login/pages/site/site.scss similarity index 100% rename from src/app/core/login/pages/site/site.scss rename to src/core/features/login/pages/site/site.scss diff --git a/src/app/core/login/pages/sites/sites.html b/src/core/features/login/pages/sites/sites.html similarity index 100% rename from src/app/core/login/pages/sites/sites.html rename to src/core/features/login/pages/sites/sites.html diff --git a/src/app/core/login/pages/sites/sites.page.module.ts b/src/core/features/login/pages/sites/sites.page.module.ts similarity index 100% rename from src/app/core/login/pages/sites/sites.page.module.ts rename to src/core/features/login/pages/sites/sites.page.module.ts diff --git a/src/app/core/login/pages/sites/sites.page.ts b/src/core/features/login/pages/sites/sites.page.ts similarity index 98% rename from src/app/core/login/pages/sites/sites.page.ts rename to src/core/features/login/pages/sites/sites.page.ts index fb1e8e632..47cdc96d2 100644 --- a/src/app/core/login/pages/sites/sites.page.ts +++ b/src/core/features/login/pages/sites/sites.page.ts @@ -18,7 +18,7 @@ import { Component, OnInit } from '@angular/core'; import { CoreSiteBasicInfo, CoreSites } from '@services/sites'; import { CoreLogger } from '@singletons/logger'; -import { CoreLoginHelper } from '@core/login/services/login.helper'; +import { CoreLoginHelper } from '@features/login/services/login.helper'; /** * Page that displays a "splash screen" while the app is being initialized. diff --git a/src/app/core/login/services/login.helper.ts b/src/core/features/login/services/login.helper.ts similarity index 99% rename from src/app/core/login/services/login.helper.ts rename to src/core/features/login/services/login.helper.ts index abeee7248..b086d9f54 100644 --- a/src/app/core/login/services/login.helper.ts +++ b/src/core/features/login/services/login.helper.ts @@ -27,7 +27,7 @@ import { CoreDomUtils } from '@services/utils/dom'; import { CoreTextUtils } from '@services/utils/text'; import { CoreUrlParams, CoreUrlUtils } from '@services/utils/url'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreSite, CoreSiteIdentityProvider, CoreSitePublicConfigResponse } from '@classes/site'; import { CoreError } from '@classes/errors/error'; import { CoreWSError } from '@classes/errors/wserror'; @@ -35,7 +35,7 @@ import { makeSingleton, Translate } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; import { CoreUrl } from '@singletons/url'; import { NavigationOptions } from '@ionic/angular/providers/nav-controller'; -import { CoreObject } from '@/app/singletons/object'; +import { CoreObject } from '@singletons/object'; /** * Helper provider that provides some common features regarding authentication. diff --git a/src/app/core/login/tests/init.page.test.ts b/src/core/features/login/tests/init.page.test.ts similarity index 88% rename from src/app/core/login/tests/init.page.test.ts rename to src/core/features/login/tests/init.page.test.ts index 3271530f0..010e42113 100644 --- a/src/app/core/login/tests/init.page.test.ts +++ b/src/core/features/login/tests/init.page.test.ts @@ -14,13 +14,13 @@ import { NavController } from '@ionic/angular'; -import { CoreApp } from '@/app/services/app'; +import { CoreApp } from '@services/app'; import { CoreInit } from '@services/init'; -import { CoreLoginInitPage } from '@core/login/pages/init/init.page'; -import { CoreSites } from '@/app/services/sites'; -import { SplashScreen } from '@/app/singletons/core.singletons'; +import { CoreLoginInitPage } from '@features/login/pages/init/init.page'; +import { CoreSites } from '@services/sites'; +import { SplashScreen } from '@singletons/core.singletons'; -import { mock, mockSingleton, renderComponent, RenderConfig } from '@/tests/utils'; +import { mock, mockSingleton, renderComponent, RenderConfig } from '@/testing/utils'; describe('CoreLoginInitPage', () => { diff --git a/src/app/core/mainmenu/lang/en.json b/src/core/features/mainmenu/lang/en.json similarity index 100% rename from src/app/core/mainmenu/lang/en.json rename to src/core/features/mainmenu/lang/en.json diff --git a/src/app/core/mainmenu/mainmenu-routing.module.ts b/src/core/features/mainmenu/mainmenu-routing.module.ts similarity index 97% rename from src/app/core/mainmenu/mainmenu-routing.module.ts rename to src/core/features/mainmenu/mainmenu-routing.module.ts index 1afad8941..ddf72fc95 100644 --- a/src/app/core/mainmenu/mainmenu-routing.module.ts +++ b/src/core/features/mainmenu/mainmenu-routing.module.ts @@ -15,7 +15,7 @@ import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; -import { CoreArray } from '@/app/singletons/array'; +import { CoreArray } from '@singletons/array'; import { CoreMainMenuPage } from './pages/menu/menu.page'; import { CoreMainMenuMorePage } from './pages/more/more.page'; diff --git a/src/app/core/mainmenu/mainmenu.module.ts b/src/core/features/mainmenu/mainmenu.module.ts similarity index 100% rename from src/app/core/mainmenu/mainmenu.module.ts rename to src/core/features/mainmenu/mainmenu.module.ts diff --git a/src/app/core/mainmenu/pages/home/home-routing.module.ts b/src/core/features/mainmenu/pages/home/home-routing.module.ts similarity index 96% rename from src/app/core/mainmenu/pages/home/home-routing.module.ts rename to src/core/features/mainmenu/pages/home/home-routing.module.ts index 092239b13..5e85d3b64 100644 --- a/src/app/core/mainmenu/pages/home/home-routing.module.ts +++ b/src/core/features/mainmenu/pages/home/home-routing.module.ts @@ -15,7 +15,7 @@ import { InjectionToken, Injector, ModuleWithProviders, NgModule } from '@angular/core'; import { RouterModule, ROUTES, Routes } from '@angular/router'; -import { CoreArray } from '@/app/singletons/array'; +import { CoreArray } from '@singletons/array'; import { CoreHomePage } from './home.page'; diff --git a/src/app/core/mainmenu/pages/home/home.html b/src/core/features/mainmenu/pages/home/home.html similarity index 100% rename from src/app/core/mainmenu/pages/home/home.html rename to src/core/features/mainmenu/pages/home/home.html diff --git a/src/app/core/mainmenu/pages/home/home.page.module.ts b/src/core/features/mainmenu/pages/home/home.page.module.ts similarity index 100% rename from src/app/core/mainmenu/pages/home/home.page.module.ts rename to src/core/features/mainmenu/pages/home/home.page.module.ts diff --git a/src/app/core/mainmenu/pages/home/home.page.ts b/src/core/features/mainmenu/pages/home/home.page.ts similarity index 100% rename from src/app/core/mainmenu/pages/home/home.page.ts rename to src/core/features/mainmenu/pages/home/home.page.ts diff --git a/src/app/core/mainmenu/pages/home/home.scss b/src/core/features/mainmenu/pages/home/home.scss similarity index 100% rename from src/app/core/mainmenu/pages/home/home.scss rename to src/core/features/mainmenu/pages/home/home.scss diff --git a/src/app/core/mainmenu/pages/menu/menu.html b/src/core/features/mainmenu/pages/menu/menu.html similarity index 100% rename from src/app/core/mainmenu/pages/menu/menu.html rename to src/core/features/mainmenu/pages/menu/menu.html diff --git a/src/app/core/mainmenu/pages/menu/menu.page.ts b/src/core/features/mainmenu/pages/menu/menu.page.ts similarity index 98% rename from src/app/core/mainmenu/pages/menu/menu.page.ts rename to src/core/features/mainmenu/pages/menu/menu.page.ts index 68925539e..820dd4b8c 100644 --- a/src/app/core/mainmenu/pages/menu/menu.page.ts +++ b/src/core/features/mainmenu/pages/menu/menu.page.ts @@ -23,8 +23,8 @@ import { CoreTextUtils } from '@services/utils/text'; import { CoreEvents, CoreEventObserver, CoreEventLoadPageMainMenuData } from '@singletons/events'; import { CoreMainMenu } from '../../services/mainmenu'; import { CoreMainMenuDelegate, CoreMainMenuHandlerToDisplay } from '../../services/mainmenu.delegate'; -import { CoreDomUtils } from '@/app/services/utils/dom'; -import { Translate } from '@/app/singletons/core.singletons'; +import { CoreDomUtils } from '@services/utils/dom'; +import { Translate } from '@singletons/core.singletons'; /** * Page that displays the main menu of the app. diff --git a/src/app/core/mainmenu/pages/menu/menu.scss b/src/core/features/mainmenu/pages/menu/menu.scss similarity index 100% rename from src/app/core/mainmenu/pages/menu/menu.scss rename to src/core/features/mainmenu/pages/menu/menu.scss diff --git a/src/app/core/mainmenu/pages/more/more.html b/src/core/features/mainmenu/pages/more/more.html similarity index 100% rename from src/app/core/mainmenu/pages/more/more.html rename to src/core/features/mainmenu/pages/more/more.html diff --git a/src/app/core/mainmenu/pages/more/more.page.ts b/src/core/features/mainmenu/pages/more/more.page.ts similarity index 98% rename from src/app/core/mainmenu/pages/more/more.page.ts rename to src/core/features/mainmenu/pages/more/more.page.ts index 50c2028eb..f5d5fd3b0 100644 --- a/src/app/core/mainmenu/pages/more/more.page.ts +++ b/src/core/features/mainmenu/pages/more/more.page.ts @@ -18,7 +18,7 @@ import { Subscription } from 'rxjs'; import { CoreSites } from '@services/sites'; import { CoreUtils } from '@services/utils/utils'; import { CoreSiteInfo } from '@classes/site'; -import { CoreLoginHelper } from '@core/login/services/login.helper'; +import { CoreLoginHelper } from '@features/login/services/login.helper'; import { CoreMainMenuDelegate, CoreMainMenuHandlerData } from '../../services/mainmenu.delegate'; import { CoreMainMenu, CoreMainMenuCustomItem } from '../../services/mainmenu'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; diff --git a/src/app/core/mainmenu/services/handlers/mainmenu.ts b/src/core/features/mainmenu/services/handlers/mainmenu.ts similarity index 100% rename from src/app/core/mainmenu/services/handlers/mainmenu.ts rename to src/core/features/mainmenu/services/handlers/mainmenu.ts diff --git a/src/app/core/mainmenu/services/home.delegate.ts b/src/core/features/mainmenu/services/home.delegate.ts similarity index 100% rename from src/app/core/mainmenu/services/home.delegate.ts rename to src/core/features/mainmenu/services/home.delegate.ts diff --git a/src/app/core/mainmenu/services/mainmenu.delegate.ts b/src/core/features/mainmenu/services/mainmenu.delegate.ts similarity index 100% rename from src/app/core/mainmenu/services/mainmenu.delegate.ts rename to src/core/features/mainmenu/services/mainmenu.delegate.ts diff --git a/src/app/core/mainmenu/services/mainmenu.ts b/src/core/features/mainmenu/services/mainmenu.ts similarity index 99% rename from src/app/core/mainmenu/services/mainmenu.ts rename to src/core/features/mainmenu/services/mainmenu.ts index 4d733b128..5baf7aad1 100644 --- a/src/app/core/mainmenu/services/mainmenu.ts +++ b/src/core/features/mainmenu/services/mainmenu.ts @@ -18,7 +18,7 @@ import { CoreApp } from '@services/app'; import { CoreLang } from '@services/lang'; import { CoreSites } from '@services/sites'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreMainMenuDelegate, CoreMainMenuHandlerToDisplay } from './mainmenu.delegate'; import { makeSingleton } from '@singletons/core.singletons'; diff --git a/src/app/core/search/components/components.module.ts b/src/core/features/search/components/components.module.ts similarity index 100% rename from src/app/core/search/components/components.module.ts rename to src/core/features/search/components/components.module.ts diff --git a/src/app/core/search/components/search-box/core-search-box.html b/src/core/features/search/components/search-box/core-search-box.html similarity index 100% rename from src/app/core/search/components/search-box/core-search-box.html rename to src/core/features/search/components/search-box/core-search-box.html diff --git a/src/app/core/search/components/search-box/search-box.scss b/src/core/features/search/components/search-box/search-box.scss similarity index 100% rename from src/app/core/search/components/search-box/search-box.scss rename to src/core/features/search/components/search-box/search-box.scss diff --git a/src/app/core/search/components/search-box/search-box.ts b/src/core/features/search/components/search-box/search-box.ts similarity index 99% rename from src/app/core/search/components/search-box/search-box.ts rename to src/core/features/search/components/search-box/search-box.ts index 23ab9a6ee..dd2048831 100644 --- a/src/app/core/search/components/search-box/search-box.ts +++ b/src/core/features/search/components/search-box/search-box.ts @@ -19,7 +19,7 @@ import { CoreDomUtils } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; import { CoreSearchHistory } from '../../services/search-history'; import { Translate } from '@singletons/core.singletons'; -import { CoreSearchHistoryDBRecord } from '../../services/search.history.db'; +import { CoreSearchHistoryDBRecord } from '../../services/search-history-db'; /** * Component to display a "search box". diff --git a/src/app/core/search/search.module.ts b/src/core/features/search/search.module.ts similarity index 82% rename from src/app/core/search/search.module.ts rename to src/core/features/search/search.module.ts index 4557cc77a..a59da3976 100644 --- a/src/app/core/search/search.module.ts +++ b/src/core/features/search/search.module.ts @@ -13,7 +13,11 @@ // limitations under the License. import { NgModule } from '@angular/core'; + +import { CORE_SITE_SCHEMAS } from '@services/sites'; + import { CoreSearchComponentsModule } from './components/components.module'; +import { SITE_SCHEMA } from './services/search-history-db'; @NgModule({ declarations: [ @@ -23,6 +27,7 @@ import { CoreSearchComponentsModule } from './components/components.module'; ], providers: [ CoreSearchComponentsModule, + { provide: CORE_SITE_SCHEMAS, useValue: [SITE_SCHEMA], multi: true }, ], }) export class CoreSearchModule {} diff --git a/src/app/core/search/services/search.history.db.ts b/src/core/features/search/services/search-history-db.ts similarity index 90% rename from src/app/core/search/services/search.history.db.ts rename to src/core/features/search/services/search-history-db.ts index 6b1080d06..19a1e8819 100644 --- a/src/app/core/search/services/search.history.db.ts +++ b/src/core/features/search/services/search-history-db.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { CoreSiteSchema, registerSiteSchema } from '@services/sites'; +import { CoreSiteSchema } from '@services/sites'; /** * Database variables for CoreSearchHistory service. */ export const SEARCH_HISTORY_TABLE_NAME = 'seach_history'; -const SITE_SCHEMA: CoreSiteSchema = { +export const SITE_SCHEMA: CoreSiteSchema = { name: 'CoreSearchHistoryProvider', version: 1, tables: [ @@ -60,8 +60,3 @@ export type CoreSearchHistoryDBRecord = { searchedtext: string; // Text of the performed search. times: number; // Times search has been performed (if previously in history). }; - -export const initCoreSearchHistoryDB = (): void => { - registerSiteSchema(SITE_SCHEMA); -}; - diff --git a/src/app/core/search/services/search-history.ts b/src/core/features/search/services/search-history.ts similarity index 98% rename from src/app/core/search/services/search-history.ts rename to src/core/features/search/services/search-history.ts index 9cf4b552c..7aa98df67 100644 --- a/src/app/core/search/services/search-history.ts +++ b/src/core/features/search/services/search-history.ts @@ -16,8 +16,8 @@ import { Injectable } from '@angular/core'; import { CoreSites } from '@services/sites'; import { SQLiteDB } from '@classes/sqlitedb'; -import { CoreSearchHistoryDBRecord, SEARCH_HISTORY_TABLE_NAME } from './search.history.db'; -import { makeSingleton } from '@/app/singletons/core.singletons'; +import { CoreSearchHistoryDBRecord, SEARCH_HISTORY_TABLE_NAME } from './search-history-db'; +import { makeSingleton } from '@singletons/core.singletons'; /** * Service that enables adding a history to a search box. diff --git a/src/app/core/settings/lang/en.json b/src/core/features/settings/lang/en.json similarity index 100% rename from src/app/core/settings/lang/en.json rename to src/core/features/settings/lang/en.json diff --git a/src/app/core/settings/pages/about/about.html b/src/core/features/settings/pages/about/about.html similarity index 100% rename from src/app/core/settings/pages/about/about.html rename to src/core/features/settings/pages/about/about.html diff --git a/src/app/core/settings/pages/about/about.page.module.ts b/src/core/features/settings/pages/about/about.page.module.ts similarity index 92% rename from src/app/core/settings/pages/about/about.page.module.ts rename to src/core/features/settings/pages/about/about.page.module.ts index 02566fc19..51a9e2e66 100644 --- a/src/app/core/settings/pages/about/about.page.module.ts +++ b/src/core/features/settings/pages/about/about.page.module.ts @@ -31,13 +31,13 @@ const routes: Routes = [ { path: 'deviceinfo', loadChildren: () => - import('@core/settings/pages/deviceinfo/deviceinfo.page.module') + import('@features/settings/pages/deviceinfo/deviceinfo.page.module') .then(m => m.CoreSettingsDeviceInfoPageModule), }, { path: 'licenses', loadChildren: () => - import('@core/settings/pages/licenses/licenses.page.module') + import('@features/settings/pages/licenses/licenses.page.module') .then(m => m.CoreSettingsLicensesPageModule), }, ]; diff --git a/src/app/core/settings/pages/about/about.page.ts b/src/core/features/settings/pages/about/about.page.ts similarity index 97% rename from src/app/core/settings/pages/about/about.page.ts rename to src/core/features/settings/pages/about/about.page.ts index 876621bcd..ca4546ebf 100644 --- a/src/app/core/settings/pages/about/about.page.ts +++ b/src/core/features/settings/pages/about/about.page.ts @@ -15,7 +15,7 @@ import { Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreSites } from '@services/sites'; /** diff --git a/src/app/core/settings/pages/app/app.html b/src/core/features/settings/pages/app/app.html similarity index 100% rename from src/app/core/settings/pages/app/app.html rename to src/core/features/settings/pages/app/app.html diff --git a/src/app/core/settings/pages/app/app.page.module.ts b/src/core/features/settings/pages/app/app.page.module.ts similarity index 100% rename from src/app/core/settings/pages/app/app.page.module.ts rename to src/core/features/settings/pages/app/app.page.module.ts diff --git a/src/app/core/settings/pages/app/app.page.ts b/src/core/features/settings/pages/app/app.page.ts similarity index 100% rename from src/app/core/settings/pages/app/app.page.ts rename to src/core/features/settings/pages/app/app.page.ts diff --git a/src/app/core/settings/pages/deviceinfo/deviceinfo.html b/src/core/features/settings/pages/deviceinfo/deviceinfo.html similarity index 100% rename from src/app/core/settings/pages/deviceinfo/deviceinfo.html rename to src/core/features/settings/pages/deviceinfo/deviceinfo.html diff --git a/src/app/core/settings/pages/deviceinfo/deviceinfo.page.module.ts b/src/core/features/settings/pages/deviceinfo/deviceinfo.page.module.ts similarity index 100% rename from src/app/core/settings/pages/deviceinfo/deviceinfo.page.module.ts rename to src/core/features/settings/pages/deviceinfo/deviceinfo.page.module.ts diff --git a/src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts b/src/core/features/settings/pages/deviceinfo/deviceinfo.page.ts similarity index 99% rename from src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts rename to src/core/features/settings/pages/deviceinfo/deviceinfo.page.ts index 06096fc70..8f65d99ca 100644 --- a/src/app/core/settings/pages/deviceinfo/deviceinfo.page.ts +++ b/src/core/features/settings/pages/deviceinfo/deviceinfo.page.ts @@ -14,7 +14,7 @@ import { CoreApp } from '@services/app'; import { Component, OnDestroy } from '@angular/core'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreLocalNotifications } from '@services/local-notifications'; import { Device, Platform, Translate, Network, NgZone } from '@singletons/core.singletons'; import { CoreLang } from '@services/lang'; diff --git a/src/app/core/settings/pages/deviceinfo/deviceinfo.scss b/src/core/features/settings/pages/deviceinfo/deviceinfo.scss similarity index 100% rename from src/app/core/settings/pages/deviceinfo/deviceinfo.scss rename to src/core/features/settings/pages/deviceinfo/deviceinfo.scss diff --git a/src/app/core/settings/pages/general/general.html b/src/core/features/settings/pages/general/general.html similarity index 100% rename from src/app/core/settings/pages/general/general.html rename to src/core/features/settings/pages/general/general.html diff --git a/src/app/core/settings/pages/general/general.page.module.ts b/src/core/features/settings/pages/general/general.page.module.ts similarity index 100% rename from src/app/core/settings/pages/general/general.page.module.ts rename to src/core/features/settings/pages/general/general.page.module.ts diff --git a/src/app/core/settings/pages/general/general.page.ts b/src/core/features/settings/pages/general/general.page.ts similarity index 97% rename from src/app/core/settings/pages/general/general.page.ts rename to src/core/features/settings/pages/general/general.page.ts index 46f9c80e2..b410e130c 100644 --- a/src/app/core/settings/pages/general/general.page.ts +++ b/src/core/features/settings/pages/general/general.page.ts @@ -13,12 +13,12 @@ // limitations under the License. import { Component } from '@angular/core'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreConfig } from '@services/config'; import { CoreEvents } from '@singletons/events'; import { CoreLang } from '@services/lang'; import { CoreDomUtils } from '@services/utils/dom'; -// import { CorePushNotifications } from '@core/pushnotifications/services/pushnotifications'; +// import { CorePushNotifications } from '@features/pushnotifications/services/pushnotifications'; import { CoreSettingsHelper, CoreColorScheme } from '../../services/settings.helper'; /** diff --git a/src/app/core/settings/pages/general/general.scss b/src/core/features/settings/pages/general/general.scss similarity index 100% rename from src/app/core/settings/pages/general/general.scss rename to src/core/features/settings/pages/general/general.scss diff --git a/src/app/core/settings/pages/licenses/licenses.html b/src/core/features/settings/pages/licenses/licenses.html similarity index 100% rename from src/app/core/settings/pages/licenses/licenses.html rename to src/core/features/settings/pages/licenses/licenses.html diff --git a/src/app/core/settings/pages/licenses/licenses.page.module.ts b/src/core/features/settings/pages/licenses/licenses.page.module.ts similarity index 100% rename from src/app/core/settings/pages/licenses/licenses.page.module.ts rename to src/core/features/settings/pages/licenses/licenses.page.module.ts diff --git a/src/app/core/settings/pages/licenses/licenses.page.ts b/src/core/features/settings/pages/licenses/licenses.page.ts similarity index 98% rename from src/app/core/settings/pages/licenses/licenses.page.ts rename to src/core/features/settings/pages/licenses/licenses.page.ts index 05dd7334f..d9793fd49 100644 --- a/src/app/core/settings/pages/licenses/licenses.page.ts +++ b/src/core/features/settings/pages/licenses/licenses.page.ts @@ -13,7 +13,7 @@ // limitations under the License. import { Component, OnInit } from '@angular/core'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { Http } from '@singletons/core.singletons'; /** diff --git a/src/app/core/settings/pages/site/site.html b/src/core/features/settings/pages/site/site.html similarity index 100% rename from src/app/core/settings/pages/site/site.html rename to src/core/features/settings/pages/site/site.html diff --git a/src/app/core/settings/pages/site/site.page.module.ts b/src/core/features/settings/pages/site/site.page.module.ts similarity index 100% rename from src/app/core/settings/pages/site/site.page.module.ts rename to src/core/features/settings/pages/site/site.page.module.ts diff --git a/src/app/core/settings/pages/site/site.page.ts b/src/core/features/settings/pages/site/site.page.ts similarity index 98% rename from src/app/core/settings/pages/site/site.page.ts rename to src/core/features/settings/pages/site/site.page.ts index 0ac690b20..28f794e11 100644 --- a/src/app/core/settings/pages/site/site.page.ts +++ b/src/core/features/settings/pages/site/site.page.ts @@ -21,7 +21,7 @@ import { CoreEventObserver, CoreEvents, CoreEventSiteUpdatedData } from '@single import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; // import { CoreSplitViewComponent } from '@components/split-view/split-view'; -// import { CoreSharedFiles } from '@core/sharedfiles/providers/sharedfiles'; +// import { CoreSharedFiles } from '@features/sharedfiles/providers/sharedfiles'; import { CoreSettingsHelper, CoreSiteSpaceUsage } from '../../services/settings.helper'; import { CoreApp } from '@services/app'; import { CoreSiteInfo } from '@classes/site'; diff --git a/src/app/core/settings/pages/space-usage/space-usage.html b/src/core/features/settings/pages/space-usage/space-usage.html similarity index 100% rename from src/app/core/settings/pages/space-usage/space-usage.html rename to src/core/features/settings/pages/space-usage/space-usage.html diff --git a/src/app/core/settings/pages/space-usage/space-usage.page.module.ts b/src/core/features/settings/pages/space-usage/space-usage.page.module.ts similarity index 100% rename from src/app/core/settings/pages/space-usage/space-usage.page.module.ts rename to src/core/features/settings/pages/space-usage/space-usage.page.module.ts diff --git a/src/app/core/settings/pages/space-usage/space-usage.page.ts b/src/core/features/settings/pages/space-usage/space-usage.page.ts similarity index 100% rename from src/app/core/settings/pages/space-usage/space-usage.page.ts rename to src/core/features/settings/pages/space-usage/space-usage.page.ts diff --git a/src/app/core/settings/pages/synchronization/synchronization.html b/src/core/features/settings/pages/synchronization/synchronization.html similarity index 100% rename from src/app/core/settings/pages/synchronization/synchronization.html rename to src/core/features/settings/pages/synchronization/synchronization.html diff --git a/src/app/core/settings/pages/synchronization/synchronization.page.module.ts b/src/core/features/settings/pages/synchronization/synchronization.page.module.ts similarity index 100% rename from src/app/core/settings/pages/synchronization/synchronization.page.module.ts rename to src/core/features/settings/pages/synchronization/synchronization.page.module.ts diff --git a/src/app/core/settings/pages/synchronization/synchronization.page.ts b/src/core/features/settings/pages/synchronization/synchronization.page.ts similarity index 96% rename from src/app/core/settings/pages/synchronization/synchronization.page.ts rename to src/core/features/settings/pages/synchronization/synchronization.page.ts index 19c6bf063..2802f5132 100644 --- a/src/app/core/settings/pages/synchronization/synchronization.page.ts +++ b/src/core/features/settings/pages/synchronization/synchronization.page.ts @@ -14,12 +14,12 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreEventObserver, CoreEvents, CoreEventSiteUpdatedData } from '@singletons/events'; import { CoreSites, CoreSiteBasicInfo } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreConfig } from '@services/config'; -import { CoreSettingsHelper } from '@core/settings/services/settings.helper'; +import { CoreSettingsHelper } from '@features/settings/services/settings.helper'; import { Translate } from '@singletons/core.singletons'; /** diff --git a/src/app/core/settings/services/settings.delegate.ts b/src/core/features/settings/services/settings.delegate.ts similarity index 100% rename from src/app/core/settings/services/settings.delegate.ts rename to src/core/features/settings/services/settings.delegate.ts diff --git a/src/app/core/settings/services/settings.helper.ts b/src/core/features/settings/services/settings.helper.ts similarity index 98% rename from src/app/core/settings/services/settings.helper.ts rename to src/core/features/settings/services/settings.helper.ts index ecef516b3..6f9022b6b 100644 --- a/src/app/core/settings/services/settings.helper.ts +++ b/src/core/features/settings/services/settings.helper.ts @@ -20,11 +20,11 @@ import { CoreFilepool } from '@services/filepool'; import { CoreSite } from '@classes/site'; import { CoreSites } from '@services/sites'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreConfig } from '@services/config'; -// import { CoreFilterProvider } from '@core/filter/providers/filter'; +// import { CoreFilterProvider } from '@features/filter/providers/filter'; import { CoreDomUtils } from '@services/utils/dom'; -// import { CoreCourseProvider } from '@core/course/providers/course'; +// import { CoreCourseProvider } from '@features/course/providers/course'; import { makeSingleton, Translate } from '@singletons/core.singletons'; import { CoreError } from '@classes/errors/error'; diff --git a/src/app/core/settings/settings-init.module.ts b/src/core/features/settings/settings-init.module.ts similarity index 77% rename from src/app/core/settings/settings-init.module.ts rename to src/core/features/settings/settings-init.module.ts index 10b819776..6300b1bc8 100644 --- a/src/app/core/settings/settings-init.module.ts +++ b/src/core/features/settings/settings-init.module.ts @@ -15,16 +15,16 @@ import { NgModule } from '@angular/core'; import { Routes } from '@angular/router'; -import { CoreMainMenuRoutingModule } from '@core/mainmenu/mainmenu-routing.module'; +import { CoreMainMenuRoutingModule } from '@features/mainmenu/mainmenu-routing.module'; const routes: Routes = [ { path: 'settings', - loadChildren: () => import('@core/settings/settings.module').then(m => m.CoreSettingsModule), + loadChildren: () => import('@features/settings/settings.module').then(m => m.CoreSettingsModule), }, { path: 'preferences', - loadChildren: () => import('@core/settings/pages/site/site.page.module').then(m => m.CoreSitePreferencesPageModule), + loadChildren: () => import('@features/settings/pages/site/site.page.module').then(m => m.CoreSitePreferencesPageModule), }, ]; diff --git a/src/app/core/settings/settings-routing.module.ts b/src/core/features/settings/settings-routing.module.ts similarity index 89% rename from src/app/core/settings/settings-routing.module.ts rename to src/core/features/settings/settings-routing.module.ts index 19d726001..76538b40b 100644 --- a/src/app/core/settings/settings-routing.module.ts +++ b/src/core/features/settings/settings-routing.module.ts @@ -27,13 +27,13 @@ const routes: Routes = [ { path: 'spaceusage', loadChildren: () => - import('@core/settings/pages/space-usage/space-usage.page.module') + import('@features/settings/pages/space-usage/space-usage.page.module') .then(m => m.CoreSettingsSpaceUsagePageModule), }, { path: 'sync', loadChildren: () => - import('@core/settings/pages/synchronization/synchronization.page.module') + import('@features/settings/pages/synchronization/synchronization.page.module') .then(m => m.CoreSettingsSynchronizationPageModule), }, { diff --git a/src/app/core/settings/settings.module.ts b/src/core/features/settings/settings.module.ts similarity index 100% rename from src/app/core/settings/settings.module.ts rename to src/core/features/settings/settings.module.ts diff --git a/src/app/guards/auth.guard.ts b/src/core/guards/auth.guard.ts similarity index 100% rename from src/app/guards/auth.guard.ts rename to src/core/guards/auth.guard.ts diff --git a/src/app/lang/en.json b/src/core/lang/en.json similarity index 100% rename from src/app/lang/en.json rename to src/core/lang/en.json diff --git a/src/app/pipes/bytes-to-size.pipe.ts b/src/core/pipes/bytes-to-size.pipe.ts similarity index 100% rename from src/app/pipes/bytes-to-size.pipe.ts rename to src/core/pipes/bytes-to-size.pipe.ts diff --git a/src/app/pipes/create-links.pipe.ts b/src/core/pipes/create-links.pipe.ts similarity index 100% rename from src/app/pipes/create-links.pipe.ts rename to src/core/pipes/create-links.pipe.ts diff --git a/src/app/pipes/format-date.pipe.ts b/src/core/pipes/format-date.pipe.ts similarity index 100% rename from src/app/pipes/format-date.pipe.ts rename to src/core/pipes/format-date.pipe.ts diff --git a/src/app/pipes/no-tags.pipe.ts b/src/core/pipes/no-tags.pipe.ts similarity index 100% rename from src/app/pipes/no-tags.pipe.ts rename to src/core/pipes/no-tags.pipe.ts diff --git a/src/app/pipes/pipes.module.ts b/src/core/pipes/pipes.module.ts similarity index 100% rename from src/app/pipes/pipes.module.ts rename to src/core/pipes/pipes.module.ts diff --git a/src/app/pipes/seconds-to-hms.pipe.ts b/src/core/pipes/seconds-to-hms.pipe.ts similarity index 97% rename from src/app/pipes/seconds-to-hms.pipe.ts rename to src/core/pipes/seconds-to-hms.pipe.ts index f483237f0..047b24ab4 100644 --- a/src/app/pipes/seconds-to-hms.pipe.ts +++ b/src/core/pipes/seconds-to-hms.pipe.ts @@ -16,7 +16,7 @@ import { Pipe, PipeTransform } from '@angular/core'; import { CoreTextUtils } from '@services/utils/text'; import { CoreLogger } from '@singletons/logger'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; /** * Pipe to convert a number of seconds to Hours:Minutes:Seconds. diff --git a/src/app/pipes/time-ago.pipe.ts b/src/core/pipes/time-ago.pipe.ts similarity index 100% rename from src/app/pipes/time-ago.pipe.ts rename to src/core/pipes/time-ago.pipe.ts diff --git a/src/app/services/app.db.ts b/src/core/services/app.db.ts similarity index 100% rename from src/app/services/app.db.ts rename to src/core/services/app.db.ts diff --git a/src/app/services/app.ts b/src/core/services/app.ts similarity index 99% rename from src/app/services/app.ts rename to src/core/services/app.ts index c977b166f..a09eea202 100644 --- a/src/app/services/app.ts +++ b/src/core/services/app.ts @@ -21,7 +21,7 @@ import { CoreEvents } from '@singletons/events'; import { CoreUtils, PromiseDefer } from '@services/utils/utils'; import { CoreUrlUtils } from '@services/utils/url'; import { SQLiteDB, SQLiteDBTableSchema } from '@classes/sqlitedb'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { makeSingleton, Keyboard, Network, StatusBar, Platform, Device } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; @@ -40,7 +40,7 @@ import { DBNAME, SCHEMA_VERSIONS_TABLE_NAME, SCHEMA_VERSIONS_TABLE_SCHEMA, Schem * } * ``` */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreAppProvider { protected db: SQLiteDB; diff --git a/src/app/services/config.db.ts b/src/core/services/config.db.ts similarity index 100% rename from src/app/services/config.db.ts rename to src/core/services/config.db.ts diff --git a/src/app/services/config.ts b/src/core/services/config.ts similarity index 98% rename from src/app/services/config.ts rename to src/core/services/config.ts index 9cdf15782..ed7d54f73 100644 --- a/src/app/services/config.ts +++ b/src/core/services/config.ts @@ -23,7 +23,7 @@ import { CONFIG_TABLE_NAME, APP_SCHEMA, ConfigDBEntry } from '@services/config.d * Factory to provide access to dynamic and permanent config and settings. * It should not be abused into a temporary storage. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreConfigProvider { protected appDB: SQLiteDB; diff --git a/src/app/services/cron.db.ts b/src/core/services/cron.db.ts similarity index 100% rename from src/app/services/cron.db.ts rename to src/core/services/cron.db.ts diff --git a/src/app/services/cron.ts b/src/core/services/cron.ts similarity index 99% rename from src/app/services/cron.ts rename to src/core/services/cron.ts index f542bfcbc..a96fec9cb 100644 --- a/src/app/services/cron.ts +++ b/src/core/services/cron.ts @@ -17,7 +17,7 @@ import { Injectable, NgZone } from '@angular/core'; import { CoreApp, CoreAppProvider } from '@services/app'; import { CoreConfig } from '@services/config'; import { CoreUtils } 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'; @@ -28,7 +28,7 @@ import { APP_SCHEMA, CRON_TABLE_NAME, CronDBEntry } from '@services/cron.db'; /* * Service to handle cron processes. The registered processes will be executed every certain time. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreCronDelegate { // Constants. diff --git a/src/app/services/db.ts b/src/core/services/db.ts similarity index 96% rename from src/app/services/db.ts rename to src/core/services/db.ts index ca5aedb1e..c02b1a416 100644 --- a/src/app/services/db.ts +++ b/src/core/services/db.ts @@ -15,13 +15,13 @@ import { Injectable } from '@angular/core'; import { SQLiteDB } from '@classes/sqlitedb'; -import { SQLiteDBMock } from '@core/emulator/classes/sqlitedb'; +import { SQLiteDBMock } from '@features/emulator/classes/sqlitedb'; import { makeSingleton, SQLite, Platform } from '@singletons/core.singletons'; /** * This service allows interacting with the local database to store and retrieve data. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreDbProvider { protected dbInstances: {[name: string]: SQLiteDB} = {}; diff --git a/src/app/services/file-helper.ts b/src/core/services/file-helper.ts similarity index 99% rename from src/app/services/file-helper.ts rename to src/core/services/file-helper.ts index b9280a4ce..e9b68c725 100644 --- a/src/app/services/file-helper.ts +++ b/src/core/services/file-helper.ts @@ -23,14 +23,14 @@ import { CoreWS, CoreWSExternalFile } from '@services/ws'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUrlUtils } from '@services/utils/url'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreError } from '@classes/errors/error'; import { makeSingleton, Translate } from '@singletons/core.singletons'; /** * Provider to provide some helper functions regarding files and packages. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreFileHelperProvider { /** diff --git a/src/app/services/file-session.ts b/src/core/services/file-session.ts similarity index 99% rename from src/app/services/file-session.ts rename to src/core/services/file-session.ts index 9cbdeadc9..c9e9fc661 100644 --- a/src/app/services/file-session.ts +++ b/src/core/services/file-session.ts @@ -26,7 +26,7 @@ import { makeSingleton } from '@singletons/core.singletons'; * Every component can provide a File area identifier to indentify every file list on the session. * This value can be the activity id or a mix of name and numbers. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreFileSessionProvider { protected files: {[siteId: string]: {[component: string]: {[id: string]: (CoreWSExternalFile | FileEntry)[]}}} = {}; diff --git a/src/app/services/file.ts b/src/core/services/file.ts similarity index 99% rename from src/app/services/file.ts rename to src/core/services/file.ts index 0912615fb..2e9704fa0 100644 --- a/src/app/services/file.ts +++ b/src/core/services/file.ts @@ -21,7 +21,7 @@ import { CoreWSExternalFile } from '@services/ws'; import { CoreMimetypeUtils } from '@services/utils/mimetype'; import { CoreTextUtils } from '@services/utils/text'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreError } from '@classes/errors/error'; import { CoreLogger } from '@singletons/logger'; @@ -66,7 +66,7 @@ export const enum CoreFileFormat { /** * Factory to interact with the file system. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreFileProvider { // Formats to read a file. diff --git a/src/app/services/filepool.db.ts b/src/core/services/filepool-db.ts similarity index 98% rename from src/app/services/filepool.db.ts rename to src/core/services/filepool-db.ts index 42c8a15b0..710584800 100644 --- a/src/app/services/filepool.db.ts +++ b/src/core/services/filepool-db.ts @@ -13,7 +13,7 @@ // limitations under the License. import { CoreAppSchema } from '@services/app'; -import { CoreSiteSchema, registerSiteSchema } from '@services/sites'; +import { CoreSiteSchema } from '@services/sites'; /** * Database variables for CoreFilepool service. @@ -361,7 +361,3 @@ export type CoreFilepoolLinksRecord = { component: string; // Component name. componentId: number | string; // Component Id. }; - -export const initCoreFilepoolDB = (): void => { - registerSiteSchema(SITE_SCHEMA); -}; diff --git a/src/app/services/filepool.ts b/src/core/services/filepool.ts similarity index 99% rename from src/app/services/filepool.ts rename to src/core/services/filepool.ts index bed2a0680..279d14239 100644 --- a/src/app/services/filepool.ts +++ b/src/core/services/filepool.ts @@ -30,7 +30,7 @@ import { CoreUrlUtils } from '@services/utils/url'; import { CoreUtils, PromiseDefer } from '@services/utils/utils'; import { SQLiteDB } from '@classes/sqlitedb'; import { CoreError } from '@classes/errors/error'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { makeSingleton, Network, NgZone, Translate } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; import { @@ -46,7 +46,7 @@ import { CoreFilepoolPackageEntry, CoreFilepoolQueueEntry, CoreFilepoolQueueDBEntry, -} from '@services/filepool.db'; +} from '@services/filepool-db'; /* * Factory for handling downloading files and retrieve downloaded files. @@ -57,7 +57,7 @@ import { * The two main goals of this is to keep the content available offline, and improve the user experience by caching * the content locally. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreFilepoolProvider { // Constants. diff --git a/src/app/services/geolocation.ts b/src/core/services/geolocation.ts similarity index 99% rename from src/app/services/geolocation.ts rename to src/core/services/geolocation.ts index 110b368e8..05214b1f2 100644 --- a/src/app/services/geolocation.ts +++ b/src/core/services/geolocation.ts @@ -19,7 +19,7 @@ import { CoreApp } from '@services/app'; import { CoreError } from '@classes/errors/error'; import { Geolocation, Diagnostic, makeSingleton } from '@singletons/core.singletons'; -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreGeolocationProvider { /** diff --git a/src/app/services/groups.ts b/src/core/services/groups.ts similarity index 99% rename from src/app/services/groups.ts rename to src/core/services/groups.ts index 3eb041db4..b82596a84 100644 --- a/src/app/services/groups.ts +++ b/src/core/services/groups.ts @@ -24,7 +24,7 @@ import { CoreCourseBase } from '@/types/global'; /* * Service to handle groups. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreGroupsProvider { // Group mode constants. diff --git a/src/app/services/handlers/site-info-cron-handler.ts b/src/core/services/handlers/site-info-cron-handler.ts similarity index 100% rename from src/app/services/handlers/site-info-cron-handler.ts rename to src/core/services/handlers/site-info-cron-handler.ts diff --git a/src/app/services/init.ts b/src/core/services/init.ts similarity index 99% rename from src/app/services/init.ts rename to src/core/services/init.ts index 5a8e042bd..feb39b7a3 100644 --- a/src/app/services/init.ts +++ b/src/core/services/init.ts @@ -48,7 +48,7 @@ export type CoreInitHandler = { /* * Provider for initialisation mechanisms. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreInitDelegate { static readonly DEFAULT_PRIORITY = 100; // Default priority for init processes. diff --git a/src/app/services/lang.ts b/src/core/services/lang.ts similarity index 99% rename from src/app/services/lang.ts rename to src/core/services/lang.ts index 8daaa3171..e1e0d6879 100644 --- a/src/app/services/lang.ts +++ b/src/core/services/lang.ts @@ -14,7 +14,7 @@ import { Injectable } from '@angular/core'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { LangChangeEvent } from '@ngx-translate/core'; import { CoreAppProvider } from '@services/app'; import { CoreConfig } from '@services/config'; @@ -25,7 +25,7 @@ import * as moment from 'moment'; /* * Service to handle language features, like changing the current language. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreLangProvider { protected fallbackLanguage = 'en'; // Always use English as fallback language since it contains all strings. diff --git a/src/app/services/local-notifications.db.ts b/src/core/services/local-notifications.db.ts similarity index 100% rename from src/app/services/local-notifications.db.ts rename to src/core/services/local-notifications.db.ts diff --git a/src/app/services/local-notifications.ts b/src/core/services/local-notifications.ts similarity index 99% rename from src/app/services/local-notifications.ts rename to src/core/services/local-notifications.ts index 55253e69c..353affdee 100644 --- a/src/app/services/local-notifications.ts +++ b/src/core/services/local-notifications.ts @@ -25,7 +25,7 @@ import { SQLiteDB } from '@classes/sqlitedb'; import { CoreSite } from '@classes/site'; import { CoreQueueRunner } from '@classes/queue-runner'; import { CoreError } from '@classes/errors/error'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { makeSingleton, NgZone, Platform, Translate, LocalNotifications, Push } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; import { @@ -39,7 +39,7 @@ import { /** * Service to handle local notifications. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreLocalNotificationsProvider { protected logger: CoreLogger; diff --git a/src/app/services/plugin-file.delegate.ts b/src/core/services/plugin-file.delegate.ts similarity index 99% rename from src/app/services/plugin-file.delegate.ts rename to src/core/services/plugin-file.delegate.ts index bc0c51953..cfd57613b 100644 --- a/src/app/services/plugin-file.delegate.ts +++ b/src/core/services/plugin-file.delegate.ts @@ -17,14 +17,14 @@ import { FileEntry } from '@ionic-native/file'; import { CoreFilepool, CoreFilepoolOnProgressCallback } from '@services/filepool'; import { CoreWSExternalFile } from '@services/ws'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate'; import { makeSingleton } from '@singletons/core.singletons'; /** * Delegate to register pluginfile information handlers. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CorePluginFileDelegate extends CoreDelegate { protected handlerNameProperty = 'component'; diff --git a/src/app/services/sites.db.ts b/src/core/services/sites-db.ts similarity index 97% rename from src/app/services/sites.db.ts rename to src/core/services/sites-db.ts index 83c6e8027..a6eea9464 100644 --- a/src/app/services/sites.db.ts +++ b/src/core/services/sites-db.ts @@ -13,7 +13,7 @@ // limitations under the License. import { CoreAppSchema } from '@services/app'; -import { CoreSiteSchema, registerSiteSchema } from '@services/sites'; +import { CoreSiteSchema } from '@services/sites'; import { SQLiteDB, SQLiteDBTableSchema } from '@classes/sqlitedb'; import { CoreSite } from '@classes/site'; @@ -227,7 +227,3 @@ export type SchemaVersionsDBEntry = { name: string; version: number; }; - -export const initCoreSitesDB = (): void => { - registerSiteSchema(SITE_SCHEMA); -}; diff --git a/src/app/services/sites.ts b/src/core/services/sites.ts similarity index 98% rename from src/app/services/sites.ts rename to src/core/services/sites.ts index 665798c64..3d8d52de2 100644 --- a/src/app/services/sites.ts +++ b/src/core/services/sites.ts @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Injectable } from '@angular/core'; +import { Inject, Injectable, InjectionToken, Optional } from '@angular/core'; import { Md5 } from 'ts-md5/dist/md5'; import { timeout } from 'rxjs/operators'; @@ -23,7 +23,7 @@ import { CoreDomUtils } from '@services/utils/dom'; import { CoreTextUtils } from '@services/utils/text'; import { CoreUrlUtils } from '@services/utils/url'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreSite, CoreSiteWSPreSets, @@ -47,25 +47,17 @@ import { SiteDBEntry, CurrentSiteDBEntry, SchemaVersionsDBEntry, -} from '@services/sites.db'; +} from '@services/sites-db'; +import { CoreArray } from '../singletons/array'; - -// Schemas for site tables. Other providers can add schemas in here using the registerSiteSchema function. -const siteSchemas: { [name: string]: CoreRegisteredSiteSchema } = {}; -export const registerSiteSchema = (schema: CoreSiteSchema): void => { - siteSchemas[schema.name] = schema; -}; +export const CORE_SITE_SCHEMAS = new InjectionToken('CORE_SITE_SCHEMAS'); /* * Service to manage and interact with sites. * It allows creating tables in the databases of all sites. Each service or component should be responsible of creating - * their own database tables. Example: - * - * import { registerSiteSchema } from '@services/sites'; - * - * registerSiteSchema(tableSchema); + * their own database tables calling the registerCoreSiteSchema method. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreSitesProvider { // Constants to validate a site version. @@ -84,11 +76,19 @@ export class CoreSitesProvider { protected appDB: SQLiteDB; protected dbReady: Promise; // Promise resolved when the app DB is initialized. protected siteSchemasMigration: { [siteId: string]: Promise } = {}; + protected siteSchemas: { [name: string]: CoreRegisteredSiteSchema } = {}; protected pluginsSiteSchemas: { [name: string]: CoreRegisteredSiteSchema } = {}; - constructor() { + constructor(@Optional() @Inject(CORE_SITE_SCHEMAS) siteSchemas: CoreSiteSchema[][] = []) { this.logger = CoreLogger.getInstance('CoreSitesProvider'); + this.siteSchemas = CoreArray.flatten(siteSchemas).reduce( + (siteSchemas, schema) => { + siteSchemas[schema.name] = schema; + return siteSchemas; + }, + this.siteSchemas, + ); this.appDB = CoreApp.instance.getDB(); this.dbReady = CoreApp.instance.createTablesFromSchema(APP_SCHEMA).catch(() => { // Ignore errors. @@ -1446,7 +1446,7 @@ export class CoreSitesProvider { /** * Register a site schema in current site. * This function is meant for site plugins to create DB tables in current site. Tables created from within the app - * whould use the registerSiteSchema function exported in this same file. + * should use the registerCoreSiteSchema method instead. * * @param schema The schema to register. * @return Promise resolved when done. @@ -1489,7 +1489,7 @@ export class CoreSitesProvider { // First create tables not registerd with name/version. const promise = site.getDb().createTableFromSchema(SCHEMA_VERSIONS_TABLE_SCHEMA) - .then(() => this.applySiteSchemas(site, siteSchemas)); + .then(() => this.applySiteSchemas(site, this.siteSchemas)); this.siteSchemasMigration[site.id] = promise; @@ -1602,7 +1602,7 @@ export class CoreSitesProvider { */ getSiteTableSchemasToClear(site: CoreSite): string[] { let reset: string[] = []; - const schemas = Object.values(siteSchemas).concat(Object.values(this.pluginsSiteSchemas)); + const schemas = Object.values(this.siteSchemas).concat(Object.values(this.pluginsSiteSchemas)); schemas.forEach((schema) => { if (schema.canBeCleared && (!schema.siteId || site.getId() == schema.siteId)) { diff --git a/src/app/services/sync.db.ts b/src/core/services/sync-db.ts similarity index 88% rename from src/app/services/sync.db.ts rename to src/core/services/sync-db.ts index 91489c5f7..c30db03c2 100644 --- a/src/app/services/sync.db.ts +++ b/src/core/services/sync-db.ts @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { CoreSiteSchema, registerSiteSchema } from '@services/sites'; +import { CoreSiteSchema } from '@services/sites'; /** * Database variables for CoreSync service. */ export const SYNC_TABLE_NAME = 'sync'; -const SITE_SCHEMA: CoreSiteSchema = { +export const SITE_SCHEMA: CoreSiteSchema = { name: 'CoreSyncProvider', version: 1, tables: [ @@ -55,8 +55,3 @@ export type CoreSyncRecord = { time: number; warnings: string; }; - -export const initCoreSyncDB = (): void => { - registerSiteSchema(SITE_SCHEMA); -}; - diff --git a/src/app/services/sync.ts b/src/core/services/sync.ts similarity index 98% rename from src/app/services/sync.ts rename to src/core/services/sync.ts index 16383a6f7..2b7f4a32e 100644 --- a/src/app/services/sync.ts +++ b/src/core/services/sync.ts @@ -16,12 +16,12 @@ import { Injectable } from '@angular/core'; import { CoreEvents } from '@singletons/events'; import { CoreSites } from '@services/sites'; import { makeSingleton } from '@singletons/core.singletons'; -import { SYNC_TABLE_NAME, CoreSyncRecord } from '@services/sync.db'; +import { SYNC_TABLE_NAME, CoreSyncRecord } from '@services/sync-db'; /* * Service that provides some features regarding synchronization. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreSyncProvider { // Store blocked sync objects. diff --git a/src/app/services/tests/utils/text.test.ts b/src/core/services/tests/utils/text.test.ts similarity index 97% rename from src/app/services/tests/utils/text.test.ts rename to src/core/services/tests/utils/text.test.ts index 82bbc2bfd..2b82aa7a8 100644 --- a/src/app/services/tests/utils/text.test.ts +++ b/src/core/services/tests/utils/text.test.ts @@ -17,7 +17,7 @@ import { DomSanitizer } from '@angular/platform-browser'; import { CoreApp } from '@services/app'; import { CoreTextUtilsProvider } from '@services/utils/text'; -import { mock, mockSingleton } from '@/tests/utils'; +import { mock, mockSingleton } from '@/testing/utils'; describe('CoreTextUtilsProvider', () => { diff --git a/src/app/services/tests/utils/url.test.ts b/src/core/services/tests/utils/url.test.ts similarity index 100% rename from src/app/services/tests/utils/url.test.ts rename to src/core/services/tests/utils/url.test.ts diff --git a/src/app/services/update-manager.ts b/src/core/services/update-manager.ts similarity index 96% rename from src/app/services/update-manager.ts rename to src/core/services/update-manager.ts index 2245269e6..78ee29cdd 100644 --- a/src/app/services/update-manager.ts +++ b/src/core/services/update-manager.ts @@ -16,7 +16,7 @@ import { Injectable } from '@angular/core'; import { CoreConfig } from '@services/config'; import { CoreInitHandler, CoreInitDelegate } from '@services/init'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { makeSingleton } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; @@ -27,7 +27,7 @@ const VERSION_APPLIED = 'version_applied'; * * This service handles processes that need to be run when updating the app, like migrate Ionic 1 database data to Ionic 3. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreUpdateManagerProvider implements CoreInitHandler { // Data for init delegate. diff --git a/src/app/services/utils/dom.ts b/src/core/services/utils/dom.ts similarity index 99% rename from src/app/services/utils/dom.ts rename to src/core/services/utils/dom.ts index ec31a81bc..0e7473e1f 100644 --- a/src/app/services/utils/dom.ts +++ b/src/core/services/utils/dom.ts @@ -26,7 +26,7 @@ import { CoreWSExternalWarning } from '@services/ws'; import { CoreTextUtils, CoreTextErrorObject } from '@services/utils/text'; import { CoreUrlUtils } from '@services/utils/url'; import { CoreUtils } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreIonLoadingElement } from '@classes/ion-loading'; import { CoreCanceledError } from '@classes/errors/cancelederror'; import { CoreError } from '@classes/errors/error'; @@ -38,7 +38,7 @@ import { CoreLogger } from '@singletons/logger'; /* * "Utils" service with helper functions for UI, DOM elements and HTML code. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreDomUtilsProvider { protected readonly INSTANCE_ID_ATTR_NAME = 'core-instance-id'; diff --git a/src/app/services/utils/iframe.ts b/src/core/services/utils/iframe.ts similarity index 99% rename from src/app/services/utils/iframe.ts rename to src/core/services/utils/iframe.ts index b6e09d003..3f0541a4e 100644 --- a/src/app/services/utils/iframe.ts +++ b/src/core/services/utils/iframe.ts @@ -42,7 +42,7 @@ type CoreFrameElement = (HTMLIFrameElement | HTMLFrameElement | HTMLObjectElemen /* * "Utils" service with helper functions for iframes, embed and similar. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreIframeUtilsProvider { static readonly FRAME_TAGS = ['iframe', 'frame', 'object', 'embed']; diff --git a/src/app/services/utils/mimetype.ts b/src/core/services/utils/mimetype.ts similarity index 99% rename from src/app/services/utils/mimetype.ts rename to src/core/services/utils/mimetype.ts index bbf1219c4..4f400f8c5 100644 --- a/src/app/services/utils/mimetype.ts +++ b/src/core/services/utils/mimetype.ts @@ -44,7 +44,7 @@ const EXTENSION_REGEX = /^[a-z0-9]+$/; /* * "Utils" service with helper functions for mimetypes and extensions. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreMimetypeUtilsProvider { protected logger: CoreLogger; diff --git a/src/app/services/utils/text.ts b/src/core/services/utils/text.ts similarity index 99% rename from src/app/services/utils/text.ts rename to src/core/services/utils/text.ts index dcaf3c00f..a5a81301d 100644 --- a/src/app/services/utils/text.ts +++ b/src/core/services/utils/text.ts @@ -37,7 +37,7 @@ export type CoreTextErrorObject = { /* * "Utils" service with helper functions for text. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreTextUtilsProvider { // List of regular expressions to convert the old nomenclature to new nomenclature for disabled features. diff --git a/src/app/services/utils/time.ts b/src/core/services/utils/time.ts similarity index 99% rename from src/app/services/utils/time.ts rename to src/core/services/utils/time.ts index d06b45b47..345e10008 100644 --- a/src/app/services/utils/time.ts +++ b/src/core/services/utils/time.ts @@ -15,13 +15,13 @@ import { Injectable } from '@angular/core'; import moment, { LongDateFormatKey } from 'moment'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { makeSingleton, Translate } from '@singletons/core.singletons'; /* * "Utils" service with helper functions for date and time. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreTimeUtilsProvider { protected static readonly FORMAT_REPLACEMENTS = { // To convert PHP strf format to Moment format. diff --git a/src/app/services/utils/url.ts b/src/core/services/utils/url.ts similarity index 99% rename from src/app/services/utils/url.ts rename to src/core/services/utils/url.ts index 7fc7ee464..fb5489abe 100644 --- a/src/app/services/utils/url.ts +++ b/src/core/services/utils/url.ts @@ -16,14 +16,14 @@ import { Injectable } from '@angular/core'; import { CoreLang } from '@services/lang'; import { CoreTextUtils } from '@services/utils/text'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { makeSingleton } from '@singletons/core.singletons'; import { CoreUrl } from '@singletons/url'; /* * "Utils" service with helper functions for URLs. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreUrlUtilsProvider { /** diff --git a/src/app/services/utils/utils.ts b/src/core/services/utils/utils.ts similarity index 99% rename from src/app/services/utils/utils.ts rename to src/core/services/utils/utils.ts index 676f9855a..be7c87793 100644 --- a/src/app/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -36,7 +36,7 @@ type TreeNode = T & { children: TreeNode[] }; /* * "Utils" service with helper functions. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreUtilsProvider { protected readonly DONT_CLONE = ['[object FileEntry]', '[object DirectoryEntry]', '[object DOMFileSystem]']; diff --git a/src/app/services/ws.ts b/src/core/services/ws.ts similarity index 99% rename from src/app/services/ws.ts rename to src/core/services/ws.ts index bcacb74c2..cd7b37868 100644 --- a/src/app/services/ws.ts +++ b/src/core/services/ws.ts @@ -27,7 +27,7 @@ import { CoreFile, CoreFileProvider } from '@services/file'; import { CoreMimetypeUtils } from '@services/utils/mimetype'; import { CoreTextUtils } from '@services/utils/text'; import { CoreUtils, PromiseDefer } from '@services/utils/utils'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; import { CoreError } from '@classes/errors/error'; import { CoreInterceptor } from '@classes/interceptor'; import { makeSingleton, Translate, FileTransfer, Http, Platform, NativeHttp } from '@singletons/core.singletons'; @@ -40,7 +40,7 @@ import { CoreAjaxWSError } from '@classes/errors/ajaxwserror'; /** * This service allows performing WS calls and download/upload files. */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class CoreWSProvider { protected logger: CoreLogger; diff --git a/src/app/singletons/array.ts b/src/core/singletons/array.ts similarity index 100% rename from src/app/singletons/array.ts rename to src/core/singletons/array.ts diff --git a/src/app/singletons/core.singletons.ts b/src/core/singletons/core.singletons.ts similarity index 100% rename from src/app/singletons/core.singletons.ts rename to src/core/singletons/core.singletons.ts diff --git a/src/app/singletons/events.ts b/src/core/singletons/events.ts similarity index 100% rename from src/app/singletons/events.ts rename to src/core/singletons/events.ts diff --git a/src/app/singletons/locutus.ts b/src/core/singletons/locutus.ts similarity index 100% rename from src/app/singletons/locutus.ts rename to src/core/singletons/locutus.ts diff --git a/src/app/singletons/logger.ts b/src/core/singletons/logger.ts similarity index 98% rename from src/app/singletons/logger.ts rename to src/core/singletons/logger.ts index fab03132b..88e1dd93d 100644 --- a/src/app/singletons/logger.ts +++ b/src/core/singletons/logger.ts @@ -14,7 +14,7 @@ import moment from 'moment'; -import { CoreConstants } from '@core/constants'; +import { CoreConstants } from '@/core/constants'; /** * Log function type. diff --git a/src/app/singletons/object.ts b/src/core/singletons/object.ts similarity index 100% rename from src/app/singletons/object.ts rename to src/core/singletons/object.ts diff --git a/src/app/singletons/url.ts b/src/core/singletons/url.ts similarity index 100% rename from src/app/singletons/url.ts rename to src/core/singletons/url.ts diff --git a/src/app/singletons/window.ts b/src/core/singletons/window.ts similarity index 100% rename from src/app/singletons/window.ts rename to src/core/singletons/window.ts diff --git a/src/main.ts b/src/main.ts index 12a0be150..5e28626c8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,7 +16,7 @@ import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; -import { CoreConstants } from './app/core/constants'; +import { CoreConstants } from './core/constants'; if (CoreConstants.BUILD.isProduction) { enableProdMode(); diff --git a/src/polyfills.ts b/src/polyfills.ts index 7139d16af..191982e76 100644 --- a/src/polyfills.ts +++ b/src/polyfills.ts @@ -12,12 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -/** - * BROWSER POLYFILLS - */ -import './zone-flags'; +// Prevents Angular change detection from running with certain Web Component callbacks. +// eslint-disable-next-line no-underscore-dangle +window.__Zone_disable_customElements = true; -/** - * Zone JS is required by default for Angular itself. - */ -import 'zone.js/dist/zone'; // Included with Angular CLI. +// Zone JS is required by default for Angular itself. +import 'zone.js/dist/zone'; diff --git a/src/tests/setup.ts b/src/testing/setup.ts similarity index 100% rename from src/tests/setup.ts rename to src/testing/setup.ts diff --git a/src/tests/utils.ts b/src/testing/utils.ts similarity index 98% rename from src/tests/utils.ts rename to src/testing/utils.ts index f15be53ae..97d6bba4b 100644 --- a/src/tests/utils.ts +++ b/src/testing/utils.ts @@ -15,7 +15,7 @@ import { Component, CUSTOM_ELEMENTS_SCHEMA, Type, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreSingletonClass } from '@app/classes/singletons-factory'; +import { CoreSingletonClass } from '@classes/singletons-factory'; abstract class WrapperComponent { diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 7d0373840..9d4eedb56 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -14,7 +14,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { CoreColorScheme } from '@core/settings/services/settings.helper'; +import { CoreColorScheme } from '@features/settings/services/settings.helper'; import { CoreSitesDemoSiteData } from '@services/sites'; declare global { diff --git a/tsconfig.app.json b/tsconfig.app.json index 72a9b5489..fac4237c0 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -11,16 +11,14 @@ ], "paths": { "@/*": ["*"], - "@addon/*": ["app/addon/*"], - "@app/*": ["app/*"], - "@classes/*": ["app/classes/*"], - "@components/*": ["app/components/*"], - "@core/*": ["app/core/*"], - "@directives/*": ["app/directives/*"], - "@guards/*": ["app/guards/*"], - "@pipes/*": ["app/pipes/*"], - "@services/*": ["app/services/*"], - "@singletons/*": ["app/singletons/*"] + "@classes/*": ["core/classes/*"], + "@components/*": ["core/components/*"], + "@directives/*": ["core/directives/*"], + "@features/*": ["core/features/*"], + "@guards/*": ["core/guards/*"], + "@pipes/*": ["core/pipes/*"], + "@services/*": ["core/services/*"], + "@singletons/*": ["core/singletons/*"] } }, "files": [ @@ -33,6 +31,6 @@ ], "exclude": [ "src/**/*.test.ts", - "src/tests/**" + "src/testing/**" ] } diff --git a/tsconfig.json b/tsconfig.json index 1bc3663d1..549502f80 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -30,17 +30,14 @@ ], "paths": { "@/*": ["*"], - "@addon/*": ["app/addon/*"], - "@app/*": ["app/*"], - "@classes/*": ["app/classes/*"], - "@components/*": ["app/components/*"], - "@core/*": ["app/core/*"], - "@directives/*": ["app/directives/*"], - "@guards/*": ["app/guards/*"], - "@pipes/*": ["app/pipes/*"], - "@services/*": ["app/services/*"], - "@singletons/*": ["app/singletons/*"], - "@tests/*": ["tests/*"] + "@classes/*": ["core/classes/*"], + "@components/*": ["core/components/*"], + "@directives/*": ["core/directives/*"], + "@features/*": ["core/features/*"], + "@guards/*": ["core/guards/*"], + "@pipes/*": ["core/pipes/*"], + "@services/*": ["core/services/*"], + "@singletons/*": ["core/singletons/*"] } }, "angularCompilerOptions": { diff --git a/tsconfig.test.json b/tsconfig.test.json index c62c89cf9..7d7f29bfe 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -16,21 +16,18 @@ ], "paths": { "@/*": ["*"], - "@addon/*": ["app/addon/*"], - "@app/*": ["app/*"], - "@classes/*": ["app/classes/*"], - "@components/*": ["app/components/*"], - "@core/*": ["app/core/*"], - "@directives/*": ["app/directives/*"], - "@guards/*": ["app/guards/*"], - "@pipes/*": ["app/pipes/*"], - "@services/*": ["app/services/*"], - "@singletons/*": ["app/singletons/*"], - "@tests/*": ["tests/*"] + "@classes/*": ["core/classes/*"], + "@components/*": ["core/components/*"], + "@directives/*": ["core/directives/*"], + "@features/*": ["core/features/*"], + "@guards/*": ["core/guards/*"], + "@pipes/*": ["core/pipes/*"], + "@services/*": ["core/services/*"], + "@singletons/*": ["core/singletons/*"] } }, "files": [ - "src/tests/setup.ts", + "src/testing/setup.ts", "src/polyfills.ts" ], "include": [