MOBILE-3245 naming: Prefix ReadingStrategy name with CoreSites
parent
accb83b339
commit
5ba3c03d91
|
@ -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<any[]> {
|
||||
getUserCourses(preferCache?: boolean, siteId?: string, strategy?: CoreSitesReadingStrategy): Promise<any[]> {
|
||||
return this.sitesProvider.getSite(siteId).then((site) => {
|
||||
|
||||
const userId = site.getUserId(),
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ export interface CoreSiteSchema {
|
|||
migrate?(db: SQLiteDB, oldVersion: number, siteId: string): Promise<any> | 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 {};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue