diff --git a/src/addon/storagemanager/pages/course-storage/course-storage.html b/src/addon/storagemanager/pages/course-storage/course-storage.html index 8dd91ea1e..88dffd229 100644 --- a/src/addon/storagemanager/pages/course-storage/course-storage.html +++ b/src/addon/storagemanager/pages/course-storage/course-storage.html @@ -9,12 +9,12 @@

{{ course.displayname }}

{{ 'addon.storagemanager.info' | translate }}

- - - - {{ 'addon.storagemanager.storageused' | translate }} - {{ totalSize | coreBytesToSize }} - + + +

{{ 'addon.storagemanager.storageused' | translate }}

+
+

{{ totalSize | coreBytesToSize }}

+
@@ -25,13 +25,11 @@ - -

{{ section.name }}

-
- - +

{{ section.name }}

+

+ {{ section.totalSize | coreBytesToSize }} - +

@@ -39,21 +37,20 @@
-
- - - {{ module.name }} - - - - {{ module.totalSize | coreBytesToSize }} - - - -
+ +

+ + {{ module.name }} +

+

+ + {{ module.totalSize | coreBytesToSize }} +

+ +
diff --git a/src/addon/storagemanager/pages/course-storage/course-storage.scss b/src/addon/storagemanager/pages/course-storage/course-storage.scss index 2c03e4984..77e6022d7 100644 --- a/src/addon/storagemanager/pages/course-storage/course-storage.scss +++ b/src/addon/storagemanager/pages/course-storage/course-storage.scss @@ -13,12 +13,7 @@ ion-app.app-root page-addon-storagemanager-course-storage { font-weight: bold; font-size: 2rem; } - .size { - margin-top: 4px; - } - .size ion-icon { - margin-right: 4px; - } + .core-module-icon { margin-right: 4px; width: 16px; diff --git a/src/addon/storagemanager/pages/course-storage/course-storage.ts b/src/addon/storagemanager/pages/course-storage/course-storage.ts index eb605fc57..ff9196403 100644 --- a/src/addon/storagemanager/pages/course-storage/course-storage.ts +++ b/src/addon/storagemanager/pages/course-storage/course-storage.ts @@ -19,6 +19,7 @@ import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module- import { CoreCourseHelperProvider } from '@core/course/providers/helper'; import { CoreDomUtilsProvider } from '@providers/utils/dom'; import { TranslateService } from '@ngx-translate/core'; +import { CoreConstants } from '@core/constants'; /** * Page that displays the amount of file storage used by each activity on the course, and allows @@ -84,6 +85,10 @@ export class AddonStorageManagerCourseStoragePage { Promise.all(allPromises).then(() => { this.loaded = true; + + if (this.totalSize == 0) { + this.markCourseAsNotDownloaded(); + } }); }); } @@ -162,6 +167,25 @@ export class AddonStorageManagerCourseStoragePage { modal.dismiss(); this.domUtils.showErrorModalDefault(error, this.translate.instant('core.errordeletefile')); + }).finally(() => { + // @TODO This is a workaround that should be more specific solving MOBILE-3305. + // Also should take into account all modules are not downloaded. + + // Mark course as not downloaded if course size is 0. + if (this.totalSize == 0) { + this.markCourseAsNotDownloaded(); + } }); } + + /** + * Mark course as not downloaded. + */ + protected markCourseAsNotDownloaded(): void { + // @TODO This is a workaround that should be more specific solving MOBILE-3305. + // Also should take into account all modules are not downloaded. + // Check after MOBILE-3188 is integrated. + + this.courseProvider.setCourseStatus(this.course.id, CoreConstants.NOT_DOWNLOADED); + } }