2020-10-05 12:56:27 +00:00
|
|
|
// (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.
|
|
|
|
|
2020-10-15 09:41:42 +00:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
import { CoreLangProvider } from '@services/lang';
|
2020-10-22 10:48:23 +00:00
|
|
|
import { CoreEvents } from '@singletons/events';
|
2020-10-05 12:56:27 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: 'app.component.html',
|
2020-10-06 10:47:16 +00:00
|
|
|
styleUrls: ['app.component.scss'],
|
2020-10-05 12:56:27 +00:00
|
|
|
})
|
2020-10-15 09:41:42 +00:00
|
|
|
export class AppComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private langProvider: CoreLangProvider,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component being initialized.
|
|
|
|
*/
|
|
|
|
ngOnInit(): void {
|
2020-10-22 10:48:23 +00:00
|
|
|
CoreEvents.on(CoreEvents.LOGOUT, () => {
|
2020-10-15 09:41:42 +00:00
|
|
|
// Go to sites page when user is logged out.
|
|
|
|
// Due to DeepLinker, we need to use the ViewCtrl instead of name.
|
|
|
|
// Otherwise some pages are re-created when they shouldn't.
|
|
|
|
// TODO
|
|
|
|
// CoreApp.instance.getRootNavController().setRoot(CoreLoginSitesPage);
|
|
|
|
|
|
|
|
// Unload lang custom strings.
|
|
|
|
this.langProvider.clearCustomStrings();
|
|
|
|
|
|
|
|
// Remove version classes from body.
|
|
|
|
// TODO
|
|
|
|
// this.removeVersionClass();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|