Skip to content

Commit 9b9493f

Browse files
committed
MOBILE-3590 h5p: Don't display embed button in the app
1 parent 0cf2b3c commit 9b9493f

File tree

3 files changed

+18
-25
lines changed

3 files changed

+18
-25
lines changed

src/core/h5p/classes/core.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -270,22 +270,13 @@ export class CoreH5PCore {
270270
// Never allow downloading in the app.
271271
displayOptions[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD] = false;
272272

273-
// Embed - force setting it if always on or always off. In web, this is done when storing in DB.
274-
const embed = this.h5pFramework.getOption(CoreH5PCore.DISPLAY_OPTION_EMBED, CoreH5PDisplayOptionBehaviour.ALWAYS_SHOW);
275-
if (embed == CoreH5PDisplayOptionBehaviour.ALWAYS_SHOW || embed == CoreH5PDisplayOptionBehaviour.NEVER_SHOW) {
276-
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] = (embed == CoreH5PDisplayOptionBehaviour.ALWAYS_SHOW);
277-
}
273+
// Never show the embed option in the app.
274+
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] = false;
278275

279276
if (!this.h5pFramework.getOption(CoreH5PCore.DISPLAY_OPTION_FRAME, true)) {
280277
displayOptions[CoreH5PCore.DISPLAY_OPTION_FRAME] = false;
281-
} else {
282-
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] = this.setDisplayOptionOverrides(
283-
CoreH5PCore.DISPLAY_OPTION_EMBED, CoreH5PPermission.EMBED_H5P, id,
284-
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED]);
285-
286-
if (this.h5pFramework.getOption(CoreH5PCore.DISPLAY_OPTION_COPYRIGHT, true) == false) {
287-
displayOptions[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT] = false;
288-
}
278+
} else if (this.h5pFramework.getOption(CoreH5PCore.DISPLAY_OPTION_COPYRIGHT, true) == false) {
279+
displayOptions[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT] = false;
289280
}
290281

291282
displayOptions[CoreH5PCore.DISPLAY_OPTION_COPY] = this.h5pFramework.hasPermission(CoreH5PPermission.COPY_H5P, id);
@@ -506,8 +497,8 @@ export class CoreH5PCore {
506497

507498
// tslint:disable: no-bitwise
508499
displayOptions[CoreH5PCore.DISPLAY_OPTION_FRAME] = !(disable & CoreH5PCore.DISABLE_FRAME);
509-
displayOptions[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD] = !(disable & CoreH5PCore.DISABLE_DOWNLOAD);
510-
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] = !(disable & CoreH5PCore.DISABLE_EMBED);
500+
displayOptions[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD] = false; // Never allow downloading in the app.
501+
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] = false; // Never show the embed option in the app.
511502
displayOptions[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT] = !(disable & CoreH5PCore.DISABLE_COPYRIGHT);
512503
displayOptions[CoreH5PCore.DISPLAY_OPTION_ABOUT] = !!this.h5pFramework.getOption(CoreH5PCore.DISPLAY_OPTION_ABOUT, true);
513504

src/core/h5p/classes/helper.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ export class CoreH5PHelper {
3535
* @return Object with display options.
3636
*/
3737
static decodeDisplayOptions(displayOptions: number): CoreH5PDisplayOptions {
38-
const config: any = {};
3938
const displayOptionsObject = CoreH5P.instance.h5pCore.getDisplayOptionsAsObject(displayOptions);
4039

41-
config.export = false; // Don't allow downloading in the app.
42-
config.embed = CoreUtils.instance.notNullOrUndefined(displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_EMBED]) ?
43-
displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_EMBED] : false;
44-
config.copyright = CoreUtils.instance.notNullOrUndefined(displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT]) ?
45-
displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT] : false;
40+
const config: CoreH5PDisplayOptions = {
41+
export: false, // Don't allow downloading in the app.
42+
embed: false, // Don't display the embed button in the app.
43+
copyright: CoreUtils.instance.notNullOrUndefined(displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT]) ?
44+
displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT] : false,
45+
icon: CoreUtils.instance.notNullOrUndefined(displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_ABOUT]) ?
46+
displayOptionsObject[CoreH5PCore.DISPLAY_OPTION_ABOUT] : false,
47+
};
48+
49+
config.frame = config.copyright || config.export || config.embed;
4650

4751
return config;
4852
}

src/core/h5p/classes/player.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,8 @@ export class CoreH5PPlayer {
301301
return displayOptions;
302302
}
303303

304-
displayOptions[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD] =
305-
CoreUtils.instance.isTrueOrOne(params[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD]);
306-
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] =
307-
CoreUtils.instance.isTrueOrOne(params[CoreH5PCore.DISPLAY_OPTION_EMBED]);
304+
displayOptions[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD] = false; // Never allow downloading in the app.
305+
displayOptions[CoreH5PCore.DISPLAY_OPTION_EMBED] = false; // Never show the embed option in the app.
308306
displayOptions[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT] =
309307
CoreUtils.instance.isTrueOrOne(params[CoreH5PCore.DISPLAY_OPTION_COPYRIGHT]);
310308
displayOptions[CoreH5PCore.DISPLAY_OPTION_FRAME] = displayOptions[CoreH5PCore.DISPLAY_OPTION_DOWNLOAD] ||

0 commit comments

Comments
 (0)