diff --git a/src/addons/calendar/components/calendar/addon-calendar-calendar.html b/src/addons/calendar/components/calendar/addon-calendar-calendar.html index a0aae3188..93d477d00 100644 --- a/src/addons/calendar/components/calendar/addon-calendar-calendar.html +++ b/src/addons/calendar/components/calendar/addon-calendar-calendar.html @@ -56,11 +56,11 @@ "duration_finish": day.haslastdayofevent }' [class.addon-calendar-event-past-day]="isPastMonth || day.ispast" - role="button cell" + role="cell" tabindex="0" (ariaButtonClick)="dayClicked(day.mday)" > -

+

{{ day.periodName | translate }}

diff --git a/src/addons/mod/data/services/data-helper.ts b/src/addons/mod/data/services/data-helper.ts index ee4ef04e3..9fc836dda 100644 --- a/src/addons/mod/data/services/data-helper.ts +++ b/src/addons/mod/data/services/data-helper.ts @@ -802,14 +802,14 @@ export class AddonModDataHelperProvider { offline: boolean, siteId?: string, ): Promise { - if (!files.length) { - return 0; - } - if (offline) { return this.storeFiles(dataId, entryId, fieldId, files, siteId); } + if (!files.length) { + return 0; + } + return CoreFileUploader.uploadOrReuploadFiles(files, AddonModDataProvider.COMPONENT, itemId, siteId); } diff --git a/src/addons/mod/quiz/pages/player/player.page.ts b/src/addons/mod/quiz/pages/player/player.page.ts index 8740e8d7d..27ea916c6 100644 --- a/src/addons/mod/quiz/pages/player/player.page.ts +++ b/src/addons/mod/quiz/pages/player/player.page.ts @@ -215,7 +215,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { // Reload the current page. const scrollElement = await this.content?.getScrollElement(); const scrollTop = scrollElement?.scrollTop || -1; - const scrollLeft = scrollElement?.scrollLeft || -1; this.loaded = false; this.content?.scrollToTop(); // Scroll top so the spinner is seen. @@ -224,8 +223,11 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { await this.loadPage(this.attempt!.currentpage!); } finally { this.loaded = true; - if (scrollTop != -1 && scrollLeft != -1) { - this.content?.scrollToPoint(scrollLeft, scrollTop); + if (scrollTop != -1) { + // Wait for content to be rendered. + setTimeout(() => { + this.content?.scrollToPoint(0, scrollTop); + }, 50); } } } catch (error) { diff --git a/src/addons/mod/survey/components/index/index.ts b/src/addons/mod/survey/components/index/index.ts index 8979f9e03..0be63e920 100644 --- a/src/addons/mod/survey/components/index/index.ts +++ b/src/addons/mod/survey/components/index/index.ts @@ -32,7 +32,12 @@ import { } from '../../services/survey'; import { AddonModSurveyHelper, AddonModSurveyQuestionFormatted } from '../../services/survey-helper'; import { AddonModSurveyOffline } from '../../services/survey-offline'; -import { AddonModSurveyAutoSyncData, AddonModSurveySync, AddonModSurveySyncResult } from '../../services/survey-sync'; +import { + AddonModSurveyAutoSyncData, + AddonModSurveySync, + AddonModSurveySyncProvider, + AddonModSurveySyncResult, +} from '../../services/survey-sync'; /** * Component that displays a survey. @@ -52,6 +57,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo answers: Record = {}; protected currentUserId?: number; + protected syncEventName = AddonModSurveySyncProvider.AUTO_SYNCED; constructor( protected content?: IonContent, diff --git a/src/addons/mod/wiki/components/index/index.ts b/src/addons/mod/wiki/components/index/index.ts index 355c38e7b..6fd242ed7 100644 --- a/src/addons/mod/wiki/components/index/index.ts +++ b/src/addons/mod/wiki/components/index/index.ts @@ -590,7 +590,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp if (modalData) { if (modalData.home) { // Go back to the initial page of the wiki. - CoreNavigator.navigateToSitePath(modalData.home); + CoreNavigator.navigateToSitePath(modalData.home, { animationDirection: 'back' }); } else if (modalData.page) { this.goToPage(modalData.page); } diff --git a/src/addons/mod/workshop/pages/edit-submission/edit-submission.html b/src/addons/mod/workshop/pages/edit-submission/edit-submission.html index f66fd99d1..65485c52c 100644 --- a/src/addons/mod/workshop/pages/edit-submission/edit-submission.html +++ b/src/addons/mod/workshop/pages/edit-submission/edit-submission.html @@ -37,7 +37,7 @@ elementId="content_editor" [draftExtraParams]="editorExtraParams"> - diff --git a/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts b/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts index b43f9e008..3cc680eb7 100644 --- a/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts +++ b/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts @@ -20,7 +20,6 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi import { CanLeave } from '@guards/can-leave'; import { CoreFile } from '@services/file'; import { CoreFileEntry, CoreFileHelper } from '@services/file-helper'; -import { CoreFileSession } from '@services/file-session'; import { CoreNavigator } from '@services/navigator'; import { CoreSites } from '@services/sites'; import { CoreSync } from '@services/sync'; @@ -67,6 +66,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca textRequired = false; fileAvailable = false; fileRequired = false; + attachments: CoreFileEntry[] = []; protected workshopId!: number; protected submissionId = 0; @@ -211,14 +211,9 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca this.editForm.controls['title'].setValue(this.submission.title); this.editForm.controls['content'].setValue(this.submission.content); + this.attachments = this.submission.attachmentfiles || []; } - CoreFileSession.setFiles( - this.component, - this.getFilesComponentId(), - this.submission?.attachmentfiles || [], - ); - this.loaded = true; } catch (error) { this.loaded = false; @@ -254,7 +249,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca } if (this.fileAvailable) { - values.attachmentfiles = CoreFileSession.getFiles(this.component, this.getFilesComponentId()) || []; + values.attachmentfiles = this.attachments; } return values; @@ -337,7 +332,9 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca // Upload attachments first if any. let allowOffline = !inputData.attachmentfiles.length; try { - let attachmentsId: CoreFileUploaderStoreFilesResult | number | undefined; + let attachmentsId: number | undefined; + let storeFilesResult: CoreFileUploaderStoreFilesResult | undefined; + try { attachmentsId = await AddonModWorkshopHelper.uploadOrStoreSubmissionFiles( this.workshopId, @@ -349,7 +346,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca saveOffline = true; allowOffline = true; - attachmentsId = await AddonModWorkshopHelper.uploadOrStoreSubmissionFiles( + storeFilesResult = await AddonModWorkshopHelper.uploadOrStoreSubmissionFiles( this.workshopId, inputData.attachmentfiles, true, @@ -369,7 +366,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca this.courseId, inputData.title, inputData.content, - attachmentsId as CoreFileUploaderStoreFilesResult, + storeFilesResult, submissionId, AddonModWorkshopAction.UPDATE, ); @@ -396,7 +393,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca this.courseId, inputData.title, inputData.content, - attachmentsId as CoreFileUploaderStoreFilesResult, + storeFilesResult, undefined, AddonModWorkshopAction.ADD, ); diff --git a/src/addons/mod/workshop/services/workshop.ts b/src/addons/mod/workshop/services/workshop.ts index 7946c70c2..ba637e2ff 100644 --- a/src/addons/mod/workshop/services/workshop.ts +++ b/src/addons/mod/workshop/services/workshop.ts @@ -17,7 +17,6 @@ import { CoreError } from '@classes/errors/error'; import { CoreSite, CoreSiteWSPreSets } from '@classes/site'; import { CoreCourseCommonModWSOptions } from '@features/course/services/course'; import { CoreCourseLogHelper } from '@features/course/services/log-helper'; -import { CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader'; import { CoreGradesMenuItem } from '@features/grades/services/grades-helper'; import { CoreApp } from '@services/app'; import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites'; @@ -718,7 +717,7 @@ export class AddonModWorkshopProvider { courseId: number, title: string, content: string, - attachmentsId?: number | CoreFileUploaderStoreFilesResult, + attachmentsId?: number, siteId?: string, allowOffline: boolean = false, ): Promise { @@ -731,7 +730,7 @@ export class AddonModWorkshopProvider { courseId, title, content, - attachmentsId as CoreFileUploaderStoreFilesResult, + undefined, undefined, AddonModWorkshopAction.ADD, siteId, @@ -814,7 +813,7 @@ export class AddonModWorkshopProvider { courseId: number, title: string, content: string, - attachmentsId?: CoreFileUploaderStoreFilesResult | number | undefined, + attachmentsId?: number | undefined, siteId?: string, allowOffline: boolean = false, ): Promise { @@ -827,7 +826,7 @@ export class AddonModWorkshopProvider { courseId, title, content, - attachmentsId as CoreFileUploaderStoreFilesResult, + undefined, submissionId, AddonModWorkshopAction.UPDATE, siteId, diff --git a/src/core/directives/external-content.ts b/src/core/directives/external-content.ts index e8a6975d8..188a27ee1 100644 --- a/src/core/directives/external-content.ts +++ b/src/core/directives/external-content.ts @@ -188,7 +188,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges { if (tagName == 'VIDEO' && targetAttr != 'poster') { const video = this.element; if (video.textTracks) { - // It's a video with subtitles. In iOS, subtitles position is wrong so it needs to be fixed. + // It's a video with subtitles. Fix some issues with subtitles. video.textTracks.onaddtrack = (event): void => { const track = event.track; if (track) { @@ -248,6 +248,11 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges { true, downloadUnknown, ); + } else if (tagName === 'TRACK') { + // Download tracks right away. Using an online URL for tracks can give a CORS error in Android. + finalUrl = await CoreFilepool.downloadUrl(site.getId(), url, false, this.component, this.componentId); + + finalUrl = CoreFile.convertFileSrc(finalUrl); } else { finalUrl = await CoreFilepool.getUrlByUrl( site.getId(), @@ -277,6 +282,13 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges { this.loaded = false; this.waitForLoad(); } + + if (targetAttr == 'poster') { + // Setting the poster immediately doesn't display it in some cases. Set it to empty and then set the right one. + this.element.setAttribute(targetAttr, ''); + await CoreUtils.nextTick(); + } + this.element.setAttribute(targetAttr, finalUrl); this.element.setAttribute('data-original-' + targetAttr, url); } diff --git a/src/core/services/navigator.ts b/src/core/services/navigator.ts index b31e38079..7d15cfa9e 100644 --- a/src/core/services/navigator.ts +++ b/src/core/services/navigator.ts @@ -44,8 +44,7 @@ export type CoreRedirectPayload = { /** * Navigation options. */ -export type CoreNavigationOptions = { - animated?: boolean; +export type CoreNavigationOptions = Pick & { params?: Params; reset?: boolean; preferCurrentTab?: boolean; // Default true. @@ -132,6 +131,8 @@ export class CoreNavigatorService { const url: string[] = [/^[./]/.test(path) ? path : `./${path}`]; const navigationOptions: NavigationOptions = CoreObject.withoutEmpty({ animated: options.animated, + animation: options.animation, + animationDirection: options.animationDirection, queryParams: CoreObject.isEmpty(options.params ?? {}) ? null : CoreObject.withoutEmpty(options.params), relativeTo: path.startsWith('/') ? null : this.getCurrentRoute(), });