From e9c84c71d02aab7fa551eaa8271f2cee4334de9f Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Thu, 3 Jun 2021 12:15:45 +0200 Subject: [PATCH] MOBILE-3320 DX: Use consistent enum casing --- src/addons/mod/assign/pages/edit/edit.ts | 4 +-- src/addons/mod/assign/services/assign-sync.ts | 4 +-- src/addons/mod/assign/services/assign.ts | 2 +- .../mod/assign/services/handlers/prefetch.ts | 12 +++---- src/addons/mod/chat/services/chat.ts | 2 +- .../mod/chat/services/handlers/prefetch.ts | 2 +- .../mod/choice/services/handlers/prefetch.ts | 2 +- .../data/fields/latlong/component/latlong.ts | 4 +-- src/addons/mod/data/services/data-sync.ts | 2 +- src/addons/mod/data/services/data.ts | 2 +- .../mod/data/services/handlers/prefetch.ts | 4 +-- src/addons/mod/feedback/pages/form/form.ts | 12 +++---- .../mod/feedback/services/feedback-helper.ts | 2 +- .../mod/feedback/services/feedback-sync.ts | 2 +- src/addons/mod/feedback/services/feedback.ts | 4 +-- .../feedback/services/handlers/prefetch.ts | 4 +-- .../post-options-menu/post-options-menu.ts | 2 +- src/addons/mod/forum/services/forum.ts | 4 +-- .../mod/forum/services/handlers/prefetch.ts | 2 +- src/addons/mod/glossary/services/glossary.ts | 6 ++-- .../glossary/services/handlers/prefetch.ts | 2 +- .../mod/h5pactivity/services/h5pactivity.ts | 2 +- .../h5pactivity/services/handlers/prefetch.ts | 6 ++-- .../mod/imscp/services/handlers/prefetch.ts | 2 +- .../mod/label/services/handlers/prefetch.ts | 2 +- .../mod/lesson/pages/player/player.page.ts | 18 +++++----- .../mod/lesson/services/handlers/prefetch.ts | 8 ++--- src/addons/mod/lesson/services/lesson-sync.ts | 4 +-- src/addons/mod/lesson/services/lesson.ts | 8 ++--- .../mod/quiz/pages/player/player.page.ts | 14 ++++---- .../mod/quiz/services/handlers/prefetch.ts | 12 +++---- src/addons/mod/quiz/services/quiz-helper.ts | 2 +- src/addons/mod/quiz/services/quiz-sync.ts | 6 ++-- src/addons/mod/quiz/services/quiz.ts | 4 +-- src/addons/mod/scorm/pages/player/player.ts | 6 ++-- .../mod/scorm/services/handlers/prefetch.ts | 2 +- src/addons/mod/scorm/services/scorm-sync.ts | 12 +++---- src/addons/mod/scorm/services/scorm.ts | 2 +- .../mod/survey/services/handlers/prefetch.ts | 4 +-- .../mod/wiki/services/handlers/create-link.ts | 2 +- .../mod/wiki/services/handlers/prefetch.ts | 4 +-- src/addons/mod/wiki/services/wiki.ts | 2 +- .../workshop/services/handlers/prefetch.ts | 4 +-- src/addons/mod/workshop/services/workshop.ts | 2 +- .../horizontal-scroll-controls.ts | 20 +++++------ src/core/components/split-view/split-view.ts | 14 ++++---- .../grades/pages/course/course.page.ts | 2 +- .../features/grades/services/grades-helper.ts | 4 +-- src/core/services/geolocation.ts | 12 +++---- src/core/services/screen.ts | 34 +++++++++---------- src/core/services/sites.ts | 16 ++++----- 51 files changed, 155 insertions(+), 155 deletions(-) diff --git a/src/addons/mod/assign/pages/edit/edit.ts b/src/addons/mod/assign/pages/edit/edit.ts index 1a8aa7507..43dd2a858 100644 --- a/src/addons/mod/assign/pages/edit/edit.ts +++ b/src/addons/mod/assign/pages/edit/edit.ts @@ -138,7 +138,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { isBlind: this.isBlind, cmId: this.assign.cmid, filter: false, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }; let submissionStatus: AddonModAssignGetSubmissionStatusWSResponse; @@ -149,7 +149,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { } catch (error) { // Cannot connect. Get cached data. options.filter = true; - options.readingStrategy = CoreSitesReadingStrategy.PreferCache; + options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE; submissionStatus = await AddonModAssign.getSubmissionStatus(this.assign.id, options); this.userSubmission = diff --git a/src/addons/mod/assign/services/assign-sync.ts b/src/addons/mod/assign/services/assign-sync.ts index 1461ce771..162165dee 100644 --- a/src/addons/mod/assign/services/assign-sync.ts +++ b/src/addons/mod/assign/services/assign-sync.ts @@ -313,7 +313,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid const options: AddonModAssignSubmissionStatusOptions = { userId, cmId: assign.cmid, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -427,7 +427,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid const options: AddonModAssignSubmissionStatusOptions = { userId, cmId: assign.cmid, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/assign/services/assign.ts b/src/addons/mod/assign/services/assign.ts index 71d04e56a..a6e573451 100644 --- a/src/addons/mod/assign/services/assign.ts +++ b/src/addons/mod/assign/services/assign.ts @@ -576,7 +576,7 @@ export class AddonModAssignProvider { // Try again, ignoring cache. const newOptions = { ...options, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }; try { diff --git a/src/addons/mod/assign/services/handlers/prefetch.ts b/src/addons/mod/assign/services/handlers/prefetch.ts index 0ffc75535..ab3d2ff95 100644 --- a/src/addons/mod/assign/services/handlers/prefetch.ts +++ b/src/addons/mod/assign/services/handlers/prefetch.ts @@ -234,7 +234,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref const siteId = CoreSites.getCurrentSiteId(); const options: CoreSitesCommonWSOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -287,7 +287,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref ): Promise { const modOptions: CoreCourseCommonModWSOptions = { cmId: moduleId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -313,7 +313,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref moduleId, { userId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }, true, @@ -334,7 +334,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref ): Promise { const options: CoreSitesCommonWSOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -364,7 +364,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref userId: submission.submitid, groupId: group.id, isBlind: !!submission.blindid, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -381,7 +381,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref const submissionOptions = { userId, groupId: group.id, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/chat/services/chat.ts b/src/addons/mod/chat/services/chat.ts index c4a361160..2882cc6c1 100644 --- a/src/addons/mod/chat/services/chat.ts +++ b/src/addons/mod/chat/services/chat.ts @@ -201,7 +201,7 @@ export class AddonModChatProvider { */ async getChatUsers(sessionId: string, options: CoreCourseCommonModWSOptions = {}): Promise { // By default, always try to get the latest data. - options.readingStrategy = options.readingStrategy || CoreSitesReadingStrategy.PreferNetwork; + options.readingStrategy = options.readingStrategy || CoreSitesReadingStrategy.PREFER_NETWORK; const site = await CoreSites.getSite(options.siteId); diff --git a/src/addons/mod/chat/services/handlers/prefetch.ts b/src/addons/mod/chat/services/handlers/prefetch.ts index a332b9382..d321a03a3 100644 --- a/src/addons/mod/chat/services/handlers/prefetch.ts +++ b/src/addons/mod/chat/services/handlers/prefetch.ts @@ -78,7 +78,7 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet protected async prefetchChat(module: CoreCourseAnyModuleData, courseId: number): Promise { const siteId = CoreSites.getCurrentSiteId(); const options = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { diff --git a/src/addons/mod/choice/services/handlers/prefetch.ts b/src/addons/mod/choice/services/handlers/prefetch.ts index d8e10a54a..31721344d 100644 --- a/src/addons/mod/choice/services/handlers/prefetch.ts +++ b/src/addons/mod/choice/services/handlers/prefetch.ts @@ -60,7 +60,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref siteId = siteId || CoreSites.getCurrentSiteId(); const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { diff --git a/src/addons/mod/data/fields/latlong/component/latlong.ts b/src/addons/mod/data/fields/latlong/component/latlong.ts index b19e1164c..28d5038f5 100644 --- a/src/addons/mod/data/fields/latlong/component/latlong.ts +++ b/src/addons/mod/data/fields/latlong/component/latlong.ts @@ -157,9 +157,9 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginCo protected getGeolocationErrorMessage(error: CoreGeolocationError): string { // tslint:disable-next-line: switch-default switch (error.reason) { - case CoreGeolocationErrorReason.PermissionDenied: + case CoreGeolocationErrorReason.PERMISSION_DENIED: return 'addon.mod_data.locationpermissiondenied'; - case CoreGeolocationErrorReason.LocationNotEnabled: + case CoreGeolocationErrorReason.LOCATION_NOT_ENABLED: return 'addon.mod_data.locationnotenabled'; } } diff --git a/src/addons/mod/data/services/data-sync.ts b/src/addons/mod/data/services/data-sync.ts index ee5b8b392..889119427 100644 --- a/src/addons/mod/data/services/data-sync.ts +++ b/src/addons/mod/data/services/data-sync.ts @@ -281,7 +281,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider const options: CoreCourseCommonModWSOptions = { cmId: database.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/data/services/data.ts b/src/addons/mod/data/services/data.ts index 365b618b5..47665a5ca 100644 --- a/src/addons/mod/data/services/data.ts +++ b/src/addons/mod/data/services/data.ts @@ -1003,7 +1003,7 @@ export class AddonModDataProvider { options.order || options.order || 'DESC'; options.page = options.page || 0; options.perPage = options.perPage || AddonModDataProvider.PER_PAGE; - options.readingStrategy = options.readingStrategy || CoreSitesReadingStrategy.PreferNetwork; + options.readingStrategy = options.readingStrategy || CoreSitesReadingStrategy.PREFER_NETWORK; const params: AddonModDataSearchEntriesWSParams = { databaseid: dataId, diff --git a/src/addons/mod/data/services/handlers/prefetch.ts b/src/addons/mod/data/services/handlers/prefetch.ts index e67b65a49..f10453d61 100644 --- a/src/addons/mod/data/services/handlers/prefetch.ts +++ b/src/addons/mod/data/services/handlers/prefetch.ts @@ -182,7 +182,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { const database = await AddonModData.getDatabase(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }); const accessData = await AddonModData.getDatabaseAccessInformation(database.id, { cmId: module.id }); @@ -229,7 +229,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet const options = { cmId: module.id, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/feedback/pages/form/form.ts b/src/addons/mod/feedback/pages/form/form.ts index 306ccb2c7..f365b6a9e 100644 --- a/src/addons/mod/feedback/pages/form/form.ts +++ b/src/addons/mod/feedback/pages/form/form.ts @@ -153,7 +153,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { this.offline = !CoreApp.isOnline(); const options = { cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, siteId: this.currentSite.getId(), }; @@ -198,7 +198,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { // If it fails, go offline. this.offline = true; - options.readingStrategy = CoreSitesReadingStrategy.PreferCache; + options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE; this.access = await AddonModFeedback.getFeedbackAccessInformation(this.feedback!.id, options); } @@ -221,7 +221,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { // Go offline. this.offline = true; - options.readingStrategy = CoreSitesReadingStrategy.PreferCache; + options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE; return AddonModFeedback.getResumePage(this.feedback!.id, options); } @@ -256,7 +256,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { protected async fetchPageItems(page: number): Promise { const options = { cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, siteId: this.currentSite.getId(), }; @@ -284,7 +284,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { // Go offline. this.offline = true; - options.readingStrategy = CoreSitesReadingStrategy.PreferCache; + options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE; response = await AddonModFeedback.getPageItemsWithValues(this.feedback!.id, page, options); } @@ -344,7 +344,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { await this.fetchAccessData({ cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, siteId: this.currentSite.getId(), }); } else if (typeof response.jumpto != 'number' || response.jumpto == this.currentPage) { diff --git a/src/addons/mod/feedback/services/feedback-helper.ts b/src/addons/mod/feedback/services/feedback-helper.ts index b1a0d27d4..05751c7f5 100644 --- a/src/addons/mod/feedback/services/feedback-helper.ts +++ b/src/addons/mod/feedback/services/feedback-helper.ts @@ -190,7 +190,7 @@ export class AddonModFeedbackHelperProvider { const attempt = await AddonModFeedback.getAttempt(module.instance, Number(params.showcompleted), { cmId: module.id, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); diff --git a/src/addons/mod/feedback/services/feedback-sync.ts b/src/addons/mod/feedback/services/feedback-sync.ts index 51c4cae18..d404ed6f2 100644 --- a/src/addons/mod/feedback/services/feedback-sync.ts +++ b/src/addons/mod/feedback/services/feedback-sync.ts @@ -205,7 +205,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv } const timemodified = await AddonModFeedback.getCurrentCompletedTimeModified(feedbackId, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); // Sort by page. diff --git a/src/addons/mod/feedback/services/feedback.ts b/src/addons/mod/feedback/services/feedback.ts index 734abdcf8..7181b1031 100644 --- a/src/addons/mod/feedback/services/feedback.ts +++ b/src/addons/mod/feedback/services/feedback.ts @@ -823,7 +823,7 @@ export class AddonModFeedbackProvider { const response = await this.getPageItemsWithValues(feedbackId, page, { cmId: options.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, }); @@ -1173,7 +1173,7 @@ export class AddonModFeedbackProvider { const pageItems = await this.getPageItemsWithValues(feedbackId, page, { cmId: options.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, }); diff --git a/src/addons/mod/feedback/services/handlers/prefetch.ts b/src/addons/mod/feedback/services/handlers/prefetch.ts index 5ed1b4746..b2ac5d3e9 100644 --- a/src/addons/mod/feedback/services/handlers/prefetch.ts +++ b/src/addons/mod/feedback/services/handlers/prefetch.ts @@ -94,7 +94,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { const feedback = await AddonModFeedback.getFeedback(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }); const now = CoreTimeUtils.timestamp(); @@ -136,7 +136,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr protected async prefetchFeedback(module: CoreCourseAnyModuleData, courseId: number): Promise { const siteId = CoreSites.getCurrentSiteId(); const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { diff --git a/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts b/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts index 4b5ed2c4d..cf2d1acc8 100644 --- a/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts +++ b/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts @@ -75,7 +75,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit, OnDestroy this.post = await AddonModForum.getDiscussionPost(this.forumId, this.post.discussionid, this.post.id, { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }); } catch (error) { CoreDomUtils.showErrorModalDefault(error, 'Error getting discussion post.'); diff --git a/src/addons/mod/forum/services/forum.ts b/src/addons/mod/forum/services/forum.ts index 901f138ba..bf53d6c30 100644 --- a/src/addons/mod/forum/services/forum.ts +++ b/src/addons/mod/forum/services/forum.ts @@ -778,7 +778,7 @@ export class AddonModForumProvider { sortby: 'timemodified', sortdirection: 'DESC', }; - Object.assign(preSets, CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.PreferCache)); + Object.assign(preSets, CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.PREFER_CACHE)); response = await site.read( 'mod_forum_get_forum_discussions_paginated', @@ -889,7 +889,7 @@ export class AddonModForumProvider { .getDiscussionsInPages(forum.id, { cmId: forum.cmid, sortOrder: sortOrder.value, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }) .then((response) => { // Now invalidate the WS calls. diff --git a/src/addons/mod/forum/services/handlers/prefetch.ts b/src/addons/mod/forum/services/handlers/prefetch.ts index a9c55d2e9..0f3d73f91 100644 --- a/src/addons/mod/forum/services/handlers/prefetch.ts +++ b/src/addons/mod/forum/services/handlers/prefetch.ts @@ -199,7 +199,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe siteId: string, ): Promise { const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { diff --git a/src/addons/mod/glossary/services/glossary.ts b/src/addons/mod/glossary/services/glossary.ts index 4efd33ccd..e5f6cef2d 100644 --- a/src/addons/mod/glossary/services/glossary.ts +++ b/src/addons/mod/glossary/services/glossary.ts @@ -644,7 +644,7 @@ export class AddonModGlossaryProvider { // Get the entries from this "page" and check if the entry we're looking for is in it. const result = await this.getEntriesByLetter(glossaryId, 'ALL', { from: from, - readingStrategy: CoreSitesReadingStrategy.OnlyCache, + readingStrategy: CoreSitesReadingStrategy.ONLY_CACHE, cmId: options.cmId, siteId: options.siteId, }); @@ -763,7 +763,7 @@ export class AddonModGlossaryProvider { if (!onlyEntriesList) { promises.push(this.fetchAllEntries(this.getEntriesByLetter.bind(this, glossary.id, 'ALL'), { cmId: glossary.coursemodule, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }).then((entries) => this.invalidateEntries(entries, siteId))); } @@ -995,7 +995,7 @@ export class AddonModGlossaryProvider { // Get entries from the cache. const entries = await this.fetchAllEntries(this.getEntriesByLetter.bind(glossaryId, 'ALL'), { cmId: options.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, }); diff --git a/src/addons/mod/glossary/services/handlers/prefetch.ts b/src/addons/mod/glossary/services/handlers/prefetch.ts index a153527a1..0c722bdce 100644 --- a/src/addons/mod/glossary/services/handlers/prefetch.ts +++ b/src/addons/mod/glossary/services/handlers/prefetch.ts @@ -114,7 +114,7 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr const options = { cmId: module.id, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/h5pactivity/services/h5pactivity.ts b/src/addons/mod/h5pactivity/services/h5pactivity.ts index fba890efb..7902596d1 100644 --- a/src/addons/mod/h5pactivity/services/h5pactivity.ts +++ b/src/addons/mod/h5pactivity/services/h5pactivity.ts @@ -239,7 +239,7 @@ export class AddonModH5PActivityProvider { // Check if the full list of results is cached. If so, get the results from there. const cacheOptions: AddonModH5PActivityGetAttemptResultsOptions = { ...options, // Include all the original options. - readingStrategy: CoreSitesReadingStrategy.OnlyCache, + readingStrategy: CoreSitesReadingStrategy.ONLY_CACHE, }; const attemptsResults = await AddonModH5PActivity.getAllAttemptsResults(id, cacheOptions); diff --git a/src/addons/mod/h5pactivity/services/handlers/prefetch.ts b/src/addons/mod/h5pactivity/services/handlers/prefetch.ts index 6c6d6cf8e..3d8375652 100644 --- a/src/addons/mod/h5pactivity/services/handlers/prefetch.ts +++ b/src/addons/mod/h5pactivity/services/handlers/prefetch.ts @@ -96,7 +96,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit siteId = siteId || CoreSites.getCurrentSiteId(); const h5pActivity = await AddonModH5PActivity.getH5PActivity(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); @@ -145,7 +145,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit const accessInfo = await AddonModH5PActivity.getAccessInformation(h5pActivity.id, { cmId: h5pActivity.coursemodule, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }); @@ -155,7 +155,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit const options = { cmId: h5pActivity.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId: siteId, }; diff --git a/src/addons/mod/imscp/services/handlers/prefetch.ts b/src/addons/mod/imscp/services/handlers/prefetch.ts index fb95f9898..4f8aca282 100644 --- a/src/addons/mod/imscp/services/handlers/prefetch.ts +++ b/src/addons/mod/imscp/services/handlers/prefetch.ts @@ -48,7 +48,7 @@ export class AddonModImscpPrefetchHandlerService extends CoreCourseResourcePrefe promises.push(super.downloadOrPrefetch(module, courseId, prefetch, dirPath)); promises.push(AddonModImscp.getImscp(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, })); diff --git a/src/addons/mod/label/services/handlers/prefetch.ts b/src/addons/mod/label/services/handlers/prefetch.ts index ba7a0b950..2b702318a 100644 --- a/src/addons/mod/label/services/handlers/prefetch.ts +++ b/src/addons/mod/label/services/handlers/prefetch.ts @@ -41,7 +41,7 @@ export class AddonModLabelPrefetchHandlerService extends CoreCourseResourcePrefe if (AddonModLabel.isGetLabelAvailableForSite()) { label = await AddonModLabel.getLabel(courseId, module.id, { - readingStrategy: ignoreCache ? CoreSitesReadingStrategy.OnlyNetwork : undefined, + readingStrategy: ignoreCache ? CoreSitesReadingStrategy.ONLY_NETWORK : undefined, }); } diff --git a/src/addons/mod/lesson/pages/player/player.page.ts b/src/addons/mod/lesson/pages/player/player.page.ts index 1a014068c..303d8add6 100644 --- a/src/addons/mod/lesson/pages/player/player.page.ts +++ b/src/addons/mod/lesson/pages/player/player.page.ts @@ -215,11 +215,11 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { // Get the possible jumps now. this.jumps = await AddonModLesson.getPagesPossibleJumps(this.lesson!.id, { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }); // Call the function again with offline mode and the new jumps. - options.readingStrategy = CoreSitesReadingStrategy.PreferCache; + options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE; options.jumps = this.jumps; options.offline = true; @@ -280,7 +280,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { const options = { cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }; this.accessInfo = await this.callFunction( AddonModLesson.getAccessInformation.bind(AddonModLesson.instance, this.lesson.id, options), @@ -311,7 +311,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { const options = { password: this.password, cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }; promises.push(this.callFunction( AddonModLesson.getLessonWithPassword.bind(AddonModLesson.instance, this.lesson.id, options), @@ -327,7 +327,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { // Offline mode, get the list of possible jumps to allow navigation. promises.push(AddonModLesson.getPagesPossibleJumps(this.lesson.id, { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }).then((jumpList) => { this.jumps = jumpList; @@ -490,7 +490,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { // Get the last lesson timer. const timers = await AddonModLesson.getTimers(this.lesson!.id, { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }); this.endTime = timers[timers.length - 1].starttime + this.lesson!.timelimit; @@ -515,7 +515,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { const options = { password: this.password, cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }; const pages = await this.callFunction( @@ -548,7 +548,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { review: this.review, includeContents: true, cmId: this.cmId, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, accessInfo: this.accessInfo, jumps: this.jumps, includeOfflineData: true, @@ -643,7 +643,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { const retake = this.accessInfo!.attemptscount; const options = { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }; // Update in background the list of content pages viewed or question attempts. diff --git a/src/addons/mod/lesson/services/handlers/prefetch.ts b/src/addons/mod/lesson/services/handlers/prefetch.ts index c53114c00..f99e844d8 100644 --- a/src/addons/mod/lesson/services/handlers/prefetch.ts +++ b/src/addons/mod/lesson/services/handlers/prefetch.ts @@ -81,7 +81,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref // Get the lesson password if it's needed. const passwordData = await this.getLessonPassword(lesson.id, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, askPassword: single, siteId, }); @@ -188,7 +188,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref const siteId = CoreSites.getCurrentSiteId(); const lesson = await AddonModLesson.getLesson(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }); @@ -257,7 +257,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref courseId = courseId || module.course || CoreSites.getCurrentSiteHomeId(); const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { @@ -269,7 +269,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref // Get the lesson password if it's needed. const passwordData = await this.getLessonPassword(lesson.id, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, askPassword: single, siteId, }); diff --git a/src/addons/mod/lesson/services/lesson-sync.ts b/src/addons/mod/lesson/services/lesson-sync.ts index 8c4bb9133..55d5fa55f 100644 --- a/src/addons/mod/lesson/services/lesson-sync.ts +++ b/src/addons/mod/lesson/services/lesson-sync.ts @@ -287,7 +287,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid const lesson = await AddonModLesson.getLessonById(result.courseId, lessonId, { siteId }); const passwordData = await AddonModLessonPrefetchHandler.getLessonPassword(lessonId, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, askPassword, siteId, }); @@ -431,7 +431,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid // Retrieve the needed data. const lesson = await AddonModLesson.getLessonById(result.courseId!, lessonId, { siteId }); passwordData = await AddonModLessonPrefetchHandler.getLessonPassword(lessonId, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, askPassword, siteId, }); diff --git a/src/addons/mod/lesson/services/lesson.ts b/src/addons/mod/lesson/services/lesson.ts index 4b9a53e33..fe86bbe71 100644 --- a/src/addons/mod/lesson/services/lesson.ts +++ b/src/addons/mod/lesson/services/lesson.ts @@ -292,7 +292,7 @@ export class AddonModLessonProvider { const pages = await this.getPages(lessonId, { cmId: options.cmId, password: options.password, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, }); @@ -1600,7 +1600,7 @@ export class AddonModLessonProvider { const data = await this.getPageData(lesson, pageId, { includeContents: true, ...options, // Include all options. - readingStrategy: options.readingStrategy || CoreSitesReadingStrategy.PreferCache, + readingStrategy: options.readingStrategy || CoreSitesReadingStrategy.PREFER_CACHE, includeOfflineData: false, }); @@ -2854,7 +2854,7 @@ export class AddonModLessonProvider { const pages = await this.getPages(lesson.id, { password: options.password, cmId: lesson.coursemodule, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, }); @@ -3038,7 +3038,7 @@ export class AddonModLessonProvider { const pages = await this.getPages(lesson.id, { cmId: lesson.coursemodule, password: options.password, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, }); diff --git a/src/addons/mod/quiz/pages/player/player.page.ts b/src/addons/mod/quiz/pages/player/player.page.ts index 9d213fe40..8740e8d7d 100644 --- a/src/addons/mod/quiz/pages/player/player.page.ts +++ b/src/addons/mod/quiz/pages/player/player.page.ts @@ -349,13 +349,13 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { // Get access information for the quiz. this.quizAccessInfo = await AddonModQuiz.getQuizAccessInformation(this.quiz.id, { cmId: this.quiz.coursemodule, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); // Get user attempts to determine last attempt. const attempts = await AddonModQuiz.getUserAttempts(this.quiz.id, { cmId: this.quiz.coursemodule, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); if (!attempts.length) { @@ -428,7 +428,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { // Get current page data again to get the latest sequencechecks. const data = await AddonModQuiz.getAttemptData(this.attempt!.id, this.attempt!.currentpage!, this.preflightData, { cmId: this.quiz!.coursemodule, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); const newSequenceChecks: Record = {}; @@ -486,7 +486,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { protected async loadPage(page: number): Promise { const data = await AddonModQuiz.getAttemptData(this.attempt!.id, page, this.preflightData, { cmId: this.quiz!.coursemodule, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); // Update attempt, status could change during the execution. @@ -531,7 +531,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { this.summaryQuestions = await AddonModQuiz.getAttemptSummary(this.attempt!.id, this.preflightData, { cmId: this.quiz!.coursemodule, loadLocal: this.offline, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); this.showSummary = true; @@ -556,7 +556,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { this.navigation = await AddonModQuiz.getAttemptSummary(this.attempt!.id, this.preflightData, { cmId: this.quiz!.coursemodule, loadLocal: this.offline, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); this.navigation.forEach((question) => { @@ -737,7 +737,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { // Re-fetch attempt access information with the right attempt (might have changed because a new attempt was created). this.attemptAccessInfo = await AddonModQuiz.getAttemptAccessInformation(this.quiz!.id, attempt.id, { cmId: this.quiz!.coursemodule, - readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, }); this.attempt = attempt; diff --git a/src/addons/mod/quiz/services/handlers/prefetch.ts b/src/addons/mod/quiz/services/handlers/prefetch.ts index 0528dee8f..f5ca3f793 100644 --- a/src/addons/mod/quiz/services/handlers/prefetch.ts +++ b/src/addons/mod/quiz/services/handlers/prefetch.ts @@ -85,7 +85,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet const attempts = await AddonModQuiz.getUserAttempts(quiz.id, { cmId: module.id, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }); const attemptFiles = await this.getAttemptsFeedbackFiles(quiz, attempts); @@ -126,7 +126,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet const feedback = await AddonModQuiz.getFeedbackForGrade(quiz.id, Number(attemptGrade), { cmId: quiz.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); @@ -305,7 +305,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet canStart: boolean, ): Promise { const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { @@ -417,7 +417,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet const modOptions: CoreCourseCommonModWSOptions = { cmId: quiz.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -546,7 +546,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet const modOptions = { cmId: quiz.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -575,7 +575,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet await this.setStatusAfterPrefetch(quiz, { cmId: quiz.coursemodule, attempts, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }); } diff --git a/src/addons/mod/quiz/services/quiz-helper.ts b/src/addons/mod/quiz/services/quiz-helper.ts index bfe31ac83..d94ccba31 100644 --- a/src/addons/mod/quiz/services/quiz-helper.ts +++ b/src/addons/mod/quiz/services/quiz-helper.ts @@ -349,7 +349,7 @@ export class AddonModQuizHelperProvider { const rules = accessInfo.activerulenames; const modOptions = { cmId: quiz.coursemodule, - readingStrategy: offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/quiz/services/quiz-sync.ts b/src/addons/mod/quiz/services/quiz-sync.ts index a6741fae5..25c101242 100644 --- a/src/addons/mod/quiz/services/quiz-sync.ts +++ b/src/addons/mod/quiz/services/quiz-sync.ts @@ -169,7 +169,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider // Prefetch finished or not needed, set the right status. await AddonModQuizPrefetchHandler.setStatusAfterPrefetch(quiz, { cmId: module.id, - readingStrategy: shouldDownload ? CoreSitesReadingStrategy.PreferCache : undefined, + readingStrategy: shouldDownload ? CoreSitesReadingStrategy.PREFER_CACHE : undefined, siteId, }); } @@ -293,7 +293,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider const courseId = quiz.course; const modOptions = { cmId: quiz.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; @@ -368,7 +368,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider // Now get the online questions data. const onlineQuestions = await AddonModQuiz.getAllQuestionsData(quiz, onlineAttempt, preflightData, { pages: AddonModQuiz.getPagesFromLayoutAndQuestions(onlineAttempt.layout || '', offlineQuestions), - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); diff --git a/src/addons/mod/quiz/services/quiz.ts b/src/addons/mod/quiz/services/quiz.ts index 0dd4a9d9e..478a4dce5 100644 --- a/src/addons/mod/quiz/services/quiz.ts +++ b/src/addons/mod/quiz/services/quiz.ts @@ -1265,7 +1265,7 @@ export class AddonModQuizProvider { // Get required data to call the invalidate functions. const quiz = await this.getQuiz(courseId, moduleId, { - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }); @@ -1753,7 +1753,7 @@ export class AddonModQuizProvider { const questionsArray = await this.getAttemptSummary(attempt.id, preflightData, { cmId: quiz.coursemodule, loadLocal: true, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }); diff --git a/src/addons/mod/scorm/pages/player/player.ts b/src/addons/mod/scorm/pages/player/player.ts index 982808f42..fccabab23 100644 --- a/src/addons/mod/scorm/pages/player/player.ts +++ b/src/addons/mod/scorm/pages/player/player.ts @@ -131,7 +131,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { // Get the SCORM instance. this.scorm = await AddonModScorm.getScorm(this.courseId, this.cmId, { moduleUrl: this.moduleUrl, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }); // Block the SCORM so it cannot be synchronized. @@ -248,7 +248,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { // Last attempt was online, verify that we can create a new online attempt. We ignore cache. await AddonModScorm.getScormUserData(this.scorm.id, result.attempt, { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, }); } catch { // Cannot communicate with the server, create an offline attempt. @@ -529,7 +529,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { // New online attempt created, update cached data about online attempts. await CoreUtils.ignoreErrors(AddonModScorm.getAttemptCount(this.scorm.id, { cmId: this.cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, })); } diff --git a/src/addons/mod/scorm/services/handlers/prefetch.ts b/src/addons/mod/scorm/services/handlers/prefetch.ts index f25974718..f92274403 100644 --- a/src/addons/mod/scorm/services/handlers/prefetch.ts +++ b/src/addons/mod/scorm/services/handlers/prefetch.ts @@ -212,7 +212,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe const modOptions: CoreCourseCommonModWSOptions = { cmId: scorm.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; diff --git a/src/addons/mod/scorm/services/scorm-sync.ts b/src/addons/mod/scorm/services/scorm-sync.ts index 44ba195cd..3ebcfec81 100644 --- a/src/addons/mod/scorm/services/scorm-sync.ts +++ b/src/addons/mod/scorm/services/scorm-sync.ts @@ -125,7 +125,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide const siteData = await AddonModScorm.getScormUserData(scormId, attempt, { cmId, - readingStrategy: refresh ? CoreSitesReadingStrategy.OnlyNetwork : undefined, + readingStrategy: refresh ? CoreSitesReadingStrategy.ONLY_NETWORK : undefined, siteId, }); @@ -222,7 +222,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide // Last online attempt wasn't finished, let's check if it is now. const incomplete = await AddonModScorm.isAttemptIncomplete(scorm.id, lastOnline, { cmId: scorm.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); @@ -365,7 +365,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide try { userData = await AddonModScorm.getScormUserData(scormId, attempt, { cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); } catch { @@ -616,7 +616,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide // Get attempts data. We ignore cache for online attempts, so this call will fail if offline or server down. const attemptsData = await AddonModScorm.getAttemptCount(scorm.id, { cmId: scorm.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); @@ -641,7 +641,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide false : await AddonModScorm.isAttemptIncomplete(scorm.id, lastOnline, { cmId: scorm.coursemodule, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); @@ -799,7 +799,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide const userData = await AddonModScorm.getScormUserData(scormId, attempt, { cmId, - readingStrategy: refresh ? CoreSitesReadingStrategy.OnlyNetwork : undefined, + readingStrategy: refresh ? CoreSitesReadingStrategy.ONLY_NETWORK : undefined, siteId, }); diff --git a/src/addons/mod/scorm/services/scorm.ts b/src/addons/mod/scorm/services/scorm.ts index cc07a74c7..daeace34c 100644 --- a/src/addons/mod/scorm/services/scorm.ts +++ b/src/addons/mod/scorm/services/scorm.ts @@ -1699,7 +1699,7 @@ export class AddonModScormProvider { await this.getScormUserDataOnline(scormId, attempt, { cmId: options.cmId, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId: options.siteId, }); } diff --git a/src/addons/mod/survey/services/handlers/prefetch.ts b/src/addons/mod/survey/services/handlers/prefetch.ts index 0ccae56eb..6f75862d2 100644 --- a/src/addons/mod/survey/services/handlers/prefetch.ts +++ b/src/addons/mod/survey/services/handlers/prefetch.ts @@ -81,7 +81,7 @@ export class AddonModSurveyPrefetchHandlerService extends CoreCourseActivityPref */ protected async prefetchSurvey(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const survey = await AddonModSurvey.getSurvey(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }); @@ -95,7 +95,7 @@ export class AddonModSurveyPrefetchHandlerService extends CoreCourseActivityPref if (!survey.surveydone) { promises.push(AddonModSurvey.getQuestions(survey.id, { cmId: module.id, - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, })); } diff --git a/src/addons/mod/wiki/services/handlers/create-link.ts b/src/addons/mod/wiki/services/handlers/create-link.ts index 473a2c0e9..3b63f51de 100644 --- a/src/addons/mod/wiki/services/handlers/create-link.ts +++ b/src/addons/mod/wiki/services/handlers/create-link.ts @@ -60,7 +60,7 @@ export class AddonModWikiCreateLinkHandlerService extends CoreContentLinksHandle const options = { cmId: params.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }; diff --git a/src/addons/mod/wiki/services/handlers/prefetch.ts b/src/addons/mod/wiki/services/handlers/prefetch.ts index 22b6e4922..a8d9d0160 100644 --- a/src/addons/mod/wiki/services/handlers/prefetch.ts +++ b/src/addons/mod/wiki/services/handlers/prefetch.ts @@ -73,7 +73,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet CorePluginFileDelegate.getFilesDownloadSize(files))); promises.push(this.getAllPages(module, courseId, { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }).then((pages) => { let size = 0; @@ -161,7 +161,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet const userId = CoreSites.getCurrentSiteUserId(); const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { diff --git a/src/addons/mod/wiki/services/wiki.ts b/src/addons/mod/wiki/services/wiki.ts index 6dc180136..e51324cc0 100644 --- a/src/addons/mod/wiki/services/wiki.ts +++ b/src/addons/mod/wiki/services/wiki.ts @@ -683,7 +683,7 @@ export class AddonModWikiProvider { // We have wiki ID, check if there's already an online page with this title and subwiki. const used = await CoreUtils.ignoreErrors(this.isTitleUsed(options.wikiId, options.subwikiId, title, { cmId: options.cmId, - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId: options.siteId, })); diff --git a/src/addons/mod/workshop/services/handlers/prefetch.ts b/src/addons/mod/workshop/services/handlers/prefetch.ts index d8bd7864c..0c62e0832 100644 --- a/src/addons/mod/workshop/services/handlers/prefetch.ts +++ b/src/addons/mod/workshop/services/handlers/prefetch.ts @@ -191,7 +191,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { const workshop = await AddonModWorkshop.getWorkshop(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, }); const accessData = await AddonModWorkshop.getWorkshopAccessInformation(workshop.id, { cmId: module.id }); @@ -263,7 +263,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr const userIds: number[] = []; const commonOptions = { - readingStrategy: CoreSitesReadingStrategy.OnlyNetwork, + readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK, siteId, }; const modOptions = { diff --git a/src/addons/mod/workshop/services/workshop.ts b/src/addons/mod/workshop/services/workshop.ts index c4432cec8..7946c70c2 100644 --- a/src/addons/mod/workshop/services/workshop.ts +++ b/src/addons/mod/workshop/services/workshop.ts @@ -1419,7 +1419,7 @@ export class AddonModWorkshopProvider { siteId = siteId || CoreSites.getCurrentSiteId(); const workshop = await this.getWorkshop(courseId, moduleId, { - readingStrategy: CoreSitesReadingStrategy.PreferCache, + readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, siteId, }); diff --git a/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts b/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts index 61964d49b..ccce235d1 100644 --- a/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts +++ b/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts @@ -16,10 +16,10 @@ import { Component, Input } from '@angular/core'; import { Platform } from '@singletons'; const enum ScrollPosition { - Start = 'start', - End = 'end', - Middle = 'middle', - Hidden = 'hidden', + START = 'start', + END = 'end', + MIDDLE = 'middle', + HIDDEN = 'hidden', } @Component({ @@ -32,7 +32,7 @@ export class CoreHorizontalScrollControlsComponent { // eslint-disable-next-line @angular-eslint/no-input-rename @Input('aria-controls') targetId?: string; - scrollPosition: ScrollPosition = ScrollPosition.Hidden; + scrollPosition: ScrollPosition = ScrollPosition.HIDDEN; /** * Get target element. @@ -85,22 +85,22 @@ export class CoreHorizontalScrollControlsComponent { scrollLeft = scrollLeft ?? this.target?.scrollLeft ?? 0; if (!this.target || this.target.scrollWidth <= this.target.clientWidth) { - return ScrollPosition.Hidden; + return ScrollPosition.HIDDEN; } if (scrollLeft === 0) { - return Platform.isRTL ? ScrollPosition.End : ScrollPosition.Start; + return Platform.isRTL ? ScrollPosition.END : ScrollPosition.START; } if (!Platform.isRTL && this.target.scrollWidth - scrollLeft === this.target.clientWidth) { - return ScrollPosition.End; + return ScrollPosition.END; } if (Platform.isRTL && this.target.scrollWidth + scrollLeft === this.target.clientWidth) { - return ScrollPosition.Start; + return ScrollPosition.START; } - return ScrollPosition.Middle; + return ScrollPosition.MIDDLE; } } diff --git a/src/core/components/split-view/split-view.ts b/src/core/components/split-view/split-view.ts index b08eea849..1a50991a5 100644 --- a/src/core/components/split-view/split-view.ts +++ b/src/core/components/split-view/split-view.ts @@ -19,9 +19,9 @@ import { CoreScreen } from '@services/screen'; import { BehaviorSubject, Observable, Subscription } from 'rxjs'; export enum CoreSplitViewMode { - MenuOnly = 'menu-only', // Hides content. - ContentOnly = 'content-only', // Hides menu. - MenuAndContent = 'menu-and-content', // Shows both menu and content. + MENU_ONLY = 'menu-only', // Hides content. + CONTENT_ONLY = 'content-only', // Hides menu. + MENU_AND_CONTENT = 'menu-and-content', // Shows both menu and content. } const disabledScrollClass = 'disable-scroll-y'; @@ -118,16 +118,16 @@ export class CoreSplitViewComponent implements AfterViewInit, OnDestroy { } if (this.isNested) { - return CoreSplitViewMode.MenuOnly; + return CoreSplitViewMode.MENU_ONLY; } if (CoreScreen.isMobile) { return this.contentOutlet.isActivated - ? CoreSplitViewMode.ContentOnly - : CoreSplitViewMode.MenuOnly; + ? CoreSplitViewMode.CONTENT_ONLY + : CoreSplitViewMode.MENU_ONLY; } - return CoreSplitViewMode.MenuAndContent; + return CoreSplitViewMode.MENU_AND_CONTENT; } /** diff --git a/src/core/features/grades/pages/course/course.page.ts b/src/core/features/grades/pages/course/course.page.ts index 2c93e5aae..e47cf8819 100644 --- a/src/core/features/grades/pages/course/course.page.ts +++ b/src/core/features/grades/pages/course/course.page.ts @@ -51,7 +51,7 @@ export class CoreGradesCoursePage implements AfterViewInit, OnDestroy { const useSplitView = route.snapshot.data.useSplitView ?? true; const outsideGradesTab = route.snapshot.data.outsideGradesTab ?? false; - this.splitViewMode = useSplitView ? undefined : CoreSplitViewMode.MenuOnly; + this.splitViewMode = useSplitView ? undefined : CoreSplitViewMode.MENU_ONLY; this.grades = new CoreGradesCourseManager(CoreGradesCoursePage, courseId, userId, outsideGradesTab); } diff --git a/src/core/features/grades/services/grades-helper.ts b/src/core/features/grades/services/grades-helper.ts index 602855a8e..809566334 100644 --- a/src/core/features/grades/services/grades-helper.ts +++ b/src/core/features/grades/services/grades-helper.ts @@ -221,7 +221,7 @@ export class CoreGradesHelperProvider { let coursesWereMissing = false; try { - const courses = await CoreCourses.getUserCourses(undefined, undefined, CoreSitesReadingStrategy.OnlyCache); + const courses = await CoreCourses.getUserCourses(undefined, undefined, CoreSitesReadingStrategy.ONLY_CACHE); const coursesMap = CoreUtils.arrayToObject(courses, 'id'); coursesWereMissing = this.addCourseData(grades, coursesMap); @@ -233,7 +233,7 @@ export class CoreGradesHelperProvider { if (coursesWereMissing) { const coursesPromise = CoreCourses.isGetCoursesByFieldAvailable() ? CoreCourses.getCoursesByField('ids', grades.map((grade) => grade.courseid).join(',')) - : CoreCourses.getUserCourses(undefined, undefined, CoreSitesReadingStrategy.PreferNetwork); + : CoreCourses.getUserCourses(undefined, undefined, CoreSitesReadingStrategy.PREFER_NETWORK); const courses = await coursesPromise; const coursesMap = diff --git a/src/core/services/geolocation.ts b/src/core/services/geolocation.ts index aecc397cd..61f34d953 100644 --- a/src/core/services/geolocation.ts +++ b/src/core/services/geolocation.ts @@ -41,7 +41,7 @@ export class CoreGeolocationProvider { return result.coords; } catch (error) { if (this.isCordovaPermissionDeniedError(error)) { - throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied); + throw new CoreGeolocationError(CoreGeolocationErrorReason.PERMISSION_DENIED); } throw error; @@ -78,7 +78,7 @@ export class CoreGeolocationProvider { } if (!locationEnabled) { - throw new CoreGeolocationError(CoreGeolocationErrorReason.LocationNotEnabled); + throw new CoreGeolocationError(CoreGeolocationErrorReason.LOCATION_NOT_ENABLED); } } @@ -93,7 +93,7 @@ export class CoreGeolocationProvider { switch (authorizationStatus) { case Diagnostic.permissionStatus.DENIED_ONCE: if (failOnDeniedOnce) { - throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied); + throw new CoreGeolocationError(CoreGeolocationErrorReason.PERMISSION_DENIED); } // Fall through. case Diagnostic.permissionStatus.NOT_REQUESTED: @@ -107,7 +107,7 @@ export class CoreGeolocationProvider { // Location is authorized. return; default: - throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied); + throw new CoreGeolocationError(CoreGeolocationErrorReason.PERMISSION_DENIED); } } @@ -138,8 +138,8 @@ export class CoreGeolocationProvider { export const CoreGeolocation = makeSingleton(CoreGeolocationProvider); export enum CoreGeolocationErrorReason { - PermissionDenied = 'permission-denied', - LocationNotEnabled = 'location-not-enabled', + PERMISSION_DENIED = 'permission-denied', + LOCATION_NOT_ENABLED = 'location-not-enabled', } export class CoreGeolocationError extends CoreError { diff --git a/src/core/services/screen.ts b/src/core/services/screen.ts index 696abb6cb..592b98ec2 100644 --- a/src/core/services/screen.ts +++ b/src/core/services/screen.ts @@ -24,28 +24,28 @@ import { makeSingleton } from '@singletons'; * @see https://ionicframework.com/docs/layout/grid#default-breakpoints */ enum Breakpoint { - ExtraSmall = 'xs', - Small = 'sm', - Medium = 'md', - Large = 'lg', - ExtraLarge = 'xl', + EXTRA_SMALL = 'xs', + SMALL = 'sm', + MEDIUM = 'md', + LARGE = 'lg', + EXTRA_LARGE = 'xl', } const BREAKPOINT_NAMES = Object.values(Breakpoint); const BREAKPOINT_WIDTHS: Record = { - [Breakpoint.ExtraSmall]: 0, - [Breakpoint.Small]: 576, - [Breakpoint.Medium]: 768, - [Breakpoint.Large]: 992, - [Breakpoint.ExtraLarge]: 1200, + [Breakpoint.EXTRA_SMALL]: 0, + [Breakpoint.SMALL]: 576, + [Breakpoint.MEDIUM]: 768, + [Breakpoint.LARGE]: 992, + [Breakpoint.EXTRA_LARGE]: 1200, }; /** * Screen layouts. */ export enum CoreScreenLayout { - Mobile = 'mobile', - Tablet = 'tablet', + MOBILE = 'mobile', + TABLET = 'tablet', } /** @@ -86,11 +86,11 @@ export class CoreScreenService { } get isMobile(): boolean { - return this.layout === CoreScreenLayout.Mobile; + return this.layout === CoreScreenLayout.MOBILE; } get isTablet(): boolean { - return this.layout === CoreScreenLayout.Tablet; + return this.layout === CoreScreenLayout.TABLET; } /** @@ -131,11 +131,11 @@ export class CoreScreenService { * @return Active layout. */ protected calculateLayout(breakpoints: Record): CoreScreenLayout { - if (breakpoints[Breakpoint.Large]) { - return CoreScreenLayout.Tablet; + if (breakpoints[Breakpoint.LARGE]) { + return CoreScreenLayout.TABLET; } - return CoreScreenLayout.Mobile; + return CoreScreenLayout.MOBILE; } } diff --git a/src/core/services/sites.ts b/src/core/services/sites.ts index 80a940dcb..0c1dd10ce 100644 --- a/src/core/services/sites.ts +++ b/src/core/services/sites.ts @@ -1675,20 +1675,20 @@ export class CoreSitesProvider { */ getReadingStrategyPreSets(strategy?: CoreSitesReadingStrategy): CoreSiteWSPreSets { switch (strategy) { - case CoreSitesReadingStrategy.PreferCache: + case CoreSitesReadingStrategy.PREFER_CACHE: return { omitExpires: true, }; - case CoreSitesReadingStrategy.OnlyCache: + case CoreSitesReadingStrategy.ONLY_CACHE: return { omitExpires: true, forceOffline: true, }; - case CoreSitesReadingStrategy.PreferNetwork: + case CoreSitesReadingStrategy.PREFER_NETWORK: return { getFromCache: false, }; - case CoreSitesReadingStrategy.OnlyNetwork: + case CoreSitesReadingStrategy.ONLY_NETWORK: return { getFromCache: false, emergencyCache: false, @@ -1889,10 +1889,10 @@ export type CoreRegisteredSiteSchema = CoreSiteSchema & { * Possible reading strategies (for cache). */ export const enum CoreSitesReadingStrategy { - OnlyCache, - PreferCache, - OnlyNetwork, - PreferNetwork, + ONLY_CACHE, + PREFER_CACHE, + ONLY_NETWORK, + PREFER_NETWORK, } /**