/* * Copyright (C) 2018-2020 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ import {Component} from '@angular/core'; import {SplashScreen} from '@capacitor/splash-screen'; import {Platform} from '@ionic/angular'; import {NGXLogger} from 'ngx-logger'; import {ConfigProvider} from './modules/config/config.provider'; import {SettingsProvider} from './modules/settings/settings.provider'; /** * TODO */ @Component({ selector: 'app-root', templateUrl: 'app.component.html', }) export class AppComponent { /** * TODO */ pages: Array<{ /** * TODO */ component: unknown; /** * TODO */ title: string; }>; /** * * @param platform TODO * @param settingsProvider TODO * @param configProvider TODO * @param logger An angular logger */ constructor( private readonly platform: Platform, private readonly settingsProvider: SettingsProvider, private readonly configProvider: ConfigProvider, private readonly logger: NGXLogger, ) { void this.initializeApp(); } /** * TODO */ async initializeApp() { this.platform.ready().then(async () => { await SplashScreen.hide(); // initialise the configProvider try { await this.configProvider.init(); } catch (error) { if ( typeof error.name !== 'undefined' && error.name === 'ConfigInitError' ) { // TODO: Issue #43 handle initialisation error and inform user } this.logger.error(error); } // set order of categories in settings this.settingsProvider.setCategoriesOrder([ 'profile', 'privacy', 'credentials', 'others', ]); }); } }