From 275639517541bf3c2c6d5a299ae6c0ba676e14ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 3 Dec 2020 11:02:30 +0100 Subject: [PATCH] MOBILE-3617 login: Use login helper singleton on course helper --- src/core/course/providers/helper.ts | 7 +++---- src/core/login/providers/helper.ts | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index 87fcd202e..db2046f87 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -34,7 +34,7 @@ import { CoreCourseProvider } from './course'; import { CoreCourseOfflineProvider } from './course-offline'; import { CoreCourseModuleDelegate } from './module-delegate'; import { CoreCourseModulePrefetchDelegate } from './module-prefetch-delegate'; -import { CoreLoginHelperProvider } from '@core/login/providers/helper'; +import { CoreLoginHelper, CoreLoginHelperProvider } from '@core/login/providers/helper'; import { CoreConstants } from '@core/constants'; import { CoreSite } from '@classes/site'; import { CoreLoggerProvider } from '@providers/logger'; @@ -122,7 +122,6 @@ export class CoreCourseHelperProvider { private timeUtils: CoreTimeUtilsProvider, private utils: CoreUtilsProvider, private translate: TranslateService, - private loginHelper: CoreLoginHelperProvider, private courseOptionsDelegate: CoreCourseOptionsDelegate, private siteHomeProvider: CoreSiteHomeProvider, private eventsProvider: CoreEventsProvider, @@ -1302,7 +1301,7 @@ export class CoreCourseHelperProvider { if (courseId == site.getSiteHomeId()) { // Check if site home is available. return this.siteHomeProvider.isAvailable().then(() => { - this.loginHelper.redirect('CoreSiteHomeIndexPage', params, siteId); + CoreLoginHelper.instance.redirect('CoreSiteHomeIndexPage', params, siteId); }).finally(() => { modal.dismiss(); }); @@ -1610,7 +1609,7 @@ export class CoreCourseHelperProvider { params = params || {}; Object.assign(params, { course: course }); - return this.loginHelper.redirect(CoreLoginHelperProvider.OPEN_COURSE, params, siteId); + return CoreLoginHelper.instance.redirect(CoreLoginHelperProvider.OPEN_COURSE, params, siteId); } } diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 05c517d98..84c2e0aca 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -34,6 +34,7 @@ import { CoreConstants } from '@core/constants'; import { Md5 } from 'ts-md5/dist/md5'; import { CoreSite } from '@classes/site'; import { CoreUrl } from '@singletons/url'; +import { makeSingleton } from '@singletons/core.singletons'; /** * Data related to a SSO authentication. @@ -1417,3 +1418,5 @@ export class CoreLoginHelperProvider { }); } } + +export class CoreLoginHelper extends makeSingleton(CoreLoginHelperProvider) {}