diff --git a/src/core/courses/providers/courses.ts b/src/core/courses/providers/courses.ts index f869e467a..b0529d926 100644 --- a/src/core/courses/providers/courses.ts +++ b/src/core/courses/providers/courses.ts @@ -15,7 +15,7 @@ import { Injectable } from '@angular/core'; import { CoreEventsProvider } from '@providers/events'; import { CoreLoggerProvider } from '@providers/logger'; -import { CoreSitesProvider, ReadingStrategy } from '@providers/sites'; +import { CoreSitesProvider, CoreSitesReadingStrategy } from '@providers/sites'; import { CoreSite } from '@classes/site'; /** @@ -774,7 +774,7 @@ export class CoreCoursesProvider { * @param siteId Site to get the courses from. If not defined, use current site. * @return Promise resolved with the courses. */ - getUserCourses(preferCache?: boolean, siteId?: string, strategy?: ReadingStrategy): Promise { + getUserCourses(preferCache?: boolean, siteId?: string, strategy?: CoreSitesReadingStrategy): Promise { return this.sitesProvider.getSite(siteId).then((site) => { const userId = site.getUserId(), diff --git a/src/core/grades/providers/helper.ts b/src/core/grades/providers/helper.ts index ae8cc9071..7bdfc7b67 100644 --- a/src/core/grades/providers/helper.ts +++ b/src/core/grades/providers/helper.ts @@ -15,7 +15,7 @@ import { Injectable } from '@angular/core'; import { NavController } from 'ionic-angular'; import { CoreLoggerProvider } from '@providers/logger'; -import { CoreSitesProvider, ReadingStrategy } from '@providers/sites'; +import { CoreSitesProvider, CoreSitesReadingStrategy } from '@providers/sites'; import { CoreCoursesProvider } from '@core/courses/providers/courses'; import { CoreCourseProvider } from '@core/course/providers/course'; import { CoreGradesProvider } from './grades'; @@ -203,7 +203,7 @@ export class CoreGradesHelperProvider { let coursesWereMissing; try { - const courses = await this.coursesProvider.getUserCourses(undefined, undefined, ReadingStrategy.OnlyCache); + const courses = await this.coursesProvider.getUserCourses(undefined, undefined, CoreSitesReadingStrategy.OnlyCache); const coursesMap = this.utils.arrayToObject(courses, 'id'); @@ -216,7 +216,7 @@ export class CoreGradesHelperProvider { if (coursesWereMissing) { const coursesPromise = this.coursesProvider.isGetCoursesByFieldAvailable() ? this.coursesProvider.getCoursesByField('ids', grades.map((grade) => grade.courseid).join(',')) - : this.coursesProvider.getUserCourses(undefined, undefined, ReadingStrategy.PreferNetwork); + : this.coursesProvider.getUserCourses(undefined, undefined, CoreSitesReadingStrategy.PreferNetwork); const courses = await coursesPromise; diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 0094d7096..3458aaefd 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -158,7 +158,7 @@ export interface CoreSiteSchema { migrate?(db: SQLiteDB, oldVersion: number, siteId: string): Promise | void; } -export const enum ReadingStrategy { +export const enum CoreSitesReadingStrategy { OnlyCache, PreferCache, PreferNetwork, @@ -1743,18 +1743,18 @@ export class CoreSitesProvider { * @param strategy Reading strategy. * @return PreSets options object. */ - getReadingStrategyPreSets(strategy: ReadingStrategy): CoreSiteWSPreSets { + getReadingStrategyPreSets(strategy: CoreSitesReadingStrategy): CoreSiteWSPreSets { switch (strategy) { - case ReadingStrategy.PreferCache: + case CoreSitesReadingStrategy.PreferCache: return { omitExpires: true, }; - case ReadingStrategy.OnlyCache: + case CoreSitesReadingStrategy.OnlyCache: return { omitExpires: true, forceOffline: true, }; - case ReadingStrategy.PreferNetwork: + case CoreSitesReadingStrategy.PreferNetwork: default: return {}; }