From 2533829030a08cf0a477f95b3efe9498c15aba99 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 6 Mar 2024 08:58:20 +0100 Subject: [PATCH] MOBILE-4539 course: Don't call isDownloadable to check module updates --- .../services/module-prefetch-delegate.ts | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/core/features/course/services/module-prefetch-delegate.ts b/src/core/features/course/services/module-prefetch-delegate.ts index 845e2c99f..5451cb139 100644 --- a/src/core/features/course/services/module-prefetch-delegate.ts +++ b/src/core/features/course/services/module-prefetch-delegate.ts @@ -122,8 +122,8 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { try { - const data = await this.getModuleStatusAndDownloadTime(module, courseId); - if (data.status != CoreConstants.DOWNLOADED) { + const data = await this.getModuleDownloadTime(module); + if (!data.downloadTime || data.outdated) { return; } @@ -730,22 +730,20 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { + ): Promise<{ downloadTime?: number; outdated?: boolean }> { const handler = this.getPrefetchHandlerFor(module.modname); const siteId = CoreSites.getCurrentSiteId(); if (!handler) { - // No handler found, module not downloadable. - return { status: CoreConstants.NOT_DOWNLOADABLE }; + return {}; } // Get the status from the cache. @@ -753,14 +751,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate(packageId, 'status'); if (status !== undefined && !CoreFileHelper.isStateDownloaded(status)) { - // Module isn't downloaded, just return the status. - return { status }; - } - - // Check if the module is downloadable. - const downloadable = await this.isModuleDownloadable(module, courseId); - if (!downloadable) { - return { status: CoreConstants.NOT_DOWNLOADABLE }; + return {}; } try { @@ -768,11 +759,11 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate