MOBILE-2525 course: Fix context menu info not updated in modules
parent
e6c5607463
commit
12787403d6
|
@ -41,7 +41,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
|
||||||
size: string; // Used when calling fillContextMenu.
|
size: string; // Used when calling fillContextMenu.
|
||||||
|
|
||||||
protected isDestroyed; // Whether the component is destroyed, used when calling fillContextMenu.
|
protected isDestroyed; // Whether the component is destroyed, used when calling fillContextMenu.
|
||||||
protected statusObserver; // Observer of package status changed, used when calling fillContextMenu.
|
protected contextMenuStatusObserver; // Observer of package status changed, used when calling fillContextMenu.
|
||||||
protected fetchContentDefaultError = 'core.course.errorgetmodule'; // Default error to show when loading contents.
|
protected fetchContentDefaultError = 'core.course.errorgetmodule'; // Default error to show when loading contents.
|
||||||
protected isCurrentView: boolean; // Whether the component is in the current view.
|
protected isCurrentView: boolean; // Whether the component is in the current view.
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy,
|
||||||
*/
|
*/
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.isDestroyed = true;
|
this.isDestroyed = true;
|
||||||
this.statusObserver && this.statusObserver.off();
|
this.contextMenuStatusObserver && this.contextMenuStatusObserver.off();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -719,8 +719,8 @@ export class CoreCourseHelperProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof instance.statusObserver == 'undefined' && component) {
|
if (typeof instance.contextMenuStatusObserver == 'undefined' && component) {
|
||||||
instance.statusObserver = this.eventsProvider.on(CoreEventsProvider.PACKAGE_STATUS_CHANGED, (data) => {
|
instance.contextMenuStatusObserver = this.eventsProvider.on(CoreEventsProvider.PACKAGE_STATUS_CHANGED, (data) => {
|
||||||
if (data.componentId == module.id && data.component == component) {
|
if (data.componentId == module.id && data.component == component) {
|
||||||
this.fillContextMenu(instance, module, courseId, false, component);
|
this.fillContextMenu(instance, module, courseId, false, component);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue