MOBILE-3188 core: Rename getModuleTotalSize to getModuleStoredSize

main
Dani Palou 2020-09-02 10:01:14 +02:00
parent 16b7f8b696
commit bb88252822
4 changed files with 9 additions and 5 deletions

View File

@ -72,7 +72,7 @@ export class AddonStorageManagerCourseStoragePage {
// But these aren't necessarily consistent, for example mod_frog vs mmaModFrog.
// There is nothing enforcing correct values.
// Most modules which have large files are downloadable, so I think this is sufficient.
const promise = this.prefetchDelegate.getModuleTotalSize(module, this.course.id).
const promise = this.prefetchDelegate.getModuleStoredSize(module, this.course.id).
then((size) => {
// There are some cases where the return from this is not a valid number.
if (!isNaN(size)) {

View File

@ -1200,9 +1200,13 @@ export class CoreSite {
* @param componentId Component id.
* @return Promise resolved when the entries are deleted.
*/
deleteComponentFromCache(component: string, componentId?: string): Promise<any> {
async deleteComponentFromCache(component: string, componentId?: string): Promise<void> {
if (!component) {
return;
}
if (!this.db) {
return Promise.reject(null);
throw new Error('Site DB not initialized');
}
const params = {

View File

@ -1136,7 +1136,7 @@ export class CoreCourseHelperProvider {
this.prefetchDelegate.invalidateModuleStatusCache(module);
}
promises.push(this.prefetchDelegate.getModuleTotalSize(module, courseId).then((moduleSize) => {
promises.push(this.prefetchDelegate.getModuleStoredSize(module, courseId).then((moduleSize) => {
moduleInfo.size = moduleSize;
moduleInfo.sizeReadable = this.textUtils.bytesToSize(moduleSize, 2);
}));

View File

@ -699,7 +699,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate {
* @param courseId Course ID the module belongs to.
* @return Promise resolved with the total size (0 if unknown)
*/
getModuleTotalSize(module: any, courseId: number): Promise<number> {
getModuleStoredSize(module: any, courseId: number): Promise<number> {
return this.getModuleDownloadedSize(module, courseId).then((downloadedSize) => {
if (isNaN(downloadedSize)) {
downloadedSize = 0;