From 6c1712ed762e4902292e9b8935de4965b6f02c61 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 15 Jun 2021 12:41:07 +0200 Subject: [PATCH 01/11] MOBILE-3320 scorm: Fix SCORM height --- src/addons/mod/scorm/pages/player/player.html | 2 +- src/core/components/loading/loading.scss | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/addons/mod/scorm/pages/player/player.html b/src/addons/mod/scorm/pages/player/player.html index f0bbd46b8..7e5b687dd 100644 --- a/src/addons/mod/scorm/pages/player/player.html +++ b/src/addons/mod/scorm/pages/player/player.html @@ -17,7 +17,7 @@ - + diff --git a/src/core/components/loading/loading.scss b/src/core/components/loading/loading.scss index c29e4f9b7..60b6358fc 100644 --- a/src/core/components/loading/loading.scss +++ b/src/core/components/loading/loading.scss @@ -51,8 +51,8 @@ @include margin(10px, 0, 0, 0); } - &.core-loading-noheight .core-loading-content { - height: auto; + &.core-loading-fullheight .core-loading-content { + height: 100%; } &.core-loading-loaded { From 22edea2dfc61d06bd1dac2dff2736b3f6277210c Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 15 Jun 2021 15:00:08 +0200 Subject: [PATCH 02/11] MOBILE-3320 lesson: Hide nav menu when reviewing the lesson --- src/addons/mod/lesson/pages/player/player.page.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; From 7de65ddd5a409ffcd3cb2774670033e303b36b3f Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 15 Jun 2021 15:37:51 +0200 Subject: [PATCH 03/11] MOBILE-3320 lesson: Remove sync review button after clicked --- src/addons/mod/lesson/components/index/index.ts | 6 ++++-- src/addons/mod/lesson/pages/player/player.html | 13 +++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) 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 }} From 3f7dfb254943ba8a979bdc47a71b1d7abab1a7d6 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 16 Jun 2021 10:02:25 +0200 Subject: [PATCH 04/11] MOBILE-3320 workshop: Fix offline warning never disappearing --- src/addons/mod/workshop/services/workshop-sync.ts | 4 ++++ 1 file changed, 4 insertions(+) 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 Date: Wed, 16 Jun 2021 10:25:09 +0200 Subject: [PATCH 05/11] MOBILE-3320 core: Fix wrong align in capture media modal --- .../emulator/components/capture-media/capture-media.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/features/emulator/components/capture-media/capture-media.html b/src/core/features/emulator/components/capture-media/capture-media.html index e44f37942..544e4dc95 100644 --- a/src/core/features/emulator/components/capture-media/capture-media.html +++ b/src/core/features/emulator/components/capture-media/capture-media.html @@ -9,7 +9,7 @@ - +
From cbb69db301ada5b78f8447859dbd29b80029016f Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 16 Jun 2021 12:09:05 +0200 Subject: [PATCH 06/11] MOBILE-3320 core: Fix hide tabs issues in SCORM and H5P --- .../mod/h5pactivity/components/index/index.ts | 40 ++++++++++++++++--- src/addons/mod/scorm/pages/player/player.ts | 18 ++++++++- .../course/classes/main-activity-page.ts | 14 +++++++ .../course/classes/main-resource-component.ts | 14 +++++++ 4 files changed, 78 insertions(+), 8 deletions(-) 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/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/core/features/course/classes/main-activity-page.ts b/src/core/features/course/classes/main-activity-page.ts index 8d1ce25c9..4c66ba3b0 100644 --- a/src/core/features/course/classes/main-activity-page.ts +++ b/src/core/features/course/classes/main-activity-page.ts @@ -64,4 +64,18 @@ export class CoreCourseModuleMainActivityPage Date: Wed, 16 Jun 2021 12:59:53 +0200 Subject: [PATCH 07/11] MOBILE-3320 h5p: Fix package disappear when opening new pages --- src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From fae349a96d2a69e8292010a42c6805f35249f404 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 16 Jun 2021 14:53:51 +0200 Subject: [PATCH 08/11] MOBILE-3320 feedback: Fix new feedbacks not downloadable --- src/addons/mod/feedback/services/handlers/prefetch.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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(); From 3368b17eb6db7fdcaf30eedabc3a3e2085e815e7 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 16 Jun 2021 14:55:51 +0200 Subject: [PATCH 09/11] MOBILE-3320 feedback: Fix empty box at end of feedback --- src/addons/mod/feedback/pages/form/form.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 @@ - - + + From 88b0d3aa0a3f2e59e6ede5c703dfaa781851a2ac Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 16 Jun 2021 15:15:19 +0200 Subject: [PATCH 10/11] MOBILE-3320 feedback: Remove wrong click effect for students --- .../mod/feedback/components/index/addon-mod-feedback-index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 }}

From da050a66c836293fd9acfa5425bcf52a075e105c Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 16 Jun 2021 16:14:04 +0200 Subject: [PATCH 11/11] MOBILE-3320 feedback: Fix some offline answers not loaded --- src/addons/mod/feedback/services/feedback.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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), }; });