From 27a0a8fcdf5d93b8eb8547ac69f4d16496e43a6c Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 22 May 2019 12:31:15 +0200 Subject: [PATCH] MOBILE-2898 courses: Display done icon when course download finishes --- src/core/course/providers/helper.ts | 5 ++++- .../course-progress/core-courses-course-progress.html | 6 +++++- .../courses/components/course-progress/course-progress.scss | 6 ++++++ .../courses/components/course-progress/course-progress.ts | 1 + src/core/courses/pages/course-preview/course-preview.html | 3 ++- src/core/courses/pages/course-preview/course-preview.ts | 1 + 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index d1eb53fe5..7259db9b8 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -264,7 +264,7 @@ export class CoreCourseHelperProvider { * This function will set the icon to "spinner" when starting and it will also set it back to the initial icon if the * user cancels. All the other updates of the icon should be made when CoreEventsProvider.COURSE_STATUS_CHANGED is received. * - * @param {any} data An object where to store the course icon and title: "prefetchCourseIcon" and "title". + * @param {any} data An object where to store the course icon and title: "prefetchCourseIcon", "title" and "downloadSucceeded". * @param {any} course Course to prefetch. * @param {any[]} [sections] List of course sections. * @param {CoreCourseOptionsHandlerToDisplay[]} courseHandlers List of course handlers. @@ -279,6 +279,7 @@ export class CoreCourseHelperProvider { siteId = this.sitesProvider.getCurrentSiteId(); let promise; + data.downloadSucceeded = false; data.prefetchCourseIcon = 'spinner'; data.title = 'core.downloading'; @@ -313,6 +314,8 @@ export class CoreCourseHelperProvider { return this.prefetchCourse(course, sections, courseHandlers, menuHandlers, siteId); }).then(() => { // Download successful. + data.downloadSucceeded = true; + return true; }); }, (error): any => { diff --git a/src/core/courses/components/course-progress/core-courses-course-progress.html b/src/core/courses/components/course-progress/core-courses-course-progress.html index ed633bbac..985d92008 100644 --- a/src/core/courses/components/course-progress/core-courses-course-progress.html +++ b/src/core/courses/components/course-progress/core-courses-course-progress.html @@ -14,7 +14,8 @@
@@ -24,6 +25,9 @@ + + +