MOBILE-3930 course: Mark site plugins as module viewed
parent
6c518d55fa
commit
d42bbdf2ca
|
@ -21,6 +21,7 @@ import {
|
|||
CoreCourseModuleSummaryResult,
|
||||
CoreCourseModuleSummaryComponent,
|
||||
} from '@features/course/components/module-summary/module-summary';
|
||||
import { CoreCourse } from '@features/course/services/course';
|
||||
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
|
||||
import {
|
||||
CoreCourseModuleDelegate,
|
||||
|
@ -35,7 +36,7 @@ import {
|
|||
import { IonRefresher } from '@ionic/angular';
|
||||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
|
||||
import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoadedData } from '../plugin-content/plugin-content';
|
||||
|
||||
/**
|
||||
* Component that displays the index of a module site plugin.
|
||||
|
@ -161,9 +162,12 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C
|
|||
/**
|
||||
* Function called when the data of the site plugin content is loaded.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
contentLoaded(refresh: boolean): void {
|
||||
return;
|
||||
contentLoaded(data: CoreSitePluginsPluginContentLoadedData): void {
|
||||
if (data.success) {
|
||||
CoreCourse.storeModuleViewed(this.courseId, this.module.id, {
|
||||
sectionId: this.module.section,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
|||
@Input() data?: Record<string, unknown>; // Data to pass to the component.
|
||||
@Input() preSets?: CoreSiteWSPreSets; // The preSets for the WS call.
|
||||
@Input() pageTitle?: string; // Current page title. It can be used by the "new-content" directives.
|
||||
@Output() onContentLoaded = new EventEmitter<boolean>(); // Emits an event when the content is loaded.
|
||||
@Output() onContentLoaded = new EventEmitter<CoreSitePluginsPluginContentLoadedData>(); // Emits event when content is loaded.
|
||||
@Output() onLoadingContent = new EventEmitter<boolean>(); // Emits an event when starts to load the content.
|
||||
|
||||
content?: string; // Content.
|
||||
|
@ -114,11 +114,11 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
|||
this.jsData.updateContent = this.updateContent.bind(this);
|
||||
this.jsData.updateModuleCourseContent = this.updateModuleCourseContent.bind(this);
|
||||
|
||||
this.onContentLoaded.emit(refresh);
|
||||
this.onContentLoaded.emit({ refresh: !!refresh, success: true });
|
||||
} catch (error) {
|
||||
// Make it think it's loaded - otherwise it sticks on 'loading' and stops navigation working.
|
||||
this.content = '<div></div>';
|
||||
this.onContentLoaded.emit(refresh);
|
||||
this.onContentLoaded.emit({ refresh: !!refresh, success: false });
|
||||
|
||||
CoreDomUtils.showErrorModalDefault(error, 'core.errorloadingcontent', true);
|
||||
} finally {
|
||||
|
@ -237,3 +237,8 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
export type CoreSitePluginsPluginContentLoadedData = {
|
||||
refresh: boolean;
|
||||
success: boolean;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue