fix: update core and apply stricter tslint rules

This commit is contained in:
Michel Jonathan Schmitz
2019-07-10 12:38:29 +02:00
parent 03c317430a
commit 911492d064
67 changed files with 1291 additions and 507 deletions

View File

@@ -21,62 +21,87 @@ import {Logger} from '@openstapps/logger';
import {ConfigProvider} from './modules/config/config.provider';
import {SettingsProvider} from './modules/settings/settings.provider';
const logger: Logger = new Logger();
/**
* TODO
*/
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent {
logger: Logger = new Logger();
pages: Array<{ component: any, title: string }>;
/**
* TODO
*/
pages: Array<{
/**
* TODO
*/
component: any;
/**
* TODO
*/
title: string;
}>;
constructor(private platform: Platform,
private statusBar: StatusBar,
private splashScreen: SplashScreen,
private translateService: TranslateService,
private settingsProvider: SettingsProvider,
private configProvider: ConfigProvider) {
/**
*
* @param platform TODO
* @param statusBar TODO
* @param splashScreen TODO
* @param translateService TODO
* @param settingsProvider TODO
* @param configProvider TODO
*/
constructor(private readonly platform: Platform,
private readonly statusBar: StatusBar,
private readonly splashScreen: SplashScreen,
private readonly translateService: TranslateService,
private readonly settingsProvider: SettingsProvider,
private readonly configProvider: ConfigProvider) {
this.initializeApp();
// this language will be used as a fallback when a translation isn't found in the current language
translateService.setDefaultLang('en');
}
/**
* TODO
*/
initializeApp() {
this.platform.ready().then(async () => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
this.statusBar.styleDefault();
this.splashScreen.hide();
this.platform.ready()
.then(async () => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
this.statusBar.styleDefault();
this.splashScreen.hide();
// initialise the configProvider
try {
await this.configProvider.init();
} catch (error) {
if (typeof error.name !== 'undefined') {
if (error.name === 'ConfigInitError') {
// @TODO: Issue #43 handle initialisation error and inform user
// initialise the configProvider
try {
await this.configProvider.init();
} catch (error) {
if (typeof error.name !== 'undefined') {
if (error.name === 'ConfigInitError') {
// @TODO: Issue #43 handle initialisation error and inform user
}
}
await Logger.error(error);
}
logger.error(error);
}
// set order of categories in settings
this.settingsProvider.setCategoriesOrder([
'profile',
'privacy',
'credentials',
'others',
]);
// set order of categories in settings
this.settingsProvider.setCategoriesOrder([
'profile',
'privacy',
'credentials',
'others',
]);
try {
// set language from settings
const languageCode = await this.settingsProvider.getValue('profile', 'language');
this.translateService.use(languageCode);
} catch (error) {
this.logger.warn(error);
}
});
try {
// set language from settings
const languageCode = await this.settingsProvider.getValue('profile', 'language');
this.translateService.use(languageCode);
} catch (error) {
Logger.warn(error);
}
});
}
}