diff --git a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html index 2d67aeb9a..74641e68c 100644 --- a/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html +++ b/src/addons/mod/feedback/components/index/addon-mod-feedback-index.html @@ -74,7 +74,7 @@ + [button]="access.canviewreports && completedCount > 0">

{{ 'addon.mod_feedback.completed_feedbacks' | translate }}

diff --git a/src/addons/mod/feedback/pages/form/form.html b/src/addons/mod/feedback/pages/form/form.html index 2a2af980e..209a184bf 100644 --- a/src/addons/mod/feedback/pages/form/form.html +++ b/src/addons/mod/feedback/pages/form/form.html @@ -154,8 +154,8 @@
- - + + diff --git a/src/addons/mod/feedback/services/feedback.ts b/src/addons/mod/feedback/services/feedback.ts index 7181b1031..c1b696b67 100644 --- a/src/addons/mod/feedback/services/feedback.ts +++ b/src/addons/mod/feedback/services/feedback.ts @@ -172,11 +172,12 @@ export class AddonModFeedbackProvider { return array.concat(responses); }, []).map((valueEntry) => { const parts = valueEntry.id.split('_'); + const item = (parts[1] || '').replace(/\[.*\]/, ''); // Remove [0] and similar. return { ...valueEntry, typ: parts[0], - item: Number(parts[1]), + item: Number(item), }; }); diff --git a/src/addons/mod/feedback/services/handlers/prefetch.ts b/src/addons/mod/feedback/services/handlers/prefetch.ts index 97faa96ac..88a346d88 100644 --- a/src/addons/mod/feedback/services/handlers/prefetch.ts +++ b/src/addons/mod/feedback/services/handlers/prefetch.ts @@ -93,9 +93,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr * @inheritdoc */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { - const feedback = await AddonModFeedback.getFeedback(courseId, module.id, { - readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE, - }); + const feedback = await AddonModFeedback.getFeedback(courseId, module.id); const now = CoreTimeUtils.timestamp(); diff --git a/src/addons/mod/h5pactivity/components/index/index.ts b/src/addons/mod/h5pactivity/components/index/index.ts index 0f76adba3..e2f69620e 100644 --- a/src/addons/mod/h5pactivity/components/index/index.ts +++ b/src/addons/mod/h5pactivity/components/index/index.ts @@ -80,6 +80,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv hasOffline = false; isOpeningPage = false; + protected listeningResize = false; protected fetchContentDefaultError = 'addon.mod_h5pactivity.errorgetactivity'; protected syncEventName = AddonModH5PActivitySyncProvider.AUTO_SYNCED; protected site: CoreSite; @@ -372,8 +373,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv CoreCourse.checkModuleCompletion(this.courseId, this.module.completiondata); - window.addEventListener('resize', this.contentResized.bind(this)); - this.contentResized(); + this.setResizeListener(); } /** @@ -488,6 +488,19 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv } } + /** + * Set the resize listener if needed. + */ + setResizeListener(): void { + if (!this.playing || this.listeningResize) { + return; + } + + this.listeningResize = true; + window.addEventListener('resize', this.contentResized.bind(this)); + this.contentResized(); + } + /** * On content resize, change visibility of the main menu: show on portrait and hide on landscape. */ @@ -495,6 +508,25 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv this.mainMenuPage.changeVisibility(Platform.isPortrait()); } + /** + * @inheritdoc + */ + ionViewDidEnter(): void { + this.setResizeListener(); + } + + /** + * @inheritdoc + */ + ionViewWillLeave(): void { + this.mainMenuPage.changeVisibility(true); + + if (this.listeningResize) { + this.listeningResize = false; + window.removeEventListener('resize', this.resizeFunction); + } + } + /** * Component destroyed. */ @@ -503,10 +535,6 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv this.observer?.off(); window.removeEventListener('message', this.messageListenerFunction); - - if (this.playing) { - window.removeEventListener('resize', this.resizeFunction); - } } } diff --git a/src/addons/mod/lesson/components/index/index.ts b/src/addons/mod/lesson/components/index/index.ts index 8557039c3..522d769fa 100644 --- a/src/addons/mod/lesson/components/index/index.ts +++ b/src/addons/mod/lesson/components/index/index.ts @@ -470,13 +470,13 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Review the lesson. */ - review(): void { + async review(): Promise { if (!this.retakeToReview || !this.lesson) { // No retake to review, stop. return; } - CoreNavigator.navigateToSitePath( + await CoreNavigator.navigateToSitePath( `${AddonModLessonModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/player`, { params: { @@ -487,6 +487,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo }, }, ); + + this.retakeToReview = undefined; } /** diff --git a/src/addons/mod/lesson/pages/player/player.html b/src/addons/mod/lesson/pages/player/player.html index 816db0f4e..b5a0a9e7b 100644 --- a/src/addons/mod/lesson/pages/player/player.html +++ b/src/addons/mod/lesson/pages/player/player.html @@ -186,13 +186,14 @@ + + + + {{ 'addon.mod_lesson.finishretakeoffline' | translate }} + + + -
- - - {{ 'addon.mod_lesson.finishretakeoffline' | translate }} - -
{{ 'addon.mod_lesson.congratulations' | translate }} diff --git a/src/addons/mod/lesson/pages/player/player.page.ts b/src/addons/mod/lesson/pages/player/player.page.ts index 303d8add6..9d5d7db72 100644 --- a/src/addons/mod/lesson/pages/player/player.page.ts +++ b/src/addons/mod/lesson/pages/player/player.page.ts @@ -272,8 +272,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { // If lesson has offline data already, use offline mode. this.offline = await AddonModLessonOffline.hasOfflineData(this.lesson.id); - if (!this.offline && !CoreApp.isOnline() && AddonModLesson.isLessonOffline(this.lesson) && - !this.review) { + if (!this.offline && !CoreApp.isOnline() && AddonModLesson.isLessonOffline(this.lesson) && !this.review) { // Lesson doesn't have offline data, but it allows offline and the device is offline. Use offline mode. this.offline = true; } @@ -586,11 +585,12 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { this.originalData = undefined; } - if (data.displaymenu && !this.displayMenu) { + // Don't display the navigation menu in review mode, using them displays errors. + if (data.displaymenu && !this.displayMenu && !this.review) { // Load the menu. this.loadMenu(); } - this.displayMenu = !!data.displaymenu; + this.displayMenu = !this.review && !!data.displaymenu; if (!this.firstPageLoaded) { this.firstPageLoaded = true; diff --git a/src/addons/mod/scorm/pages/player/player.html b/src/addons/mod/scorm/pages/player/player.html index ffc225db0..5bf9e6959 100644 --- a/src/addons/mod/scorm/pages/player/player.html +++ b/src/addons/mod/scorm/pages/player/player.html @@ -18,7 +18,7 @@ - + diff --git a/src/addons/mod/scorm/pages/player/player.ts b/src/addons/mod/scorm/pages/player/player.ts index fccabab23..c24a3d9fd 100644 --- a/src/addons/mod/scorm/pages/player/player.ts +++ b/src/addons/mod/scorm/pages/player/player.ts @@ -533,6 +533,22 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { })); } + /** + * @inheritdoc + */ + ionViewDidEnter(): void { + if (this.scorm && this.scorm.popup) { + this.mainMenuPage.changeVisibility(false); + } + } + + /** + * @inheritdoc + */ + ionViewWillLeave(): void { + this.mainMenuPage.changeVisibility(true); + } + /** * Component being destroyed. */ @@ -549,8 +565,6 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { this.goOfflineObserver?.off(); }, 500); - this.mainMenuPage.changeVisibility(true); - // Unblock the SCORM so it can be synced. CoreSync.unblockOperation(AddonModScormProvider.COMPONENT, this.scorm.id, 'player'); } diff --git a/src/addons/mod/workshop/services/workshop-sync.ts b/src/addons/mod/workshop/services/workshop-sync.ts index 73ab2e22c..aef9e01ce 100644 --- a/src/addons/mod/workshop/services/workshop-sync.ts +++ b/src/addons/mod/workshop/services/workshop-sync.ts @@ -345,6 +345,8 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider - +
diff --git a/src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts b/src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts index 9cbc3878b..72bcdb169 100644 --- a/src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts +++ b/src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts @@ -72,7 +72,7 @@ export class CoreH5PIframeComponent implements OnChanges, OnDestroy { this.subscription = router.events .pipe(filter(event => event instanceof NavigationEnd)) .subscribe((event: NavigationEnd) => { - if (!this.iframeLoadedOnce || event.urlAfterRedirects == this.currentPageRoute) { + if (!this.iframeLoadedOnce || event.urlAfterRedirects !== this.currentPageRoute) { return; }