From 5cb0c6fe0cdd8850d643096a613511545b5a2b80 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 14 Oct 2020 08:32:09 +0200 Subject: [PATCH] MOBILE-3565 core: Fix some ESLint of CoreUpdateManagerProvider --- src/app/services/update-manager.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/services/update-manager.ts b/src/app/services/update-manager.ts index b751e5d6d..96de478d9 100644 --- a/src/app/services/update-manager.ts +++ b/src/app/services/update-manager.ts @@ -20,6 +20,8 @@ import CoreConfigConstants from '@app/config.json'; import { makeSingleton } from '@singletons/core.singletons'; import { CoreLogger } from '@singletons/logger'; +const VERSION_APPLIED = 'version_applied'; + /** * Factory to handle app updates. This factory shouldn't be used outside of core. * @@ -27,12 +29,12 @@ import { CoreLogger } from '@singletons/logger'; */ @Injectable() export class CoreUpdateManagerProvider implements CoreInitHandler { + // Data for init delegate. name = 'CoreUpdateManager'; priority = CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 300; blocking = true; - protected VERSION_APPLIED = 'version_applied'; protected logger: CoreLogger; constructor() { @@ -45,11 +47,11 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { * * @return Promise resolved when the update process finishes. */ - async load(): Promise { + async load(): Promise { const promises = []; const versionCode = CoreConfigConstants.versioncode; - const versionApplied: number = await CoreConfig.instance.get(this.VERSION_APPLIED, 0); + const versionApplied: number = await CoreConfig.instance.get(VERSION_APPLIED, 0); if (versionCode >= 3900 && versionApplied < 3900 && versionApplied > 0) { // @todo: H5P update. @@ -58,11 +60,12 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { try { await Promise.all(promises); - await CoreConfig.instance.set(this.VERSION_APPLIED, versionCode); + await CoreConfig.instance.set(VERSION_APPLIED, versionCode); } catch (error) { this.logger.error(`Error applying update from ${versionApplied} to ${versionCode}`, error); } } + } export class CoreUpdateManager extends makeSingleton(CoreUpdateManagerProvider) {}