From b5a83cd9b6a03b91d0754c6ef5e79c664b16128d Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Wed, 6 Mar 2019 12:29:01 +0100 Subject: [PATCH] MOBILE-2892 url: Fetch module contents when opening URL --- src/addon/mod/url/providers/module-handler.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/addon/mod/url/providers/module-handler.ts b/src/addon/mod/url/providers/module-handler.ts index 6c205ae51..9cf493fd9 100644 --- a/src/addon/mod/url/providers/module-handler.ts +++ b/src/addon/mod/url/providers/module-handler.ts @@ -75,8 +75,12 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { action(event: Event, navCtrl: NavController, module: any, courseId: number, options: NavOptions, params?: any): void { const modal = handler.domUtils.showModalLoading(); - // First of all, check if the URL can be handled by the app. If so, always open it directly. - handler.contentLinksHelper.canHandleLink(module.contents[0].fileurl, courseId).then((canHandle) => { + // First of all, make sure module contents are loaded. + handler.courseProvider.loadModuleContents(module, courseId, undefined, false, false, undefined, handler.modName) + .then(() => { + // Check if the URL can be handled by the app. If so, always open it directly. + return handler.contentLinksHelper.canHandleLink(module.contents[0].fileurl, courseId); + }).then((canHandle) => { if (canHandle) { // URL handled by the app, open it directly. return true;