MOBILE-2795 url: Log view on embedded content

main
Pau Ferrer Ocaña 2019-01-10 11:15:20 +01:00
parent 8cafbfdd9f
commit 75551cfc72
1 changed files with 18 additions and 4 deletions

View File

@ -57,7 +57,12 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo
this.canGetUrl = this.urlProvider.isGetUrlWSAvailable();
this.loadContent();
this.loadContent().then(() => {
if ((this.shouldIframe || (this.shouldEmbed && this.isOther)) ||
(!this.shouldIframe && (!this.shouldEmbed || !this.isOther))) {
this.logView();
}
});
}
/**
@ -168,14 +173,23 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo
}
/**
* Opens a file.
* Log view into the site and checks module completion.
*
* @return {Promise<void>} Promise resolved when done.
*/
go(): void {
this.urlProvider.logView(this.module.instance).then(() => {
protected logView(): Promise<void> {
return this.urlProvider.logView(this.module.instance).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completiondata);
}).catch(() => {
// Ignore errors.
});
}
/**
* Opens a file.
*/
go(): void {
this.logView();
this.urlHelper.open(this.url);
}
}