MOBILE-4653 sites: Move CoreSite constants

main
Pau Ferrer Ocaña 2024-11-06 13:18:49 +01:00
parent 3959df94d5
commit dba799ff90
56 changed files with 284 additions and 223 deletions

View File

@ -15,9 +15,9 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreSite } from '@classes/sites/site';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CoreCacheUpdateFrequency } from '@/core/constants';
const ROOT_CACHE_KEY = 'mmaBadges:';
@ -70,7 +70,7 @@ export class AddonBadgesProvider {
};
const preSets = {
cacheKey: this.getBadgesCacheKey(courseId, userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const response = await site.read<AddonBadgesGetUserBadgesWSResponse>('core_badges_get_user_badges', data, preSets);
@ -133,7 +133,7 @@ export class AddonBadgesProvider {
};
const preSets = {
cacheKey: this.getUserBadgeByHashCacheKey(hash),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const response = await site.read<AddonBadgesGetUserBadgeByHashWSResponse>(
@ -190,7 +190,7 @@ export class AddonBadgesProvider {
};
const preSets = {
cacheKey: this.getBadgeClassCacheKey(id),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const response = await site.read<AddonBadgesGetBadgeClassWSResponse>(

View File

@ -12,10 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
import { CoreTagItem } from '@features/tag/services/tag';
import { CoreUser, CoreUserProfile } from '@features/user/services/user';
@ -83,7 +82,7 @@ export class AddonBlogProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesCacheKey(filter),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
...CoreSites.getReadingStrategyPreSets(options?.readingStrategy),
};

View File

@ -29,7 +29,7 @@ import { CoreWSExternalWarning, CoreWSDate } from '@services/ws';
import moment from 'moment-timezone';
import { AddonCalendarEventDBRecord } from './database/calendar';
import { CoreCourses } from '@features/courses/services/courses';
import { ContextLevel, CoreConstants } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency, CoreConstants } from '@/core/constants';
import { CoreWSError } from '@classes/errors/wserror';
import { ApplicationInit, makeSingleton, Translate } from '@singletons';
import { AddonCalendarOfflineEventDBRecord } from './database/calendar-offline';
@ -563,7 +563,7 @@ export class AddonCalendarProvider {
const site = await CoreSites.getSite(siteId);
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEventCacheKey(id),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const params: AddonCalendarGetCalendarEventsWSParams = {
options: {
@ -599,7 +599,7 @@ export class AddonCalendarProvider {
const site = await CoreSites.getSite(siteId);
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEventCacheKey(id),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const params: AddonCalendarGetCalendarEventByIdWSParams = {
eventid: id,
@ -765,7 +765,7 @@ export class AddonCalendarProvider {
}
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getDayEventsCacheKey(year, month, day, courseId, categoryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {
preSets.getFromCache = false;
@ -877,7 +877,7 @@ export class AddonCalendarProvider {
cacheKey: this.getEventsListCacheKey(daysToStart, daysInterval),
getCacheUsingCacheKey: true,
uniqueCacheKey: true,
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
const response =
await site.read<AddonCalendarGetCalendarEventsWSResponse>('core_calendar_get_calendar_events', params, preSets);
@ -955,7 +955,7 @@ export class AddonCalendarProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getMonthlyEventsCacheKey(year, month, courseId, categoryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {
preSets.getFromCache = false;
@ -1040,7 +1040,7 @@ export class AddonCalendarProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUpcomingEventsCacheKey(courseId, categoryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreCacheUpdateFrequency } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
@ -208,7 +209,7 @@ export class AddonCompetencyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getLearningPlansCacheKey(userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const response = await site.read<AddonCompetencyDataForPlansPageWSResponse>('tool_lp_data_for_plans_page', params, preSets);
@ -232,7 +233,7 @@ export class AddonCompetencyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getLearningPlanCacheKey(planId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
return site.read('tool_lp_data_for_plan_page', params, preSets);
@ -260,7 +261,7 @@ export class AddonCompetencyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCompetencyInPlanCacheKey(planId, competencyId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
return site.read(
@ -298,7 +299,7 @@ export class AddonCompetencyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCompetencyInCourseCacheKey(courseId, competencyId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {
@ -334,7 +335,7 @@ export class AddonCompetencyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCompetencySummaryCacheKey(competencyId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {
@ -400,7 +401,7 @@ export class AddonCompetencyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCourseCompetenciesCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {

View File

@ -25,6 +25,7 @@ import { asyncObservable } from '@/core/utils/rxjs';
import { map } from 'rxjs/operators';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
import { firstValueFrom } from 'rxjs';
import { CoreCacheUpdateFrequency } from '@/core/constants';
const ROOT_CACHE_KEY = 'mmaCourseCompletion:';
@ -173,7 +174,7 @@ export class AddonCourseCompletionProvider {
const preSets = {
...(options.preSets ?? {}),
cacheKey: this.getCompletionCacheKey(courseId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
cacheErrors: ['notenroled'],
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreCacheUpdateFrequency } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreEnrolEnrolmentInfo } from '@features/enrol/services/enrol';
import { CoreSites } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';
@ -44,7 +44,7 @@ export class AddonEnrolGuestService {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getGuestEnrolmentInfoCacheKey(instanceId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const response =

View File

@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreCacheUpdateFrequency } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCoursesProvider } from '@features/courses/services/courses';
import { CoreSites } from '@services/sites';
import { CoreStatusWithWarningsWSResponse } from '@services/ws';
@ -45,7 +45,7 @@ export class AddonEnrolSelfService {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSelfEnrolmentInfoCacheKey(instanceId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
return await site.read<AddonEnrolSelfGetInstanceInfoWSResponse>('enrol_self_get_instance_info', params, preSets);

View File

@ -16,8 +16,7 @@ import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreConstants } from '@/core/constants';
import { CoreSite } from '@classes/sites/site';
import { CoreCacheUpdateFrequency, CoreConstants } from '@/core/constants';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { makeSingleton, Translate } from '@singletons';
@ -102,7 +101,7 @@ export class AddonMessageOutputAirnotifierProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSystemConfiguredCacheKey(),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -136,7 +135,7 @@ export class AddonMessageOutputAirnotifierProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserDevicesCacheKey(),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (ignoreCache) {

View File

@ -34,6 +34,7 @@ import { AddonMessagesSyncEvents, AddonMessagesSyncProvider } from './messages-s
import { CoreWSError } from '@classes/errors/wserror';
import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -628,7 +629,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCacheKeyForBlockedContacts(userId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
};
return site.read('core_message_get_blocked_users', params, preSets);
@ -648,7 +649,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCacheKeyForContacts(),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
};
const contacts = await site.read<AddonMessagesGetContactsWSResponse>('core_message_get_contacts', undefined, preSets);
@ -699,7 +700,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCacheKeyForUserContacts(),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
};
const contacts = await site.read<AddonMessagesGetUserContactsWSResponse>('core_message_get_user_contacts', params, preSets);
@ -743,7 +744,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCacheKeyForContactRequests(),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
};
const requests = await site.read<AddonMessagesGetContactRequestsWSResponse>(
@ -939,7 +940,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCacheKeyForConversationMembers(userId, conversationId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
const params: AddonMessagesGetConversationMembersWSParams = {
@ -1371,7 +1372,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCacheKeyForMemberInfo(userId, otherUserId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
};
const params: AddonMessagesGetMemberInfoWSParams = {
referenceuserid: userId,
@ -1410,7 +1411,7 @@ export class AddonMessagesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getMessagePreferencesCacheKey(),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
const data = await site.read<AddonMessagesGetUserMessagePreferencesWSResponse>(

View File

@ -35,7 +35,7 @@ import { CoreFormFields } from '@singletons/form';
import { CoreFileHelper } from '@services/file-helper';
import { CoreIonicColorNames } from '@singletons/colors';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
import {
ADDON_MOD_ASSIGN_AUTO_SYNCED,
ADDON_MOD_ASSIGN_COMPONENT,
@ -174,7 +174,7 @@ export class AddonModAssignProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAssignmentCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_ASSIGN_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -246,7 +246,7 @@ export class AddonModAssignProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAssignmentUserMappingsCacheKey(assignId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_ASSIGN_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
@ -456,7 +456,7 @@ export class AddonModAssignProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSubmissionsCacheKey(assignId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_ASSIGN_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
@ -654,7 +654,7 @@ export class AddonModAssignProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.listParticipantsCacheKey(assignId, groupId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_ASSIGN_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),

View File

@ -16,7 +16,6 @@ import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
@ -25,6 +24,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_BBB_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for Big Blue Button activity.
@ -73,7 +73,7 @@ export class AddonModBBBService {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getBBBsCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_BBB_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreSite } from '@classes/sites/site';
import { CoreTagItem } from '@features/tag/services/tag';
import { CoreWSExternalWarning, CoreWSExternalFile, CoreWS } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
@ -29,6 +28,7 @@ import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ADDON_MOD_BOOK_COMPONENT } from '../constants';
import { CoreUrl } from '@singletons/url';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for books.
@ -72,7 +72,7 @@ export class AddonModBookProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getBookDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_BOOK_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -15,7 +15,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreUser } from '@features/user/services/user';
@ -23,6 +22,7 @@ import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_CHAT_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for chats.
@ -48,7 +48,7 @@ export class AddonModChatProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getChatsCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_CHAT_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -262,7 +262,7 @@ export class AddonModChatProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSessionsCacheKey(chatId, groupId, showAll),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_CHAT_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -300,7 +300,7 @@ export class AddonModChatProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSessionMessagesCacheKey(chatId, sessionStart, groupId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_CHAT_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -15,7 +15,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreNetwork } from '@services/network';
@ -28,6 +27,7 @@ import { AddonModChoiceOffline } from './choice-offline';
import { AddonModChoiceAutoSyncData } from './choice-sync';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ADDON_MOD_CHOICE_AUTO_SYNCED, ADDON_MOD_CHOICE_COMPONENT, AddonModChoiceShowResults } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for choices.
@ -217,7 +217,7 @@ export class AddonModChoiceProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getChoiceDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_CHOICE_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -276,7 +276,7 @@ export class AddonModChoiceProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getChoiceOptionsCacheKey(choiceId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_CHOICE_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreRatingInfo } from '@features/rating/services/rating';
@ -37,6 +36,7 @@ import {
ADDON_MOD_DATA_ENTRY_CHANGED,
AddonModDataAction,
} from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -543,7 +543,7 @@ export class AddonModDataProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getDatabaseDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_DATA_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -663,7 +663,7 @@ export class AddonModDataProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesCacheKey(dataId, options.groupId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_DATA_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -721,7 +721,7 @@ export class AddonModDataProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntryCacheKey(dataId, entryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_DATA_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -773,7 +773,7 @@ export class AddonModDataProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getFieldsCacheKey(dataId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_DATA_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreNetwork } from '@services/network';
@ -36,6 +35,7 @@ import {
ADDON_MOD_FEEDBACK_PER_PAGE,
AddonModFeedbackIndexTabName,
} from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for feedbacks.
@ -590,7 +590,7 @@ export class AddonModFeedbackProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getFeedbackCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_FEEDBACK_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -648,7 +648,7 @@ export class AddonModFeedbackProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getItemsDataCacheKey(feedbackId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_FEEDBACK_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -1082,7 +1082,7 @@ export class AddonModFeedbackProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCompletedDataCacheKey(feedbackId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_FEEDBACK_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -15,7 +15,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
@ -23,6 +22,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_FOLDER_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for folder.
@ -67,7 +67,7 @@ export class AddonModFolderProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getFolderCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_FOLDER_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -49,6 +49,7 @@ import {
AddonModForumSortorder,
AddonModForumType,
} from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -429,7 +430,7 @@ export class AddonModForumProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getForumDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_FORUM_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};
@ -458,7 +459,7 @@ export class AddonModForumProvider {
};
const preSets = {
cacheKey: this.getDiscussionPostDataCacheKey(forumId, discussionId, postId),
updateFrequency: CoreSite.FREQUENCY_USUALLY,
updateFrequency: CoreCacheUpdateFrequency.USUALLY,
component: ADDON_MOD_FORUM_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -37,6 +37,7 @@ import {
ADDON_MOD_GLOSSARY_LIMIT_CATEGORIES,
ADDON_MOD_GLOSSARY_LIMIT_ENTRIES,
} from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for glossaries.
@ -72,7 +73,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCourseGlossariesCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_GLOSSARY_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -133,7 +134,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesByAuthorCacheKey(glossaryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -177,7 +178,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesByCategoryCacheKey(glossaryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -247,7 +248,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesByDateCacheKey(glossaryId, order),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -305,7 +306,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesByLetterCacheKey(glossaryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -379,7 +380,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getEntriesBySearchCacheKey(glossaryId, query, fullSearch),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -457,7 +458,7 @@ export class AddonModGlossaryProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCategoriesCacheKey(glossaryId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -514,7 +515,7 @@ export class AddonModGlossaryProvider {
};
const preSets = {
cacheKey: this.getEntryCacheKey(entryId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_GLOSSARY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -34,6 +34,7 @@ import {
ADDON_MOD_H5PACTIVITY_USERS_PER_PAGE,
AddonModH5PActivityGradeMethod,
} from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for H5P activity.
@ -162,7 +163,7 @@ export class AddonModH5PActivityProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAccessInformationCacheKey(id),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_H5PACTIVITY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -266,7 +267,7 @@ export class AddonModH5PActivityProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUsersAttemptsCacheKey(id, options),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_H5PACTIVITY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -362,7 +363,7 @@ export class AddonModH5PActivityProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAttemptResultsCacheKey(id, params.attemptids),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_H5PACTIVITY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -427,7 +428,7 @@ export class AddonModH5PActivityProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAttemptResultsCommonCacheKey(id),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_H5PACTIVITY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -510,7 +511,7 @@ export class AddonModH5PActivityProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getH5PActivityDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_H5PACTIVITY_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -617,7 +618,7 @@ export class AddonModH5PActivityProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserAttemptsCacheKey(id, params.userids),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_H5PACTIVITY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourse, CoreCourseModuleContentFile } from '@features/course/services/course';
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
@ -28,6 +27,7 @@ import { makeSingleton, Translate } from '@singletons';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ADDON_MOD_IMSCP_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for IMSCP.
@ -114,7 +114,7 @@ export class AddonModImscpProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getImscpDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_IMSCP_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -15,13 +15,13 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreFilepool } from '@services/filepool';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_LABEL_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for labels.
@ -64,7 +64,7 @@ export class AddonModLabelProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getLabelDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_LABEL_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
@ -38,6 +37,7 @@ import {
AddonModLessonPageSubtype,
} from '../constants';
import { CoreGradeType } from '@features/grades/constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -1160,7 +1160,7 @@ export class AddonModLessonProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAccessInformationCacheKey(lessonId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_LESSON_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -1409,7 +1409,7 @@ export class AddonModLessonProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getLessonDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_LESSON_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -1710,7 +1710,7 @@ export class AddonModLessonProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getPagesCacheKey(lessonId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_LESSON_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -2059,7 +2059,7 @@ export class AddonModLessonProvider {
};
const preSets = {
cacheKey: this.getRetakesOverviewCacheKey(lessonId, groupId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_LESSON_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -2273,7 +2273,7 @@ export class AddonModLessonProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserRetakeCacheKey(lessonId, userId, retake),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_LESSON_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -27,6 +27,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_LTI_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for LTI.
@ -96,7 +97,7 @@ export class AddonModLtiProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getLtiCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_LTI_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreSitesCommonWSOptions, CoreSites } from '@services/sites';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning, CoreWSExternalFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreFilepool } from '@services/filepool';
@ -24,6 +23,7 @@ import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ADDON_MOD_PAGE_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for page.
@ -67,7 +67,7 @@ export class AddonModPageProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getPageCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_PAGE_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -17,7 +17,6 @@ import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreGradesFormattedItem, CoreGradesHelper } from '@features/grades/services/grades-helper';
@ -55,6 +54,7 @@ import {
ADDON_MOD_QUIZ_AUTO_SYNCED,
} from '../constants';
import { CoreIonicColorNames } from '@singletons/colors';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -680,7 +680,7 @@ export class AddonModQuizProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getFeedbackForGradeCacheKey(quizId, grade),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_QUIZ_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -820,7 +820,7 @@ export class AddonModQuizProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getQuizDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_QUIZ_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -955,7 +955,7 @@ export class AddonModQuizProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getQuizRequiredQtypesCacheKey(quizId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_QUIZ_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -1119,7 +1119,7 @@ export class AddonModQuizProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserAttemptsCacheKey(quizId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_QUIZ_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -15,7 +15,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreFilepool } from '@services/filepool';
@ -24,6 +23,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { ADDON_MOD_RESOURCE_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for resources.
@ -66,7 +66,7 @@ export class AddonModResourceProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getResourceCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_RESOURCE_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -12,10 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { DownloadStatus } from '@/core/constants';
import { CoreCacheUpdateFrequency, DownloadStatus } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreFilepool } from '@services/filepool';
@ -555,7 +554,7 @@ export class AddonModScormProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAttemptCountCacheKey(scormId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_SCORM_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -851,7 +850,7 @@ export class AddonModScormProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getScosCacheKey(scormId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_SCORM_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -1093,7 +1092,7 @@ export class AddonModScormProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getScormDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_SCORM_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreNetwork } from '@services/network';
@ -26,6 +25,7 @@ import { makeSingleton, Translate } from '@singletons';
import { AddonModSurveyOffline } from './survey-offline';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ADDON_MOD_SURVEY_COMPONENT } from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for surveys.
@ -51,7 +51,7 @@ export class AddonModSurveyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getQuestionsCacheKey(surveyId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_SURVEY_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -108,7 +108,7 @@ export class AddonModSurveyProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSurveyCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_SURVEY_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -14,10 +14,9 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning, CoreWSExternalFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreConstants } from '@/core/constants';
import { CoreCacheUpdateFrequency, CoreConstants } from '@/core/constants';
import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { CoreCourse } from '@features/course/services/course';
import { CoreUtils } from '@services/utils/utils';
@ -119,7 +118,7 @@ export class AddonModUrlProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUrlCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_URL_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreTagItem } from '@features/tag/services/tag';
@ -35,6 +34,7 @@ import {
ADDON_MOD_WIKI_MANUAL_SYNCED,
ADDON_MOD_WIKI_PAGE_CREATED_EVENT,
} from '../constants';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some features for wikis.
@ -138,7 +138,7 @@ export class AddonModWikiProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getPageContentsCacheKey(pageId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_WIKI_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -211,7 +211,7 @@ export class AddonModWikiProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSubwikiFilesCacheKey(wikiId, groupId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_WIKI_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -281,7 +281,7 @@ export class AddonModWikiProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSubwikiPagesCacheKey(wikiId, groupId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
component: ADDON_MOD_WIKI_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -329,7 +329,7 @@ export class AddonModWikiProvider {
};
const preSets = {
cacheKey: this.getSubwikisCacheKey(wikiId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_WIKI_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -387,7 +387,7 @@ export class AddonModWikiProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getWikiDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_WIKI_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreGradesMenuItem } from '@features/grades/services/grades-helper';
@ -42,6 +41,7 @@ import {
AddonModWorkshopSubmissionType,
} from '@addons/mod/workshop/constants';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -218,7 +218,7 @@ export class AddonModWorkshopProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getWorkshopDataCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_WORKSHOP_COMPONENT,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -360,7 +360,7 @@ export class AddonModWorkshopProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserPlanDataCacheKey(workshopId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_WORKSHOP_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -407,7 +407,7 @@ export class AddonModWorkshopProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getSubmissionsDataCacheKey(workshopId, userId, groupId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_WORKSHOP_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -537,7 +537,7 @@ export class AddonModWorkshopProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getGradesReportDataCacheKey(workshopId, options.groupId),
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
component: ADDON_MOD_WORKSHOP_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
@ -1035,7 +1035,7 @@ export class AddonModWorkshopProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAssessmentFormDataCacheKey(workshopId, assessmentId, mode),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
component: ADDON_MOD_WORKSHOP_COMPONENT,
componentId: options.cmId,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.

View File

@ -14,7 +14,6 @@
import { Injectable } from '@angular/core';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite } from '@classes/sites/site';
import { CoreUser } from '@features/user/services/user';
import { CoreNetwork } from '@services/network';
import { CoreSites } from '@services/sites';
@ -23,6 +22,7 @@ import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonNotesOffline } from './notes-offline';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
const ROOT_CACHE_KEY = 'mmaNotes:';
@ -241,7 +241,7 @@ export class AddonNotesProvider {
],
};
const preSets: CoreSiteWSPreSets = {
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
// Use .read to cache data and be able to check it in offline. This means that, if a user loses the capabilities
@ -309,7 +309,7 @@ export class AddonNotesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getNotesCacheKey(courseId, userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
if (ignoreCache) {

View File

@ -19,12 +19,12 @@ import { CoreWSExternalWarning } from '@services/ws';
import { CoreText } from '@singletons/text';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreUser, USER_NOREPLY_USER } from '@features/user/services/user';
import { CoreSite } from '@classes/sites/site';
import { CoreLogger } from '@singletons/logger';
import { Translate, makeSingleton } from '@singletons';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
import { AddonNotificationsPushNotification } from './handlers/push-click';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -187,7 +187,7 @@ export class AddonNotificationsProvider {
const site = await CoreSites.getSite(options.siteId);
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getNotificationPreferencesCacheKey(),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};

View File

@ -19,7 +19,7 @@ import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreSite } from '@classes/sites/site';
import { makeSingleton } from '@singletons';
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
const ROOT_CACHE_KEY = 'mmaFiles:';
@ -84,7 +84,7 @@ export class AddonPrivateFilesProvider {
const preSets = {
cacheKey: this.getFilesListCacheKey(params),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
const result: AddonPrivateFilesGetFilesWSResult = await site.read('core_files_get_files', params, preSets);
@ -163,7 +163,7 @@ export class AddonPrivateFilesProvider {
};
const preSets = {
cacheKey: this.getPrivateFilesInfoCacheKey(userId),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
return site.read('core_user_get_private_files_info', params, preSets);

View File

@ -24,7 +24,7 @@ import {
import { CoreToasts, ToastDuration } from '@services/toasts';
import { CoreText } from '@singletons/text';
import { CoreUtils } from '@services/utils/utils';
import { CoreConstants } from '@/core/constants';
import { CoreCacheUpdateFrequency, CoreConstants, MINIMUM_MOODLE_VERSION, MOODLE_RELEASES } from '@/core/constants';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreLogger } from '@singletons/logger';
@ -51,31 +51,34 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
static readonly REQUEST_QUEUE_FORCE_WS = false; // Use "tool_mobile_call_external_functions" even for calling a single function.
// Constants for cache update frequency.
static readonly FREQUENCY_USUALLY = 0;
static readonly FREQUENCY_OFTEN = 1;
static readonly FREQUENCY_SOMETIMES = 2;
static readonly FREQUENCY_RARELY = 3;
/**
* @deprecated 5.0. Use CoreCacheUpdateFrequency.USUALLY instead.
*/
static readonly FREQUENCY_USUALLY = CoreCacheUpdateFrequency.USUALLY;
/**
* @deprecated 5.0. Use CoreCacheUpdateFrequency.OFTEN instead.
*/
static readonly FREQUENCY_OFTEN = CoreCacheUpdateFrequency.OFTEN;
/**
* @deprecated 5.0. Use CoreCacheUpdateFrequency.SOMETIMES instead.
*/
static readonly FREQUENCY_SOMETIMES = CoreCacheUpdateFrequency.SOMETIMES;
/**
* @deprecated 5.0. Use CoreCacheUpdateFrequency.RARELY instead.
*/
static readonly FREQUENCY_RARELY = CoreCacheUpdateFrequency.RARELY;
static readonly MINIMUM_MOODLE_VERSION = '3.5';
/**
* @deprecated 5.0. Use MINIMUM_MOODLE_VERSION from constants.ts.
*/
static readonly MINIMUM_MOODLE_VERSION = MINIMUM_MOODLE_VERSION;
// Versions of Moodle releases.
static readonly MOODLE_RELEASES = {
'3.5': 2018051700,
'3.6': 2018120300,
'3.7': 2019052000,
'3.8': 2019111800,
'3.9': 2020061500,
'3.10': 2020110900,
'3.11': 2021051700,
'4.0': 2022041900,
'4.1': 2022112800,
'4.2': 2023042400,
'4.3': 2023100900,
'4.4': 2024042200,
'4.5': 2024100700,
'5.0': 2024100800, // @todo [5.0] replace with right value when released. Using a tmp value to be able to test new things.
};
/**
* Versions of Moodle releases.
*
* @deprecated 5.0. Use MOODLE_RELEASES from constants.ts.
*/
static readonly MOODLE_RELEASES = MOODLE_RELEASES;
// Possible cache update frequencies.
protected static readonly UPDATE_FREQUENCIES = [
@ -1484,9 +1487,9 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
return 0;
}
if (CoreAuthenticatedSite.MOODLE_RELEASES[data.major] === undefined) {
if (MOODLE_RELEASES[data.major] === undefined) {
// Major version not found. Use the last one.
const major = Object.keys(CoreAuthenticatedSite.MOODLE_RELEASES).pop();
const major = Object.keys(MOODLE_RELEASES).pop();
if (!major) {
return 0;
}
@ -1494,7 +1497,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
data.major = major;
}
return CoreAuthenticatedSite.MOODLE_RELEASES[data.major] + data.minor;
return MOODLE_RELEASES[data.major] + data.minor;
}
/**
@ -1524,7 +1527,7 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
*/
protected getNextMajorVersionNumber(version: string): number {
const data = this.getMajorAndMinor(version);
const releases = Object.keys(CoreAuthenticatedSite.MOODLE_RELEASES);
const releases = Object.keys(MOODLE_RELEASES);
if (!data) {
// Invalid version.
@ -1535,10 +1538,10 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
if (position == -1 || position == releases.length - 1) {
// Major version not found or it's the last one. Use the last one.
return CoreAuthenticatedSite.MOODLE_RELEASES[releases[position]];
return MOODLE_RELEASES[releases[position]];
}
return CoreAuthenticatedSite.MOODLE_RELEASES[releases[position + 1]];
return MOODLE_RELEASES[releases[position + 1]];
}
/**
@ -1547,10 +1550,10 @@ export class CoreAuthenticatedSite extends CoreUnauthenticatedSite {
* @param updateFrequency The update frequency of the entry.
* @returns Expiration delay.
*/
getExpirationDelay(updateFrequency?: number): number {
updateFrequency = updateFrequency || CoreAuthenticatedSite.FREQUENCY_USUALLY;
getExpirationDelay(updateFrequency?: CoreCacheUpdateFrequency): number {
updateFrequency = updateFrequency ?? CoreCacheUpdateFrequency.USUALLY;
let expirationDelay = CoreAuthenticatedSite.UPDATE_FREQUENCIES[updateFrequency] ||
CoreAuthenticatedSite.UPDATE_FREQUENCIES[CoreAuthenticatedSite.FREQUENCY_USUALLY];
CoreAuthenticatedSite.UPDATE_FREQUENCIES[CoreCacheUpdateFrequency.USUALLY];
if (CoreNetwork.isNetworkAccessLimited()) {
// Not WiFi, increase the expiration delay a 50% to decrease the data usage in this case.
@ -1744,10 +1747,10 @@ export type CoreSiteWSPreSets = {
/**
* Update frequency. This value determines how often the cached data will be updated. Possible values:
* CoreSite.FREQUENCY_USUALLY, CoreSite.FREQUENCY_OFTEN, CoreSite.FREQUENCY_SOMETIMES, CoreSite.FREQUENCY_RARELY.
* Defaults to CoreSite.FREQUENCY_USUALLY.
* USUALLY, OFTEN, SOMETIMES, RARELY.
* Defaults to USUALLY.
*/
updateFrequency?: number;
updateFrequency?: CoreCacheUpdateFrequency;
/**
* Component name. Optionally included if this request is being made on behalf of a specific

View File

@ -76,6 +76,36 @@ export const DownloadStatus = {
export type DownloadStatus = typeof DownloadStatus[keyof typeof DownloadStatus];
/* eslint-enable @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare */
// Constants for cache update frequency.
export const CoreCacheUpdateFrequency = {
USUALLY: 0, // eslint-disable-line @typescript-eslint/naming-convention
OFTEN: 1, // eslint-disable-line @typescript-eslint/naming-convention
SOMETIMES: 2, // eslint-disable-line @typescript-eslint/naming-convention
RARELY: 3, // eslint-disable-line @typescript-eslint/naming-convention
} as const;
// eslint-disable-next-line @typescript-eslint/no-redeclare
export type CoreCacheUpdateFrequency = typeof CoreCacheUpdateFrequency[keyof typeof CoreCacheUpdateFrequency];
export const MINIMUM_MOODLE_VERSION = '3.5';
// Versions of Moodle releases.
export const MOODLE_RELEASES = {
'3.5': 2018051700,
'3.6': 2018120300,
'3.7': 2019052000,
'3.8': 2019111800,
'3.9': 2020061500,
'3.10': 2020110900,
'3.11': 2021051700,
'4.0': 2022041900,
'4.1': 2022112800,
'4.2': 2023042400,
'4.3': 2023100900,
'4.4': 2024042200,
'4.5': 2024100700,
'5.0': 2024100800, // @todo [5.0] replace with right value when released. Using a tmp value to be able to test new things.
};
/**
* Static class to contain all the core constants.
*/

View File

@ -100,6 +100,32 @@ export async function getCoreServices(): Promise<Type<unknown>[]> {
];
}
/**
* Get core exported objects.
*
* @returns Core exported objects.
*/
export async function getCoreExportedObjects(): Promise<Record<string, unknown>> {
const {
CoreConstants,
CoreCacheUpdateFrequency,
DownloadStatus,
MINIMUM_MOODLE_VERSION,
MOODLE_RELEASES,
} = await import('@/core/constants');
/* eslint-disable @typescript-eslint/naming-convention */
return {
CoreConstants,
CoreConfigConstants: CoreConstants.CONFIG,
CoreCacheUpdateFrequency,
DownloadStatus,
MINIMUM_MOODLE_VERSION,
MOODLE_RELEASES,
};
/* eslint-enable @typescript-eslint/naming-convention */
}
@NgModule({
imports: [
CoreFeaturesModule,

View File

@ -24,7 +24,7 @@ import { CoreEvents } from '@singletons/events';
import { CoreCommentsOffline } from './comments-offline';
import { CoreCommentsSyncAutoSyncData, CoreCommentsSyncProvider } from './comments-sync';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
const ROOT_CACHE_KEY = 'mmComments:';
@ -422,7 +422,7 @@ export class CoreCommentsProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCommentsCacheKey(contextLevel, instanceId, component, itemId, area),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
const response = await site.read<CoreCommentsGetCommentsWSResponse>('core_comment_get_comments', params, preSets);

View File

@ -42,7 +42,7 @@ import { makeSingleton } from '@singletons';
import { effectWithInjectionContext, modelWithInjectionContext } from '@/core/utils/signals';
// Import core services.
import { getCoreServices } from '@/core/core.module';
import { getCoreExportedObjects, getCoreServices } from '@/core/core.module';
import { getBlockServices } from '@features/block/block.module';
import { getCommentsServices } from '@features/comments/comments.module';
import { getContentLinksExportedObjects, getContentLinksServices } from '@features/contentlinks/contentlinks.module';
@ -73,7 +73,6 @@ import { getXAPIServices } from '@features/xapi/xapi.module';
import { DomSanitizer } from '@angular/platform-browser';
import { FormBuilder, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { CoreConstants, DownloadStatus } from '@/core/constants';
import moment from 'moment-timezone';
import { Md5 } from 'ts-md5/dist/md5';
@ -297,9 +296,6 @@ export class CoreCompileProvider {
// Add some final classes.
instance['injector'] = injector;
instance['Validators'] = Validators;
instance['CoreConstants'] = CoreConstants;
instance['DownloadStatus'] = DownloadStatus;
instance['CoreConfigConstants'] = CoreConstants.CONFIG;
instance['CoreEventsProvider'] = CoreEvents;
instance['CoreLoggerProvider'] = CoreLogger;
instance['moment'] = moment;
@ -420,6 +416,7 @@ export class CoreCompileProvider {
*/
protected async getExportedObjects(): Promise<Record<string, unknown>> {
const objects = await Promise.all([
getCoreExportedObjects(),
getCoreErrorsExportedObjects(),
getCourseExportedObjects(),
getContentLinksExportedObjects(),

View File

@ -22,7 +22,7 @@ import { CoreSitesCommonWSOptions, CoreSites, CoreSitesReadingStrategy } from '@
import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils';
import { CoreSite } from '@classes/sites/site';
import { CoreConstants, DownloadStatus } from '@/core/constants';
import { CoreCacheUpdateFrequency, CoreConstants, DownloadStatus } from '@/core/constants';
import { makeSingleton, Translate } from '@singletons';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
@ -455,7 +455,7 @@ export class CoreCourseProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCourseBlocksCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};
@ -581,7 +581,7 @@ export class CoreCourseProvider {
const preSets: CoreSiteWSPreSets = {
omitExpires: preferCache,
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (includeStealth) {
@ -735,7 +735,7 @@ export class CoreCourseProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getModuleCacheKey(moduleId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
const response = await site.read<CoreCourseGetCourseModuleWSResponse>('core_course_get_course_module', params, preSets);
@ -796,7 +796,7 @@ export class CoreCourseProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getModuleBasicInfoByInstanceCacheKey(instanceId, moduleName),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
};
@ -1007,7 +1007,7 @@ export class CoreCourseProvider {
const preSets: CoreSiteWSPreSets = {
...options.preSets,
cacheKey: this.getSectionsCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -26,6 +26,7 @@ import { AddonEnrolGuest, AddonEnrolGuestInfo } from '@addons/enrol/guest/servic
import { AddonEnrolSelf } from '@addons/enrol/self/services/self';
import { CoreEnrol, CoreEnrolEnrolmentInfo, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -100,7 +101,7 @@ export class CoreCoursesProvider {
const preSets = {
cacheKey: this.getCategoriesCacheKey(categoryId, addSubcategories),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
return site.read('core_course_get_categories', params, preSets);
@ -350,7 +351,7 @@ export class CoreCoursesProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCoursesCacheKey(ids),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
return site.read('core_course_get_courses', params, preSets);
@ -487,7 +488,7 @@ export class CoreCoursesProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getCoursesByFieldCacheKey(field, value),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};
@ -737,7 +738,7 @@ export class CoreCoursesProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserAdministrationOptionsCacheKey(courseIds),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};
@ -807,7 +808,7 @@ export class CoreCoursesProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserNavigationOptionsCacheKey(courseIds),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};
@ -910,7 +911,7 @@ export class CoreCoursesProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserCoursesCacheKey(),
getCacheUsingCacheKey: true,
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -23,6 +23,7 @@ import { map } from 'rxjs/operators';
import { firstValueFrom } from 'rxjs';
import { asyncObservable } from '@/core/utils/rxjs';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
const ROOT_CACHE_KEY = 'CoreCoursesDashboard:';
@ -90,7 +91,7 @@ export class CoreCoursesDashboardProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getDashboardBlocksCacheKey(myPage, options.userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};
if (options.userId) {

View File

@ -14,10 +14,10 @@
import { Injectable } from '@angular/core';
import { makeSingleton } from '@singletons';
import { CoreSite } from '@classes/sites/site';
import { CoreSites } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { CoreEnrolAction, CoreEnrolDelegate } from './enrol-delegate';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides functions for enrolment plugins.
@ -44,7 +44,7 @@ export class CoreEnrolService {
};
const preSets = {
cacheKey: this.getCourseEnrolmentMethodsCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
return site.read<CoreEnrolGetCourseEnrolmentMethodsWSResponse>('core_enrol_get_course_enrolment_methods', params, preSets);

View File

@ -34,7 +34,7 @@ import { CoreLogger } from '@singletons/logger';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseHelper } from '@features/course/services/course-helper';
import { firstValueFrom } from 'rxjs';
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
import { CoreUtils } from '@services/utils/utils';
/**
@ -427,7 +427,7 @@ export class CoreFilterHelperProvider {
const cachedData = this.moduleContextsCache[siteId][courseId][contextLevel];
if (!CoreNetwork.isOnline() || Date.now() <= cachedData.time + site.getExpirationDelay(CoreSite.FREQUENCY_RARELY)) {
if (!CoreNetwork.isOnline() || Date.now() <= cachedData.time + site.getExpirationDelay(CoreCacheUpdateFrequency.RARELY)) {
// We can use cache, return the filters if found.
return cachedData.contexts[contextLevel] && cachedData.contexts[contextLevel][instanceId];
}

View File

@ -24,7 +24,7 @@ import { makeSingleton } from '@singletons';
import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreLogger } from '@singletons/logger';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service to provide filter functionalities.
@ -288,7 +288,7 @@ export class CoreFilterProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAllStatesCacheKey(),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
// Use stale while revalidate by default, but always use the first value. If data is updated it will be stored in DB.
...CoreSites.getReadingStrategyPreSets(options.readingStrategy ?? CoreSitesReadingStrategy.STALE_WHILE_REVALIDATE),
};
@ -364,7 +364,7 @@ export class CoreFilterProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getAvailableInContextsCacheKey(contextsToSend),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
splitRequest: {
param: 'contexts',
maxLength: 300,
@ -428,7 +428,7 @@ export class CoreFilterProvider {
// Check the context isn't "expired". The time stored in this cache will not match the one in the site cache.
if (cachedCtxt && (!isOnline ||
Date.now() <= cachedCtxt.time + site.getExpirationDelay(CoreSite.FREQUENCY_RARELY))) {
Date.now() <= cachedCtxt.time + site.getExpirationDelay(CoreCacheUpdateFrequency.RARELY))) {
result[context.contextlevel] = result[context.contextlevel] || {};
result[context.contextlevel][context.instanceid] = cachedCtxt.filters;

View File

@ -31,7 +31,7 @@ import { CoreError } from '@classes/errors/error';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreFilepool } from '@services/filepool';
import { DownloadStatus } from '@/core/constants';
import { CoreCacheUpdateFrequency, DownloadStatus } from '@/core/constants';
import { CoreUtils } from '@services/utils/utils';
/**
@ -145,7 +145,7 @@ export class CoreH5PProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getTrustedH5PFileCacheKey(url),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (ignoreCache) {

View File

@ -21,7 +21,7 @@ import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';
import { POLICY_PAGE_NAME, SITE_POLICY_PAGE_NAME } from '../constants';
import { CoreSite } from '@classes/sites/site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
/**
* Service that provides some common features regarding policies.
@ -140,7 +140,7 @@ export class CorePolicyService {
};
const preSets = {
cacheKey: this.getUserAcceptancesCacheKey(userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
...CoreSites.getReadingStrategyPreSets(options.readingStrategy),
};

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { ContextLevel } from '@/core/constants';
import { ContextLevel, CoreCacheUpdateFrequency } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreSite } from '@classes/sites/site';
import { CoreUser } from '@features/user/services/user';
@ -237,7 +237,7 @@ export class CoreRatingProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getItemRatingsCacheKey(contextLevel, instanceId, component, ratingArea, itemId, scaleId, sort),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (ignoreCache) {

View File

@ -19,7 +19,7 @@ import { CoreWSExternalWarning } from '@services/ws';
import { CoreCourseListItem, CoreCourses } from '@features/courses/services/courses';
import { CoreUserWithAvatar } from '@components/user-avatar/user-avatar';
import { CoreUser } from '@features/user/services/user';
import { CoreSite } from '@classes/sites/site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
declare module '@singletons/events' {
@ -154,7 +154,7 @@ export class CoreSearchGlobalSearchService {
const params: CoreSearchGetSearchAreasListWSParams = {};
const { areas } = await site.read<CoreSearchGetSearchAreasListWSResponse>('core_search_get_search_areas_list', params, {
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
cacheKey: CoreSearchGlobalSearchService.SEARCH_AREAS_CACHE_KEY,
});

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreConstants } from '@/core/constants';
import { CoreCacheUpdateFrequency, CoreConstants } from '@/core/constants';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseAnyModuleData } from '@features/course/services/course';
import { CoreCourses } from '@features/courses/services/courses';
@ -225,7 +225,7 @@ export class CoreSitePluginsProvider {
preSets = preSets || {};
preSets.cacheKey = this.getContentCacheKey(component, method, args);
preSets.updateFrequency = preSets.updateFrequency ?? CoreSite.FREQUENCY_OFTEN;
preSets.updateFrequency = preSets.updateFrequency ?? CoreCacheUpdateFrequency.OFTEN;
const result = await site.read<CoreSitePluginsGetContentWSResponse>('tool_mobile_get_content', data, preSets);

View File

@ -19,6 +19,7 @@ import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '@/core/constants';
const ROOT_CACHE_KEY = 'CoreTag:';
@ -100,7 +101,7 @@ export class CoreTagProvider {
rec: recursive,
};
const preSets: CoreSiteWSPreSets = {
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
cacheKey: this.getTagCloudKey(collectionId, isStandard, sort, search, fromContextId, contextId, recursive),
getFromCache: search != '', // Try to get updated data when searching.
};
@ -118,7 +119,7 @@ export class CoreTagProvider {
async getTagCollections(siteId?: string): Promise<CoreTagCollection[]> {
const site = await CoreSites.getSite(siteId);
const preSets: CoreSiteWSPreSets = {
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
cacheKey: this.getTagCollectionsKey(),
};
@ -172,7 +173,7 @@ export class CoreTagProvider {
},
};
const preSets: CoreSiteWSPreSets = {
updateFrequency: CoreSite.FREQUENCY_OFTEN,
updateFrequency: CoreCacheUpdateFrequency.OFTEN,
cacheKey: this.getTagIndexPerAreaKey(id, name, collectionId, areaId, fromContextId, contextId, recursive),
};

View File

@ -28,7 +28,7 @@ import { CoreError } from '@classes/errors/error';
import { USERS_TABLE_NAME, CoreUserDBRecord } from './database/user';
import { CoreUrl } from '@singletons/url';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreConstants } from '@/core/constants';
import { CoreCacheUpdateFrequency, CoreConstants } from '@/core/constants';
const ROOT_CACHE_KEY = 'mmUser:';
@ -223,7 +223,7 @@ export class CoreUserProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getParticipantsListCacheKey(courseId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (ignoreCache) {
@ -362,7 +362,7 @@ export class CoreUserProvider {
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserCacheKey(userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
let users: CoreUserData[] | CoreUserCourseProfile[] | undefined;
@ -463,7 +463,7 @@ export class CoreUserProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getUserPreferenceCacheKey(name),
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
updateFrequency: CoreCacheUpdateFrequency.SOMETIMES,
};
const result = await site.read<CoreUserGetUserPreferencesWSResponse>('core_user_get_user_preferences', params, preSets);

View File

@ -15,12 +15,12 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSite } from '@classes/sites/site';
import { CoreError } from '@classes/errors/error';
import { makeSingleton, Translate } from '@singletons';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreCourses } from '@features/courses/services/courses';
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
import { CoreCacheUpdateFrequency } from '../constants';
const ROOT_CACHE_KEY = 'mmGroups:';
@ -78,7 +78,7 @@ export class CoreGroupsProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getActivityAllowedGroupsCacheKey(cmId, userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (ignoreCache) {
@ -202,7 +202,7 @@ export class CoreGroupsProvider {
};
const preSets: CoreSiteWSPreSets = {
cacheKey: this.getActivityGroupModeCacheKey(cmId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
if (ignoreCache) {
@ -285,7 +285,7 @@ export class CoreGroupsProvider {
};
const preSets = {
cacheKey: this.getUserGroupsInCourseCacheKey(courseId, userId),
updateFrequency: CoreSite.FREQUENCY_RARELY,
updateFrequency: CoreCacheUpdateFrequency.RARELY,
};
const response: CoreGroupGetCourseUserGroupsWSResponse =

View File

@ -22,7 +22,7 @@ import { CoreWS } from '@services/ws';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUrl, CoreUrlPartNames } from '@singletons/url';
import { CoreUtils } from '@services/utils/utils';
import { CoreConstants } from '@/core/constants';
import { CoreConstants, MINIMUM_MOODLE_VERSION, MOODLE_RELEASES } from '@/core/constants';
import {
CoreSite,
CoreSiteConfig,
@ -482,7 +482,7 @@ export class CoreSitesProvider {
options.message = Translate.instant('core.siteunavailablehelp', { site: siteUrl });
options.debug = {
code: 'invalidmoodleversion',
details: Translate.instant('core.login.invalidmoodleversion', { $a: CoreSite.MINIMUM_MOODLE_VERSION }),
details: Translate.instant('core.login.invalidmoodleversion', { $a: MINIMUM_MOODLE_VERSION }),
};
} else if (error.debug?.code === 'redirecterrordetected') {
options.critical = false; // Keep checking fallback URLs.
@ -710,7 +710,7 @@ export class CoreSitesProvider {
break;
default:
errorKey = 'core.login.invalidmoodleversion';
translateParams = { $a: CoreSite.MINIMUM_MOODLE_VERSION };
translateParams = { $a: MINIMUM_MOODLE_VERSION };
debug = {
code: 'invalidmoodleversion',
details: 'Cannot connect to app',
@ -788,7 +788,7 @@ export class CoreSitesProvider {
if (info.version) {
const version = parseInt(info.version, 10);
if (!isNaN(version)) {
if (version >= CoreSite.MOODLE_RELEASES[CoreSite.MINIMUM_MOODLE_VERSION]) {
if (version >= MOODLE_RELEASES[MINIMUM_MOODLE_VERSION]) {
return this.validateWorkplaceVersion(info);
}
}
@ -797,7 +797,7 @@ export class CoreSitesProvider {
// We couldn't validate by version number. Let's try to validate by release number.
const release = this.getReleaseNumber(info.release || '');
if (release) {
if (release >= CoreSite.MINIMUM_MOODLE_VERSION) {
if (release >= MINIMUM_MOODLE_VERSION) {
return this.validateWorkplaceVersion(info);
}
}

View File

@ -26,7 +26,7 @@ import { CoreNetwork } from '@services/network';
import { CoreFile, CoreFileFormat } from '@services/file';
import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { CoreText } from '@singletons/text';
import { CoreConstants } from '@/core/constants';
import { CoreConstants, MINIMUM_MOODLE_VERSION } from '@/core/constants';
import { CoreError } from '@classes/errors/error';
import { CoreInterceptor } from '@classes/interceptor';
import { makeSingleton, Translate, Http, NativeHttp } from '@singletons';
@ -35,7 +35,6 @@ import { CoreWSError } from '@classes/errors/wserror';
import { CoreAjaxError } from '@classes/errors/ajaxerror';
import { CoreAjaxWSError } from '@classes/errors/ajaxwserror';
import { CoreNetworkError } from '@classes/errors/network-error';
import { CoreSite } from '@classes/sites/site';
import { CoreHttpError } from '@classes/errors/httperror';
import { CorePromisedValue } from '@classes/promised-value';
import { CorePlatform } from '@services/platform';
@ -592,7 +591,7 @@ export class CoreWSProvider {
options.debug = {
code: 'endpointnotfound',
details: Translate.instant('core.ajaxendpointnotfound', {
$a: CoreSite.MINIMUM_MOODLE_VERSION,
$a: MINIMUM_MOODLE_VERSION,
}),
};
break;