Merge pull request #1794 from albertgasset/MOBILE-2892
MOBILE-2892 url: Fetch module contents when opening URLmain
commit
80e8c89a37
|
@ -75,8 +75,12 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler {
|
||||||
action(event: Event, navCtrl: NavController, module: any, courseId: number, options: NavOptions, params?: any): void {
|
action(event: Event, navCtrl: NavController, module: any, courseId: number, options: NavOptions, params?: any): void {
|
||||||
const modal = handler.domUtils.showModalLoading();
|
const modal = handler.domUtils.showModalLoading();
|
||||||
|
|
||||||
// First of all, check if the URL can be handled by the app. If so, always open it directly.
|
// First of all, make sure module contents are loaded.
|
||||||
handler.contentLinksHelper.canHandleLink(module.contents[0].fileurl, courseId).then((canHandle) => {
|
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) {
|
if (canHandle) {
|
||||||
// URL handled by the app, open it directly.
|
// URL handled by the app, open it directly.
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue