MOBILE-2512 prefetch: Don't download hidden modules and sections

main
Dani Palou 2018-07-19 11:49:25 +02:00
parent d5026c5e16
commit 204a1ce8f1
2 changed files with 10 additions and 0 deletions

View File

@ -1114,6 +1114,11 @@ export class CoreCourseHelperProvider {
return Promise.resolve();
}
if (section.hiddenbynumsections) {
// Hidden section.
return Promise.resolve();
}
section.isDownloading = true;
// Validate the section needs to be downloaded and calculate amount of modules that need to be downloaded.

View File

@ -953,6 +953,11 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate {
* @return {Promise<boolean>} Promise resolved with true if downloadable, false otherwise.
*/
isModuleDownloadable(module: any, courseId: number): Promise<boolean> {
if (module.uservisible === false) {
// Module isn't visible by the user, cannot be downloaded.
return Promise.resolve(false);
}
const handler = this.getPrefetchHandlerFor(module);
if (handler) {