@@ -48,13 +48,9 @@
-
-
-
@@ -81,7 +77,7 @@
+ contextLevel="module" [contextInstanceId]="module.id" [courseId]="module.course">
diff --git a/src/core/features/course/components/module/module.ts b/src/core/features/course/components/module/module.ts
index 82df87061..936901f5f 100644
--- a/src/core/features/course/components/module/module.ts
+++ b/src/core/features/course/components/module/module.ts
@@ -15,20 +15,13 @@
import { Component, Input, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
import { CoreSites } from '@services/sites';
-import { CoreDomUtils } from '@services/utils/dom';
-import { CoreEventObserver, CoreEvents } from '@singletons/events';
import {
- CoreCourseHelper,
CoreCourseModuleData,
CoreCourseModuleCompletionData,
CoreCourseSection,
} from '@features/course/services/course-helper';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseModuleDelegate, CoreCourseModuleHandlerButton } from '@features/course/services/module-delegate';
-import {
- CoreCourseModulePrefetchDelegate,
- CoreCourseModulePrefetchHandler,
-} from '@features/course/services/module-prefetch-delegate';
/**
* Component to display a module entry in a list of modules.
@@ -45,47 +38,20 @@ import {
export class CoreCourseModuleComponent implements OnInit, OnDestroy {
@Input() module!: CoreCourseModuleData; // The module to render.
- @Input() courseId?: number; // The course the module belongs to.
@Input() section?: CoreCourseSection; // The section the module belongs to.
@Input() showActivityDates = false; // Whether to show activity dates.
@Input() showCompletionConditions = false; // Whether to show activity completion conditions.
- // eslint-disable-next-line @angular-eslint/no-input-rename
- @Input('downloadEnabled') set enabled(value: boolean) {
- this.downloadEnabled = value;
-
- if (!this.module.handlerData?.showDownloadButton || !this.downloadEnabled || this.statusCalculated) {
- return;
- }
-
- // First time that the download is enabled. Initialize the data.
- this.statusCalculated = true;
- this.spinner = true; // Show spinner while calculating the status.
-
- // Get current status to decide which icon should be shown.
- this.calculateAndShowStatus();
- }
-
@Output() completionChanged = new EventEmitter(); // Notify when module completion changes.
- @Output() statusChanged = new EventEmitter(); // Notify when the download status changes.
- downloadStatus?: string;
- spinner?: boolean; // Whether to display a loading spinner.
- downloadEnabled?: boolean; // Whether the download of sections and modules is enabled.
modNameTranslated = '';
hasInfo = false;
showLegacyCompletion = false; // Whether to show module completion in the old format.
showManualCompletion = false; // Whether to show manual completion when completion conditions are disabled.
- protected prefetchHandler?: CoreCourseModulePrefetchHandler;
- protected statusObserver?: CoreEventObserver;
- protected statusCalculated = false;
- protected isDestroyed = false;
-
/**
* Component being initialized.
*/
ngOnInit(): void {
- this.courseId = this.courseId || this.module.course;
this.modNameTranslated = CoreCourse.translateModuleName(this.module.modname) || '';
this.showLegacyCompletion = !CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('3.11');
this.checkShowManualCompletion();
@@ -103,29 +69,6 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
(this.showCompletionConditions && this.module.completiondata.isautomatic))
)
);
-
- if (this.module.handlerData.showDownloadButton) {
- // Listen for changes on this module status, even if download isn't enabled.
- this.prefetchHandler = CoreCourseModulePrefetchDelegate.getPrefetchHandlerFor(this.module.modname);
-
- this.statusObserver = CoreEvents.on(CoreEvents.PACKAGE_STATUS_CHANGED, (data) => {
- if (!this.module || data.componentId != this.module.id || !this.prefetchHandler ||
- data.component != this.prefetchHandler.component) {
- return;
- }
-
- // Call determineModuleStatus to get the right status to display.
- const status = CoreCourseModulePrefetchDelegate.determineModuleStatus(this.module, data.status);
-
- if (this.downloadEnabled) {
- // Download is enabled, show the status.
- this.showStatus(status);
- } else if (this.module.handlerData?.updateStatus) {
- // Download isn't enabled but the handler defines a updateStatus function, call it anyway.
- this.module.handlerData.updateStatus(status);
- }
- }, CoreSites.getCurrentSiteId());
- }
}
/**
@@ -143,7 +86,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
*/
moduleClicked(event: Event): void {
if (this.module.uservisible !== false && this.module.handlerData?.action) {
- this.module.handlerData.action(event, this.module, this.courseId!);
+ this.module.handlerData.action(event, this.module, this.module.course);
}
}
@@ -161,91 +104,14 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
event.preventDefault();
event.stopPropagation();
- button.action(event, this.module, this.courseId!);
- }
-
- /**
- * Download the module.
- *
- * @param refresh Whether it's refreshing.
- * @return Promise resolved when done.
- */
- async download(refresh: boolean): Promise {
- if (!this.prefetchHandler || !this.module) {
- return;
- }
-
- // Show spinner since this operation might take a while.
- this.spinner = true;
-
- try {
- // Get download size to ask for confirm if it's high.
- const size = await this.prefetchHandler.getDownloadSize(this.module, this.module.course, true);
-
- await CoreCourseHelper.prefetchModule(this.prefetchHandler, this.module, size, this.module.course, refresh);
-
- const eventData = {
- sectionId: this.section?.id,
- moduleId: this.module.id,
- courseId: this.module.course,
- };
- this.statusChanged.emit(eventData);
- } catch (error) {
- // Error, hide spinner.
- this.spinner = false;
- if (!this.isDestroyed) {
- CoreDomUtils.showErrorModalDefault(error, 'core.errordownloading', true);
- }
- }
- }
-
- /**
- * Show download buttons according to module status.
- *
- * @param status Module status.
- */
- protected showStatus(status: string): void {
- if (!status) {
- return;
- }
-
- this.spinner = false;
- this.downloadStatus = status;
-
- this.module.handlerData?.updateStatus?.(status);
- }
-
- /**
- * Calculate and show module status.
- *
- * @return Promise resolved when done.
- */
- protected async calculateAndShowStatus(): Promise {
- if (!this.module || !this.courseId) {
- return;
- }
-
- const status = await CoreCourseModulePrefetchDelegate.getModuleStatus(this.module, this.courseId);
-
- this.showStatus(status);
+ button.action(event, this.module, this.module.course);
}
/**
* Component destroyed.
*/
ngOnDestroy(): void {
- // this.statusObserver?.off();
this.module.handlerData?.onDestroy?.();
- this.isDestroyed = true;
}
}
-
-/**
- * Data sent to the status changed output.
- */
-export type CoreCourseModuleStatusChangedData = {
- moduleId: number;
- courseId: number;
- sectionId?: number;
-};
diff --git a/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html b/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html
index 17cf0dd0f..68eedcebf 100644
--- a/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html
+++ b/src/core/features/course/format/singleactivity/components/core-course-format-single-activity.html
@@ -1,4 +1,4 @@
-
+
diff --git a/src/core/features/course/format/singleactivity/components/singleactivity.ts b/src/core/features/course/format/singleactivity/components/singleactivity.ts
index 3fd7cf5c0..01da69058 100644
--- a/src/core/features/course/format/singleactivity/components/singleactivity.ts
+++ b/src/core/features/course/format/singleactivity/components/singleactivity.ts
@@ -36,7 +36,6 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges {
@Input() course?: CoreCourseAnyCourseData; // The course to render.
@Input() sections?: CoreCourseSectionWithStatus[]; // List of course sections.
- @Input() downloadEnabled?: boolean; // Whether the download of sections and modules is enabled.
@Input() initialSectionId?: number; // The section to load first (by ID).
@Input() initialSectionNumber?: number; // The section to load first (by number).
@Input() moduleId?: number; // The module ID to scroll to. Must be inside the initial selected section.
diff --git a/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts b/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts
index 3ce49d231..945b99e4c 100644
--- a/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts
+++ b/src/core/features/course/format/singleactivity/services/handlers/singleactivity-format.ts
@@ -68,13 +68,6 @@ export class CoreCourseFormatSingleActivityHandlerService implements CoreCourseF
return '';
}
- /**
- * @inheritdoc
- */
- displayEnableDownload(): boolean {
- return false;
- }
-
/**
* @inheritdoc
*/
diff --git a/src/core/features/course/pages/contents/contents.html b/src/core/features/course/pages/contents/contents.html
index 9c1633cad..1f6b46f1c 100644
--- a/src/core/features/course/pages/contents/contents.html
+++ b/src/core/features/course/pages/contents/contents.html
@@ -1,12 +1,5 @@
-
-
-
-
@@ -22,8 +15,7 @@
+ [moduleId]="moduleId" (completionChanged)="onCompletionChange($event)" class="core-course-format-{{course.format}}">
diff --git a/src/core/features/course/pages/contents/contents.ts b/src/core/features/course/pages/contents/contents.ts
index 03662c5b4..43bbcfb2d 100644
--- a/src/core/features/course/pages/contents/contents.ts
+++ b/src/core/features/course/pages/contents/contents.ts
@@ -15,20 +15,17 @@
import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core';
import { IonContent, IonRefresher } from '@ionic/angular';
-import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
-import { CoreCourses, CoreCourseAnyCourseData, CoreCoursesProvider } from '@features/courses/services/courses';
+import { CoreCourses, CoreCourseAnyCourseData } from '@features/courses/services/courses';
import {
CoreCourse,
CoreCourseCompletionActivityStatus,
- CoreCourseProvider,
} from '@features/course/services/course';
import {
CoreCourseHelper,
CoreCourseModuleCompletionData,
CoreCourseSection,
- CorePrefetchStatusInfo,
} from '@features/course/services/course-helper';
import { CoreCourseFormatDelegate } from '@features/course/services/format-delegate';
import { CoreCourseModulePrefetchDelegate } from '@features/course/services/module-prefetch-delegate';
@@ -43,7 +40,6 @@ import {
CoreEventObserver,
} from '@singletons/events';
import { CoreNavigator } from '@services/navigator';
-import { CoreConstants } from '@/core/constants';
/**
* Page that displays the contents of a course.
@@ -63,47 +59,19 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
sectionNumber?: number;
courseMenuHandlers: CoreCourseOptionsMenuHandlerToDisplay[] = [];
dataLoaded = false;
- downloadEnabled = false;
downloadCourseEnabled = false;
moduleId?: number;
displayEnableDownload = false;
displayRefresher = false;
- prefetchCourseData: CorePrefetchStatusInfo = {
- icon: CoreConstants.ICON_LOADING,
- statusTranslatable: 'core.course.downloadcourse',
- status: '',
- loading: true,
- };
protected formatOptions?: Record;
protected completionObserver?: CoreEventObserver;
- protected courseStatusObserver?: CoreEventObserver;
- protected siteUpdatedObserver?: CoreEventObserver;
- protected downloadEnabledObserver?: CoreEventObserver;
protected syncObserver?: CoreEventObserver;
protected isDestroyed = false;
protected modulesHaveCompletion = false;
- protected isGuest?: boolean;
+ protected isGuest = false;
protected debouncedUpdateCachedCompletion?: () => void; // Update the cached completion after a certain time.
- constructor() {
- // Refresh the enabled flags if site is updated.
- this.siteUpdatedObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => {
- this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite();
-
- this.displayEnableDownload = !CoreSites.getRequiredCurrentSite().isOfflineDisabled() &&
- CoreCourseFormatDelegate.displayEnableDownload(this.course);
-
- this.downloadEnabled = this.displayEnableDownload && this.downloadEnabled;
-
- this.initListeners();
- }, CoreSites.getCurrentSiteId());
-
- this.downloadEnabledObserver = CoreEvents.on(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, (data) => {
- this.downloadEnabled = this.displayEnableDownload && data.enabled;
- });
- }
-
/**
* @inheritdoc
*/
@@ -121,13 +89,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
this.sectionId = CoreNavigator.getRouteNumberParam('sectionId');
this.sectionNumber = CoreNavigator.getRouteNumberParam('sectionNumber');
this.moduleId = CoreNavigator.getRouteNumberParam('moduleId');
- this.isGuest = CoreNavigator.getRouteBooleanParam('isGuest');
-
- this.displayEnableDownload = !CoreSites.getRequiredCurrentSite().isOfflineDisabled() &&
- CoreCourseFormatDelegate.displayEnableDownload(this.course);
- this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite();
-
- this.downloadEnabled = this.displayEnableDownload && CoreCourses.getCourseDownloadOptionsEnabled();
+ this.isGuest = !!CoreNavigator.getRouteBooleanParam('isGuest');
this.debouncedUpdateCachedCompletion = CoreUtils.debounce(() => {
if (this.modulesHaveCompletion) {
@@ -149,8 +111,6 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
await this.loadData(false, true);
this.dataLoaded = true;
-
- this.initPrefetch();
}
/**
@@ -159,15 +119,6 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
* @return Promise resolved when done.
*/
protected async initListeners(): Promise {
- if (this.downloadCourseEnabled && !this.courseStatusObserver) {
- // Listen for changes in course status.
- this.courseStatusObserver = CoreEvents.on(CoreEvents.COURSE_STATUS_CHANGED, (data) => {
- if (data.courseId == this.course.id || data.courseId == CoreCourseProvider.ALL_COURSES_CLEARED) {
- this.updateCourseStatus(data.status);
- }
- }, CoreSites.getCurrentSiteId());
- }
-
// Check if the course format requires the view to be refreshed when completion changes.
const shouldRefresh = await CoreCourseFormatDelegate.shouldRefreshWhenCompletionChanges(this.course);
if (!shouldRefresh) {
@@ -200,41 +151,6 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
}
}
- /**
- * Init prefetch data if needed.
- *
- * @return Promise resolved when done.
- */
- protected async initPrefetch(): Promise {
- if (!this.downloadCourseEnabled) {
- // Cannot download the whole course, stop.
- return;
- }
-
- // Determine the course prefetch status.
- await this.determineCoursePrefetchIcon();
-
- if (this.prefetchCourseData.icon != CoreConstants.ICON_LOADING) {
- return;
- }
-
- // Course is being downloaded. Get the download promise.
- const promise = CoreCourseHelper.getCourseDownloadPromise(this.course.id);
- if (promise) {
- // There is a download promise. Show an error if it fails.
- promise.catch((error) => {
- if (!this.isDestroyed) {
- CoreDomUtils.showErrorModalDefault(error, 'core.course.errordownloadingcourse', true);
- }
- });
- } else {
- // No download, this probably means that the app was closed while downloading. Set previous status.
- const status = await CoreCourse.setCoursePreviousStatus(this.course.id);
-
- this.updateCourseStatus(status);
- }
- }
-
/**
* Fetch and load all the data required for the view.
*
@@ -463,59 +379,6 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
}
}
- /**
- * Determines the prefetch icon of the course.
- *
- * @return Promise resolved when done.
- */
- protected async determineCoursePrefetchIcon(): Promise {
- this.prefetchCourseData = await CoreCourseHelper.getCourseStatusIconAndTitle(this.course.id);
- }
-
- /**
- * Prefetch the whole course.
- */
- async prefetchCourse(): Promise {
- try {
- await CoreCourseHelper.confirmAndPrefetchCourse(
- this.prefetchCourseData,
- this.course,
- {
- sections: this.sections,
- menuHandlers: this.courseMenuHandlers,
- isGuest: this.isGuest,
- },
- );
- } catch (error) {
- if (this.isDestroyed) {
- return;
- }
-
- CoreDomUtils.showErrorModalDefault(error, 'core.course.errordownloadingcourse', true);
- }
- }
-
- /**
- * Toggle download enabled.
- */
- toggleDownload(): void {
- CoreCourses.setCourseDownloadOptionsEnabled(this.downloadEnabled);
- }
-
- /**
- * Update the course status icon and title.
- *
- * @param status Status to show.
- */
- protected updateCourseStatus(status: string): void {
- const statusData = CoreCourseHelper.getCoursePrefetchStatusInfo(status);
-
- this.prefetchCourseData.status = statusData.status;
- this.prefetchCourseData.icon = statusData.icon;
- this.prefetchCourseData.statusTranslatable = statusData.statusTranslatable;
- this.prefetchCourseData.loading = statusData.loading;
- }
-
/**
* Open the course summary
*/
@@ -542,10 +405,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.isDestroyed = true;
this.completionObserver?.off();
- this.courseStatusObserver?.off();
this.syncObserver?.off();
- this.siteUpdatedObserver?.off();
- this.downloadEnabledObserver?.off();
}
/**
diff --git a/src/core/features/course/pages/list-mod-type/list-mod-type.html b/src/core/features/course/pages/list-mod-type/list-mod-type.html
index 1d6d7d2aa..d0cf3b7d1 100644
--- a/src/core/features/course/pages/list-mod-type/list-mod-type.html
+++ b/src/core/features/course/pages/list-mod-type/list-mod-type.html
@@ -19,8 +19,7 @@
-
+
diff --git a/src/core/features/course/pages/list-mod-type/list-mod-type.page.ts b/src/core/features/course/pages/list-mod-type/list-mod-type.page.ts
index 38e6cccf2..fde5d1830 100644
--- a/src/core/features/course/pages/list-mod-type/list-mod-type.page.ts
+++ b/src/core/features/course/pages/list-mod-type/list-mod-type.page.ts
@@ -14,7 +14,6 @@
import { Component, OnInit } from '@angular/core';
-import { CoreSites } from '@services/sites';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreCourse } from '@features/course/services/course';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@@ -36,7 +35,6 @@ export class CoreCourseListModTypePage implements OnInit {
sections: CoreCourseSection[] = [];
title = '';
loaded = false;
- downloadEnabled = false;
courseId?: number;
protected modName?: string;
@@ -49,7 +47,6 @@ export class CoreCourseListModTypePage implements OnInit {
this.title = CoreNavigator.getRouteParam('title') || '';
this.courseId = CoreNavigator.getRouteNumberParam('courseId');
this.modName = CoreNavigator.getRouteParam('modName');
- this.downloadEnabled = !CoreSites.getCurrentSite()?.isOfflineDisabled();
try {
await this.fetchData();
diff --git a/src/core/features/course/services/format-delegate.ts b/src/core/features/course/services/format-delegate.ts
index b2ecc2f13..295691a0e 100644
--- a/src/core/features/course/services/format-delegate.ts
+++ b/src/core/features/course/services/format-delegate.ts
@@ -58,8 +58,9 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler {
displayBlocks?(course: CoreCourseAnyCourseData): boolean;
/**
- * Whether the option to enable section/module download should be displayed. Defaults to true.
+ * Whether the option to enable section/module download should be displayed.
*
+ * @deprecated on 4.0 Not used anymore because prefetch has been moved to storage manager.
* @param course The course to check.
* @return Whether the option to enable section/module download should be displayed.
*/
@@ -204,16 +205,6 @@ export class CoreCourseFormatDelegateService extends CoreDelegate(course.format || '', 'displayBlocks', [course]);
}
- /**
- * Whether the option to enable section/module download should be displayed. Defaults to true.
- *
- * @param course The course to check.
- * @return Whether the option to enable section/module download should be displayed
- */
- displayEnableDownload(course: CoreCourseAnyCourseData): boolean {
- return !!this.executeFunctionOnEnabled(course.format || '', 'displayEnableDownload', [course]);
- }
-
/**
* Whether the course refresher should be displayed. If it returns false, a refresher must be included in the course format,
* and the doRefresh method of CoreCourseSectionPage must be called on refresh. Defaults to true.
diff --git a/src/core/features/course/services/handlers/default-format.ts b/src/core/features/course/services/handlers/default-format.ts
index c84073a96..4ef53ca4b 100644
--- a/src/core/features/course/services/handlers/default-format.ts
+++ b/src/core/features/course/services/handlers/default-format.ts
@@ -78,17 +78,6 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler {
return true;
}
- /**
- * Whether the option to enable section/module download should be displayed. Defaults to true.
- *
- * @param course The course to check.
- * @return Whether the option to enable section/module download should be displayed
- */
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
- displayEnableDownload(course: CoreCourseAnyCourseData): boolean {
- return true;
- }
-
/**
* Whether the default section selector should be displayed. Defaults to true.
*
diff --git a/src/core/features/courses/pages/dashboard/dashboard.html b/src/core/features/courses/pages/dashboard/dashboard.html
index ee5fb7421..4e704d5e8 100644
--- a/src/core/features/courses/pages/dashboard/dashboard.html
+++ b/src/core/features/courses/pages/dashboard/dashboard.html
@@ -23,7 +23,7 @@
-
+
diff --git a/src/core/features/sitehome/pages/index/index.html b/src/core/features/sitehome/pages/index/index.html
index e7437c3c7..62b96b90c 100644
--- a/src/core/features/sitehome/pages/index/index.html
+++ b/src/core/features/sitehome/pages/index/index.html
@@ -3,8 +3,6 @@
-
-
+
@@ -54,7 +51,7 @@
-
+
@@ -73,8 +70,7 @@
-
+
diff --git a/src/core/features/sitehome/pages/index/index.ts b/src/core/features/sitehome/pages/index/index.ts
index 4d6cc23a4..b28c7d648 100644
--- a/src/core/features/sitehome/pages/index/index.ts
+++ b/src/core/features/sitehome/pages/index/index.ts
@@ -21,7 +21,7 @@ import { CoreCourse, CoreCourseWSSection } from '@features/course/services/cours
import { CoreDomUtils } from '@services/utils/dom';
import { CoreSites } from '@services/sites';
import { CoreSiteHome } from '@features/sitehome/services/sitehome';
-import { CoreCourses, CoreCoursesProvider } from '@features//courses/services/courses';
+import { CoreCourses } from '@features//courses/services/courses';
import { CoreEventObserver, CoreEvents } from '@singletons/events';
import { CoreCourseHelper, CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate';
@@ -50,24 +50,15 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy {
siteHomeId = 1;
currentSite!: CoreSite;
searchEnabled = false;
- displayEnableDownload = false;
- downloadEnabled = false;
newsForumModule?: CoreCourseModuleData;
protected updateSiteObserver: CoreEventObserver;
- protected downloadEnabledObserver: CoreEventObserver;
constructor() {
// Refresh the enabled flags if site is updated.
this.updateSiteObserver = CoreEvents.on(CoreEvents.SITE_UPDATED, () => {
this.searchEnabled = !CoreCourses.isSearchCoursesDisabledInSite();
-
- this.displayEnableDownload = !CoreSites.getRequiredCurrentSite().isOfflineDisabled();
}, CoreSites.getCurrentSiteId());
-
- this.downloadEnabledObserver = CoreEvents.on(CoreCoursesProvider.EVENT_DASHBOARD_DOWNLOAD_ENABLED_CHANGED, (data) => {
- this.downloadEnabled = data.enabled;
- });
}
/**
@@ -85,9 +76,6 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy {
CoreCourseHelper.openModule(module, this.siteHomeId, undefined, modParams);
}
- this.displayEnableDownload = !CoreSites.getRequiredCurrentSite().isOfflineDisabled();
- this.downloadEnabled = CoreCourses.getCourseDownloadOptionsEnabled();
-
this.loadContent().finally(() => {
this.dataLoaded = true;
});
@@ -186,13 +174,6 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy {
});
}
- /**
- * Switch download enabled.
- */
- switchDownload(): void {
- CoreCourses.setCourseDownloadOptionsEnabled(this.downloadEnabled);
- }
-
/**
* Open page to manage courses storage.
*/
@@ -240,7 +221,6 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy {
*/
ngOnDestroy(): void {
this.updateSiteObserver.off();
- this.downloadEnabledObserver.off();
}
}
diff --git a/src/core/features/siteplugins/classes/handlers/course-format-handler.ts b/src/core/features/siteplugins/classes/handlers/course-format-handler.ts
index 1878f6186..89cfaff07 100644
--- a/src/core/features/siteplugins/classes/handlers/course-format-handler.ts
+++ b/src/core/features/siteplugins/classes/handlers/course-format-handler.ts
@@ -35,13 +35,6 @@ export class CoreSitePluginsCourseFormatHandler extends CoreSitePluginsBaseHandl
return this.handlerSchema.canviewallsections ?? true;
}
- /**
- * @inheritdoc
- */
- displayEnableDownload(): boolean {
- return this.handlerSchema.displayenabledownload ?? true;
- }
-
/**
* @inheritdoc
*/
diff --git a/upgrade.txt b/upgrade.txt
index b373c0db4..ddb9fc2c5 100644
--- a/upgrade.txt
+++ b/upgrade.txt
@@ -9,6 +9,7 @@ information provided here is intended especially for developers.
- CoreCourseModulePrefetchDelegate.getPrefetchHandlerFor now admits module name instead of full module object.
- CoreCourse.getModuleBasicInfoByInstance and CoreCourse.getModuleBasicInfo have been modified to accept an "options" parameter instead of only siteId.
- The function CoreFilepool.isFileDownloadingByUrl now returns Promise instead of relying on resolve/reject.
+- downloadEnabled input has been removed from CoreBlockSideBlocksComponent, CoreCourseFormatComponent, CoreCourseFormatSingleActivityComponent and CoreCourseModuleComponent.
=== 3.9.5 ===