MOBILE-2567 lti: Fix LTI icons not displayed
parent
9d09a31af5
commit
a0d76b9370
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { NavController, NavOptions } from 'ionic-angular';
|
import { NavController, NavOptions } from 'ionic-angular';
|
||||||
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
|
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@core/course/providers/module-delegate';
|
||||||
import { CoreAppProvider } from '@providers/app';
|
import { CoreAppProvider } from '@providers/app';
|
||||||
import { CoreCourseProvider } from '@core/course/providers/course';
|
import { CoreCourseProvider } from '@core/course/providers/course';
|
||||||
|
@ -36,7 +37,8 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler {
|
||||||
private domUtils: CoreDomUtilsProvider,
|
private domUtils: CoreDomUtilsProvider,
|
||||||
private filepoolProvider: CoreFilepoolProvider,
|
private filepoolProvider: CoreFilepoolProvider,
|
||||||
private sitesProvider: CoreSitesProvider,
|
private sitesProvider: CoreSitesProvider,
|
||||||
private ltiProvider: AddonModLtiProvider) {}
|
private ltiProvider: AddonModLtiProvider,
|
||||||
|
private sanitizer: DomSanitizer) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the handler is enabled on a site level.
|
* Check if the handler is enabled on a site level.
|
||||||
|
@ -100,11 +102,11 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler {
|
||||||
// Get the internal URL.
|
// Get the internal URL.
|
||||||
return this.filepoolProvider.getSrcByUrl(siteId, icon, AddonModLtiProvider.COMPONENT, module.id);
|
return this.filepoolProvider.getSrcByUrl(siteId, icon, AddonModLtiProvider.COMPONENT, module.id);
|
||||||
}).then((url) => {
|
}).then((url) => {
|
||||||
data.icon = url;
|
data.icon = this.sanitizer.bypassSecurityTrustUrl(url);
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
// Error downloading. If we're online we'll set the online url.
|
// Error downloading. If we're online we'll set the online url.
|
||||||
if (this.appProvider.isOnline()) {
|
if (this.appProvider.isOnline()) {
|
||||||
data.icon = icon;
|
data.icon = this.sanitizer.bypassSecurityTrustUrl(icon);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import { Injectable, Injector } from '@angular/core';
|
import { Injectable, Injector } from '@angular/core';
|
||||||
import { NavController, NavOptions } from 'ionic-angular';
|
import { NavController, NavOptions } from 'ionic-angular';
|
||||||
|
import { SafeUrl } from '@angular/platform-browser';
|
||||||
import { CoreEventsProvider } from '@providers/events';
|
import { CoreEventsProvider } from '@providers/events';
|
||||||
import { CoreLoggerProvider } from '@providers/logger';
|
import { CoreLoggerProvider } from '@providers/logger';
|
||||||
import { CoreSitesProvider } from '@providers/sites';
|
import { CoreSitesProvider } from '@providers/sites';
|
||||||
|
@ -77,7 +78,7 @@ export interface CoreCourseModuleHandlerData {
|
||||||
* The image to use as icon (path to the image).
|
* The image to use as icon (path to the image).
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
icon?: string;
|
icon?: string | SafeUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class to assign to the item.
|
* The class to assign to the item.
|
||||||
|
|
Loading…
Reference in New Issue