From cb30bb555e0f34322ffb6d6d805e7b9284b1e4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 12 Mar 2020 17:05:11 +0100 Subject: [PATCH 1/2] MOBILE-3269 tabs: Fix scroll top management --- src/components/tabs/tabs.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index 76d6b5628..ed0910a49 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -490,6 +490,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe this.originalTabsContainer.style.paddingBottom = this.tabBarHeight + 'px'; this.tabBarElement.classList.remove('tabs-hidden'); this.tabsShown = true; + this.lastScroll = 0; return; } From 8b02bd50c672e0d0b677c021e39a3a815f60927e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 13 Mar 2020 11:21:16 +0100 Subject: [PATCH 2/2] MOBILE-3269 storage: Mark as not downloaded when size 0 --- .../pages/course-storage/course-storage.html | 51 +++++++++---------- .../pages/course-storage/course-storage.scss | 7 +-- .../pages/course-storage/course-storage.ts | 24 +++++++++ 3 files changed, 49 insertions(+), 33 deletions(-) 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); + } }