commit
530ac1a109
|
@ -24,12 +24,20 @@ jobs:
|
||||||
git clone --branch MOBILE-3738 --depth 1 git://github.com/NoelDeMartin/moodle-docker $GITHUB_WORKSPACE/moodle-docker
|
git clone --branch MOBILE-3738 --depth 1 git://github.com/NoelDeMartin/moodle-docker $GITHUB_WORKSPACE/moodle-docker
|
||||||
- name: Setup docker machine
|
- name: Setup docker machine
|
||||||
run: |
|
run: |
|
||||||
|
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
|
||||||
|
export MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE
|
||||||
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
|
cp $GITHUB_WORKSPACE/moodle-docker/config.docker-template.php $GITHUB_WORKSPACE/moodle/config.php
|
||||||
MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose pull
|
||||||
MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose up -d
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose up -d
|
||||||
MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-db
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-db
|
||||||
MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-app
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-wait-for-app
|
||||||
- name: Init behat
|
- name: Init behat
|
||||||
run: MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/init.php"
|
run: |
|
||||||
|
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
|
||||||
|
export MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE
|
||||||
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/init.php"
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE $GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/run.php --tags="@app" --auto-rerun"
|
run: |
|
||||||
|
export MOODLE_DOCKER_WWWROOT=$GITHUB_WORKSPACE/moodle
|
||||||
|
export MOODLE_DOCKER_APP_PATH=$GITHUB_WORKSPACE
|
||||||
|
$GITHUB_WORKSPACE/moodle-docker/bin/moodle-docker-compose exec -T webserver sh -c "php admin/tool/behat/cli/run.php --tags="@app" --auto-rerun"
|
||||||
|
|
|
@ -37,16 +37,18 @@ import { IonRefresher } from '@ionic/angular';
|
||||||
})
|
})
|
||||||
export class AddonMessagesContactsPage implements OnInit, OnDestroy {
|
export class AddonMessagesContactsPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
selected = 'confirmed';
|
selected: 'confirmed' | 'requests' = 'confirmed';
|
||||||
requestsBadge = '';
|
requestsBadge = '';
|
||||||
selectedUserId?: number; // User id of the conversation opened in the split view.
|
selectedUserId?: number; // User id of the conversation opened in the split view.
|
||||||
|
|
||||||
confirmedLoaded = false;
|
confirmedLoaded = false;
|
||||||
|
confirmedInitialising = false;
|
||||||
confirmedCanLoadMore = false;
|
confirmedCanLoadMore = false;
|
||||||
confirmedLoadMoreError = false;
|
confirmedLoadMoreError = false;
|
||||||
confirmedContacts: AddonMessagesConversationMember[] = [];
|
confirmedContacts: AddonMessagesConversationMember[] = [];
|
||||||
|
|
||||||
requestsLoaded = false;
|
requestsLoaded = false;
|
||||||
|
requestsInitialising = false;
|
||||||
requestsCanLoadMore = false;
|
requestsCanLoadMore = false;
|
||||||
requestsLoadMoreError = false;
|
requestsLoadMoreError = false;
|
||||||
requests: AddonMessagesConversationMember[] = [];
|
requests: AddonMessagesConversationMember[] = [];
|
||||||
|
@ -83,7 +85,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy {
|
||||||
this.confirmedContacts.splice(index, 1);
|
this.confirmedContacts.splice(index, 1);
|
||||||
}
|
}
|
||||||
} else if (data.contactRequestConfirmed) {
|
} else if (data.contactRequestConfirmed) {
|
||||||
this.refreshData();
|
this.confirmedFetchData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contactRequestConfirmed || data.contactRequestDeclined) {
|
if (data.contactRequestConfirmed || data.contactRequestDeclined) {
|
||||||
|
@ -104,25 +106,52 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy {
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
AddonMessages.getContactRequestsCount(this.siteId); // Badge already updated by the observer.
|
AddonMessages.getContactRequestsCount(this.siteId); // Badge already updated by the observer.
|
||||||
|
|
||||||
if (this.selected == 'confirmed') {
|
this.selected === 'confirmed'
|
||||||
try {
|
? await this.initConfirmed()
|
||||||
|
: await this.initRequests();
|
||||||
|
}
|
||||||
|
|
||||||
await this.confirmedFetchData();
|
/**
|
||||||
if (this.confirmedContacts.length && CoreScreen.isTablet) {
|
* Initialise confirmed contacts.
|
||||||
this.selectUser(this.confirmedContacts[0].id, true);
|
*/
|
||||||
}
|
async initConfirmed(): Promise<void> {
|
||||||
} finally {
|
if (this.confirmedInitialising) {
|
||||||
this.confirmedLoaded = true;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.confirmedInitialising = true;
|
||||||
|
|
||||||
|
await this.confirmedFetchData();
|
||||||
|
|
||||||
|
if (this.confirmedContacts.length && CoreScreen.isTablet) {
|
||||||
|
this.selectUser(this.confirmedContacts[0].id, true);
|
||||||
}
|
}
|
||||||
} else {
|
} finally {
|
||||||
try {
|
this.confirmedInitialising = false;
|
||||||
await this.requestsFetchData();
|
this.confirmedLoaded = true;
|
||||||
if (this.requests.length && CoreScreen.isTablet) {
|
}
|
||||||
this.selectUser(this.requests[0].id, true);
|
}
|
||||||
}
|
|
||||||
} finally {
|
/**
|
||||||
this.requestsLoaded = true;
|
* Initialise contact requests.
|
||||||
|
*/
|
||||||
|
async initRequests(): Promise<void> {
|
||||||
|
if (this.requestsInitialising) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.requestsInitialising = true;
|
||||||
|
|
||||||
|
await this.requestsFetchData();
|
||||||
|
|
||||||
|
if (this.requests.length && CoreScreen.isTablet) {
|
||||||
|
this.selectUser(this.requests[0].id, true);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
this.requestsInitialising = false;
|
||||||
|
this.requestsLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,10 +257,18 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
selectTab(selected: string): void {
|
selectTab(selected: string): void {
|
||||||
|
if (selected !== 'confirmed' && selected !== 'requests') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.selected = selected;
|
this.selected = selected;
|
||||||
|
|
||||||
if ((this.selected == 'confirmed' && !this.confirmedLoaded) || (this.selected != 'confirmed' && !this.requestsLoaded)) {
|
if (this.selected == 'confirmed' && !this.confirmedLoaded) {
|
||||||
this.ngOnInit();
|
this.initConfirmed();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.selected == 'requests' && !this.requestsLoaded) {
|
||||||
|
this.initRequests();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
|
||||||
this.conversationImage = this.otherMember.profileimageurl;
|
this.conversationImage = this.otherMember.profileimageurl;
|
||||||
this.title = this.otherMember.fullname;
|
this.title = this.otherMember.fullname;
|
||||||
}
|
}
|
||||||
this.blockIcon = this.otherMember.isblocked ? 'fas-user-lock' : 'fas-user-check';
|
this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}));
|
}));
|
||||||
|
@ -317,7 +317,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
|
||||||
};
|
};
|
||||||
this.otherMember.isblocked = await AddonMessages.isBlocked(this.userId!);
|
this.otherMember.isblocked = await AddonMessages.isBlocked(this.userId!);
|
||||||
this.otherMember.iscontact = await AddonMessages.isContact(this.userId!);
|
this.otherMember.iscontact = await AddonMessages.isContact(this.userId!);
|
||||||
this.blockIcon = this.otherMember.isblocked ? 'fas-user-lock' : 'fas-user-check';
|
this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}));
|
}));
|
||||||
|
@ -1466,7 +1466,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
|
CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
|
||||||
} finally {
|
} finally {
|
||||||
this.blockIcon = this.otherMember.isblocked ? 'fas-user-lock' : 'fas-user-check';
|
this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock';
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// User cancelled.
|
// User cancelled.
|
||||||
|
@ -1548,7 +1548,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
|
CoreDomUtils.showErrorModalDefault(error, 'core.error', true);
|
||||||
} finally {
|
} finally {
|
||||||
this.blockIcon = this.otherMember.isblocked ? 'fas-user-lock' : 'fas-user-check';
|
this.blockIcon = this.otherMember.isblocked ? 'fas-user-check' : 'fas-user-lock';
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// User cancelled.
|
// User cancelled.
|
||||||
|
|
|
@ -138,7 +138,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
||||||
isBlind: this.isBlind,
|
isBlind: this.isBlind,
|
||||||
cmId: this.assign.cmid,
|
cmId: this.assign.cmid,
|
||||||
filter: false,
|
filter: false,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
};
|
};
|
||||||
|
|
||||||
let submissionStatus: AddonModAssignGetSubmissionStatusWSResponse;
|
let submissionStatus: AddonModAssignGetSubmissionStatusWSResponse;
|
||||||
|
@ -149,7 +149,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Cannot connect. Get cached data.
|
// Cannot connect. Get cached data.
|
||||||
options.filter = true;
|
options.filter = true;
|
||||||
options.readingStrategy = CoreSitesReadingStrategy.PreferCache;
|
options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE;
|
||||||
|
|
||||||
submissionStatus = await AddonModAssign.getSubmissionStatus(this.assign.id, options);
|
submissionStatus = await AddonModAssign.getSubmissionStatus(this.assign.id, options);
|
||||||
this.userSubmission =
|
this.userSubmission =
|
||||||
|
|
|
@ -313,7 +313,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
||||||
const options: AddonModAssignSubmissionStatusOptions = {
|
const options: AddonModAssignSubmissionStatusOptions = {
|
||||||
userId,
|
userId,
|
||||||
cmId: assign.cmid,
|
cmId: assign.cmid,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid
|
||||||
const options: AddonModAssignSubmissionStatusOptions = {
|
const options: AddonModAssignSubmissionStatusOptions = {
|
||||||
userId,
|
userId,
|
||||||
cmId: assign.cmid,
|
cmId: assign.cmid,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -576,7 +576,7 @@ export class AddonModAssignProvider {
|
||||||
// Try again, ignoring cache.
|
// Try again, ignoring cache.
|
||||||
const newOptions = {
|
const newOptions = {
|
||||||
...options,
|
...options,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -234,7 +234,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
const siteId = CoreSites.getCurrentSiteId();
|
const siteId = CoreSites.getCurrentSiteId();
|
||||||
|
|
||||||
const options: CoreSitesCommonWSOptions = {
|
const options: CoreSitesCommonWSOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const modOptions: CoreCourseCommonModWSOptions = {
|
const modOptions: CoreCourseCommonModWSOptions = {
|
||||||
cmId: moduleId,
|
cmId: moduleId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
moduleId,
|
moduleId,
|
||||||
{
|
{
|
||||||
userId,
|
userId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
@ -334,7 +334,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|
||||||
const options: CoreSitesCommonWSOptions = {
|
const options: CoreSitesCommonWSOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
userId: submission.submitid,
|
userId: submission.submitid,
|
||||||
groupId: group.id,
|
groupId: group.id,
|
||||||
isBlind: !!submission.blindid,
|
isBlind: !!submission.blindid,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
const submissionOptions = {
|
const submissionOptions = {
|
||||||
userId,
|
userId,
|
||||||
groupId: group.id,
|
groupId: group.id,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ export class AddonModChatProvider {
|
||||||
*/
|
*/
|
||||||
async getChatUsers(sessionId: string, options: CoreCourseCommonModWSOptions = {}): Promise<AddonModChatGetChatUsersWSResponse> {
|
async getChatUsers(sessionId: string, options: CoreCourseCommonModWSOptions = {}): Promise<AddonModChatGetChatUsersWSResponse> {
|
||||||
// By default, always try to get the latest data.
|
// 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);
|
const site = await CoreSites.getSite(options.siteId);
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
protected async prefetchChat(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
protected async prefetchChat(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||||
const siteId = CoreSites.getCurrentSiteId();
|
const siteId = CoreSites.getCurrentSiteId();
|
||||||
const options = {
|
const options = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref
|
||||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||||
|
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
|
|
@ -157,9 +157,9 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginCo
|
||||||
protected getGeolocationErrorMessage(error: CoreGeolocationError): string {
|
protected getGeolocationErrorMessage(error: CoreGeolocationError): string {
|
||||||
// tslint:disable-next-line: switch-default
|
// tslint:disable-next-line: switch-default
|
||||||
switch (error.reason) {
|
switch (error.reason) {
|
||||||
case CoreGeolocationErrorReason.PermissionDenied:
|
case CoreGeolocationErrorReason.PERMISSION_DENIED:
|
||||||
return 'addon.mod_data.locationpermissiondenied';
|
return 'addon.mod_data.locationpermissiondenied';
|
||||||
case CoreGeolocationErrorReason.LocationNotEnabled:
|
case CoreGeolocationErrorReason.LOCATION_NOT_ENABLED:
|
||||||
return 'addon.mod_data.locationnotenabled';
|
return 'addon.mod_data.locationnotenabled';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider
|
||||||
|
|
||||||
const options: CoreCourseCommonModWSOptions = {
|
const options: CoreCourseCommonModWSOptions = {
|
||||||
cmId: database.coursemodule,
|
cmId: database.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1003,7 +1003,7 @@ export class AddonModDataProvider {
|
||||||
options.order || options.order || 'DESC';
|
options.order || options.order || 'DESC';
|
||||||
options.page = options.page || 0;
|
options.page = options.page || 0;
|
||||||
options.perPage = options.perPage || AddonModDataProvider.PER_PAGE;
|
options.perPage = options.perPage || AddonModDataProvider.PER_PAGE;
|
||||||
options.readingStrategy = options.readingStrategy || CoreSitesReadingStrategy.PreferNetwork;
|
options.readingStrategy = options.readingStrategy || CoreSitesReadingStrategy.PREFER_NETWORK;
|
||||||
|
|
||||||
const params: AddonModDataSearchEntriesWSParams = {
|
const params: AddonModDataSearchEntriesWSParams = {
|
||||||
databaseid: dataId,
|
databaseid: dataId,
|
||||||
|
|
|
@ -182,7 +182,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
*/
|
*/
|
||||||
async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise<boolean> {
|
async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise<boolean> {
|
||||||
const database = await AddonModData.getDatabase(courseId, module.id, {
|
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 });
|
const accessData = await AddonModData.getDatabaseAccessInformation(database.id, { cmId: module.id });
|
||||||
|
@ -229,7 +229,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
cmId: module.id,
|
cmId: module.id,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
||||||
this.offline = !CoreApp.isOnline();
|
this.offline = !CoreApp.isOnline();
|
||||||
const options = {
|
const options = {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId: this.currentSite.getId(),
|
siteId: this.currentSite.getId(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
||||||
|
|
||||||
// If it fails, go offline.
|
// If it fails, go offline.
|
||||||
this.offline = true;
|
this.offline = true;
|
||||||
options.readingStrategy = CoreSitesReadingStrategy.PreferCache;
|
options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE;
|
||||||
|
|
||||||
this.access = await AddonModFeedback.getFeedbackAccessInformation(this.feedback!.id, options);
|
this.access = await AddonModFeedback.getFeedbackAccessInformation(this.feedback!.id, options);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
||||||
|
|
||||||
// Go offline.
|
// Go offline.
|
||||||
this.offline = true;
|
this.offline = true;
|
||||||
options.readingStrategy = CoreSitesReadingStrategy.PreferCache;
|
options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE;
|
||||||
|
|
||||||
return AddonModFeedback.getResumePage(this.feedback!.id, options);
|
return AddonModFeedback.getResumePage(this.feedback!.id, options);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
||||||
protected async fetchPageItems(page: number): Promise<AddonModFeedbackPageItems> {
|
protected async fetchPageItems(page: number): Promise<AddonModFeedbackPageItems> {
|
||||||
const options = {
|
const options = {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId: this.currentSite.getId(),
|
siteId: this.currentSite.getId(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
||||||
|
|
||||||
// Go offline.
|
// Go offline.
|
||||||
this.offline = true;
|
this.offline = true;
|
||||||
options.readingStrategy = CoreSitesReadingStrategy.PreferCache;
|
options.readingStrategy = CoreSitesReadingStrategy.PREFER_CACHE;
|
||||||
|
|
||||||
response = await AddonModFeedback.getPageItemsWithValues(this.feedback!.id, page, options);
|
response = await AddonModFeedback.getPageItemsWithValues(this.feedback!.id, page, options);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave {
|
||||||
|
|
||||||
await this.fetchAccessData({
|
await this.fetchAccessData({
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId: this.currentSite.getId(),
|
siteId: this.currentSite.getId(),
|
||||||
});
|
});
|
||||||
} else if (typeof response.jumpto != 'number' || response.jumpto == this.currentPage) {
|
} else if (typeof response.jumpto != 'number' || response.jumpto == this.currentPage) {
|
||||||
|
|
|
@ -190,7 +190,7 @@ export class AddonModFeedbackHelperProvider {
|
||||||
|
|
||||||
const attempt = await AddonModFeedback.getAttempt(module.instance, Number(params.showcompleted), {
|
const attempt = await AddonModFeedback.getAttempt(module.instance, Number(params.showcompleted), {
|
||||||
cmId: module.id,
|
cmId: module.id,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
|
||||||
}
|
}
|
||||||
|
|
||||||
const timemodified = await AddonModFeedback.getCurrentCompletedTimeModified(feedbackId, {
|
const timemodified = await AddonModFeedback.getCurrentCompletedTimeModified(feedbackId, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
// Sort by page.
|
// Sort by page.
|
||||||
|
|
|
@ -823,7 +823,7 @@ export class AddonModFeedbackProvider {
|
||||||
|
|
||||||
const response = await this.getPageItemsWithValues(feedbackId, page, {
|
const response = await this.getPageItemsWithValues(feedbackId, page, {
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1173,7 +1173,7 @@ export class AddonModFeedbackProvider {
|
||||||
|
|
||||||
const pageItems = await this.getPageItemsWithValues(feedbackId, page, {
|
const pageItems = await this.getPageItemsWithValues(feedbackId, page, {
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr
|
||||||
*/
|
*/
|
||||||
async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise<boolean> {
|
async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise<boolean> {
|
||||||
const feedback = await AddonModFeedback.getFeedback(courseId, module.id, {
|
const feedback = await AddonModFeedback.getFeedback(courseId, module.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
});
|
});
|
||||||
|
|
||||||
const now = CoreTimeUtils.timestamp();
|
const now = CoreTimeUtils.timestamp();
|
||||||
|
@ -136,7 +136,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr
|
||||||
protected async prefetchFeedback(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
protected async prefetchFeedback(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||||
const siteId = CoreSites.getCurrentSiteId();
|
const siteId = CoreSites.getCurrentSiteId();
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
|
|
@ -75,7 +75,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit, OnDestroy
|
||||||
this.post =
|
this.post =
|
||||||
await AddonModForum.getDiscussionPost(this.forumId, this.post.discussionid, this.post.id, {
|
await AddonModForum.getDiscussionPost(this.forumId, this.post.discussionid, this.post.id, {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreDomUtils.showErrorModalDefault(error, 'Error getting discussion post.');
|
CoreDomUtils.showErrorModalDefault(error, 'Error getting discussion post.');
|
||||||
|
|
|
@ -778,7 +778,7 @@ export class AddonModForumProvider {
|
||||||
sortby: 'timemodified',
|
sortby: 'timemodified',
|
||||||
sortdirection: 'DESC',
|
sortdirection: 'DESC',
|
||||||
};
|
};
|
||||||
Object.assign(preSets, CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.PreferCache));
|
Object.assign(preSets, CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.PREFER_CACHE));
|
||||||
|
|
||||||
response = await site.read<AddonModForumGetForumDiscussionsPaginatedWSResponse>(
|
response = await site.read<AddonModForumGetForumDiscussionsPaginatedWSResponse>(
|
||||||
'mod_forum_get_forum_discussions_paginated',
|
'mod_forum_get_forum_discussions_paginated',
|
||||||
|
@ -889,7 +889,7 @@ export class AddonModForumProvider {
|
||||||
.getDiscussionsInPages(forum.id, {
|
.getDiscussionsInPages(forum.id, {
|
||||||
cmId: forum.cmid,
|
cmId: forum.cmid,
|
||||||
sortOrder: sortOrder.value,
|
sortOrder: sortOrder.value,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
// Now invalidate the WS calls.
|
// Now invalidate the WS calls.
|
||||||
|
|
|
@ -199,7 +199,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
|
||||||
siteId: string,
|
siteId: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
|
|
@ -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.
|
// 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', {
|
const result = await this.getEntriesByLetter(glossaryId, 'ALL', {
|
||||||
from: from,
|
from: from,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyCache,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_CACHE,
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
@ -763,7 +763,7 @@ export class AddonModGlossaryProvider {
|
||||||
if (!onlyEntriesList) {
|
if (!onlyEntriesList) {
|
||||||
promises.push(this.fetchAllEntries(this.getEntriesByLetter.bind(this, glossary.id, 'ALL'), {
|
promises.push(this.fetchAllEntries(this.getEntriesByLetter.bind(this, glossary.id, 'ALL'), {
|
||||||
cmId: glossary.coursemodule,
|
cmId: glossary.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
}).then((entries) => this.invalidateEntries(entries, siteId)));
|
}).then((entries) => this.invalidateEntries(entries, siteId)));
|
||||||
}
|
}
|
||||||
|
@ -995,7 +995,7 @@ export class AddonModGlossaryProvider {
|
||||||
// Get entries from the cache.
|
// Get entries from the cache.
|
||||||
const entries = await this.fetchAllEntries(this.getEntriesByLetter.bind(glossaryId, 'ALL'), {
|
const entries = await this.fetchAllEntries(this.getEntriesByLetter.bind(glossaryId, 'ALL'), {
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
cmId: module.id,
|
cmId: module.id,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ export class AddonModH5PActivityProvider {
|
||||||
// Check if the full list of results is cached. If so, get the results from there.
|
// Check if the full list of results is cached. If so, get the results from there.
|
||||||
const cacheOptions: AddonModH5PActivityGetAttemptResultsOptions = {
|
const cacheOptions: AddonModH5PActivityGetAttemptResultsOptions = {
|
||||||
...options, // Include all the original options.
|
...options, // Include all the original options.
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyCache,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_CACHE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const attemptsResults = await AddonModH5PActivity.getAllAttemptsResults(id, cacheOptions);
|
const attemptsResults = await AddonModH5PActivity.getAllAttemptsResults(id, cacheOptions);
|
||||||
|
|
|
@ -96,7 +96,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit
|
||||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||||
|
|
||||||
const h5pActivity = await AddonModH5PActivity.getH5PActivity(courseId, module.id, {
|
const h5pActivity = await AddonModH5PActivity.getH5PActivity(courseId, module.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit
|
||||||
|
|
||||||
const accessInfo = await AddonModH5PActivity.getAccessInformation(h5pActivity.id, {
|
const accessInfo = await AddonModH5PActivity.getAccessInformation(h5pActivity.id, {
|
||||||
cmId: h5pActivity.coursemodule,
|
cmId: h5pActivity.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
cmId: h5pActivity.coursemodule,
|
cmId: h5pActivity.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId: siteId,
|
siteId: siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class AddonModImscpPrefetchHandlerService extends CoreCourseResourcePrefe
|
||||||
|
|
||||||
promises.push(super.downloadOrPrefetch(module, courseId, prefetch, dirPath));
|
promises.push(super.downloadOrPrefetch(module, courseId, prefetch, dirPath));
|
||||||
promises.push(AddonModImscp.getImscp(courseId, module.id, {
|
promises.push(AddonModImscp.getImscp(courseId, module.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class AddonModLabelPrefetchHandlerService extends CoreCourseResourcePrefe
|
||||||
|
|
||||||
if (AddonModLabel.isGetLabelAvailableForSite()) {
|
if (AddonModLabel.isGetLabelAvailableForSite()) {
|
||||||
label = await AddonModLabel.getLabel(courseId, module.id, {
|
label = await AddonModLabel.getLabel(courseId, module.id, {
|
||||||
readingStrategy: ignoreCache ? CoreSitesReadingStrategy.OnlyNetwork : undefined,
|
readingStrategy: ignoreCache ? CoreSitesReadingStrategy.ONLY_NETWORK : undefined,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,11 +215,11 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
// Get the possible jumps now.
|
// Get the possible jumps now.
|
||||||
this.jumps = await AddonModLesson.getPagesPossibleJumps(this.lesson!.id, {
|
this.jumps = await AddonModLesson.getPagesPossibleJumps(this.lesson!.id, {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Call the function again with offline mode and the new jumps.
|
// 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.jumps = this.jumps;
|
||||||
options.offline = true;
|
options.offline = true;
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
};
|
};
|
||||||
this.accessInfo = await this.callFunction<AddonModLessonGetAccessInformationWSResponse>(
|
this.accessInfo = await this.callFunction<AddonModLessonGetAccessInformationWSResponse>(
|
||||||
AddonModLesson.getAccessInformation.bind(AddonModLesson.instance, this.lesson.id, options),
|
AddonModLesson.getAccessInformation.bind(AddonModLesson.instance, this.lesson.id, options),
|
||||||
|
@ -311,7 +311,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
const options = {
|
const options = {
|
||||||
password: this.password,
|
password: this.password,
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
};
|
};
|
||||||
promises.push(this.callFunction<AddonModLessonLessonWSData>(
|
promises.push(this.callFunction<AddonModLessonLessonWSData>(
|
||||||
AddonModLesson.getLessonWithPassword.bind(AddonModLesson.instance, this.lesson.id, options),
|
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.
|
// Offline mode, get the list of possible jumps to allow navigation.
|
||||||
promises.push(AddonModLesson.getPagesPossibleJumps(this.lesson.id, {
|
promises.push(AddonModLesson.getPagesPossibleJumps(this.lesson.id, {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
}).then((jumpList) => {
|
}).then((jumpList) => {
|
||||||
this.jumps = jumpList;
|
this.jumps = jumpList;
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
// Get the last lesson timer.
|
// Get the last lesson timer.
|
||||||
const timers = await AddonModLesson.getTimers(this.lesson!.id, {
|
const timers = await AddonModLesson.getTimers(this.lesson!.id, {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.endTime = timers[timers.length - 1].starttime + this.lesson!.timelimit;
|
this.endTime = timers[timers.length - 1].starttime + this.lesson!.timelimit;
|
||||||
|
@ -515,7 +515,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
const options = {
|
const options = {
|
||||||
password: this.password,
|
password: this.password,
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
};
|
};
|
||||||
|
|
||||||
const pages = await this.callFunction<AddonModLessonGetPagesPageWSData[]>(
|
const pages = await this.callFunction<AddonModLessonGetPagesPageWSData[]>(
|
||||||
|
@ -548,7 +548,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
review: this.review,
|
review: this.review,
|
||||||
includeContents: true,
|
includeContents: true,
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
accessInfo: this.accessInfo,
|
accessInfo: this.accessInfo,
|
||||||
jumps: this.jumps,
|
jumps: this.jumps,
|
||||||
includeOfflineData: true,
|
includeOfflineData: true,
|
||||||
|
@ -643,7 +643,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
const retake = this.accessInfo!.attemptscount;
|
const retake = this.accessInfo!.attemptscount;
|
||||||
const options = {
|
const options = {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Update in background the list of content pages viewed or question attempts.
|
// Update in background the list of content pages viewed or question attempts.
|
||||||
|
|
|
@ -81,7 +81,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
|
|
||||||
// Get the lesson password if it's needed.
|
// Get the lesson password if it's needed.
|
||||||
const passwordData = await this.getLessonPassword(lesson.id, {
|
const passwordData = await this.getLessonPassword(lesson.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
askPassword: single,
|
askPassword: single,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
@ -188,7 +188,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
const siteId = CoreSites.getCurrentSiteId();
|
const siteId = CoreSites.getCurrentSiteId();
|
||||||
|
|
||||||
const lesson = await AddonModLesson.getLesson(courseId, module.id, {
|
const lesson = await AddonModLesson.getLesson(courseId, module.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
courseId = courseId || module.course || CoreSites.getCurrentSiteHomeId();
|
courseId = courseId || module.course || CoreSites.getCurrentSiteHomeId();
|
||||||
|
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
@ -269,7 +269,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
|
|
||||||
// Get the lesson password if it's needed.
|
// Get the lesson password if it's needed.
|
||||||
const passwordData = await this.getLessonPassword(lesson.id, {
|
const passwordData = await this.getLessonPassword(lesson.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
askPassword: single,
|
askPassword: single,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
|
@ -287,7 +287,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
||||||
const lesson = await AddonModLesson.getLessonById(result.courseId, lessonId, { siteId });
|
const lesson = await AddonModLesson.getLessonById(result.courseId, lessonId, { siteId });
|
||||||
|
|
||||||
const passwordData = await AddonModLessonPrefetchHandler.getLessonPassword(lessonId, {
|
const passwordData = await AddonModLessonPrefetchHandler.getLessonPassword(lessonId, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
askPassword,
|
askPassword,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
@ -431,7 +431,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
|
||||||
// Retrieve the needed data.
|
// Retrieve the needed data.
|
||||||
const lesson = await AddonModLesson.getLessonById(result.courseId!, lessonId, { siteId });
|
const lesson = await AddonModLesson.getLessonById(result.courseId!, lessonId, { siteId });
|
||||||
passwordData = await AddonModLessonPrefetchHandler.getLessonPassword(lessonId, {
|
passwordData = await AddonModLessonPrefetchHandler.getLessonPassword(lessonId, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
askPassword,
|
askPassword,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
|
@ -292,7 +292,7 @@ export class AddonModLessonProvider {
|
||||||
const pages = await this.getPages(lessonId, {
|
const pages = await this.getPages(lessonId, {
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
password: options.password,
|
password: options.password,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1600,7 +1600,7 @@ export class AddonModLessonProvider {
|
||||||
const data = await this.getPageData(lesson, pageId, {
|
const data = await this.getPageData(lesson, pageId, {
|
||||||
includeContents: true,
|
includeContents: true,
|
||||||
...options, // Include all options.
|
...options, // Include all options.
|
||||||
readingStrategy: options.readingStrategy || CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: options.readingStrategy || CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
includeOfflineData: false,
|
includeOfflineData: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2854,7 +2854,7 @@ export class AddonModLessonProvider {
|
||||||
const pages = await this.getPages(lesson.id, {
|
const pages = await this.getPages(lesson.id, {
|
||||||
password: options.password,
|
password: options.password,
|
||||||
cmId: lesson.coursemodule,
|
cmId: lesson.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -3038,7 +3038,7 @@ export class AddonModLessonProvider {
|
||||||
const pages = await this.getPages(lesson.id, {
|
const pages = await this.getPages(lesson.id, {
|
||||||
cmId: lesson.coursemodule,
|
cmId: lesson.coursemodule,
|
||||||
password: options.password,
|
password: options.password,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -349,13 +349,13 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
// Get access information for the quiz.
|
// Get access information for the quiz.
|
||||||
this.quizAccessInfo = await AddonModQuiz.getQuizAccessInformation(this.quiz.id, {
|
this.quizAccessInfo = await AddonModQuiz.getQuizAccessInformation(this.quiz.id, {
|
||||||
cmId: this.quiz.coursemodule,
|
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.
|
// Get user attempts to determine last attempt.
|
||||||
const attempts = await AddonModQuiz.getUserAttempts(this.quiz.id, {
|
const attempts = await AddonModQuiz.getUserAttempts(this.quiz.id, {
|
||||||
cmId: this.quiz.coursemodule,
|
cmId: this.quiz.coursemodule,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!attempts.length) {
|
if (!attempts.length) {
|
||||||
|
@ -428,7 +428,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
// Get current page data again to get the latest sequencechecks.
|
// Get current page data again to get the latest sequencechecks.
|
||||||
const data = await AddonModQuiz.getAttemptData(this.attempt!.id, this.attempt!.currentpage!, this.preflightData, {
|
const data = await AddonModQuiz.getAttemptData(this.attempt!.id, this.attempt!.currentpage!, this.preflightData, {
|
||||||
cmId: this.quiz!.coursemodule,
|
cmId: this.quiz!.coursemodule,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
const newSequenceChecks: Record<number, { name: string; value: string }> = {};
|
const newSequenceChecks: Record<number, { name: string; value: string }> = {};
|
||||||
|
@ -486,7 +486,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
protected async loadPage(page: number): Promise<void> {
|
protected async loadPage(page: number): Promise<void> {
|
||||||
const data = await AddonModQuiz.getAttemptData(this.attempt!.id, page, this.preflightData, {
|
const data = await AddonModQuiz.getAttemptData(this.attempt!.id, page, this.preflightData, {
|
||||||
cmId: this.quiz!.coursemodule,
|
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.
|
// 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, {
|
this.summaryQuestions = await AddonModQuiz.getAttemptSummary(this.attempt!.id, this.preflightData, {
|
||||||
cmId: this.quiz!.coursemodule,
|
cmId: this.quiz!.coursemodule,
|
||||||
loadLocal: this.offline,
|
loadLocal: this.offline,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.showSummary = true;
|
this.showSummary = true;
|
||||||
|
@ -556,7 +556,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
this.navigation = await AddonModQuiz.getAttemptSummary(this.attempt!.id, this.preflightData, {
|
this.navigation = await AddonModQuiz.getAttemptSummary(this.attempt!.id, this.preflightData, {
|
||||||
cmId: this.quiz!.coursemodule,
|
cmId: this.quiz!.coursemodule,
|
||||||
loadLocal: this.offline,
|
loadLocal: this.offline,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.navigation.forEach((question) => {
|
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).
|
// 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, {
|
this.attemptAccessInfo = await AddonModQuiz.getAttemptAccessInformation(this.quiz!.id, attempt.id, {
|
||||||
cmId: this.quiz!.coursemodule,
|
cmId: this.quiz!.coursemodule,
|
||||||
readingStrategy: this.offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.attempt = attempt;
|
this.attempt = attempt;
|
||||||
|
|
|
@ -85,7 +85,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
|
|
||||||
const attempts = await AddonModQuiz.getUserAttempts(quiz.id, {
|
const attempts = await AddonModQuiz.getUserAttempts(quiz.id, {
|
||||||
cmId: module.id,
|
cmId: module.id,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
|
|
||||||
const attemptFiles = await this.getAttemptsFeedbackFiles(quiz, attempts);
|
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), {
|
const feedback = await AddonModQuiz.getFeedbackForGrade(quiz.id, Number(attemptGrade), {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
canStart: boolean,
|
canStart: boolean,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
@ -417,7 +417,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
|
|
||||||
const modOptions: CoreCourseCommonModWSOptions = {
|
const modOptions: CoreCourseCommonModWSOptions = {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -546,7 +546,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
|
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
await this.setStatusAfterPrefetch(quiz, {
|
await this.setStatusAfterPrefetch(quiz, {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
attempts,
|
attempts,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,7 +349,7 @@ export class AddonModQuizHelperProvider {
|
||||||
const rules = accessInfo.activerulenames;
|
const rules = accessInfo.activerulenames;
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
readingStrategy: offline ? CoreSitesReadingStrategy.PreferCache : CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
|
||||||
// Prefetch finished or not needed, set the right status.
|
// Prefetch finished or not needed, set the right status.
|
||||||
await AddonModQuizPrefetchHandler.setStatusAfterPrefetch(quiz, {
|
await AddonModQuizPrefetchHandler.setStatusAfterPrefetch(quiz, {
|
||||||
cmId: module.id,
|
cmId: module.id,
|
||||||
readingStrategy: shouldDownload ? CoreSitesReadingStrategy.PreferCache : undefined,
|
readingStrategy: shouldDownload ? CoreSitesReadingStrategy.PREFER_CACHE : undefined,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
|
||||||
const courseId = quiz.course;
|
const courseId = quiz.course;
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
|
||||||
// Now get the online questions data.
|
// Now get the online questions data.
|
||||||
const onlineQuestions = await AddonModQuiz.getAllQuestionsData(quiz, onlineAttempt, preflightData, {
|
const onlineQuestions = await AddonModQuiz.getAllQuestionsData(quiz, onlineAttempt, preflightData, {
|
||||||
pages: AddonModQuiz.getPagesFromLayoutAndQuestions(onlineAttempt.layout || '', offlineQuestions),
|
pages: AddonModQuiz.getPagesFromLayoutAndQuestions(onlineAttempt.layout || '', offlineQuestions),
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1265,7 +1265,7 @@ export class AddonModQuizProvider {
|
||||||
|
|
||||||
// Get required data to call the invalidate functions.
|
// Get required data to call the invalidate functions.
|
||||||
const quiz = await this.getQuiz(courseId, moduleId, {
|
const quiz = await this.getQuiz(courseId, moduleId, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1753,7 +1753,7 @@ export class AddonModQuizProvider {
|
||||||
const questionsArray = await this.getAttemptSummary(attempt.id, preflightData, {
|
const questionsArray = await this.getAttemptSummary(attempt.id, preflightData, {
|
||||||
cmId: quiz.coursemodule,
|
cmId: quiz.coursemodule,
|
||||||
loadLocal: true,
|
loadLocal: true,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
|
||||||
// Get the SCORM instance.
|
// Get the SCORM instance.
|
||||||
this.scorm = await AddonModScorm.getScorm(this.courseId, this.cmId, {
|
this.scorm = await AddonModScorm.getScorm(this.courseId, this.cmId, {
|
||||||
moduleUrl: this.moduleUrl,
|
moduleUrl: this.moduleUrl,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Block the SCORM so it cannot be synchronized.
|
// 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.
|
// Last attempt was online, verify that we can create a new online attempt. We ignore cache.
|
||||||
await AddonModScorm.getScormUserData(this.scorm.id, result.attempt, {
|
await AddonModScorm.getScormUserData(this.scorm.id, result.attempt, {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
// Cannot communicate with the server, create an offline attempt.
|
// 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.
|
// New online attempt created, update cached data about online attempts.
|
||||||
await CoreUtils.ignoreErrors(AddonModScorm.getAttemptCount(this.scorm.id, {
|
await CoreUtils.ignoreErrors(AddonModScorm.getAttemptCount(this.scorm.id, {
|
||||||
cmId: this.cmId,
|
cmId: this.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe
|
||||||
|
|
||||||
const modOptions: CoreCourseCommonModWSOptions = {
|
const modOptions: CoreCourseCommonModWSOptions = {
|
||||||
cmId: scorm.coursemodule,
|
cmId: scorm.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide
|
||||||
|
|
||||||
const siteData = await AddonModScorm.getScormUserData(scormId, attempt, {
|
const siteData = await AddonModScorm.getScormUserData(scormId, attempt, {
|
||||||
cmId,
|
cmId,
|
||||||
readingStrategy: refresh ? CoreSitesReadingStrategy.OnlyNetwork : undefined,
|
readingStrategy: refresh ? CoreSitesReadingStrategy.ONLY_NETWORK : undefined,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide
|
||||||
// Last online attempt wasn't finished, let's check if it is now.
|
// Last online attempt wasn't finished, let's check if it is now.
|
||||||
const incomplete = await AddonModScorm.isAttemptIncomplete(scorm.id, lastOnline, {
|
const incomplete = await AddonModScorm.isAttemptIncomplete(scorm.id, lastOnline, {
|
||||||
cmId: scorm.coursemodule,
|
cmId: scorm.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide
|
||||||
try {
|
try {
|
||||||
userData = await AddonModScorm.getScormUserData(scormId, attempt, {
|
userData = await AddonModScorm.getScormUserData(scormId, attempt, {
|
||||||
cmId,
|
cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
} catch {
|
} 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.
|
// 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, {
|
const attemptsData = await AddonModScorm.getAttemptCount(scorm.id, {
|
||||||
cmId: scorm.coursemodule,
|
cmId: scorm.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide
|
||||||
false :
|
false :
|
||||||
await AddonModScorm.isAttemptIncomplete(scorm.id, lastOnline, {
|
await AddonModScorm.isAttemptIncomplete(scorm.id, lastOnline, {
|
||||||
cmId: scorm.coursemodule,
|
cmId: scorm.coursemodule,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -799,7 +799,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide
|
||||||
|
|
||||||
const userData = await AddonModScorm.getScormUserData(scormId, attempt, {
|
const userData = await AddonModScorm.getScormUserData(scormId, attempt, {
|
||||||
cmId,
|
cmId,
|
||||||
readingStrategy: refresh ? CoreSitesReadingStrategy.OnlyNetwork : undefined,
|
readingStrategy: refresh ? CoreSitesReadingStrategy.ONLY_NETWORK : undefined,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1699,7 +1699,7 @@ export class AddonModScormProvider {
|
||||||
|
|
||||||
await this.getScormUserDataOnline(scormId, attempt, {
|
await this.getScormUserDataOnline(scormId, attempt, {
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ export class AddonModSurveyPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
*/
|
*/
|
||||||
protected async prefetchSurvey(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
protected async prefetchSurvey(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||||
const survey = await AddonModSurvey.getSurvey(courseId, module.id, {
|
const survey = await AddonModSurvey.getSurvey(courseId, module.id, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ export class AddonModSurveyPrefetchHandlerService extends CoreCourseActivityPref
|
||||||
if (!survey.surveydone) {
|
if (!survey.surveydone) {
|
||||||
promises.push(AddonModSurvey.getQuestions(survey.id, {
|
promises.push(AddonModSurvey.getQuestions(survey.id, {
|
||||||
cmId: module.id,
|
cmId: module.id,
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ export class AddonModWikiCreateLinkHandlerService extends CoreContentLinksHandle
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
cmId: params.cmId,
|
cmId: params.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
CorePluginFileDelegate.getFilesDownloadSize(files)));
|
CorePluginFileDelegate.getFilesDownloadSize(files)));
|
||||||
|
|
||||||
promises.push(this.getAllPages(module, courseId, {
|
promises.push(this.getAllPages(module, courseId, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
}).then((pages) => {
|
}).then((pages) => {
|
||||||
let size = 0;
|
let size = 0;
|
||||||
|
@ -161,7 +161,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet
|
||||||
const userId = CoreSites.getCurrentSiteUserId();
|
const userId = CoreSites.getCurrentSiteUserId();
|
||||||
|
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
|
|
@ -683,7 +683,7 @@ export class AddonModWikiProvider {
|
||||||
// We have wiki ID, check if there's already an online page with this title and subwiki.
|
// 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, {
|
const used = await CoreUtils.ignoreErrors(this.isTitleUsed(options.wikiId, options.subwikiId, title, {
|
||||||
cmId: options.cmId,
|
cmId: options.cmId,
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId: options.siteId,
|
siteId: options.siteId,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr
|
||||||
*/
|
*/
|
||||||
async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise<boolean> {
|
async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise<boolean> {
|
||||||
const workshop = await AddonModWorkshop.getWorkshop(courseId, module.id, {
|
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 });
|
const accessData = await AddonModWorkshop.getWorkshopAccessInformation(workshop.id, { cmId: module.id });
|
||||||
|
@ -263,7 +263,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr
|
||||||
|
|
||||||
const userIds: number[] = [];
|
const userIds: number[] = [];
|
||||||
const commonOptions = {
|
const commonOptions = {
|
||||||
readingStrategy: CoreSitesReadingStrategy.OnlyNetwork,
|
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||||
siteId,
|
siteId,
|
||||||
};
|
};
|
||||||
const modOptions = {
|
const modOptions = {
|
||||||
|
|
|
@ -1419,7 +1419,7 @@ export class AddonModWorkshopProvider {
|
||||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||||
|
|
||||||
const workshop = await this.getWorkshop(courseId, moduleId, {
|
const workshop = await this.getWorkshop(courseId, moduleId, {
|
||||||
readingStrategy: CoreSitesReadingStrategy.PreferCache,
|
readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE,
|
||||||
siteId,
|
siteId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,10 @@ import { Component, Input } from '@angular/core';
|
||||||
import { Platform } from '@singletons';
|
import { Platform } from '@singletons';
|
||||||
|
|
||||||
const enum ScrollPosition {
|
const enum ScrollPosition {
|
||||||
Start = 'start',
|
START = 'start',
|
||||||
End = 'end',
|
END = 'end',
|
||||||
Middle = 'middle',
|
MIDDLE = 'middle',
|
||||||
Hidden = 'hidden',
|
HIDDEN = 'hidden',
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -32,7 +32,7 @@ export class CoreHorizontalScrollControlsComponent {
|
||||||
// eslint-disable-next-line @angular-eslint/no-input-rename
|
// eslint-disable-next-line @angular-eslint/no-input-rename
|
||||||
@Input('aria-controls') targetId?: string;
|
@Input('aria-controls') targetId?: string;
|
||||||
|
|
||||||
scrollPosition: ScrollPosition = ScrollPosition.Hidden;
|
scrollPosition: ScrollPosition = ScrollPosition.HIDDEN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get target element.
|
* Get target element.
|
||||||
|
@ -85,22 +85,22 @@ export class CoreHorizontalScrollControlsComponent {
|
||||||
scrollLeft = scrollLeft ?? this.target?.scrollLeft ?? 0;
|
scrollLeft = scrollLeft ?? this.target?.scrollLeft ?? 0;
|
||||||
|
|
||||||
if (!this.target || this.target.scrollWidth <= this.target.clientWidth) {
|
if (!this.target || this.target.scrollWidth <= this.target.clientWidth) {
|
||||||
return ScrollPosition.Hidden;
|
return ScrollPosition.HIDDEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollLeft === 0) {
|
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) {
|
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) {
|
if (Platform.isRTL && this.target.scrollWidth + scrollLeft === this.target.clientWidth) {
|
||||||
return ScrollPosition.Start;
|
return ScrollPosition.START;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ScrollPosition.Middle;
|
return ScrollPosition.MIDDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<form #messageForm>
|
<form #messageForm>
|
||||||
<textarea
|
<textarea
|
||||||
class="core-send-message-input"
|
class="core-send-message-input"
|
||||||
|
[attr.aria-label]="placeholder"
|
||||||
[core-auto-focus]="showKeyboard"
|
[core-auto-focus]="showKeyboard"
|
||||||
[placeholder]="placeholder"
|
[placeholder]="placeholder"
|
||||||
rows="1"
|
rows="1"
|
||||||
|
|
|
@ -19,9 +19,9 @@ import { CoreScreen } from '@services/screen';
|
||||||
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
||||||
|
|
||||||
export enum CoreSplitViewMode {
|
export enum CoreSplitViewMode {
|
||||||
MenuOnly = 'menu-only', // Hides content.
|
MENU_ONLY = 'menu-only', // Hides content.
|
||||||
ContentOnly = 'content-only', // Hides menu.
|
CONTENT_ONLY = 'content-only', // Hides menu.
|
||||||
MenuAndContent = 'menu-and-content', // Shows both menu and content.
|
MENU_AND_CONTENT = 'menu-and-content', // Shows both menu and content.
|
||||||
}
|
}
|
||||||
|
|
||||||
const disabledScrollClass = 'disable-scroll-y';
|
const disabledScrollClass = 'disable-scroll-y';
|
||||||
|
@ -118,16 +118,16 @@ export class CoreSplitViewComponent implements AfterViewInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isNested) {
|
if (this.isNested) {
|
||||||
return CoreSplitViewMode.MenuOnly;
|
return CoreSplitViewMode.MENU_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoreScreen.isMobile) {
|
if (CoreScreen.isMobile) {
|
||||||
return this.contentOutlet.isActivated
|
return this.contentOutlet.isActivated
|
||||||
? CoreSplitViewMode.ContentOnly
|
? CoreSplitViewMode.CONTENT_ONLY
|
||||||
: CoreSplitViewMode.MenuOnly;
|
: CoreSplitViewMode.MENU_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CoreSplitViewMode.MenuAndContent;
|
return CoreSplitViewMode.MENU_AND_CONTENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -191,8 +191,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
|
|
||||||
this.displaySectionSelector = CoreCourseFormatDelegate.displaySectionSelector(this.course);
|
this.displaySectionSelector = CoreCourseFormatDelegate.displaySectionSelector(this.course);
|
||||||
this.displayBlocks = CoreCourseFormatDelegate.displayBlocks(this.course);
|
this.displayBlocks = CoreCourseFormatDelegate.displayBlocks(this.course);
|
||||||
this.progress = 'progress' in this.course && typeof this.course.progress == 'number' &&
|
this.updateProgress();
|
||||||
this.course.progress >= 0 && this.course.completionusertracked !== false ? this.course.progress : undefined;
|
|
||||||
if ('overviewfiles' in this.course) {
|
if ('overviewfiles' in this.course) {
|
||||||
this.imageThumb = this.course.overviewfiles?.[0]?.fileurl;
|
this.imageThumb = this.course.overviewfiles?.[0]?.fileurl;
|
||||||
}
|
}
|
||||||
|
@ -414,6 +414,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
CoreCourse.logView(this.course!.id, newSection.section, undefined, this.course!.fullname),
|
CoreCourse.logView(this.course!.id, newSection.section, undefined, this.course!.fullname),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.invalidateSectionButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -506,6 +508,25 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
done?.();
|
done?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invalidate section buttons so that they are rendered again. This is necessary in order to update
|
||||||
|
* some attributes that are not reactive, for example aria-label.
|
||||||
|
*
|
||||||
|
* @see https://github.com/ionic-team/ionic-framework/issues/21534
|
||||||
|
*/
|
||||||
|
protected async invalidateSectionButtons(): Promise<void> {
|
||||||
|
const previousSection = this.previousSection;
|
||||||
|
const nextSection = this.nextSection;
|
||||||
|
|
||||||
|
this.previousSection = undefined;
|
||||||
|
this.nextSection = undefined;
|
||||||
|
|
||||||
|
await CoreUtils.nextTick();
|
||||||
|
|
||||||
|
this.previousSection = previousSection;
|
||||||
|
this.nextSection = nextSection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show more activities (only used when showing all the sections at the same time).
|
* Show more activities (only used when showing all the sections at the same time).
|
||||||
*
|
*
|
||||||
|
@ -620,6 +641,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
} else {
|
} else {
|
||||||
this.course.progress = Math.max(0, this.course.progress - moduleProgressPercent);
|
this.course.progress = Math.max(0, this.course.progress - moduleProgressPercent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -633,4 +656,23 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
CoreCourseHelper.calculateSectionsStatus(this.sections, this.course.id, false, false);
|
CoreCourseHelper.calculateSectionsStatus(this.sections, this.course.id, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update course progress.
|
||||||
|
*/
|
||||||
|
protected updateProgress(): void {
|
||||||
|
if (
|
||||||
|
!this.course ||
|
||||||
|
!('progress' in this.course) ||
|
||||||
|
typeof this.course.progress !== 'number' ||
|
||||||
|
this.course.progress < 0 ||
|
||||||
|
this.course.completionusertracked === false
|
||||||
|
) {
|
||||||
|
this.progress = undefined;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.progress = this.course.progress;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ export class CoreGradesCoursePage implements AfterViewInit, OnDestroy {
|
||||||
const useSplitView = route.snapshot.data.useSplitView ?? true;
|
const useSplitView = route.snapshot.data.useSplitView ?? true;
|
||||||
const outsideGradesTab = route.snapshot.data.outsideGradesTab ?? false;
|
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);
|
this.grades = new CoreGradesCourseManager(CoreGradesCoursePage, courseId, userId, outsideGradesTab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -221,7 +221,7 @@ export class CoreGradesHelperProvider {
|
||||||
let coursesWereMissing = false;
|
let coursesWereMissing = false;
|
||||||
|
|
||||||
try {
|
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');
|
const coursesMap = CoreUtils.arrayToObject(courses, 'id');
|
||||||
|
|
||||||
coursesWereMissing = this.addCourseData(grades, coursesMap);
|
coursesWereMissing = this.addCourseData(grades, coursesMap);
|
||||||
|
@ -233,7 +233,7 @@ export class CoreGradesHelperProvider {
|
||||||
if (coursesWereMissing) {
|
if (coursesWereMissing) {
|
||||||
const coursesPromise = CoreCourses.isGetCoursesByFieldAvailable()
|
const coursesPromise = CoreCourses.isGetCoursesByFieldAvailable()
|
||||||
? CoreCourses.getCoursesByField('ids', grades.map((grade) => grade.courseid).join(','))
|
? 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 courses = await coursesPromise;
|
||||||
const coursesMap =
|
const coursesMap =
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class CoreGeolocationProvider {
|
||||||
return result.coords;
|
return result.coords;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.isCordovaPermissionDeniedError(error)) {
|
if (this.isCordovaPermissionDeniedError(error)) {
|
||||||
throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied);
|
throw new CoreGeolocationError(CoreGeolocationErrorReason.PERMISSION_DENIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -78,7 +78,7 @@ export class CoreGeolocationProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!locationEnabled) {
|
if (!locationEnabled) {
|
||||||
throw new CoreGeolocationError(CoreGeolocationErrorReason.LocationNotEnabled);
|
throw new CoreGeolocationError(CoreGeolocationErrorReason.LOCATION_NOT_ENABLED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ export class CoreGeolocationProvider {
|
||||||
switch (authorizationStatus) {
|
switch (authorizationStatus) {
|
||||||
case Diagnostic.permissionStatus.DENIED_ONCE:
|
case Diagnostic.permissionStatus.DENIED_ONCE:
|
||||||
if (failOnDeniedOnce) {
|
if (failOnDeniedOnce) {
|
||||||
throw new CoreGeolocationError(CoreGeolocationErrorReason.PermissionDenied);
|
throw new CoreGeolocationError(CoreGeolocationErrorReason.PERMISSION_DENIED);
|
||||||
}
|
}
|
||||||
// Fall through.
|
// Fall through.
|
||||||
case Diagnostic.permissionStatus.NOT_REQUESTED:
|
case Diagnostic.permissionStatus.NOT_REQUESTED:
|
||||||
|
@ -107,7 +107,7 @@ export class CoreGeolocationProvider {
|
||||||
// Location is authorized.
|
// Location is authorized.
|
||||||
return;
|
return;
|
||||||
default:
|
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 const CoreGeolocation = makeSingleton(CoreGeolocationProvider);
|
||||||
|
|
||||||
export enum CoreGeolocationErrorReason {
|
export enum CoreGeolocationErrorReason {
|
||||||
PermissionDenied = 'permission-denied',
|
PERMISSION_DENIED = 'permission-denied',
|
||||||
LocationNotEnabled = 'location-not-enabled',
|
LOCATION_NOT_ENABLED = 'location-not-enabled',
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CoreGeolocationError extends CoreError {
|
export class CoreGeolocationError extends CoreError {
|
||||||
|
|
|
@ -24,28 +24,28 @@ import { makeSingleton } from '@singletons';
|
||||||
* @see https://ionicframework.com/docs/layout/grid#default-breakpoints
|
* @see https://ionicframework.com/docs/layout/grid#default-breakpoints
|
||||||
*/
|
*/
|
||||||
enum Breakpoint {
|
enum Breakpoint {
|
||||||
ExtraSmall = 'xs',
|
EXTRA_SMALL = 'xs',
|
||||||
Small = 'sm',
|
SMALL = 'sm',
|
||||||
Medium = 'md',
|
MEDIUM = 'md',
|
||||||
Large = 'lg',
|
LARGE = 'lg',
|
||||||
ExtraLarge = 'xl',
|
EXTRA_LARGE = 'xl',
|
||||||
}
|
}
|
||||||
|
|
||||||
const BREAKPOINT_NAMES = Object.values(Breakpoint);
|
const BREAKPOINT_NAMES = Object.values(Breakpoint);
|
||||||
const BREAKPOINT_WIDTHS: Record<Breakpoint, number> = {
|
const BREAKPOINT_WIDTHS: Record<Breakpoint, number> = {
|
||||||
[Breakpoint.ExtraSmall]: 0,
|
[Breakpoint.EXTRA_SMALL]: 0,
|
||||||
[Breakpoint.Small]: 576,
|
[Breakpoint.SMALL]: 576,
|
||||||
[Breakpoint.Medium]: 768,
|
[Breakpoint.MEDIUM]: 768,
|
||||||
[Breakpoint.Large]: 992,
|
[Breakpoint.LARGE]: 992,
|
||||||
[Breakpoint.ExtraLarge]: 1200,
|
[Breakpoint.EXTRA_LARGE]: 1200,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screen layouts.
|
* Screen layouts.
|
||||||
*/
|
*/
|
||||||
export enum CoreScreenLayout {
|
export enum CoreScreenLayout {
|
||||||
Mobile = 'mobile',
|
MOBILE = 'mobile',
|
||||||
Tablet = 'tablet',
|
TABLET = 'tablet',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,11 +86,11 @@ export class CoreScreenService {
|
||||||
}
|
}
|
||||||
|
|
||||||
get isMobile(): boolean {
|
get isMobile(): boolean {
|
||||||
return this.layout === CoreScreenLayout.Mobile;
|
return this.layout === CoreScreenLayout.MOBILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isTablet(): boolean {
|
get isTablet(): boolean {
|
||||||
return this.layout === CoreScreenLayout.Tablet;
|
return this.layout === CoreScreenLayout.TABLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,11 +131,11 @@ export class CoreScreenService {
|
||||||
* @return Active layout.
|
* @return Active layout.
|
||||||
*/
|
*/
|
||||||
protected calculateLayout(breakpoints: Record<Breakpoint, boolean>): CoreScreenLayout {
|
protected calculateLayout(breakpoints: Record<Breakpoint, boolean>): CoreScreenLayout {
|
||||||
if (breakpoints[Breakpoint.Large]) {
|
if (breakpoints[Breakpoint.LARGE]) {
|
||||||
return CoreScreenLayout.Tablet;
|
return CoreScreenLayout.TABLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CoreScreenLayout.Mobile;
|
return CoreScreenLayout.MOBILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1675,20 +1675,20 @@ export class CoreSitesProvider {
|
||||||
*/
|
*/
|
||||||
getReadingStrategyPreSets(strategy?: CoreSitesReadingStrategy): CoreSiteWSPreSets {
|
getReadingStrategyPreSets(strategy?: CoreSitesReadingStrategy): CoreSiteWSPreSets {
|
||||||
switch (strategy) {
|
switch (strategy) {
|
||||||
case CoreSitesReadingStrategy.PreferCache:
|
case CoreSitesReadingStrategy.PREFER_CACHE:
|
||||||
return {
|
return {
|
||||||
omitExpires: true,
|
omitExpires: true,
|
||||||
};
|
};
|
||||||
case CoreSitesReadingStrategy.OnlyCache:
|
case CoreSitesReadingStrategy.ONLY_CACHE:
|
||||||
return {
|
return {
|
||||||
omitExpires: true,
|
omitExpires: true,
|
||||||
forceOffline: true,
|
forceOffline: true,
|
||||||
};
|
};
|
||||||
case CoreSitesReadingStrategy.PreferNetwork:
|
case CoreSitesReadingStrategy.PREFER_NETWORK:
|
||||||
return {
|
return {
|
||||||
getFromCache: false,
|
getFromCache: false,
|
||||||
};
|
};
|
||||||
case CoreSitesReadingStrategy.OnlyNetwork:
|
case CoreSitesReadingStrategy.ONLY_NETWORK:
|
||||||
return {
|
return {
|
||||||
getFromCache: false,
|
getFromCache: false,
|
||||||
emergencyCache: false,
|
emergencyCache: false,
|
||||||
|
@ -1889,10 +1889,10 @@ export type CoreRegisteredSiteSchema = CoreSiteSchema & {
|
||||||
* Possible reading strategies (for cache).
|
* Possible reading strategies (for cache).
|
||||||
*/
|
*/
|
||||||
export const enum CoreSitesReadingStrategy {
|
export const enum CoreSitesReadingStrategy {
|
||||||
OnlyCache,
|
ONLY_CACHE,
|
||||||
PreferCache,
|
PREFER_CACHE,
|
||||||
OnlyNetwork,
|
ONLY_NETWORK,
|
||||||
PreferNetwork,
|
PREFER_NETWORK,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue