diff --git a/src/core/features/mainmenu/mainmenu.module.ts b/src/core/features/mainmenu/mainmenu.module.ts index ae4136604..3ff9bf494 100644 --- a/src/core/features/mainmenu/mainmenu.module.ts +++ b/src/core/features/mainmenu/mainmenu.module.ts @@ -41,6 +41,10 @@ const appRoutes: Routes = [ canActivate: [CoreMainMenuAuthGuard], canLoad: [CoreMainMenuAuthGuard], }, + { + path: 'reload', + loadChildren: () => import('./pages/reload/reload.module').then( m => m.CoreMainMenuReloadPageModule), + }, ]; @NgModule({ diff --git a/src/core/features/mainmenu/pages/reload/reload.html b/src/core/features/mainmenu/pages/reload/reload.html new file mode 100644 index 000000000..5e5ea6d14 --- /dev/null +++ b/src/core/features/mainmenu/pages/reload/reload.html @@ -0,0 +1,3 @@ + + + diff --git a/src/core/features/mainmenu/pages/reload/reload.module.ts b/src/core/features/mainmenu/pages/reload/reload.module.ts new file mode 100644 index 000000000..74a1fb7aa --- /dev/null +++ b/src/core/features/mainmenu/pages/reload/reload.module.ts @@ -0,0 +1,37 @@ +// (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 { RouterModule, Routes } from '@angular/router'; +import { CoreSharedModule } from '@/core/shared.module'; +import { CoreMainMenuReloadPage } from './reload'; + +const routes: Routes = [ + { + path: '', + component: CoreMainMenuReloadPage, + }, +]; + +@NgModule({ + imports: [ + RouterModule.forChild(routes), + CoreSharedModule, + ], + declarations: [ + CoreMainMenuReloadPage, + ], + exports: [RouterModule], +}) +export class CoreMainMenuReloadPageModule {} diff --git a/src/core/features/mainmenu/pages/reload/reload.ts b/src/core/features/mainmenu/pages/reload/reload.ts new file mode 100644 index 000000000..9a9b52a2f --- /dev/null +++ b/src/core/features/mainmenu/pages/reload/reload.ts @@ -0,0 +1,36 @@ +// (C) Copyright 2015 Moodle Pty Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Component, OnInit } from '@angular/core'; +import { CoreNavigator } from '@services/navigator'; + +/** + * Page that displays a loading and then opens the main menu again. + */ +@Component({ + selector: 'page-core-mainmenu-reload', + templateUrl: 'reload.html', +}) +export class CoreMainMenuReloadPage implements OnInit { + + /** + * @inheritdoc + */ + ngOnInit(): void { + CoreNavigator.navigate('/main', { + reset: true, + }); + } + +} diff --git a/src/core/features/settings/pages/general/general.ts b/src/core/features/settings/pages/general/general.ts index a1487f255..9db912420 100644 --- a/src/core/features/settings/pages/general/general.ts +++ b/src/core/features/settings/pages/general/general.ts @@ -26,6 +26,7 @@ import { Diagnostic, Translate } from '@singletons'; import { CoreSites } from '@services/sites'; import { CoreUtils } from '@services/utils/utils'; import { AlertButton } from '@ionic/angular'; +import { CoreNavigator } from '@services/navigator'; /** * Page that displays the general settings. @@ -168,7 +169,10 @@ export class CoreSettingsGeneralPage { await CoreUtils.ignoreErrors(Promise.all(sites.map((site) => site.invalidateWsCache()))); CoreEvents.trigger(CoreEvents.LANGUAGE_CHANGED, this.selectedLanguage); - window.location.reload(); + + CoreNavigator.navigate('/reload', { + reset: true, + }); } /**