Merge pull request #2624 from dpalou/MOBILE-3523

Mobile 3523
main
Dani Palou 2020-11-26 12:44:34 +01:00 committed by GitHub
commit 6554f5c988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 12 deletions

View File

@ -424,17 +424,15 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand
// Remove the unzipped folder.
promises.push(this.fileProvider.removeDir(path).catch((error) => {
if (error && error.code == 1) {
if (error && (error.code == 1 || !this.appProvider.isMobile())) {
// Not found, ignore error.
} else {
return Promise.reject(error);
}
}));
// Maybe the ZIP wasn't deleted for some reason. Try to delete it too.
promises.push(this.filepoolProvider.removeFileByUrl(siteId, this.scormProvider.getPackageUrl(scorm)).catch(() => {
// Ignore errors.
}));
// Delete other files.
promises.push(this.filepoolProvider.removeFilesByComponent(siteId, this.component, module.id));
return Promise.all(promises);
});

View File

@ -7,7 +7,10 @@
<core-loading [hideUntil]="loaded">
<ion-card class="wholecourse">
<ion-card-header>
<h1 text-wrap>{{ course.displayname }}</h1>
<h1 text-wrap>
<span *ngIf="course.displayname">{{ course.displayname }}</span>
<span *ngIf="!course.displayname">{{ course.fullname }}</span>
</h1>
<p text-wrap>{{ 'addon.storagemanager.info' | translate }}</p>
<ion-item no-padding padding-top class="size" text-wrap>
<ion-icon name="cube" item-start></ion-icon>

View File

@ -24,7 +24,10 @@
<ion-card>
<ion-list>
<ion-item *ngFor="let course of downloadedCourses" class="course">
<h2 text-wrap>{{ course.displayname }}</h2>
<h2 text-wrap>
<span *ngIf="course.displayname">{{ course.displayname }}</span>
<span *ngIf="!course.displayname">{{ course.fullname }}</span>
</h2>
<h3 *ngIf="course.isDownloading">{{ 'core.downloading' | translate }}</h3>
<p>
<ion-icon name="cube" item-start></ion-icon>

View File

@ -1384,13 +1384,22 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate {
}
return promise.then(() => {
if (handler) {
// Update status of the module.
const packageId = this.filepoolProvider.getPackageId(handler.component, module.id);
this.statusCache.setValue(packageId, 'downloadedSize', 0);
if (!handler) {
return;
}
// Update downloaded size.
const packageId = this.filepoolProvider.getPackageId(handler.component, module.id);
this.statusCache.setValue(packageId, 'downloadedSize', 0);
// If module is downloadable, set not dowloaded status.
return this.isModuleDownloadable(module, courseId).then((downloadable) => {
if (!downloadable) {
return;
}
return this.filepoolProvider.storePackageStatus(siteId, CoreConstants.NOT_DOWNLOADED, handler.component, module.id);
}
});
});
}