From 2b6bcb7d7e2a8b51ab859693d157dedea36a42d3 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 28 Jul 2020 11:40:10 +0200 Subject: [PATCH] MOBILE-3265 h5p: Delete content indexes when change language --- src/core/h5p/h5p.module.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/h5p/h5p.module.ts b/src/core/h5p/h5p.module.ts index 834278fc5..d2409309f 100644 --- a/src/core/h5p/h5p.module.ts +++ b/src/core/h5p/h5p.module.ts @@ -14,8 +14,9 @@ import { NgModule } from '@angular/core'; import { CoreH5PComponentsModule } from './components/components.module'; -import { CoreH5PProvider } from './providers/h5p'; +import { CoreH5P, CoreH5PProvider } from './providers/h5p'; import { CoreH5PPluginFileHandler } from './providers/pluginfile-handler'; +import { CoreEventsProvider } from '@providers/events'; import { CorePluginFileDelegate } from '@providers/plugin-file-delegate'; // List of providers (without handlers). @@ -36,8 +37,14 @@ export const CORE_H5P_PROVIDERS: any[] = [ }) export class CoreH5PModule { constructor(pluginfileDelegate: CorePluginFileDelegate, - pluginfileHandler: CoreH5PPluginFileHandler) { + pluginfileHandler: CoreH5PPluginFileHandler, + eventsProvider: CoreEventsProvider) { pluginfileDelegate.registerHandler(pluginfileHandler); + + // Delete content indexes if language changes, to update the strings. + eventsProvider.on(CoreEventsProvider.LANGUAGE_CHANGED, () => { + CoreH5P.instance.h5pPlayer.deleteAllContentIndexes(); + }); } }