MOBILE-3617 login: Use login helper singleton on course helper

main
Pau Ferrer Ocaña 2020-12-03 11:02:30 +01:00
parent 78d41bddac
commit 2756395175
2 changed files with 6 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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) {}