MOBILE-4469 core: Create new CoreCandidateSite class

main
Dani Palou 2023-11-10 11:54:01 +01:00
parent 954ce48d7b
commit a724a946d2
68 changed files with 1949 additions and 1734 deletions

View File

@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreCourse } from '@features/course/services/course';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { makeSingleton } from '@singletons';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { makeSingleton } from '@singletons';
const ROOT_CACHE_KEY = 'AddonBlockStarredCourses:';

View File

@ -24,7 +24,7 @@ import {
} from '@addons/calendar/services/calendar';
import moment from 'moment-timezone';
import { makeSingleton } from '@singletons';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
// Cache key was maintained from block myoverview when blocks were splitted.
const ROOT_CACHE_KEY = 'myoverview:';

View File

@ -13,7 +13,8 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSite } from '@classes/sites/site';
import { CoreTagItem } from '@features/tag/services/tag';
import { CoreSites } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreNetwork } from '@services/network';
import { CoreTextUtils } from '@services/utils/text';
import { CoreTimeUtils } from '@services/utils/time';
@ -50,6 +50,7 @@ import {
} from '@features/reminders/services/reminders';
import { CoreReminderDBRecord } from '@features/reminders/services/database/reminders';
import { CoreEvents } from '@singletons/events';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaCalendar:';

View File

@ -13,7 +13,8 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCommentsArea } from '@features/comments/services/comments';
import { CoreCourseSummary, CoreCourseModuleSummary } from '@features/course/services/course';
import { CoreUserSummary } from '@features/user/services/user';

View File

@ -17,12 +17,13 @@ import { CoreLogger } from '@singletons/logger';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourses } from '@features/courses/services/courses';
import { CoreSite, CoreSiteWSPreSets, WSObservable } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { asyncObservable, firstValueFrom } from '@/core/utils/rxjs';
import { map } from 'rxjs/operators';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaCourseCompletion:';

View File

@ -13,7 +13,8 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets, CoreSite } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSite } from '@classes/sites/site';
import { CoreEnrolEnrolmentInfo } from '@features/enrol/services/enrol';
import { CoreSites } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';

View File

@ -14,7 +14,8 @@
import { Injectable } from '@angular/core';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSiteWSPreSets, CoreSite } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCoursesProvider } from '@features/courses/services/courses';
import { CoreSites } from '@services/sites';
import { CoreStatusWithWarningsWSResponse } from '@services/ws';

View File

@ -17,7 +17,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, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { makeSingleton, Translate } from '@singletons';
@ -25,6 +25,7 @@ import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaMessageOutputAirnotifier:';

View File

@ -31,7 +31,7 @@ import { CoreConstants } from '@/core/constants';
import { CoreUser } from '@features/user/services/user';
import { CoreError } from '@classes/errors/error';
import { CoreTextErrorObject, CoreTextUtils } from '@services/utils/text';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
/**
* Service to sync messages.

View File

@ -26,13 +26,14 @@ import {
import { CoreUtils } from '@services/utils/utils';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreEvents } from '@singletons/events';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { AddonMessagesSyncEvents, AddonMessagesSyncProvider } from './messages-sync';
import { CoreWSError } from '@classes/errors/wserror';
import { AddonNotificationsPreferencesNotificationProcessorState } from '@addons/notifications/services/notifications';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaMessages:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreInterceptor } from '@classes/interceptor';
import { CoreWSExternalWarning, CoreWSExternalFile, CoreWSFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
@ -35,6 +35,7 @@ import { AddonModAssignAutoSyncData, AddonModAssignManualSyncData, AddonModAssig
import { CoreFormFields } from '@singletons/form';
import { CoreFileHelper } from '@services/file-helper';
import { CoreIonicColorNames } from '@singletons/colors';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModAssign:';

View File

@ -15,7 +15,8 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-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';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -26,6 +26,7 @@ import { CoreTextUtils } from '@services/utils/text';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreFile } from '@services/file';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
/**
* Constants to define how the chapters and subchapters of a book should be displayed in that table of contents.

View File

@ -14,7 +14,8 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-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';

View File

@ -15,7 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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 +26,7 @@ import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWar
import { makeSingleton, Translate } from '@singletons';
import { AddonModChoiceOffline } from './choice-offline';
import { AddonModChoiceAutoSyncData, AddonModChoiceSyncProvider } from './choice-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModChoice:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -29,6 +29,7 @@ import { makeSingleton, Translate } from '@singletons';
import { AddonModDataFieldsDelegate } from './data-fields-delegate';
import { AddonModDataOffline } from './data-offline';
import { AddonModDataAutoSyncData, AddonModDataSyncProvider } from './data-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModData:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -25,6 +25,7 @@ import { CoreWSExternalFile, CoreWSExternalWarning, CoreWSStoredFile } from '@se
import { makeSingleton, Translate } from '@singletons';
import { AddonModFeedbackOffline } from './feedback-offline';
import { AddonModFeedbackAutoSyncData, AddonModFeedbackSyncProvider } from './feedback-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'AddonModFeedback:';

View File

@ -14,7 +14,8 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-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';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -29,6 +29,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning, CoreWSStoredFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonModForumOffline, AddonModForumOfflineDiscussion, AddonModForumReplyOptions } from './forum-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModForum:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
@ -28,6 +28,7 @@ import { makeSingleton, Translate } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { AddonModGlossaryEntryDBRecord, ENTRIES_TABLE_NAME } from './database/glossary';
import { AddonModGlossaryOffline } from './glossary-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
export const GLOSSARY_ENTRY_ADDED = 'addon_mod_glossary_entry_added';
export const GLOSSARY_ENTRY_UPDATED = 'addon_mod_glossary_entry_updated';

View File

@ -17,7 +17,7 @@ import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
import { CoreWSExternalWarning, CoreWSExternalFile, CoreWSFile } from '@services/ws';
import { CoreUtils } from '@services/utils/utils';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreH5P } from '@features/h5p/services/h5p';
import { CoreH5PDisplayOptions } from '@features/h5p/classes/core';
@ -27,6 +27,7 @@ import { CoreWSError } from '@classes/errors/wserror';
import { CoreError } from '@classes/errors/error';
import { AddonModH5PActivityAutoSyncData, AddonModH5PActivitySyncProvider } from './h5pactivity-sync';
import { CoreTime } from '@singletons/time';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
export const MOD_H5PACTIVITY_STATE_ID = 'state';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -26,6 +26,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModImscp:';

View File

@ -14,7 +14,8 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSite } from '@classes/sites/site';
import { CoreFilepool } from '@services/filepool';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreGradesProvider } from '@features/grades/services/grades';
@ -28,6 +28,7 @@ import { CoreEvents } from '@singletons/events';
import { AddonModLessonPasswordDBRecord, PASSWORD_TABLE_NAME } from './database/lesson';
import { AddonModLessonOffline, AddonModLessonPageAttemptRecord } from './lesson-offline';
import { AddonModLessonAutoSyncData, AddonModLessonSyncProvider } from './lesson-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModLesson:';

View File

@ -15,7 +15,8 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreFile } from '@services/file';
import { CorePlatform } from '@services/platform';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSitesCommonWSOptions, CoreSites } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning, CoreWSExternalFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreFilepool } from '@services/filepool';
@ -22,6 +22,7 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModPage:';

View File

@ -17,7 +17,7 @@ import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -40,6 +40,7 @@ import { AddonModQuizAccessRuleDelegate } from './access-rules-delegate';
import { AddonModQuizAttempt } from './quiz-helper';
import { AddonModQuizOffline, AddonModQuizQuestionsWithAnswers } from './quiz-offline';
import { AddonModQuizAutoSyncData, AddonModQuizSyncProvider } from './quiz-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModQuiz:';

View File

@ -14,7 +14,8 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-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';

View File

@ -15,7 +15,7 @@
import { CoreConstants } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -31,6 +31,7 @@ import { CoreEvents } from '@singletons/events';
import { CorePath } from '@singletons/path';
import { AddonModScormOffline } from './scorm-offline';
import { AddonModScormAutoSyncEventData, AddonModScormSyncProvider } from './scorm-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
// Private constants.
const VALID_STATUSES = ['notattempted', 'passed', 'completed', 'failed', 'incomplete', 'browsed', 'suspend'];

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -24,6 +24,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonModSurveyOffline } from './survey-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModSurvey:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning, CoreWSExternalFile } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreConstants } from '@/core/constants';
@ -23,6 +23,7 @@ import { CoreCourse } from '@features/course/services/course';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModUrl:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -28,6 +28,7 @@ import { CoreEvents } from '@singletons/events';
import { AddonModWikiPageDBRecord } from './database/wiki';
import { AddonModWikiOffline } from './wiki-offline';
import { AddonModWikiAutoSyncData, AddonModWikiManualSyncData, AddonModWikiSyncProvider } from './wiki-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModWiki:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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';
@ -28,6 +28,7 @@ import { CoreFormFields } from '@singletons/form';
import { AddonModWorkshopOffline } from './workshop-offline';
import { AddonModWorkshopAutoSyncData, AddonModWorkshopSyncProvider } from './workshop-sync';
import { ADDON_MOD_WORKSHOP_COMPONENT } from '@addons/mod/workshop/constants';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaModWorkshop:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreWSError } from '@classes/errors/wserror';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreUser } from '@features/user/services/user';
import { CoreNetwork } from '@services/network';
import { CoreSites } from '@services/sites';
@ -22,6 +22,7 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { AddonNotesOffline } from './notes-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmaNotes:';

View File

@ -19,11 +19,12 @@ import { CoreWSExternalWarning } from '@services/ws';
import { CoreTextUtils } from '@services/utils/text';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreUser, USER_NOREPLY_USER } from '@features/user/services/user';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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/candidate-site';
declare module '@singletons/events' {

View File

@ -18,7 +18,7 @@ import { Subscription } from 'rxjs';
import { AsyncDirective } from './async-directive';
import { PageLoadsManager } from './page-loads-manager';
import { CorePromisedValue } from './promised-value';
import { WSObservable } from './sites/site';
import { WSObservable } from './sites/candidate-site';
/**
* Class to watch requests from a page load (including requests from page sub-components).

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreNetwork } from '@services/network';
import { CoreSites } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
@ -23,6 +23,7 @@ import { makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { CoreCommentsOffline } from './comments-offline';
import { CoreCommentsSyncAutoSyncData, CoreCommentsSyncProvider } from './comments-sync';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmComments:';

View File

@ -21,7 +21,7 @@ import { CoreLogger } from '@singletons/logger';
import { CoreSitesCommonWSOptions, CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils';
import { CoreSiteWSPreSets, CoreSite, WSObservable } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreConstants } from '@/core/constants';
import { makeSingleton, Translate } from '@singletons';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
@ -55,6 +55,7 @@ import { SQLiteDB } from '@classes/sqlitedb';
import { CorePlatform } from '@services/platform';
import { asyncObservable, firstValueFrom } from '@/core/utils/rxjs';
import { map } from 'rxjs/operators';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmCourse:';

View File

@ -24,7 +24,7 @@ import { CoreTimeUtils } from '@services/utils/time';
import { CoreUtils } from '@services/utils/utils';
import { CoreCourse, CoreCourseAnyModuleData, CoreCourseModuleContentFile } from './course';
import { CoreCache } from '@classes/cache';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreConstants } from '@/core/constants';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { makeSingleton } from '@singletons';

View File

@ -29,7 +29,7 @@ import moment from 'moment-timezone';
import { of } from 'rxjs';
import { firstValueFrom, zipIncludingComplete } from '@/core/utils/rxjs';
import { catchError, map } from 'rxjs/operators';
import { chainRequests, WSObservable } from '@classes/sites/site';
import { chainRequests, WSObservable } from '@classes/sites/candidate-site';
// Id for a course item representing all courses (for example, for course filters).
export const ALL_COURSES_ID = -1;

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets, WSObservable } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { makeSingleton } from '@singletons';
import { CoreWarningsWSResponse, CoreWSExternalFile, CoreWSExternalWarning } from '@services/ws';
import { CoreEvents } from '@singletons/events';
@ -25,6 +25,7 @@ import { map } from 'rxjs/operators';
import { AddonEnrolGuest, AddonEnrolGuestInfo } from '@addons/enrol/guest/services/guest';
import { AddonEnrolSelf } from '@addons/enrol/self/services/self';
import { CoreEnrol, CoreEnrolEnrolmentInfo, CoreEnrolEnrolmentMethod } from '@features/enrol/services/enrol';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmCourses:';

View File

@ -14,13 +14,14 @@
import { Injectable } from '@angular/core';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets, WSObservable } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseBlock } from '@features/course/services/course';
import { CoreStatusWithWarningsWSResponse } from '@services/ws';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { map } from 'rxjs/operators';
import { asyncObservable, firstValueFrom } from '@/core/utils/rxjs';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'CoreCoursesDashboard:';

View File

@ -16,13 +16,14 @@ import { Injectable } from '@angular/core';
import { CoreNetwork } from '@services/network';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreTextUtils } from '@services/utils/text';
import { CoreFilterDelegate } from './filter-delegate';
import { makeSingleton } from '@singletons';
import { CoreEvents, CoreEventSiteData } from '@singletons/events';
import { CoreLogger } from '@singletons/logger';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
/**
* Service to provide filter functionalities.

View File

@ -18,7 +18,7 @@ import { CoreSites } from '@services/sites';
import { makeSingleton } from '@singletons';
import { CoreLogger } from '@singletons/logger';
import { CoreWSExternalWarning } from '@services/ws';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreError } from '@classes/errors/error';
import { SafeNumber } from '@/core/utils/types';

View File

@ -18,7 +18,7 @@ import { CoreSites } from '@services/sites';
import { CoreWSExternalWarning, CoreWSExternalFile, CoreWSFile } from '@services/ws';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreQueueRunner } from '@classes/queue-runner';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreH5PCore } from '../classes/core';
import { CoreH5PFramework } from '../classes/framework';
@ -29,6 +29,7 @@ import { CoreH5PValidator } from '../classes/validator';
import { makeSingleton } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CorePath } from '@singletons/path';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
/**
* Service to provide H5P functionalities.

View File

@ -14,7 +14,7 @@
import { ContextLevel } from '@/core/constants';
import { Injectable } from '@angular/core';
import { CoreSiteWSPreSets, CoreSite } from '@classes/sites/site';
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 +23,7 @@ import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';
import { CoreEvents } from '@singletons/events';
import { CoreRatingOffline } from './rating-offline';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'CoreRating:';

View File

@ -14,7 +14,7 @@
import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSites } from '@services/sites';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton } from '@singletons';

View File

@ -15,13 +15,14 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { makeSingleton } from '@singletons';
import { CoreCourse } from '../../course/services/course';
import { CoreCourses } from '../../courses/services/courses';
import { AddonModForum, AddonModForumData } from '@addons/mod/forum/services/forum';
import { CoreError } from '@classes/errors/error';
import { CoreBlockHelper } from '@features/block/services/block-helper';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
/**
* Items with index 1 and 3 were removed on 2.5 and not being supported in the app.

View File

@ -30,7 +30,7 @@ describe('Site Home link handlers', () => {
mockSingleton(CoreSites, mock({
isStoredRootURL: () => Promise.resolve({ siteIds: [siteId] }),
getSite: () => Promise.resolve(new CoreSite(siteId, siteUrl)),
getSite: () => Promise.resolve(new CoreSite(siteId, siteUrl, '')),
getSiteIdsFromUrl: () => Promise.resolve([siteId]),
}));

View File

@ -15,7 +15,7 @@
import { Input, OnInit, OnDestroy, ElementRef, Output, EventEmitter, Directive } from '@angular/core';
import { Subscription } from 'rxjs';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSitePluginsPluginContentComponent } from '../components/plugin-content/plugin-content';
import { CoreSitePlugins } from '../services/siteplugins';
import { CoreLogger } from '@singletons/logger';

View File

@ -14,7 +14,7 @@
import { Component, OnInit, OnDestroy, Input, ViewChild, HostBinding } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import {
CoreCourseModuleSummaryResult,
CoreCourseModuleSummaryComponent,

View File

@ -27,7 +27,7 @@ import {
import { Subject } from 'rxjs';
import { Md5 } from 'ts-md5';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreCompileHtmlComponent } from '@features/compile/components/compile-html/compile-html';
import { CoreSitePlugins, CoreSitePluginsContent, CoreSitePluginsProvider } from '@features/siteplugins/services/siteplugins';
import { CoreNavigator } from '@services/navigator';

View File

@ -13,7 +13,7 @@
// limitations under the License.
import { Directive, Input, ElementRef, Optional } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils';
import { Md5 } from 'ts-md5';

View File

@ -15,7 +15,7 @@
import { Directive, Input, OnInit, ElementRef, Optional } from '@angular/core';
import { Md5 } from 'ts-md5';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreNavigator } from '@services/navigator';
import { CoreUtils } from '@services/utils/utils';
import { CoreSitePluginsPluginContentComponent } from '../components/plugin-content/plugin-content';

View File

@ -14,7 +14,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins';
import { CanLeave } from '@guards/can-leave';
import { CoreNavigator } from '@services/navigator';

View File

@ -20,7 +20,7 @@ import { AddonModAssignSubmissionDelegate } from '@addons/mod/assign/services/su
import { AddonModQuizAccessRuleDelegate } from '@addons/mod/quiz/services/access-rules-delegate';
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
import { CoreBlockDelegate } from '@features/block/services/block-delegate';
import { CoreCompile } from '@features/compile/services/compile';
import { CoreCourseOptionsDelegate } from '@features/course/services/course-options-delegate';

View File

@ -15,7 +15,7 @@
import { Injectable } from '@angular/core';
import { CoreConstants } from '@/core/constants';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreCourseAnyModuleData } from '@features/course/services/course';
import { CoreCourses } from '@features/courses/services/courses';
import { CoreApp } from '@services/app';
@ -32,6 +32,7 @@ import { CoreSitePluginsModuleHandler } from '../classes/handlers/module-handler
import { CorePromisedValue } from '@classes/promised-value';
import { CorePlatform } from '@services/platform';
import { CoreEnrolAction, CoreEnrolInfoIcon } from '@features/enrol/services/enrol-delegate';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'CoreSitePlugins:';

View File

@ -14,10 +14,11 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreWSExternalWarning } from '@services/ws';
import { makeSingleton, Translate } from '@singletons';
import { CoreError } from '@classes/errors/error';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'CoreTag:';

View File

@ -20,7 +20,7 @@ import { CoreSites } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { CoreUserOffline } from './user-offline';
import { CoreLogger } from '@singletons/logger';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { makeSingleton, Translate } from '@singletons';
import { CoreEvents, CoreEventSiteData, CoreEventUserDeletedData, CoreEventUserSuspendedData } from '@singletons/events';
import { CoreStatusWithWarningsWSResponse, CoreWSExternalWarning } from '@services/ws';
@ -28,6 +28,7 @@ import { CoreError } from '@classes/errors/error';
import { USERS_TABLE_NAME, CoreUserDBRecord } from './database/user';
import { CoreUserHelper } from './user-helper';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
const ROOT_CACHE_KEY = 'mmUser:';

View File

@ -17,13 +17,14 @@ import { Injectable } from '@angular/core';
import { CoreNetwork } from '@services/network';
import { CoreSites, CoreSitesCommonWSOptions } from '@services/sites';
import { CoreUtils } from '@services/utils/utils';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
import { CoreSite } from '@classes/sites/site';
import { CoreXAPIOffline, CoreXAPIOfflineSaveStatementsOptions } from './offline';
import { makeSingleton } from '@singletons';
import { CoreXAPIItemAgent } from '../classes/item-agent';
import { CoreXAPIIRI } from '../classes/iri';
import { CoreError } from '@classes/errors/error';
import { CoreLogger } from '@singletons/logger';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
export const XAPI_STATE_DELETED = 'STATE_DELETED';

View File

@ -15,11 +15,12 @@
import { Injectable } from '@angular/core';
import { CoreSites } from '@services/sites';
import { CoreSite, CoreSiteWSPreSets } from '@classes/sites/site';
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/candidate-site';
const ROOT_CACHE_KEY = 'mmGroups:';

View File

@ -13,6 +13,7 @@
// limitations under the License.
import { Injectable } from '@angular/core';
import { CoreCandidateSite } from '@classes/sites/candidate-site';
import { CoreSite, CoreSiteConfig } from '@classes/sites/site';
import { CoreUnauthenticatedSite, CoreSiteInfo } from '@classes/sites/unauthenticated-site';
@ -37,9 +38,9 @@ export class CoreSitesFactoryService {
* @returns Site instance.
*/
makeSite(
id: string | undefined,
id: string,
siteUrl: string,
token?: string,
token: string,
info?: CoreSiteInfo,
privateToken?: string,
config?: CoreSiteConfig,
@ -48,6 +49,18 @@ export class CoreSitesFactoryService {
return new CoreSite(id, siteUrl, token, info, privateToken, config, loggedOut);
}
/**
* Create a candidate site instance.
*
* @param siteUrl Site URL.
* @param token Site's WS token.
* @param privateToken Private token.
* @returns Candidate site instance.
*/
makeCandidateSite(siteUrl: string, token: string, privateToken?: string): CoreCandidateSite {
return new CoreCandidateSite(siteUrl, token, privateToken);
}
/**
* Create an unauthenticated site instance.
*

View File

@ -26,7 +26,6 @@ import { CoreUtils } from '@services/utils/utils';
import { CoreConstants } from '@/core/constants';
import {
CoreSite,
CoreSiteWSPreSets,
CoreSiteConfig,
} from '@classes/sites/site';
import { SQLiteDB, SQLiteDBRecordValues, SQLiteDBTableSchema } from '@classes/sqlitedb';
@ -65,6 +64,7 @@ import { CoreContentLinksHelper } from '@features/contentlinks/services/contentl
import { CoreAutoLogoutType, CoreAutoLogout } from '@features/autologout/services/autologout';
import { CoreCacheManager } from '@services/cache-manager';
import { CoreSiteInfo, CoreSiteInfoResponse, CoreSitePublicConfigResponse } from '@classes/sites/unauthenticated-site';
import { CoreSiteWSPreSets } from '@classes/sites/candidate-site';
export const CORE_SITE_SCHEMAS = new InjectionToken<CoreSiteSchema[]>('CORE_SITE_SCHEMAS');
export const CORE_SITE_CURRENT_SITE_ID_CONFIG = 'current_site_id';
@ -515,7 +515,7 @@ export class CoreSitesProvider {
}
// Create a "candidate" site to fetch the site info.
let candidateSite = CoreSitesFactory.makeSite(undefined, siteUrl, token, undefined, privateToken);
const candidateSite = CoreSitesFactory.makeCandidateSite(siteUrl, token, privateToken);
let isNewSite = true;
try {
@ -529,33 +529,33 @@ export class CoreSitesProvider {
const siteId = this.createSiteID(info.siteurl, info.username);
// Check if the site already exists.
const site = await CoreUtils.ignoreErrors<CoreSite>(this.getSite(siteId));
const storedSite = await CoreUtils.ignoreErrors(this.getSite(siteId));
let site: CoreSite;
if (site) {
// Site already exists, update its data and use it.
if (storedSite) {
// Site already exists.
isNewSite = false;
candidateSite = site;
candidateSite.setToken(token);
candidateSite.setPrivateToken(privateToken);
candidateSite.setInfo(info);
candidateSite.setOAuthId(oauthId);
candidateSite.setLoggedOut(false);
site = storedSite;
site.setToken(token);
site.setPrivateToken(privateToken);
site.setInfo(info);
site.setOAuthId(oauthId);
site.setLoggedOut(false);
} else {
// New site, set site ID and info.
isNewSite = true;
candidateSite.setId(siteId);
candidateSite.setInfo(info);
candidateSite.setOAuthId(oauthId);
site = CoreSitesFactory.makeSite(siteId, siteUrl, token, info, privateToken);
site.setOAuthId(oauthId);
// Create database tables before login and before any WS call.
await this.migrateSiteSchemas(candidateSite);
await this.migrateSiteSchemas(site);
}
// Try to get the site config.
let config: CoreSiteConfig | undefined;
try {
config = await this.getSiteConfig(candidateSite);
config = await this.getSiteConfig(site);
} catch (error) {
// Ignore errors if it's not a new site, we'll use the config already stored.
if (isNewSite) {
@ -564,16 +564,16 @@ export class CoreSitesProvider {
}
if (config !== undefined) {
candidateSite.setConfig(config);
site.setConfig(config);
}
// Add site to sites list.
await this.addSite(siteId, siteUrl, token, info, privateToken, config, oauthId);
this.sites[siteId] = candidateSite;
this.sites[siteId] = site;
if (login) {
// Turn candidate site into current site.
this.currentSite = candidateSite;
this.currentSite = site;
// Store session.
await this.login(siteId);
} else if (this.currentSite && this.currentSite.getId() == siteId) {
@ -2065,7 +2065,7 @@ export class CoreSitesProvider {
await Promise.all(
sites
.map(site => CoreSitesFactory.makeSite(site.id, site.siteUrl))
.map(site => CoreSitesFactory.makeSite(site.id, site.siteUrl, ''))
.map(site => site.invalidateCaches()),
);
}

View File

@ -12,7 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import { CoreSite, CoreSiteConfigResponse, CoreSiteWSPreSets, WSObservable } from '@classes/sites/site';
import { CoreSiteWSPreSets, WSObservable } from '@classes/sites/candidate-site';
import { CoreSite, CoreSiteConfigResponse } from '@classes/sites/site';
import { CoreSiteInfo } from '@classes/sites/unauthenticated-site';
import { of } from 'rxjs';
@ -26,7 +27,7 @@ export class CoreSiteStub extends CoreSite {
protected wsStubs: Record<string, unknown> = {};
constructor (fixture: CoreSiteFixture) {
super(fixture.id, fixture.info.siteurl, undefined, fixture.info);
super(fixture.id, fixture.info.siteurl, '', fixture.info);
this.stubWSResponse<CoreSiteConfigResponse>('tool_mobile_get_config', {
settings: [],