MOBILE-3320 course: Fix course downloaded icon
parent
b1db34ebaa
commit
aa106f3728
|
@ -477,7 +477,12 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
|
||||||
* @param status Status to show.
|
* @param status Status to show.
|
||||||
*/
|
*/
|
||||||
protected updateCourseStatus(status: string): void {
|
protected updateCourseStatus(status: string): void {
|
||||||
this.prefetchCourseData = CoreCourseHelper.getCourseStatusIconAndTitleFromStatus(status);
|
const statusData = CoreCourseHelper.getCoursePrefetchStatusInfo(status);
|
||||||
|
|
||||||
|
this.prefetchCourseData.status = statusData.status;
|
||||||
|
this.prefetchCourseData.icon = statusData.icon;
|
||||||
|
this.prefetchCourseData.statusTranslatable = statusData.statusTranslatable;
|
||||||
|
this.prefetchCourseData.loading = statusData.loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -402,7 +402,12 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy {
|
||||||
* @param status Status to show.
|
* @param status Status to show.
|
||||||
*/
|
*/
|
||||||
protected updateCourseStatus(status: string): void {
|
protected updateCourseStatus(status: string): void {
|
||||||
this.prefetchCourseData = CoreCourseHelper.getCourseStatusIconAndTitleFromStatus(status);
|
const statusData = CoreCourseHelper.getCoursePrefetchStatusInfo(status);
|
||||||
|
|
||||||
|
this.prefetchCourseData.status = statusData.status;
|
||||||
|
this.prefetchCourseData.icon = statusData.icon;
|
||||||
|
this.prefetchCourseData.statusTranslatable = statusData.statusTranslatable;
|
||||||
|
this.prefetchCourseData.loading = statusData.loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1163,7 +1163,7 @@ export class CoreCourseHelperProvider {
|
||||||
|
|
||||||
const status = await this.determineCoursesStatus(courses);
|
const status = await this.determineCoursesStatus(courses);
|
||||||
|
|
||||||
prefetch = this.getCourseStatusIconAndTitleFromStatus(status);
|
prefetch = this.getCoursePrefetchStatusInfo(status);
|
||||||
|
|
||||||
if (prefetch.loading) {
|
if (prefetch.loading) {
|
||||||
// It seems all courses are being downloaded, show a download button instead.
|
// It seems all courses are being downloaded, show a download button instead.
|
||||||
|
@ -1298,16 +1298,16 @@ export class CoreCourseHelperProvider {
|
||||||
async getCourseStatusIconAndTitle(courseId: number, siteId?: string): Promise<CorePrefetchStatusInfo> {
|
async getCourseStatusIconAndTitle(courseId: number, siteId?: string): Promise<CorePrefetchStatusInfo> {
|
||||||
const status = await CoreCourse.getCourseStatus(courseId, siteId);
|
const status = await CoreCourse.getCourseStatus(courseId, siteId);
|
||||||
|
|
||||||
return this.getCourseStatusIconAndTitleFromStatus(status);
|
return this.getCoursePrefetchStatusInfo(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a course status icon and the langkey to use as a title from status.
|
* Get a course status icon and the langkey to use as a title from status.
|
||||||
*
|
*
|
||||||
* @param status Course status.
|
* @param status Course status.
|
||||||
* @return Title and icon name.
|
* @return Prefetch status info.
|
||||||
*/
|
*/
|
||||||
getCourseStatusIconAndTitleFromStatus(status: string): CorePrefetchStatusInfo {
|
getCoursePrefetchStatusInfo(status: string): CorePrefetchStatusInfo {
|
||||||
const prefetchStatus: CorePrefetchStatusInfo = {
|
const prefetchStatus: CorePrefetchStatusInfo = {
|
||||||
status: status,
|
status: status,
|
||||||
icon: this.getPrefetchStatusIcon(status, false),
|
icon: this.getPrefetchStatusIcon(status, false),
|
||||||
|
|
|
@ -49,6 +49,11 @@
|
||||||
<ion-spinner *ngIf="(downloadCourseEnabled && prefetchCourseData.icon == 'spinner') || showSpinner"
|
<ion-spinner *ngIf="(downloadCourseEnabled && prefetchCourseData.icon == 'spinner') || showSpinner"
|
||||||
[attr.aria-label]="'core.loading' | translate"></ion-spinner>
|
[attr.aria-label]="'core.loading' | translate"></ion-spinner>
|
||||||
|
|
||||||
|
<!-- Downloaded icon. -->
|
||||||
|
<ion-icon *ngIf="downloadCourseEnabled && prefetchCourseData.downloadSucceeded && !showSpinner"
|
||||||
|
class="core-icon-downloaded" name="cloud-done" color="success" role="status"
|
||||||
|
[attr.aria-label]="'core.downloaded' | translate"></ion-icon>
|
||||||
|
|
||||||
<!-- Options menu. -->
|
<!-- Options menu. -->
|
||||||
<ion-button fill="clear" color="dark" (click)="showCourseOptionsMenu($event)" *ngIf="!showSpinner"
|
<ion-button fill="clear" color="dark" (click)="showCourseOptionsMenu($event)" *ngIf="!showSpinner"
|
||||||
[attr.aria-label]="('core.displayoptions' | translate)">
|
[attr.aria-label]="('core.displayoptions' | translate)">
|
||||||
|
|
|
@ -107,7 +107,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy {
|
||||||
// Determine course prefetch icon.
|
// Determine course prefetch icon.
|
||||||
const status = await CoreCourse.getCourseStatus(this.course.id);
|
const status = await CoreCourse.getCourseStatus(this.course.id);
|
||||||
|
|
||||||
this.prefetchCourseData = CoreCourseHelper.getCourseStatusIconAndTitleFromStatus(status);
|
this.prefetchCourseData = CoreCourseHelper.getCoursePrefetchStatusInfo(status);
|
||||||
this.courseStatus = status;
|
this.courseStatus = status;
|
||||||
|
|
||||||
if (this.prefetchCourseData.loading) {
|
if (this.prefetchCourseData.loading) {
|
||||||
|
@ -184,9 +184,13 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy {
|
||||||
* @param status Status to show.
|
* @param status Status to show.
|
||||||
*/
|
*/
|
||||||
protected updateCourseStatus(status: string): void {
|
protected updateCourseStatus(status: string): void {
|
||||||
this.prefetchCourseData = CoreCourseHelper.getCourseStatusIconAndTitleFromStatus(status);
|
const statusData = CoreCourseHelper.getCoursePrefetchStatusInfo(status);
|
||||||
|
|
||||||
this.courseStatus = status;
|
this.courseStatus = status;
|
||||||
|
this.prefetchCourseData.status = statusData.status;
|
||||||
|
this.prefetchCourseData.icon = statusData.icon;
|
||||||
|
this.prefetchCourseData.statusTranslatable = statusData.statusTranslatable;
|
||||||
|
this.prefetchCourseData.loading = statusData.loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue