MOBILE-2701 resource: Always show refresh for external files
parent
601508aefc
commit
da799faf6e
|
@ -23,6 +23,7 @@ import { CoreCourseProvider } from '@core/course/providers/course';
|
||||||
import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler';
|
import { CoreCourseResourcePrefetchHandlerBase } from '@core/course/classes/resource-prefetch-handler';
|
||||||
import { AddonModResourceProvider } from './resource';
|
import { AddonModResourceProvider } from './resource';
|
||||||
import { AddonModResourceHelperProvider } from './helper';
|
import { AddonModResourceHelperProvider } from './helper';
|
||||||
|
import { CoreConstants } from '@core/constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to prefetch resources.
|
* Handler to prefetch resources.
|
||||||
|
@ -41,6 +42,26 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH
|
||||||
super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils);
|
super(translate, appProvider, utils, courseProvider, filepoolProvider, sitesProvider, domUtils);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the status to show based on current status.
|
||||||
|
*
|
||||||
|
* @param {any} module Module.
|
||||||
|
* @param {string} status The current status.
|
||||||
|
* @param {boolean} canCheck Whether the site allows checking for updates.
|
||||||
|
* @return {string} Status to display.
|
||||||
|
*/
|
||||||
|
determineStatus(module: any, status: string, canCheck: boolean): string {
|
||||||
|
if (status == CoreConstants.DOWNLOADED && module && module.contents) {
|
||||||
|
// If the first file is an external file, always display the module as outdated.
|
||||||
|
const mainFile = module.contents[0];
|
||||||
|
if (mainFile && mainFile.isexternalfile) {
|
||||||
|
return CoreConstants.OUTDATED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download or prefetch the content.
|
* Download or prefetch the content.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2501,7 +2501,7 @@ export class CoreFilepoolProvider {
|
||||||
// File not in pool.
|
// File not in pool.
|
||||||
}).then((entry: CoreFilepoolFileEntry) => {
|
}).then((entry: CoreFilepoolFileEntry) => {
|
||||||
|
|
||||||
if (entry && !this.isFileOutdated(entry, options.revision, options.timemodified)) {
|
if (entry && !options.isexternalfile && !this.isFileOutdated(entry, options.revision, options.timemodified)) {
|
||||||
// We have the file, it is not stale, we can update links and remove from queue.
|
// We have the file, it is not stale, we can update links and remove from queue.
|
||||||
this.logger.debug('Queued file already in store, ignoring...');
|
this.logger.debug('Queued file already in store, ignoring...');
|
||||||
this.addFileLinks(siteId, fileId, links).catch(() => {
|
this.addFileLinks(siteId, fileId, links).catch(() => {
|
||||||
|
|
Loading…
Reference in New Issue