From 0c0eceb0780957180010284330e3b4945bb0719f Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Tue, 28 May 2019 12:33:30 +0100 Subject: [PATCH] MOBILE-3054 Courses: Update section download icon Update the section download icon to reflect changes to the download state of modules within the section, either from the download buttons on the course page or activity within the module. --- src/core/course/components/format/format.ts | 8 ++++++++ src/core/course/components/module/module.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/core/course/components/format/format.ts b/src/core/course/components/format/format.ts index 1c87d2aed..30feb6622 100644 --- a/src/core/course/components/format/format.ts +++ b/src/core/course/components/format/format.ts @@ -449,6 +449,14 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { this.dynamicComponents.forEach((component) => { component.callComponentFunction('ionViewDidEnter'); }); + if (this.downloadEnabled) { + // The download status of a section might have been changed from within a module page. + if (this.selectedSection && this.selectedSection.id !== CoreCourseProvider.ALL_SECTIONS_ID) { + this.courseHelper.calculateSectionStatus(this.selectedSection, this.course.id); + } else { + this.courseHelper.calculateSectionsStatus(this.sections, this.course.id); + } + } } /** diff --git a/src/core/course/components/module/module.ts b/src/core/course/components/module/module.ts index b4d8cba41..758784848 100644 --- a/src/core/course/components/module/module.ts +++ b/src/core/course/components/module/module.ts @@ -148,6 +148,8 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { // Get download size to ask for confirm if it's high. this.prefetchHandler.getDownloadSize(this.module, this.courseId, true).then((size) => { return this.courseHelper.prefetchModule(this.prefetchHandler, this.module, size, this.courseId, refresh); + }).then(() => { + this.courseHelper.calculateSectionStatus(this.section, this.courseId); }).catch((error) => { // Error, hide spinner. this.spinner = false;