diff --git a/src/addons/badges/pages/issued-badge/issued-badge.page.ts b/src/addons/badges/pages/issued-badge/issued-badge.page.ts index 675957abd..890ccbfe0 100644 --- a/src/addons/badges/pages/issued-badge/issued-badge.page.ts +++ b/src/addons/badges/pages/issued-badge/issued-badge.page.ts @@ -81,7 +81,7 @@ export class AddonBadgesIssuedBadgePage implements OnInit, OnDestroy { /** * Fetch the issued badge required for the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchIssuedBadge(): Promise { this.currentTime = CoreTimeUtils.timestamp(); diff --git a/src/addons/badges/services/badges.ts b/src/addons/badges/services/badges.ts index df39a9595..8ab031010 100644 --- a/src/addons/badges/services/badges.ts +++ b/src/addons/badges/services/badges.ts @@ -34,7 +34,7 @@ export class AddonBadgesProvider { * check, we should not be calling WS from here. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, false otherwise. + * @returns Promise resolved with true if enabled, false otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -47,7 +47,7 @@ export class AddonBadgesProvider { * * @param courseId ID of the course to get the badges from. * @param userId ID of the user to get the badges from. - * @return Cache key. + * @returns Cache key. */ protected getBadgesCacheKey(courseId: number, userId: number): string { return ROOT_CACHE_KEY + 'badges:' + courseId + ':' + userId; @@ -59,7 +59,7 @@ export class AddonBadgesProvider { * @param courseId ID of the course to get the badges from. * @param userId ID of the user to get the badges from. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the badges are retrieved. + * @returns Promise to be resolved when the badges are retrieved. */ async getUserBadges(courseId: number, userId: number, siteId?: string): Promise { @@ -98,7 +98,7 @@ export class AddonBadgesProvider { * @param courseId Course ID. * @param userId ID of the user to get the badges from. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateUserBadges(courseId: number, userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/badges/services/handlers/badge-link.ts b/src/addons/badges/services/handlers/badge-link.ts index 25b14f5d9..d41c7047f 100644 --- a/src/addons/badges/services/handlers/badge-link.ts +++ b/src/addons/badges/services/handlers/badge-link.ts @@ -30,13 +30,7 @@ export class AddonBadgesBadgeLinkHandlerService extends CoreContentLinksHandlerB pattern = /\/badges\/badge\.php.*([?&]hash=)/; /** - * Get the list of actions for a link (url). - * - * @param siteIds List of sites the URL belongs to. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @return List of (or promise resolved with list of) actions. + * @inheritdoc */ getActions(siteIds: string[], url: string, params: Record): CoreContentLinksAction[] { @@ -48,14 +42,7 @@ export class AddonBadgesBadgeLinkHandlerService extends CoreContentLinksHandlerB } /** - * Check if the handler is enabled for a certain site (site + user) and a URL. - * If not defined, defaults to true. - * - * @param siteId The site ID. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @return Whether the handler is enabled for the URL and site. + * @inheritdoc */ isEnabled(siteId: string): Promise { return AddonBadges.isPluginEnabled(siteId); diff --git a/src/addons/badges/services/handlers/mybadges-link.ts b/src/addons/badges/services/handlers/mybadges-link.ts index 2de022feb..0dd2f3bfa 100644 --- a/src/addons/badges/services/handlers/mybadges-link.ts +++ b/src/addons/badges/services/handlers/mybadges-link.ts @@ -32,7 +32,7 @@ export class AddonBadgesMyBadgesLinkHandlerService extends CoreContentLinksHandl /** * Get the list of actions for a link (url). * - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions(): CoreContentLinksAction[] { return [{ @@ -47,7 +47,7 @@ export class AddonBadgesMyBadgesLinkHandlerService extends CoreContentLinksHandl * If not defined, defaults to true. * * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string): Promise { return AddonBadges.isPluginEnabled(siteId); diff --git a/src/addons/badges/services/handlers/push-click.ts b/src/addons/badges/services/handlers/push-click.ts index 1d6e41ad6..57281fc30 100644 --- a/src/addons/badges/services/handlers/push-click.ts +++ b/src/addons/badges/services/handlers/push-click.ts @@ -35,7 +35,7 @@ export class AddonBadgesPushClickHandlerService implements CorePushNotifications * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: CorePushNotificationsNotificationBasicData): Promise { const data = notification.customdata || {}; @@ -52,7 +52,7 @@ export class AddonBadgesPushClickHandlerService implements CorePushNotifications * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: CorePushNotificationsNotificationBasicData): Promise { const data = notification.customdata || {}; diff --git a/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts b/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts index afd870dce..01b9c54ee 100644 --- a/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts +++ b/src/addons/block/activitymodules/components/activitymodules/activitymodules.ts @@ -44,7 +44,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateContent(): Promise { await CoreCourse.invalidateSections(this.instanceId); @@ -53,7 +53,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i /** * Fetch the data to render the block. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(): Promise { const sections = await CoreCourse.getSections(this.getCourseId(), false, true); @@ -114,7 +114,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i /** * Obtain the appropiate course id for the block. * - * @return Course id. + * @returns Course id. */ protected getCourseId(): number { if (this.contextLevel == ContextLevel.COURSE) { diff --git a/src/addons/block/activitymodules/services/block-handler.ts b/src/addons/block/activitymodules/services/block-handler.ts index 1e34c7419..a9fa41624 100644 --- a/src/addons/block/activitymodules/services/block-handler.ts +++ b/src/addons/block/activitymodules/services/block-handler.ts @@ -30,7 +30,7 @@ export class AddonBlockActivityModulesHandlerService extends CoreBlockBaseHandle /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/activityresults/services/block-handler.ts b/src/addons/block/activityresults/services/block-handler.ts index 4b65e2572..3833d7dc7 100644 --- a/src/addons/block/activityresults/services/block-handler.ts +++ b/src/addons/block/activityresults/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockActivityResultsHandlerService extends CoreBlockBaseHandle /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/badges/services/block-handler.ts b/src/addons/block/badges/services/block-handler.ts index 2b8335d51..cd805cfc1 100644 --- a/src/addons/block/badges/services/block-handler.ts +++ b/src/addons/block/badges/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockBadgesHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/blogmenu/services/block-handler.ts b/src/addons/block/blogmenu/services/block-handler.ts index 8d01c81bf..dfe0aa3ee 100644 --- a/src/addons/block/blogmenu/services/block-handler.ts +++ b/src/addons/block/blogmenu/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockBlogMenuHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/blogrecent/services/block-handler.ts b/src/addons/block/blogrecent/services/block-handler.ts index b59d438f5..18d6f5e3b 100644 --- a/src/addons/block/blogrecent/services/block-handler.ts +++ b/src/addons/block/blogrecent/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockBlogRecentHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/blogtags/services/block-handler.ts b/src/addons/block/blogtags/services/block-handler.ts index 808745941..1ace929ac 100644 --- a/src/addons/block/blogtags/services/block-handler.ts +++ b/src/addons/block/blogtags/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockBlogTagsHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/calendarmonth/services/block-handler.ts b/src/addons/block/calendarmonth/services/block-handler.ts index a29e04ba9..793aea115 100644 --- a/src/addons/block/calendarmonth/services/block-handler.ts +++ b/src/addons/block/calendarmonth/services/block-handler.ts @@ -36,7 +36,7 @@ export class AddonBlockCalendarMonthHandlerService extends CoreBlockBaseHandler * @param block The block to render. * @param contextLevel The context where the block will be used. * @param instanceId The instance ID associated with the context level. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(block: CoreCourseBlock, contextLevel: string, instanceId: number): CoreBlockHandlerData { const linkParams: Params = contextLevel == 'course' ? { courseId: instanceId } : {}; diff --git a/src/addons/block/calendarupcoming/services/block-handler.ts b/src/addons/block/calendarupcoming/services/block-handler.ts index ee59a8ed0..6a7b79ce6 100644 --- a/src/addons/block/calendarupcoming/services/block-handler.ts +++ b/src/addons/block/calendarupcoming/services/block-handler.ts @@ -37,7 +37,7 @@ export class AddonBlockCalendarUpcomingHandlerService extends CoreBlockBaseHandl * @param block The block to render. * @param contextLevel The context where the block will be used. * @param instanceId The instance ID associated with the context level. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(block: CoreCourseBlock, contextLevel: string, instanceId: number): CoreBlockHandlerData { const linkParams: Params = { upcoming: true }; diff --git a/src/addons/block/comments/services/block-handler.ts b/src/addons/block/comments/services/block-handler.ts index 6d7544b9f..7ca6c2ef1 100644 --- a/src/addons/block/comments/services/block-handler.ts +++ b/src/addons/block/comments/services/block-handler.ts @@ -34,7 +34,7 @@ export class AddonBlockCommentsHandlerService extends CoreBlockBaseHandler { * @param block The block to render. * @param contextLevel The context where the block will be used. * @param instanceId The instance ID associated with the context level. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(block: CoreCourseBlock, contextLevel: string, instanceId: number): CoreBlockHandlerData { return { diff --git a/src/addons/block/glossaryrandom/services/block-handler.ts b/src/addons/block/glossaryrandom/services/block-handler.ts index d0cce231f..18e0feaf2 100644 --- a/src/addons/block/glossaryrandom/services/block-handler.ts +++ b/src/addons/block/glossaryrandom/services/block-handler.ts @@ -33,7 +33,7 @@ export class AddonBlockGlossaryRandomHandlerService extends CoreBlockBaseHandler * Returns the data needed to render the block. * * @param block The block to render. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(block: CoreCourseBlock): CoreBlockHandlerData { return { diff --git a/src/addons/block/html/services/block-handler.ts b/src/addons/block/html/services/block-handler.ts index a040407f0..d71ca60b7 100644 --- a/src/addons/block/html/services/block-handler.ts +++ b/src/addons/block/html/services/block-handler.ts @@ -33,7 +33,7 @@ export class AddonBlockHtmlHandlerService extends CoreBlockBaseHandler { * Returns the data needed to render the block. * * @param block The block to render. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(block: CoreCourseBlock): CoreBlockHandlerData { diff --git a/src/addons/block/learningplans/services/block-handler.ts b/src/addons/block/learningplans/services/block-handler.ts index ca4caa9e3..39be924ba 100644 --- a/src/addons/block/learningplans/services/block-handler.ts +++ b/src/addons/block/learningplans/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockLearningPlansHandlerService extends CoreBlockBaseHandler /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { return { diff --git a/src/addons/block/myoverview/components/myoverview/myoverview.ts b/src/addons/block/myoverview/components/myoverview/myoverview.ts index 6e7897558..e31ff0d1d 100644 --- a/src/addons/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addons/block/myoverview/components/myoverview/myoverview.ts @@ -187,7 +187,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * * @param refresher Refresher. * @param done Function to call when done. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void): Promise { if (this.loaded) { @@ -211,7 +211,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * Invalidate list of courses. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected invalidateCourseList(): Promise { return CoreCourses.invalidateUserCourses(); @@ -221,7 +221,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Helper function to invalidate only selected courses. * * @param courseIds Course Id array. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateCourses(courseIds: number[]): Promise { const promises: Promise[] = []; @@ -269,7 +269,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Load all courses. * * @param loadWatcher To manage the requests. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadAllCourses(loadWatcher: PageLoadWatcher): Promise { const showCategories = this.block.configsRecord?.displaycategories?.value === '1'; @@ -290,7 +290,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Load grace period. * * @param loadWatcher To manage the requests. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadGracePeriod(loadWatcher: PageLoadWatcher): Promise { this.hasCourses = this.allCourses.length > 0; @@ -334,7 +334,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * * @param config Block configuration. * @param loadWatcher To manage the requests. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadFilters( config?: Record, @@ -421,7 +421,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Refresh course list based on a EVENT_MY_COURSES_UPDATED event. * * @param data Event data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshCourseList(data: CoreCoursesMyCoursesUpdatedEventData): Promise { if (data.action == CoreCoursesProvider.ACTION_ENROL) { @@ -464,7 +464,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * Initialize the prefetch icon for selected courses. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async initPrefetchCoursesIcons(): Promise { if (this.prefetchIconsInitialized) { @@ -480,7 +480,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * Prefetch all the shown courses. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetchCourses(): Promise { const initialIcon = this.prefetchCoursesData.icon; @@ -510,7 +510,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Set selected courses filter. * * @param loadWatcher To manage the requests. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async filterCourses(loadWatcher?: PageLoadWatcher): Promise { let timeFilter = this.filters.timeFilterSelected; @@ -655,7 +655,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Saves filters value. * * @param timeFilter New time filter. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveFilters(timeFilter: string): Promise { this.filters.timeFilterSelected = timeFilter; @@ -666,7 +666,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Toggle layout value. * * @param layout New layout. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async toggleLayout(layout: AddonBlockMyOverviewLayouts): Promise { this.layout = layout; @@ -678,7 +678,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Saves sort courses value. * * @param sort New sorting. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveSort(sort: string): Promise { this.sort.selected = sort; @@ -690,7 +690,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * Option selected save and apply filter. * * @param selected Option selected. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async filterOptionsChanged(selected: AddonBlockMyOverviewTimeFilters): Promise { this.filters.timeFilterSelected = selected; @@ -709,7 +709,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * * @param previousCourses Previous courses. * @param newCourses New courses. - * @return Whether it has meaningful changes. + * @returns Whether it has meaningful changes. */ protected async coursesHaveMeaningfulChanges( previousCourses: CoreEnrolledCourseDataWithExtraInfoAndOptions[], @@ -744,7 +744,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem * * @param previousCourses Previous courses. * @param newCourses New courses. - * @return Whether it has meaningful changes. + * @returns Whether it has meaningful changes. */ protected async customFilterCoursesHaveMeaningfulChanges( previousCourses: CoreCourseSummaryData[], diff --git a/src/addons/block/myoverview/services/block-handler.ts b/src/addons/block/myoverview/services/block-handler.ts index a54f4797a..bd7632fa7 100644 --- a/src/addons/block/myoverview/services/block-handler.ts +++ b/src/addons/block/myoverview/services/block-handler.ts @@ -32,7 +32,7 @@ export class AddonBlockMyOverviewHandlerService extends CoreBlockBaseHandler { /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return (CoreSites.getCurrentSite()?.isVersionGreaterEqualThan('3.6')) || @@ -42,7 +42,7 @@ export class AddonBlockMyOverviewHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/newsitems/services/block-handler.ts b/src/addons/block/newsitems/services/block-handler.ts index ff6fa09e1..2003d1c4c 100644 --- a/src/addons/block/newsitems/services/block-handler.ts +++ b/src/addons/block/newsitems/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockNewsItemsHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/onlineusers/services/block-handler.ts b/src/addons/block/onlineusers/services/block-handler.ts index c9e19ae3e..8ec1bae89 100644 --- a/src/addons/block/onlineusers/services/block-handler.ts +++ b/src/addons/block/onlineusers/services/block-handler.ts @@ -30,7 +30,7 @@ export class AddonBlockOnlineUsersHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/privatefiles/services/block-handler.ts b/src/addons/block/privatefiles/services/block-handler.ts index bf4c9aaf7..1b5a8f1ca 100644 --- a/src/addons/block/privatefiles/services/block-handler.ts +++ b/src/addons/block/privatefiles/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockPrivateFilesHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/recentactivity/services/block-handler.ts b/src/addons/block/recentactivity/services/block-handler.ts index 0686b6d82..6a2259570 100644 --- a/src/addons/block/recentactivity/services/block-handler.ts +++ b/src/addons/block/recentactivity/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockRecentActivityHandlerService extends CoreBlockBaseHandler /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts index de139997d..82d1834c3 100644 --- a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts +++ b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts @@ -88,7 +88,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom /** * Invalidate list of courses. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateCourseList(): Promise { return this.site.isVersionGreaterEqualThan('3.8') @@ -100,7 +100,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom * Helper function to invalidate only selected courses. * * @param courseIds Course Id array. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateCourses(courseIds: number[]): Promise { const promises: Promise[] = []; @@ -166,7 +166,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom * Refresh course list based on a EVENT_MY_COURSES_UPDATED event. * * @param data Event data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshCourseList(data: CoreCoursesMyCoursesUpdatedEventData): Promise { if (data.action == CoreCoursesProvider.ACTION_ENROL) { diff --git a/src/addons/block/recentlyaccessedcourses/services/block-handler.ts b/src/addons/block/recentlyaccessedcourses/services/block-handler.ts index 935bcf9f2..506cf974d 100644 --- a/src/addons/block/recentlyaccessedcourses/services/block-handler.ts +++ b/src/addons/block/recentlyaccessedcourses/services/block-handler.ts @@ -30,7 +30,7 @@ export class AddonBlockRecentlyAccessedCoursesHandlerService extends CoreBlockBa /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts b/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts index 68b766359..3992ed377 100644 --- a/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts +++ b/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts @@ -58,7 +58,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateContent(): Promise { await AddonBlockRecentlyAccessedItems.invalidateRecentItems(); @@ -67,7 +67,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo /** * Fetch the data to render the block. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(): Promise { this.items = await AddonBlockRecentlyAccessedItems.getRecentItems(); @@ -78,6 +78,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo * * @param e Click event. * @param item Activity item info. + * @returns Promise resolved when done. */ async action(e: Event, item: AddonBlockRecentlyAccessedItemsItem): Promise { e.preventDefault(); diff --git a/src/addons/block/recentlyaccesseditems/services/block-handler.ts b/src/addons/block/recentlyaccesseditems/services/block-handler.ts index 0ceec5d43..55fc6940c 100644 --- a/src/addons/block/recentlyaccesseditems/services/block-handler.ts +++ b/src/addons/block/recentlyaccesseditems/services/block-handler.ts @@ -28,12 +28,7 @@ export class AddonBlockRecentlyAccessedItemsHandlerService extends CoreBlockBase blockName = 'recentlyaccesseditems'; /** - * Returns the data needed to render the block. - * - * @param block The block to render. - * @param contextLevel The context where the block will be used. - * @param instanceId The instance ID associated with the context level. - * @return Data or promise resolved with the data. + * @inheritdoc */ getDisplayData(): CoreBlockHandlerData{ diff --git a/src/addons/block/recentlyaccesseditems/services/recentlyaccesseditems.ts b/src/addons/block/recentlyaccesseditems/services/recentlyaccesseditems.ts index de78e4ea6..cee58917f 100644 --- a/src/addons/block/recentlyaccesseditems/services/recentlyaccesseditems.ts +++ b/src/addons/block/recentlyaccesseditems/services/recentlyaccesseditems.ts @@ -30,7 +30,7 @@ export class AddonBlockRecentlyAccessedItemsProvider { /** * Get cache key for get last accessed items value WS call. * - * @return Cache key. + * @returns Cache key. */ protected getRecentItemsCacheKey(): string { return ROOT_CACHE_KEY + ':recentitems'; @@ -40,7 +40,7 @@ export class AddonBlockRecentlyAccessedItemsProvider { * Get last accessed items. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getRecentItems(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -90,7 +90,7 @@ export class AddonBlockRecentlyAccessedItemsProvider { * Invalidates get last accessed items WS call. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateRecentItems(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/block/rssclient/services/block-handler.ts b/src/addons/block/rssclient/services/block-handler.ts index eb079eaef..c128ea7fd 100644 --- a/src/addons/block/rssclient/services/block-handler.ts +++ b/src/addons/block/rssclient/services/block-handler.ts @@ -33,7 +33,7 @@ export class AddonBlockRssClientHandlerService extends CoreBlockBaseHandler { * Returns the data needed to render the block. * * @param block The block to render. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(block: CoreCourseBlock): CoreBlockHandlerData { diff --git a/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts b/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts index b15e8766d..486875273 100644 --- a/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts +++ b/src/addons/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts @@ -40,7 +40,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { this.siteHomeId = CoreSites.getCurrentSiteHomeId(); @@ -51,7 +51,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateContent(): Promise { const promises: Promise[] = []; @@ -70,7 +70,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl /** * Fetch the data to render the block. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(): Promise { const sections = await CoreCourse.getSections(this.siteHomeId, false, true); diff --git a/src/addons/block/sitemainmenu/services/block-handler.ts b/src/addons/block/sitemainmenu/services/block-handler.ts index db1a203ae..0e4fd4b91 100644 --- a/src/addons/block/sitemainmenu/services/block-handler.ts +++ b/src/addons/block/sitemainmenu/services/block-handler.ts @@ -30,7 +30,7 @@ export class AddonBlockSiteMainMenuHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/starredcourses/components/starredcourses/starredcourses.ts b/src/addons/block/starredcourses/components/starredcourses/starredcourses.ts index be5dfee71..7f75e68bd 100644 --- a/src/addons/block/starredcourses/components/starredcourses/starredcourses.ts +++ b/src/addons/block/starredcourses/components/starredcourses/starredcourses.ts @@ -84,7 +84,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im /** * Invalidate list of courses. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateCourseList(): Promise { return AddonBlockStarredCourses.invalidateStarredCourses(); @@ -94,7 +94,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im * Helper function to invalidate only selected courses. * * @param courseIds Course Id array. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateCourses(courseIds: number[]): Promise { const promises: Promise[] = []; @@ -153,7 +153,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im * Refresh course list based on a EVENT_MY_COURSES_UPDATED event. * * @param data Event data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshCourseList(data: CoreCoursesMyCoursesUpdatedEventData): Promise { if (data.action == CoreCoursesProvider.ACTION_ENROL) { diff --git a/src/addons/block/starredcourses/services/block-handler.ts b/src/addons/block/starredcourses/services/block-handler.ts index 4b8c678c1..92ea56229 100644 --- a/src/addons/block/starredcourses/services/block-handler.ts +++ b/src/addons/block/starredcourses/services/block-handler.ts @@ -30,7 +30,7 @@ export class AddonBlockStarredCoursesHandlerService extends CoreBlockBaseHandler /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/starredcourses/services/starredcourses.ts b/src/addons/block/starredcourses/services/starredcourses.ts index b64c20ace..140bce94e 100644 --- a/src/addons/block/starredcourses/services/starredcourses.ts +++ b/src/addons/block/starredcourses/services/starredcourses.ts @@ -28,7 +28,7 @@ export class AddonBlockStarredCoursesProvider { /** * Get cache key for get starred courrses value WS call. * - * @return Cache key. + * @returns Cache key. */ protected getStarredCoursesCacheKey(): string { return ROOT_CACHE_KEY + ':starredcourses'; @@ -38,7 +38,7 @@ export class AddonBlockStarredCoursesProvider { * Get starred courrses. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getStarredCourses(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -54,7 +54,7 @@ export class AddonBlockStarredCoursesProvider { * Invalidates get starred courrses WS call. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateStarredCourses(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/block/tags/services/block-handler.ts b/src/addons/block/tags/services/block-handler.ts index e69964127..723e16f43 100644 --- a/src/addons/block/tags/services/block-handler.ts +++ b/src/addons/block/tags/services/block-handler.ts @@ -31,7 +31,7 @@ export class AddonBlockTagsHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/timeline/components/events/events.ts b/src/addons/block/timeline/components/events/events.ts index d507bdbaf..7b5cbbdac 100644 --- a/src/addons/block/timeline/components/events/events.ts +++ b/src/addons/block/timeline/components/events/events.ts @@ -42,6 +42,7 @@ export class AddonBlockTimelineEventsComponent { * * @param event Click event. * @param url Url of the action. + * @returns Promise resolved when done. */ async action(event: Event, url: string): Promise { event.preventDefault(); diff --git a/src/addons/block/timeline/services/block-handler.ts b/src/addons/block/timeline/services/block-handler.ts index 0675654c3..fc5421c5a 100644 --- a/src/addons/block/timeline/services/block-handler.ts +++ b/src/addons/block/timeline/services/block-handler.ts @@ -33,7 +33,7 @@ export class AddonBlockTimelineHandlerService extends CoreBlockBaseHandler { /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { const enabled = !CoreCoursesDashboard.isDisabledInSite(); @@ -46,7 +46,7 @@ export class AddonBlockTimelineHandlerService extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData(): CoreBlockHandlerData { diff --git a/src/addons/block/timeline/services/timeline.ts b/src/addons/block/timeline/services/timeline.ts index 144aa8fe9..3206c895f 100644 --- a/src/addons/block/timeline/services/timeline.ts +++ b/src/addons/block/timeline/services/timeline.ts @@ -45,7 +45,7 @@ export class AddonBlockTimelineProvider { * @param afterEventId The last seen event id. * @param searchValue The value a user wishes to search against. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getActionEventsByCourse( courseId: number, @@ -88,7 +88,7 @@ export class AddonBlockTimelineProvider { * Get cache key for get calendar action events for the given course value WS call. * * @param courseId Only events in this course. - * @return Cache key. + * @returns Cache key. */ protected getActionEventsByCourseCacheKey(courseId: number): string { return this.getActionEventsByCoursesCacheKey() + ':' + courseId; @@ -98,9 +98,9 @@ export class AddonBlockTimelineProvider { * Get calendar action events for a given list of courses. * * @param courseIds Course IDs. - * @param siteId Site ID. If not defined, use current site. * @param searchValue The value a user wishes to search against. - * @return Promise resolved when the info is retrieved. + * @param siteId Site ID. If not defined, use current site. + * @returns Promise resolved when the info is retrieved. */ async getActionEventsByCourses( courseIds: number[], @@ -147,7 +147,7 @@ export class AddonBlockTimelineProvider { /** * Get cache key for get calendar action events for a given list of courses value WS call. * - * @return Cache key. + * @returns Cache key. */ protected getActionEventsByCoursesCacheKey(): string { return ROOT_CACHE_KEY + 'bycourse'; @@ -159,7 +159,7 @@ export class AddonBlockTimelineProvider { * @param afterEventId The last seen event id. * @param searchValue The value a user wishes to search against. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getActionEventsByTimesort( afterEventId?: number, @@ -211,7 +211,7 @@ export class AddonBlockTimelineProvider { /** * Get prefix cache key for calendar action events based on the timesort value WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getActionEventsByTimesortPrefixCacheKey(): string { return ROOT_CACHE_KEY + 'bytimesort:'; @@ -222,7 +222,7 @@ export class AddonBlockTimelineProvider { * * @param afterEventId The last seen event id. * @param limit Limit num of the call. - * @return Cache key. + * @returns Cache key. */ protected getActionEventsByTimesortCacheKey(afterEventId?: number, limit?: number): string { afterEventId = afterEventId || 0; @@ -235,7 +235,7 @@ export class AddonBlockTimelineProvider { * Invalidates get calendar action events for a given list of courses WS call. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateActionEventsByCourses(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -247,7 +247,7 @@ export class AddonBlockTimelineProvider { * Invalidates get calendar action events based on the timesort value WS call. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateActionEventsByTimesort(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -260,7 +260,7 @@ export class AddonBlockTimelineProvider { * * @param course Object containing response course events info. * @param timeFrom Current time to filter events from. - * @return Object with course events and last loaded event id if more can be loaded. + * @returns Object with course events and last loaded event id if more can be loaded. */ protected treatCourseEvents( course: AddonCalendarEvents, @@ -283,7 +283,7 @@ export class AddonBlockTimelineProvider { * Returns the timestamp at the start of the day with an optional offset. * * @param daysOffset Offset days to add or substract. - * @return timestamp. + * @returns timestamp. */ getDayStart(daysOffset = 0): number { return moment().startOf('day').add(daysOffset, 'days').unix(); diff --git a/src/addons/blog/pages/entries/entries.ts b/src/addons/blog/pages/entries/entries.ts index 8d5baa0e4..11d2b32c6 100644 --- a/src/addons/blog/pages/entries/entries.ts +++ b/src/addons/blog/pages/entries/entries.ts @@ -131,7 +131,7 @@ export class AddonBlogEntriesPage implements OnInit { * Fetch blog entries. * * @param refresh Empty events array first. - * @return Promise with the entries. + * @returns Promise with the entries. */ protected async fetchEntries(refresh: boolean = false): Promise { this.loadMoreError = false; @@ -240,7 +240,7 @@ export class AddonBlogEntriesPage implements OnInit { * Function to load more entries. * * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Resolved when done. + * @returns Resolved when done. */ loadMore(infiniteComplete?: () => void): Promise { return this.fetchEntries().finally(() => { diff --git a/src/addons/blog/services/blog.ts b/src/addons/blog/services/blog.ts index 8e1847d83..83e588deb 100644 --- a/src/addons/blog/services/blog.ts +++ b/src/addons/blog/services/blog.ts @@ -39,7 +39,7 @@ export class AddonBlogProvider { * check, we should not be calling WS from here. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @returns Promise resolved with true if enabled, resolved with false or rejected otherwise. * @since 3.6 */ async isPluginEnabled(siteId?: string): Promise { @@ -52,7 +52,7 @@ export class AddonBlogProvider { * Get the cache key for the blog entries. * * @param filter Filter to apply on search. - * @return Cache key. + * @returns Cache key. */ getEntriesCacheKey(filter: AddonBlogFilter = {}): string { return ROOT_CACHE_KEY + CoreUtils.sortAndStringify(filter); @@ -64,7 +64,7 @@ export class AddonBlogProvider { * @param filter Filter to apply on search. * @param page Page of the blog entries to fetch. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the entries are retrieved. + * @returns Promise to be resolved when the entries are retrieved. */ async getEntries(filter: AddonBlogFilter = {}, page: number = 0, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -88,7 +88,7 @@ export class AddonBlogProvider { * * @param filter Filter to apply on search * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateEntries(filter: AddonBlogFilter = {}, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -101,7 +101,7 @@ export class AddonBlogProvider { * * @param filter Filter to apply on search. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when done. + * @returns Promise to be resolved when done. */ async logView(filter: AddonBlogFilter = {}, siteId?: string): Promise { CorePushNotifications.logViewListEvent('blog', 'core_blog_view_entries', filter, siteId); diff --git a/src/addons/calendar/components/calendar/calendar.ts b/src/addons/calendar/components/calendar/calendar.ts index aef2a3a74..77c077fb9 100644 --- a/src/addons/calendar/components/calendar/calendar.ts +++ b/src/addons/calendar/components/calendar/calendar.ts @@ -169,7 +169,7 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro /** * Fetch contacts. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchData(): Promise { try { @@ -200,7 +200,7 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro * Refresh events. * * @param afterChange Whether the refresh is done after an event has changed or has been synced. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(afterChange = false): Promise { const selectedMonth = this.manager?.getSelectedItem() || null; @@ -264,6 +264,8 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro /** * Check whether selected month is loaded. + * + * @returns If selected month has been loaded. */ selectedMonthLoaded(): boolean { return !!this.manager?.getSelectedItem()?.loaded; @@ -271,6 +273,8 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro /** * Check whether selected month is current month. + * + * @returns If selected month is the current. */ selectedMonthIsCurrent(): boolean { return !!this.manager?.getSelectedItem()?.isCurrentMonth; @@ -387,7 +391,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI /** * Fetch data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchData(): Promise { await Promise.all([ @@ -422,7 +426,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI /** * Load categories to be able to filter events. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadCategories(): Promise { if (this.categories) { @@ -443,7 +447,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI /** * Load events created or edited in offline. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadOfflineEvents(): Promise { // Get offline events. @@ -459,7 +463,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI /** * Load events deleted in offline. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadOfflineDeletedEvents(): Promise { this.deletedEvents = await AddonCalendarOffline.getAllDeletedEventsIds(); @@ -468,7 +472,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI /** * Load time format. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadTimeFormat(): Promise { this.timeFormat = await AddonCalendar.getCalendarTimeFormat(); @@ -612,7 +616,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI * * @param event Event object. * @param currentTime Current time. - * @return True if it's in the past. + * @returns True if it's in the past. */ isEventPast(event: { timestart: number; timeduration: number}, currentTime: number): boolean { return (event.timestart + event.timeduration) < currentTime; @@ -622,7 +626,7 @@ class AddonCalendarMonthSlidesItemsManagerSource extends CoreSwipeSlidesDynamicI * Invalidate content. * * @param selectedMonth The current selected month. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateContent(selectedMonth: PreloadedMonth | null): Promise { const promises: Promise[] = []; diff --git a/src/addons/calendar/components/upcoming-events/upcoming-events.ts b/src/addons/calendar/components/upcoming-events/upcoming-events.ts index 2c28089ca..0a0205a06 100644 --- a/src/addons/calendar/components/upcoming-events/upcoming-events.ts +++ b/src/addons/calendar/components/upcoming-events/upcoming-events.ts @@ -107,7 +107,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On /** * Fetch data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchData(): Promise { const promises: Promise[] = []; @@ -160,7 +160,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On /** * Fetch upcoming events. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchEvents(): Promise { // Don't pass courseId and categoryId, we'll filter them locally. @@ -185,7 +185,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On /** * Load categories to be able to filter events. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCategories(): Promise { if (this.categoriesRetrieved) { @@ -217,7 +217,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On /** * Refresh events. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(): Promise { const promises: Promise[] = []; @@ -246,7 +246,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, DoCheck, On /** * Merge online events with the offline events of that period. * - * @return Merged events. + * @returns Merged events. */ protected mergeEvents(): AddonCalendarEventToDisplay[] { if (!this.offlineEvents.length && !this.deletedEvents.length) { diff --git a/src/addons/calendar/pages/day/day.page.ts b/src/addons/calendar/pages/day/day.page.ts index 3c266ee85..793de1e54 100644 --- a/src/addons/calendar/pages/day/day.page.ts +++ b/src/addons/calendar/pages/day/day.page.ts @@ -232,8 +232,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { * Fetch all the data required for the view. * * @param sync Whether it should try to synchronize offline events. - * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchData(sync?: boolean): Promise { this.syncIcon = CoreConstants.ICON_LOADING; @@ -272,7 +271,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { * * @param refresher Refresher. * @param done Function to call when done. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void): Promise { if (!this.loaded) { @@ -290,7 +289,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { * * @param sync Whether it should try to synchronize offline events. * @param afterChange Whether the refresh is done after an event has changed or has been synced. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(sync?: boolean, afterChange?: boolean): Promise { this.syncIcon = CoreConstants.ICON_LOADING; @@ -307,7 +306,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { * Try to synchronize offline events. * * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async sync(showErrors?: boolean): Promise { try { @@ -335,6 +334,8 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Check whether selected day is current day. + * + * @returns If selected day is current. */ selectedDayIsCurrent(): boolean { return !!this.manager?.getSelectedItem()?.isCurrentDay; @@ -393,7 +394,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Check whether selected day has offline data. * - * @return Whether selected day has offline data. + * @returns Whether selected day has offline data. */ selectedDayHasOffline(): boolean { const selectedDay = this.manager?.getSelectedItem(); @@ -510,7 +511,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte * Fetch data. * * @param courseId Current selected course id (if any). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchData(courseId?: number): Promise { await Promise.all([ @@ -548,7 +549,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte * Load courses. * * @param courseId Current selected course id (if any). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadCourses(courseId?: number): Promise { const data = await CoreCoursesHelper.getCoursesForPopover(courseId); @@ -560,7 +561,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte * Load whether user can create events. * * @param courseId Current selected course id (if any). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadCanCreate(courseId?: number): Promise { this.canCreate = await AddonCalendarHelper.canEditEvents(courseId); @@ -569,7 +570,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte /** * Load categories to be able to filter events. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadCategories(): Promise { if (this.categories) { @@ -590,7 +591,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte /** * Load events created or edited in offline. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadOfflineEvents(): Promise { // Get offline events. @@ -606,7 +607,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte /** * Load events deleted in offline. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadOfflineDeletedEvents(): Promise { const deletedEventsIds = await AddonCalendarOffline.getAllDeletedEventsIds(); @@ -617,7 +618,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte /** * Load time format. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadTimeFormat(): Promise { this.timeFormat = await AddonCalendar.getCalendarTimeFormat(); @@ -704,7 +705,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte * * @param event Event object. * @param currentTime Current time. - * @return True if it's in the past. + * @returns True if it's in the past. */ isEventPast(event: AddonCalendarEventToDisplay, currentTime: number): boolean { return (event.timestart + event.timeduration) < currentTime; @@ -714,7 +715,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte * Merge online events with the offline events of that period. * * @param day Day with the events. - * @return Merged events. + * @returns Merged events. */ mergeEvents(day: PreloadedDay): AddonCalendarEventToDisplay[] { day.hasOffline = false; @@ -762,7 +763,7 @@ class AddonCalendarDaySlidesItemsManagerSource extends CoreSwipeSlidesDynamicIte * * @param selectedDay The current selected day. * @param invalidateDayEvents Whether to invalidate selected day events. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateContent(selectedDay: PreloadedDay | null, invalidateDayEvents?: boolean): Promise { const promises: Promise[] = []; diff --git a/src/addons/calendar/pages/edit-event/edit-event.page.ts b/src/addons/calendar/pages/edit-event/edit-event.page.ts index e4fb34416..8b8ffe230 100644 --- a/src/addons/calendar/pages/edit-event/edit-event.page.ts +++ b/src/addons/calendar/pages/edit-event/edit-event.page.ts @@ -160,7 +160,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave { /** * Fetch the data needed to render the form. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { this.error = false; @@ -318,7 +318,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave { * * @param event Event data. * @param isOffline Whether the data is from offline or not. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadEventData( event: AddonCalendarEvent | AddonCalendarOfflineEventDBRecord, @@ -435,7 +435,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave { * Load groups of a certain course. * * @param courseId Course ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadGroups(courseId: number): Promise { this.loadingGroups = true; @@ -622,7 +622,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved with true if we can leave it, rejected if not. + * @returns Resolved with true if we can leave it, rejected if not. */ async canLeave(): Promise { if (AddonCalendarHelper.hasEventDataChanged(this.form.value, this.originalData)) { @@ -647,7 +647,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave { /** * Init reminders. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initReminders(): Promise { // Don't init reminders when editing an event. Right now, only allow adding reminders for new events. diff --git a/src/addons/calendar/pages/event/event.page.ts b/src/addons/calendar/pages/event/event.page.ts index 907114a1e..a94f5d43f 100644 --- a/src/addons/calendar/pages/event/event.page.ts +++ b/src/addons/calendar/pages/event/event.page.ts @@ -145,7 +145,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { /** * Load reminders. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadReminders(): Promise { if (!this.remindersEnabled || !this.event) { @@ -180,7 +180,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { * * @param sync Whether it should try to synchronize offline events. * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchEvent(sync = false, showErrors = false): Promise { this.isOnline = CoreNetwork.isOnline(); @@ -319,7 +319,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { * Sync offline events. * * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved with boolean: whether event was deleted on sync. + * @returns Promise resolved with boolean: whether event was deleted on sync. */ protected async syncEvents(showErrors = false): Promise { let deleted = false; @@ -363,7 +363,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { * * @param event Event. * @param courseId Course ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadGroupName(event: AddonCalendarEventToDisplay, courseId: number): Promise { try { @@ -438,7 +438,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { * @param refresher Refresher. * @param done Function to call when done. * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void, showErrors= false): Promise { if (!this.eventLoaded) { @@ -456,7 +456,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { * * @param sync Whether it should try to synchronize offline events. * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshEvent(sync = false, showErrors = false): Promise { this.syncIcon = CoreConstants.ICON_LOADING; diff --git a/src/addons/calendar/pages/index/index.page.ts b/src/addons/calendar/pages/index/index.page.ts index cba2727e8..f9890caf5 100644 --- a/src/addons/calendar/pages/index/index.page.ts +++ b/src/addons/calendar/pages/index/index.page.ts @@ -188,7 +188,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { * * @param sync Whether it should try to synchronize offline events. * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchData(sync?: boolean, showErrors?: boolean): Promise { @@ -261,7 +261,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { * @param refresher Refresher. * @param done Function to call when done. * @param showErrors Whether to show sync errors to the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void, showErrors?: boolean): Promise { if (!this.loaded) { @@ -280,7 +280,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { * @param sync Whether it should try to synchronize offline events. * @param showErrors Whether to show sync errors to the user. * @param afterChange Whether the refresh is done after an event has changed or has been synced. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(sync = false, showErrors = false, afterChange = false): Promise { this.syncIcon = CoreConstants.ICON_LOADING; diff --git a/src/addons/calendar/pages/settings/settings.ts b/src/addons/calendar/pages/settings/settings.ts index dab3d7bab..cb0fa0c70 100644 --- a/src/addons/calendar/pages/settings/settings.ts +++ b/src/addons/calendar/pages/settings/settings.ts @@ -44,7 +44,7 @@ export class AddonCalendarSettingsPage implements OnInit { * Change default time. * * @param e Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changeDefaultTime(e: Event): Promise { e.stopPropagation(); diff --git a/src/addons/calendar/services/calendar-helper.ts b/src/addons/calendar/services/calendar-helper.ts index 6ac5d6334..bfe8f04df 100644 --- a/src/addons/calendar/services/calendar-helper.ts +++ b/src/addons/calendar/services/calendar-helper.ts @@ -61,7 +61,7 @@ export class AddonCalendarHelperProvider { * Returns event icon based on event type. * * @param eventType Type of the event. - * @return Event icon. + * @returns Event icon. */ getEventIcon(eventType: AddonCalendarEventType | string): string { if (this.eventTypeIcons.length == 0) { @@ -101,7 +101,7 @@ export class AddonCalendarHelperProvider { * * @param courseId Course ID. If not defined, site calendar. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether the user can create events. + * @returns Promise resolved with boolean: whether the user can create events. */ async canEditEvents(courseId?: number, siteId?: string): Promise { try { @@ -123,7 +123,7 @@ export class AddonCalendarHelperProvider { * it will be included in all the days it lasts. * * @param offlineEvents Events to classify. - * @return Object with the classified events. + * @returns Object with the classified events. */ classifyIntoMonths( offlineEvents: AddonCalendarOfflineEventDBRecord[], @@ -162,6 +162,7 @@ export class AddonCalendarHelperProvider { * Convenience function to format some event data to be rendered. * * @param event Event to format. + * @returns The formatted event to display. */ formatEventData( event: AddonCalendarEvent | AddonCalendarEventBase | AddonCalendarGetEventsEvent, @@ -219,6 +220,7 @@ export class AddonCalendarHelperProvider { * Convenience function to format some event data to be rendered. * * @param event Event to format. + * @returns The formatted offline event to display. */ formatOfflineEventData(event: AddonCalendarOfflineEventDBRecord): AddonCalendarEventToDisplay { @@ -293,7 +295,7 @@ export class AddonCalendarHelperProvider { * @param reminders Reminders. * @param timestart Event timestart. * @param siteId Site ID. - * @return Formatted reminders. + * @returns Formatted reminders. * @deprecated since 4.1 Use AddonCalendarHelper.getEventReminders. */ async formatReminders( @@ -314,7 +316,7 @@ export class AddonCalendarHelperProvider { * @param eventId Event Id. * @param eventTimestart Event timestart. * @param siteId Site ID. - * @return Formatted reminders. + * @returns Formatted reminders. */ async getEventReminders( eventId: number, @@ -370,7 +372,7 @@ export class AddonCalendarHelperProvider { * Get options (name & value) for each allowed event type. * * @param eventTypes Result of getAllowedEventTypes. - * @return Options. + * @returns Options. */ getEventTypeOptions(eventTypes: {[name: string]: boolean}): AddonCalendarEventTypeOption[] { const options: AddonCalendarEventTypeOption[] = []; @@ -398,7 +400,7 @@ export class AddonCalendarHelperProvider { * Get the month "id". * * @param moment Month moment. - * @return The "id". + * @returns The "id". */ getMonthId(moment: moment.Moment): string { return `${moment.year()}#${moment.month() + 1}`; @@ -408,7 +410,7 @@ export class AddonCalendarHelperProvider { * Get the day "id". * * @param moment Day moment. - * @return The "id". + * @returns The "id". */ getDayId(moment: moment.Moment): string { return `${this.getMonthId(moment)}#${moment.date()}`; @@ -422,7 +424,7 @@ export class AddonCalendarHelperProvider { * @param year Year to get. * @param month Month to get. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ async getOfflineMonthWeeks( year: number, @@ -497,7 +499,7 @@ export class AddonCalendarHelperProvider { * * @param data Current data. * @param original Original data. - * @return True if data has changed, false otherwise. + * @returns True if data has changed, false otherwise. */ hasEventDataChanged(data: AddonCalendarOfflineEventDBRecord, original?: AddonCalendarOfflineEventDBRecord): boolean { if (!original) { @@ -539,7 +541,7 @@ export class AddonCalendarHelperProvider { * @param events Events without filtering. * @param filter Filter from popover. * @param categories Categories indexed by ID. - * @return Filtered events. + * @returns Filtered events. */ getFilteredEvents( events: AddonCalendarEventToDisplay[], @@ -571,7 +573,7 @@ export class AddonCalendarHelperProvider { * @param categories Categories indexed by ID. * @param courseId Course ID to filter. * @param categoryId Category ID the course belongs to. - * @return Whether it should be displayed. + * @returns Whether it should be displayed. */ protected shouldDisplayEvent( event: AddonCalendarEventToDisplay, @@ -624,7 +626,7 @@ export class AddonCalendarHelperProvider { * * @param events Events that have been touched and number of times each event is repeated. * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async refreshAfterChangeEvents(events: AddonCalendarSyncInvalidateEvent[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -759,7 +761,7 @@ export class AddonCalendarHelperProvider { * @param event Event that has been touched. * @param repeated Number of times the event is repeated. * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ refreshAfterChangeEvent( event: { @@ -785,6 +787,7 @@ export class AddonCalendarHelperProvider { * Sort events by timestart. * * @param events List to sort. + * @returns Events sorted. */ sortEvents(events: (AddonCalendarEventToDisplay)[]): (AddonCalendarEventToDisplay)[] { return events.sort((a, b) => { diff --git a/src/addons/calendar/services/calendar-offline.ts b/src/addons/calendar/services/calendar-offline.ts index 1eeaea9b5..4136fa66f 100644 --- a/src/addons/calendar/services/calendar-offline.ts +++ b/src/addons/calendar/services/calendar-offline.ts @@ -36,7 +36,7 @@ export class AddonCalendarOfflineProvider { * * @param eventId Event ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteEvent(eventId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -52,7 +52,7 @@ export class AddonCalendarOfflineProvider { * Get the IDs of all the events created/edited/deleted in offline. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the IDs. + * @returns Promise resolved with the IDs. */ async getAllEventsIds(siteId?: string): Promise { const promises: Promise[] = []; @@ -69,7 +69,7 @@ export class AddonCalendarOfflineProvider { * Get all the events deleted in offline. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with all the events deleted in offline. + * @returns Promise resolved with all the events deleted in offline. */ async getAllDeletedEvents(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -81,7 +81,7 @@ export class AddonCalendarOfflineProvider { * Get the IDs of all the events deleted in offline. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the IDs of all the events deleted in offline. + * @returns Promise resolved with the IDs of all the events deleted in offline. */ async getAllDeletedEventsIds(siteId?: string): Promise { const events = await this.getAllDeletedEvents(siteId); @@ -93,7 +93,7 @@ export class AddonCalendarOfflineProvider { * Get all the events created/edited in offline. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with events. + * @returns Promise resolved with events. */ async getAllEditedEvents(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -105,7 +105,7 @@ export class AddonCalendarOfflineProvider { * Get the IDs of all the events created/edited in offline. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with events IDs. + * @returns Promise resolved with events IDs. */ async getAllEditedEventsIds(siteId?: string): Promise { const events = await this.getAllEditedEvents(siteId); @@ -118,7 +118,7 @@ export class AddonCalendarOfflineProvider { * * @param eventId Event ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the deleted event. + * @returns Promise resolved with the deleted event. */ async getDeletedEvent(eventId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -134,7 +134,7 @@ export class AddonCalendarOfflineProvider { * * @param eventId Event ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the event. + * @returns Promise resolved with the event. */ async getEvent(eventId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -149,7 +149,7 @@ export class AddonCalendarOfflineProvider { * Check if there are offline events to send. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline events, false otherwise. + * @returns Promise resolved with boolean: true if has offline events, false otherwise. */ async hasEditedEvents(siteId?: string): Promise { try { @@ -166,7 +166,7 @@ export class AddonCalendarOfflineProvider { * Check whether there's offline data for a site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline data, false otherwise. + * @returns Promise resolved with boolean: true if has offline data, false otherwise. */ async hasOfflineData(siteId?: string): Promise { const ids = await this.getAllEventsIds(siteId); @@ -179,7 +179,7 @@ export class AddonCalendarOfflineProvider { * * @param eventId Event ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether the event is deleted. + * @returns Promise resolved with boolean: whether the event is deleted. */ async isEventDeleted(eventId: number, siteId?: string): Promise { try { @@ -198,7 +198,7 @@ export class AddonCalendarOfflineProvider { * @param name Name of the event to delete. * @param deleteAll If it's a repeated event. whether to delete all events of the series. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async markDeleted(eventId: number, name: string, deleteAll?: boolean, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -218,7 +218,7 @@ export class AddonCalendarOfflineProvider { * @param eventId Event ID. Negative value to edit offline event. If it's a new event, set it to undefined/null. * @param data Event data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the stored event. + * @returns Promise resolved with the stored event. */ async saveEvent( eventId: number | undefined, @@ -258,7 +258,7 @@ export class AddonCalendarOfflineProvider { * * @param eventId Event ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async unmarkDeleted(eventId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/calendar/services/calendar-sync.ts b/src/addons/calendar/services/calendar-sync.ts index 59ad3e571..21845fba8 100644 --- a/src/addons/calendar/services/calendar-sync.ts +++ b/src/addons/calendar/services/calendar-sync.ts @@ -52,7 +52,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { await this.syncOnSites('all calendar events', (siteId) => this.syncAllEventsFunc(force, siteId), siteId); @@ -63,7 +63,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { const result = force @@ -80,7 +80,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -96,7 +96,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -119,7 +119,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { const result: AddonCalendarSyncEvents = { @@ -168,7 +168,7 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { diff --git a/src/addons/calendar/services/calendar.ts b/src/addons/calendar/services/calendar.ts index 28bfbb5b0..ce5142338 100644 --- a/src/addons/calendar/services/calendar.ts +++ b/src/addons/calendar/services/calendar.ts @@ -149,7 +149,7 @@ export class AddonCalendarProvider { * Check if a certain site allows creating and editing events. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if can create/edit. + * @returns Promise resolved with true if can create/edit. * @since 3.7.1 */ async canEditEvents(siteId?: string): Promise { @@ -166,7 +166,7 @@ export class AddonCalendarProvider { * Check if a certain site allows creating and editing events. * * @param site Site. If not defined, use current site. - * @return Whether events can be created and edited. + * @returns Whether events can be created and edited. * @since 3.7.1 */ canEditEventsInSite(site?: CoreSite): boolean { @@ -180,7 +180,7 @@ export class AddonCalendarProvider { * Given a number of seconds, convert it to a unit&value format compatible with reminders. * * @param seconds Number of seconds. - * @return Value and unit. + * @returns Value and unit. * @deprecated since 4.1 Use CoreRemindersService.convertSecondsToValueAndUnit instead. */ static convertSecondsToValueAndUnit(seconds: number): CoreReminderValueAndUnit { @@ -195,7 +195,7 @@ export class AddonCalendarProvider { * @param deleteAll If it's a repeated event. whether to delete all events of the series. * @param forceOffline True to always save it in offline. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteEvent( eventId: number, @@ -239,7 +239,7 @@ export class AddonCalendarProvider { * @param eventId Event ID to delete. * @param deleteAll If it's a repeated event. whether to delete all events of the series. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteEventOnline(eventId: number, deleteAll = false, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -263,7 +263,7 @@ export class AddonCalendarProvider { * * @param eventId Event ID. * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Resolved when done. + * @returns Resolved when done. */ protected async deleteLocalEvent(eventId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -286,7 +286,7 @@ export class AddonCalendarProvider { /** * Initialize the service. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async initialize(): Promise { CoreLocalNotifications.registerClick( @@ -303,7 +303,7 @@ export class AddonCalendarProvider { * Notification has been clicked. * * @param notification Calendar notification. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async notificationClicked(notification: CoreRemindersPushNotificationData): Promise { const disabled = await this.isDisabled(notification.siteId); @@ -334,7 +334,7 @@ export class AddonCalendarProvider { * @param seenDay Timestamp of day currently seen. If set, the function will not add links to this day. * @param showTime Determine the show time GMT timestamp. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the formatted event time. + * @returns Promise resolved with the formatted event time. */ async formatEventTime( event: AddonCalendarEventToDisplay, @@ -422,7 +422,7 @@ export class AddonCalendarProvider { * * @param courseId Course ID. If not defined, site calendar. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with object with access information. + * @returns Promise resolved with object with access information. * @since 3.7 */ async getAccessInformation(courseId?: number, siteId?: string): Promise { @@ -442,7 +442,7 @@ export class AddonCalendarProvider { * Get cache key for calendar access information WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getAccessInformationCacheKey(courseId?: number): string { return ROOT_CACHE_KEY + 'accessInformation:' + (courseId || 0); @@ -452,7 +452,7 @@ export class AddonCalendarProvider { * Get all calendar events from local Db. * * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Promise resolved with all the events. + * @returns Promise resolved with all the events. */ async getAllEventsFromLocalDb(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -465,7 +465,7 @@ export class AddonCalendarProvider { * * @param courseId Course ID. If not defined, site calendar. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with an object indicating the types. + * @returns Promise resolved with an object indicating the types. * @since 3.7 */ async getAllowedEventTypes(courseId?: number, siteId?: string): Promise<{[name: string]: boolean}> { @@ -495,7 +495,7 @@ export class AddonCalendarProvider { * Get cache key for calendar allowed event types WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getAllowedEventTypesCacheKey(courseId?: number): string { return ROOT_CACHE_KEY + 'allowedEventTypes:' + (courseId || 0); @@ -505,7 +505,7 @@ export class AddonCalendarProvider { * Get the "look ahead" for a certain user. * * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved with the look ahead (number of days). + * @returns Promise resolved with the look ahead (number of days). */ async getCalendarLookAhead(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -527,7 +527,7 @@ export class AddonCalendarProvider { * Get the time format to use in calendar. * * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved with the format. + * @returns Promise resolved with the format. */ async getCalendarTimeFormat(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -557,7 +557,7 @@ export class AddonCalendarProvider { * * @param time Timestamp to get the day from. * @param useCommonWords Whether to use common words like "Today", "Yesterday", etc. - * @return The formatted date/time. + * @returns The formatted date/time. */ getDayRepresentation(time: number, useCommonWords: boolean = true): string { @@ -586,7 +586,7 @@ export class AddonCalendarProvider { * Get the configured default notification time. * * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved with the default time (in seconds). + * @returns Promise resolved with the default time (in seconds). * @deprecated since 4.1 Use CoreReminders.getDefaultNotificationTime instead. */ async getDefaultNotificationTime(siteId?: string): Promise { @@ -598,7 +598,7 @@ export class AddonCalendarProvider { * * @param id Event ID. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved when the event data is retrieved. + * @returns Promise resolved when the event data is retrieved. */ async getEvent(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -634,7 +634,7 @@ export class AddonCalendarProvider { * * @param id Event ID. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved when the event data is retrieved. + * @returns Promise resolved when the event data is retrieved. */ async getEventById(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -666,7 +666,7 @@ export class AddonCalendarProvider { * Get cache key for a single event WS call. * * @param id Event ID. - * @return Cache key. + * @returns Cache key. */ protected getEventCacheKey(id: number): string { return ROOT_CACHE_KEY + 'events:' + id; @@ -677,7 +677,7 @@ export class AddonCalendarProvider { * * @param id Event ID. * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Promise resolved when the event data is retrieved. + * @returns Promise resolved when the event data is retrieved. */ async getEventFromLocalDb(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -719,7 +719,7 @@ export class AddonCalendarProvider { * @param event Event to set the reminder. * @param timebefore Amount of seconds of the reminder. Undefined for default reminder. * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Promise resolved when the notification is updated. + * @returns Promise resolved when the notification is updated. */ async addEventReminder( event: AddonCalendarEvent | AddonCalendarEventDBRecord | AddonCalendarEventToDisplay | AddonCalendarOfflineEventDBRecord, @@ -761,7 +761,7 @@ export class AddonCalendarProvider { * Activity events are normalised to be course events. * * @param event The event to get its type. - * @return Event type. + * @returns Event type. */ getEventType(event: { modulename?: string; eventtype: AddonCalendarEventType | string }): string { if (event.modulename) { @@ -776,7 +776,7 @@ export class AddonCalendarProvider { * * @param id Reminder ID. * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Promise resolved when the notification is updated. + * @returns Promise resolved when the notification is updated. * @deprecated since 4.1. Use CoreReminders.removeReminder instead. */ async deleteEventReminder(id: number, siteId?: string): Promise { @@ -793,7 +793,7 @@ export class AddonCalendarProvider { * @param categoryId Category to get. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ async getDayEvents( year: number, @@ -835,7 +835,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for day events WS calls. * - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getDayEventsPrefixCacheKey(): string { return ROOT_CACHE_KEY + 'day:'; @@ -847,7 +847,7 @@ export class AddonCalendarProvider { * @param year Year to get. * @param month Month to get. * @param day Day to get. - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getDayEventsDayPrefixCacheKey(year: number, month: number, day: number): string { return this.getDayEventsPrefixCacheKey() + year + ':' + month + ':' + day + ':'; @@ -861,7 +861,7 @@ export class AddonCalendarProvider { * @param day Day to get. * @param courseId Course to get. * @param categoryId Category to get. - * @return Cache key. + * @returns Cache key. */ protected getDayEventsCacheKey(year: number, month: number, day: number, courseId?: number, categoryId?: number): string { return this.getDayEventsDayPrefixCacheKey(year, month, day) + (courseId ? courseId : '') + ':' + @@ -873,7 +873,7 @@ export class AddonCalendarProvider { * * @param eventId Event ID. * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Promise resolved when the event data is retrieved. + * @returns Promise resolved when the event data is retrieved. * @deprecated since 4.1. Use CoreReminders.getReminders instead. */ async getEventReminders(eventId: number, siteId?: string): Promise { @@ -894,7 +894,7 @@ export class AddonCalendarProvider { * @param daysToStart Number of days from now to start getting events. * @param daysInterval Number of days between timestart and timeend. * @param siteId Site to get the events from. If not defined, use current site. - * @return Promise to be resolved when the events are retrieved. + * @returns Promise to be resolved when the events are retrieved. */ async getEventsList( initialTime?: number, @@ -958,7 +958,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for events list WS calls. * - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getEventsListPrefixCacheKey(): string { return ROOT_CACHE_KEY + 'events:'; @@ -969,7 +969,7 @@ export class AddonCalendarProvider { * * @param daysToStart Number of days from now to start getting events. * @param daysInterval Number of days between timestart and timeend. - * @return Cache key. + * @returns Cache key. */ protected getEventsListCacheKey(daysToStart: number, daysInterval: number): string { return this.getEventsListPrefixCacheKey() + daysToStart + ':' + daysInterval; @@ -980,7 +980,7 @@ export class AddonCalendarProvider { * * @param repeatId Repeat Id of the event. * @param siteId ID of the site the event belongs to. If not defined, use current site. - * @return Promise resolved with all the events. + * @returns Promise resolved with all the events. */ async getLocalEventsByRepeatIdFromLocalDb(repeatId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -997,7 +997,7 @@ export class AddonCalendarProvider { * @param categoryId Category to get. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ async getMonthlyEvents( year: number, @@ -1049,7 +1049,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for monthly events WS calls. * - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getMonthlyEventsPrefixCacheKey(): string { return ROOT_CACHE_KEY + 'monthly:'; @@ -1060,7 +1060,7 @@ export class AddonCalendarProvider { * * @param year Year to get. * @param month Month to get. - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getMonthlyEventsMonthPrefixCacheKey(year: number, month: number): string { return this.getMonthlyEventsPrefixCacheKey() + year + ':' + month + ':'; @@ -1073,7 +1073,7 @@ export class AddonCalendarProvider { * @param month Month to get. * @param courseId Course to get. * @param categoryId Category to get. - * @return Cache key. + * @returns Cache key. */ protected getMonthlyEventsCacheKey(year: number, month: number, courseId?: number, categoryId?: number): string { return this.getMonthlyEventsMonthPrefixCacheKey(year, month) + (courseId ? courseId : '') + ':' + @@ -1086,7 +1086,7 @@ export class AddonCalendarProvider { * @param value Value. * @param unit Unit. * @param addDefaultLabel Whether to add the "Default" text. - * @return Translated label. + * @returns Translated label. * @deprecated since 4.1 Use CoreReminders.getUnitValueLabel instead. */ getUnitValueLabel(value: number, unit: CoreRemindersUnits, addDefaultLabel = false): string { @@ -1100,7 +1100,7 @@ export class AddonCalendarProvider { * @param categoryId Category to get. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ async getUpcomingEvents( courseId?: number, @@ -1140,7 +1140,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for upcoming events WS calls. * - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getUpcomingEventsPrefixCacheKey(): string { return ROOT_CACHE_KEY + 'upcoming:'; @@ -1151,7 +1151,7 @@ export class AddonCalendarProvider { * * @param courseId Course to get. * @param categoryId Category to get. - * @return Cache key. + * @returns Cache key. */ protected getUpcomingEventsCacheKey(courseId?: number, categoryId?: number): string { return this.getUpcomingEventsPrefixCacheKey() + (courseId ? courseId : '') + ':' + (categoryId ? categoryId : ''); @@ -1164,7 +1164,7 @@ export class AddonCalendarProvider { * @param time Time to load. If not defined, current time. * @param courseId Course to load. If not defined, all courses. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the URL.x + * @returns Promise resolved with the URL.x */ async getViewUrl(view: string, time?: number, courseId?: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1184,7 +1184,7 @@ export class AddonCalendarProvider { * Get the week days, already ordered according to a specified starting day. * * @param startingDay Starting day. 0=Sunday, 1=Monday, ... - * @return Week days. + * @returns Week days. */ getWeekDays(startingDay?: number): AddonCalendarWeekDaysTranslationKeys[] { startingDay = startingDay || 0; @@ -1197,7 +1197,7 @@ export class AddonCalendarProvider { * * @param courseId Course ID. If not defined, site calendar. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAccessInformation(courseId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1210,7 +1210,7 @@ export class AddonCalendarProvider { * * @param courseId Course ID. If not defined, site calendar. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllowedEventTypes(courseId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1222,7 +1222,7 @@ export class AddonCalendarProvider { * Invalidates day events for all days. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllDayEvents(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1236,7 +1236,7 @@ export class AddonCalendarProvider { * @param year Year. * @param month Month. * @param day Day. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDayEvents(year: number, month: number, day: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1248,7 +1248,7 @@ export class AddonCalendarProvider { * Invalidates events list and all the single events and related info. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the list is invalidated. + * @returns Promise resolved when the list is invalidated. */ async invalidateEventsList(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1267,7 +1267,7 @@ export class AddonCalendarProvider { * * @param eventId List of courses or course ids. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the list is invalidated. + * @returns Promise resolved when the list is invalidated. */ async invalidateEvent(eventId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1279,7 +1279,7 @@ export class AddonCalendarProvider { * Invalidates monthly events for all months. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllMonthlyEvents(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1292,7 +1292,7 @@ export class AddonCalendarProvider { * * @param year Year. * @param month Month. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateMonthlyEvents(year: number, month: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1304,7 +1304,7 @@ export class AddonCalendarProvider { * Invalidates upcoming events for all courses and categories. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllUpcomingEvents(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1318,7 +1318,7 @@ export class AddonCalendarProvider { * @param courseId Course ID. * @param categoryId Category ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUpcomingEvents(courseId?: number, categoryId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1330,7 +1330,7 @@ export class AddonCalendarProvider { * Invalidates look ahead setting. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLookAhead(siteId?: string): Promise { await CoreUser.invalidateUserPreference('calendar_lookahead', siteId); @@ -1340,7 +1340,7 @@ export class AddonCalendarProvider { * Invalidates time format setting. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateTimeFormat(siteId?: string): Promise { return CoreUser.invalidateUserPreference('calendar_timeformat', siteId); @@ -1350,7 +1350,7 @@ export class AddonCalendarProvider { * Check if Calendar is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isCalendarDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -1362,7 +1362,7 @@ export class AddonCalendarProvider { * Check if Calendar is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1373,7 +1373,7 @@ export class AddonCalendarProvider { /** * Get the next events for all the sites and schedules their notifications. * - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 4.1 Use AddonCalendar.updateAllSitesEventReminders. */ async scheduleAllSitesEventsNotifications(): Promise { @@ -1385,7 +1385,7 @@ export class AddonCalendarProvider { * If an event notification time is 0, cancel its scheduled notification (if any). * If local notification plugin is not enabled, resolve the promise. * - * @return Promise resolved when all the notifications have been scheduled. + * @returns Promise resolved when all the notifications have been scheduled. */ async updateAllSitesEventReminders(): Promise { await CorePlatform.ready(); @@ -1407,7 +1407,7 @@ export class AddonCalendarProvider { /** * Get the next events for all the sites and schedules their notifications. * - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 4.1. No replacement for that function. */ async scheduleEventsNotifications( @@ -1426,7 +1426,7 @@ export class AddonCalendarProvider { * * @param events Events to schedule. * @param siteId ID of the site the events belong to. - * @return Promise resolved when all the notifications have been scheduled. + * @returns Promise resolved when all the notifications have been scheduled. */ protected async updateEventsReminders( events: ({ id: number; timestart: number; name: string})[], @@ -1464,7 +1464,7 @@ export class AddonCalendarProvider { * * @param time New default time. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved when stored. + * @returns Promise resolved when stored. * @deprecated since 4.1 Use CoreReminders.setDefaultNotificationTime. */ async setDefaultNotificationTime(time: number, siteId?: string): Promise { @@ -1476,7 +1476,7 @@ export class AddonCalendarProvider { * * @param event Event to store. * @param options Options. - * @return Promise resolved when stored. + * @returns Promise resolved when stored. */ protected async storeEventInLocalDb( event: AddonCalendarGetEventsEvent | AddonCalendarCalendarEvent | AddonCalendarEvent, @@ -1578,7 +1578,7 @@ export class AddonCalendarProvider { * * @param events Events to store. * @param options Options. - * @return Promise resolved when the events are stored. + * @returns Promise resolved when the events are stored. */ protected async storeEventsInLocalDB( events: (AddonCalendarGetEventsEvent | AddonCalendarCalendarEvent | AddonCalendarEvent)[], @@ -1593,7 +1593,7 @@ export class AddonCalendarProvider { * @param eventId ID of the event. Negative value to edit offline event. If undefined/null, create a new event. * @param formData Form data. * @param options Calendar submit event options. - * @return Promise resolved with the event and a boolean indicating if data was sent to server or stored in offline. + * @returns Promise resolved with the event and a boolean indicating if data was sent to server or stored in offline. */ async submitEvent( eventId: number | undefined, @@ -1656,7 +1656,7 @@ export class AddonCalendarProvider { * @param eventId ID of the event. If undefined/null or negative number, create a new event. * @param formData Form data. * @param siteId Site ID. If not provided, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async submitEventOnline( eventId: number = 0, diff --git a/src/addons/calendar/services/handlers/mainmenu.ts b/src/addons/calendar/services/handlers/mainmenu.ts index 74a4cb6e0..2cf9259a9 100644 --- a/src/addons/calendar/services/handlers/mainmenu.ts +++ b/src/addons/calendar/services/handlers/mainmenu.ts @@ -31,7 +31,7 @@ export class AddonCalendarMainMenuHandlerService implements CoreMainMenuHandler /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return !AddonCalendar.isCalendarDisabledInSite(); @@ -40,7 +40,7 @@ export class AddonCalendarMainMenuHandlerService implements CoreMainMenuHandler /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreMainMenuHandlerData { return { diff --git a/src/addons/calendar/services/handlers/sync-cron.ts b/src/addons/calendar/services/handlers/sync-cron.ts index 59443a05d..6f50a46b4 100644 --- a/src/addons/calendar/services/handlers/sync-cron.ts +++ b/src/addons/calendar/services/handlers/sync-cron.ts @@ -31,7 +31,7 @@ export class AddonCalendarSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ async execute(siteId?: string, force?: boolean): Promise { await AddonCalendarSync.syncAllEvents(siteId, force); @@ -40,7 +40,7 @@ export class AddonCalendarSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonCalendarSync.syncInterval; diff --git a/src/addons/calendar/services/handlers/view-link.ts b/src/addons/calendar/services/handlers/view-link.ts index fe7f1c0d2..087962300 100644 --- a/src/addons/calendar/services/handlers/view-link.ts +++ b/src/addons/calendar/services/handlers/view-link.ts @@ -39,7 +39,7 @@ export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandler * @param siteIds List of sites the URL belongs to. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], @@ -104,7 +104,7 @@ export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandler * @param siteId The site ID. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string, url: string, params: Record): Promise { if (params.view && SUPPORTED_VIEWS.indexOf(params.view) == -1) { diff --git a/src/addons/calendar/tests/behat/create_events.feature b/src/addons/calendar/tests/behat/create_events.feature index 17d61c67d..231aab2a5 100755 --- a/src/addons/calendar/tests/behat/create_events.feature +++ b/src/addons/calendar/tests/behat/create_events.feature @@ -64,4 +64,4 @@ Feature: Test creation of calendar events in app And I press "OK" in the app Then the app should have opened a browser tab with url "google.com" - # @todo: Add more Scenarios to test teacher, different values, and creating events from other views (e.g. day view). + # @todo Add more Scenarios to test teacher, different values, and creating events from other views (e.g. day view). diff --git a/src/addons/competency/pages/competencies/competencies.page.ts b/src/addons/competency/pages/competencies/competencies.page.ts index 0841df662..16eb9076a 100644 --- a/src/addons/competency/pages/competencies/competencies.page.ts +++ b/src/addons/competency/pages/competencies/competencies.page.ts @@ -79,7 +79,7 @@ export class AddonCompetencyCompetenciesPage implements AfterViewInit, OnDestroy /** * Fetches the competencies and updates the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCompetencies(): Promise { try { diff --git a/src/addons/competency/pages/competency/competency.page.ts b/src/addons/competency/pages/competency/competency.page.ts index 763d63ede..d3a9f825b 100644 --- a/src/addons/competency/pages/competency/competency.page.ts +++ b/src/addons/competency/pages/competency/competency.page.ts @@ -134,7 +134,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy { /** * Fetches the competency and updates the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCompetency(): Promise { try { @@ -208,7 +208,7 @@ export class AddonCompetencyCompetencyPage implements OnInit, OnDestroy { /** * Opens the summary of a competency. * - * @param competencyId + * @param competencyId Competency Id. */ openCompetencySummary(competencyId: number): void { CoreNavigator.navigate( diff --git a/src/addons/competency/pages/competencysummary/competencysummary.page.ts b/src/addons/competency/pages/competencysummary/competencysummary.page.ts index b6fe06664..28554cdb7 100644 --- a/src/addons/competency/pages/competencysummary/competencysummary.page.ts +++ b/src/addons/competency/pages/competencysummary/competencysummary.page.ts @@ -64,7 +64,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit { /** * Fetches the competency summary and updates the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCompetency(): Promise { try { @@ -102,7 +102,7 @@ export class AddonCompetencyCompetencySummaryPage implements OnInit { /** * Opens the summary of a competency. * - * @param competencyId + * @param competencyId Competency Id. */ openCompetencySummary(competencyId: number): void { CoreNavigator.navigate( diff --git a/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts b/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts index 79924d2a1..63a9000a2 100644 --- a/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts +++ b/src/addons/competency/pages/coursecompetencies/coursecompetencies.page.ts @@ -107,7 +107,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit, OnDestroy /** * Fetches the competencies and updates the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCourseCompetencies(): Promise { try { @@ -120,7 +120,7 @@ export class AddonCompetencyCourseCompetenciesPage implements OnInit, OnDestroy /** * Opens the summary of a competency. * - * @param competencyId + * @param competencyId Competency Id. */ openCompetencySummary(competencyId: number): void { CoreNavigator.navigateToSitePath( diff --git a/src/addons/competency/pages/plan/plan.ts b/src/addons/competency/pages/plan/plan.ts index ee1c9a11f..85d06ca30 100644 --- a/src/addons/competency/pages/plan/plan.ts +++ b/src/addons/competency/pages/plan/plan.ts @@ -88,7 +88,7 @@ export class AddonCompetencyPlanPage implements OnInit, OnDestroy { /** * Fetches the learning plan and updates the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchLearningPlan(): Promise { try { diff --git a/src/addons/competency/pages/planlist/planlist.ts b/src/addons/competency/pages/planlist/planlist.ts index 1cec25f8c..eb314632a 100644 --- a/src/addons/competency/pages/planlist/planlist.ts +++ b/src/addons/competency/pages/planlist/planlist.ts @@ -53,7 +53,7 @@ export class AddonCompetencyPlanListPage implements AfterViewInit, OnDestroy { /** * Fetches the learning plans and updates the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchLearningPlans(): Promise { try { diff --git a/src/addons/competency/services/competency-helper.ts b/src/addons/competency/services/competency-helper.ts index 9a9d44b79..ae8d91de4 100644 --- a/src/addons/competency/services/competency-helper.ts +++ b/src/addons/competency/services/competency-helper.ts @@ -28,7 +28,7 @@ export class AddonCompetencyHelperProvider { * Convenient helper to get the user profile image. * * @param userId User Id - * @return User profile Image URL or true if default icon. + * @returns User profile Image URL or true if default icon. */ async getProfile(userId?: number): Promise { if (!userId || userId == CoreSites.getCurrentSiteUserId()) { @@ -42,7 +42,9 @@ export class AddonCompetencyHelperProvider { /** * Get the review status name translated. * - * @param status + * @param status Competency Status name. + * @returns The status name translated. + * @todo Move statutes into an enum. */ getCompetencyStatusName(status: number): string { let statusTranslateName: string; @@ -67,7 +69,9 @@ export class AddonCompetencyHelperProvider { /** * Get the status name translated. * - * @param status + * @param status Plan Status name. + * @returns The status name translated. + * @todo Move statutes into an enum. */ getPlanStatusName(status: number): string { let statusTranslateName: string; diff --git a/src/addons/competency/services/competency.ts b/src/addons/competency/services/competency.ts index 802c7f925..4991f034f 100644 --- a/src/addons/competency/services/competency.ts +++ b/src/addons/competency/services/competency.ts @@ -46,7 +46,7 @@ export class AddonCompetencyProvider { * Check if all competencies features are disabled. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether all competency features are disabled. + * @returns Promise resolved with boolean: whether all competency features are disabled. */ async allCompetenciesDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -62,7 +62,7 @@ export class AddonCompetencyProvider { * @param courseId Course ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether the user can view the competencies. + * @returns Promise resolved with boolean: whether the user can view the competencies. */ async canViewUserCompetenciesInCourse(courseId: number, userId?: number, siteId?: string): Promise { if (!CoreSites.isLoggedIn()) { @@ -95,7 +95,7 @@ export class AddonCompetencyProvider { * Get cache key for user learning plans data WS calls. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getLearningPlansCacheKey(userId: number): string { return ROOT_CACHE_KEY + 'userplans:' + userId; @@ -105,7 +105,7 @@ export class AddonCompetencyProvider { * Get cache key for learning plan data WS calls. * * @param planId Plan ID. - * @return Cache key. + * @returns Cache key. */ protected getLearningPlanCacheKey(planId: number): string { return ROOT_CACHE_KEY + 'learningplan:' + planId; @@ -116,7 +116,7 @@ export class AddonCompetencyProvider { * * @param planId Plan ID. * @param competencyId Competency ID. - * @return Cache key. + * @returns Cache key. */ protected getCompetencyInPlanCacheKey(planId: number, competencyId: number): string { return ROOT_CACHE_KEY + 'plancompetency:' + planId + ':' + competencyId; @@ -128,7 +128,7 @@ export class AddonCompetencyProvider { * @param courseId Course ID. * @param competencyId Competency ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getCompetencyInCourseCacheKey(courseId: number, competencyId: number, userId: number): string { return ROOT_CACHE_KEY + 'coursecompetency:' + userId + ':' + courseId + ':' + competencyId; @@ -139,7 +139,7 @@ export class AddonCompetencyProvider { * * @param competencyId Competency ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getCompetencySummaryCacheKey(competencyId: number, userId: number): string { return ROOT_CACHE_KEY + 'competencysummary:' + userId + ':' + competencyId; @@ -149,7 +149,7 @@ export class AddonCompetencyProvider { * Get cache key for course competencies data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getCourseCompetenciesCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'coursecompetencies:' + courseId; @@ -160,7 +160,7 @@ export class AddonCompetencyProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return competencies if enabled for the given course, false otherwise. + * @returns competencies if enabled for the given course, false otherwise. */ async isPluginForCourseEnabled(courseId: number, siteId?: string): Promise { if (!CoreSites.isLoggedIn()) { @@ -175,7 +175,7 @@ export class AddonCompetencyProvider { * * @param userId ID of the user. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the plans are retrieved. + * @returns Promise to be resolved when the plans are retrieved. */ async getLearningPlans(userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -200,7 +200,7 @@ export class AddonCompetencyProvider { * * @param planId ID of the plan. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the plan is retrieved. + * @returns Promise to be resolved when the plan is retrieved. */ async getLearningPlan(planId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -223,7 +223,7 @@ export class AddonCompetencyProvider { * @param planId ID of the plan. * @param competencyId ID of the competency. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the competency is retrieved. + * @returns Promise to be resolved when the competency is retrieved. */ async getCompetencyInPlan( planId: number, @@ -257,7 +257,7 @@ export class AddonCompetencyProvider { * @param userId ID of the user. If not defined, current user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the competency is retrieved. + * @returns Promise to be resolved when the competency is retrieved. */ async getCompetencyInCourse( courseId: number, @@ -295,7 +295,7 @@ export class AddonCompetencyProvider { * @param userId ID of the user. If not defined, current user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the competency summary is retrieved. + * @returns Promise to be resolved when the competency summary is retrieved. */ async getCompetencySummary( competencyId: number, @@ -331,7 +331,7 @@ export class AddonCompetencyProvider { * @param userId ID of the user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the course competencies are retrieved. + * @returns Promise to be resolved when the course competencies are retrieved. */ async getCourseCompetencies( courseId: number, @@ -364,7 +364,7 @@ export class AddonCompetencyProvider { * @param courseId ID of the course. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the course competencies are retrieved. + * @returns Promise to be resolved when the course competencies are retrieved. */ async getCourseCompetenciesPage( courseId: number, @@ -399,7 +399,7 @@ export class AddonCompetencyProvider { * * @param userId ID of the user. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLearningPlans(userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -413,7 +413,7 @@ export class AddonCompetencyProvider { * * @param planId ID of the plan. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLearningPlan(planId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -427,7 +427,7 @@ export class AddonCompetencyProvider { * @param planId ID of the plan. * @param competencyId ID of the competency. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -442,7 +442,7 @@ export class AddonCompetencyProvider { * @param competencyId ID of the competency. * @param userId ID of the user. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -457,7 +457,7 @@ export class AddonCompetencyProvider { * @param competencyId ID of the competency. * @param userId ID of the user. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCompetencySummary(competencyId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -472,7 +472,7 @@ export class AddonCompetencyProvider { * @param courseId ID of the course. * @param userId ID of the user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourseCompetencies(courseId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -498,7 +498,7 @@ export class AddonCompetencyProvider { * @param name Name of the competency. * @param userId User ID. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logCompetencyInPlanView( planId: number, @@ -542,7 +542,7 @@ export class AddonCompetencyProvider { * @param name Name of the competency. * @param userId User ID. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logCompetencyInCourseView( courseId: number, @@ -580,7 +580,7 @@ export class AddonCompetencyProvider { * @param competencyId ID of the competency. * @param name Name of the competency. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logCompetencyView(competencyId: number, name?: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/coursecompletion/pages/report/report.ts b/src/addons/coursecompletion/pages/report/report.ts index 1087e4095..b95bb88b5 100644 --- a/src/addons/coursecompletion/pages/report/report.ts +++ b/src/addons/coursecompletion/pages/report/report.ts @@ -65,7 +65,7 @@ export class AddonCourseCompletionReportPage implements OnInit { /** * Fetch compleiton data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCompletion(): Promise { try { diff --git a/src/addons/coursecompletion/services/coursecompletion.ts b/src/addons/coursecompletion/services/coursecompletion.ts index 1bfe05acd..5b257367b 100644 --- a/src/addons/coursecompletion/services/coursecompletion.ts +++ b/src/addons/coursecompletion/services/coursecompletion.ts @@ -44,7 +44,7 @@ export class AddonCourseCompletionProvider { * * @param userId User ID. * @param completion Course completion. - * @return True if user can mark course as self completed, false otherwise. + * @returns True if user can mark course as self completed, false otherwise. */ canMarkSelfCompleted(userId: number, completion: AddonCourseCompletionCourseCompletionStatus): boolean { if (CoreSites.getCurrentSiteUserId() != userId) { @@ -69,7 +69,7 @@ export class AddonCourseCompletionProvider { * Get completed status text. The language code returned is meant to be translated. * * @param completion Course completion. - * @return Language code of the text to show. + * @returns Language code of the text to show. */ getCompletedStatusText(completion: AddonCourseCompletionCourseCompletionStatus): string { if (completion.completed) { @@ -93,7 +93,7 @@ export class AddonCourseCompletionProvider { * @param userId User ID. If not defined, use current user. * @param preSets Presets to use when calling the WebService. * @param siteId Site ID. If not defined, use current site. - * @return Promise to be resolved when the completion is retrieved. + * @returns Promise to be resolved when the completion is retrieved. */ getCompletion( courseId: number, @@ -113,7 +113,7 @@ export class AddonCourseCompletionProvider { * * @param courseId Course ID. * @param options Options. - * @return Observable returning the completion. + * @returns Observable returning the completion. */ getCompletionObservable( courseId: number, @@ -150,8 +150,8 @@ export class AddonCourseCompletionProvider { * Get cache key for get completion WS calls. * * @param courseId Course ID. - * @param useIid User ID. - * @return Cache key. + * @param userId User ID. + * @returns Cache key. */ protected getCompletionCacheKey(courseId: number, userId: number): string { return ROOT_CACHE_KEY + 'view:' + courseId + ':' + userId; @@ -163,7 +163,7 @@ export class AddonCourseCompletionProvider { * @param courseId Course ID. * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the list is invalidated. + * @returns Promise resolved when the list is invalidated. */ async invalidateCourseCompletion(courseId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -175,7 +175,7 @@ export class AddonCourseCompletionProvider { /** * Returns whether or not the view course completion plugin is enabled for the current site. * - * @return True if plugin enabled, false otherwise. + * @returns True if plugin enabled, false otherwise. */ isPluginViewEnabled(): boolean { return CoreSites.isLoggedIn(); @@ -186,7 +186,7 @@ export class AddonCourseCompletionProvider { * * @param courseId Course ID. * @param preferCache True if shouldn't call WS if data is cached, false otherwise. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginViewEnabledForCourse(courseId?: number, preferCache: boolean = true): Promise { if (!courseId) { @@ -216,7 +216,7 @@ export class AddonCourseCompletionProvider { * @param courseId Course ID. * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginViewEnabledForUser(courseId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -273,7 +273,7 @@ export class AddonCourseCompletionProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ async markCourseAsSelfCompleted(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/filter/activitynames/services/handlers/activitynames.ts b/src/addons/filter/activitynames/services/handlers/activitynames.ts index 83a57daf8..8b0ab6909 100644 --- a/src/addons/filter/activitynames/services/handlers/activitynames.ts +++ b/src/addons/filter/activitynames/services/handlers/activitynames.ts @@ -33,7 +33,7 @@ export class AddonFilterActivityNamesHandlerService extends CoreFilterDefaultHan * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/algebra/services/handlers/algebra.ts b/src/addons/filter/algebra/services/handlers/algebra.ts index fdb1552db..4b7859f55 100644 --- a/src/addons/filter/algebra/services/handlers/algebra.ts +++ b/src/addons/filter/algebra/services/handlers/algebra.ts @@ -33,7 +33,7 @@ export class AddonFilterAlgebraHandlerService extends CoreFilterDefaultHandler { * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/censor/services/handlers/censor.ts b/src/addons/filter/censor/services/handlers/censor.ts index 93e490d07..8b62c4c3d 100644 --- a/src/addons/filter/censor/services/handlers/censor.ts +++ b/src/addons/filter/censor/services/handlers/censor.ts @@ -33,7 +33,7 @@ export class AddonFilterCensorHandlerService extends CoreFilterDefaultHandler { * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/data/services/handlers/data.ts b/src/addons/filter/data/services/handlers/data.ts index 83693cc26..cd81af23e 100644 --- a/src/addons/filter/data/services/handlers/data.ts +++ b/src/addons/filter/data/services/handlers/data.ts @@ -33,7 +33,7 @@ export class AddonFilterDataHandlerService extends CoreFilterDefaultHandler { * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/displayh5p/services/handlers/displayh5p.ts b/src/addons/filter/displayh5p/services/handlers/displayh5p.ts index c2b11d7f7..ae5ec4f2c 100644 --- a/src/addons/filter/displayh5p/services/handlers/displayh5p.ts +++ b/src/addons/filter/displayh5p/services/handlers/displayh5p.ts @@ -37,19 +37,10 @@ export class AddonFilterDisplayH5PHandlerService extends CoreFilterDefaultHandle } /** - * Filter some text. - * - * @param text The text to filter. - * @param filter The filter. - * @param options Options passed to the filters. - * @param siteId Site ID. If not defined, current site. - * @return Filtered text (or promise resolved with the filtered text). + * @inheritdoc */ filter( text: string, - filter: CoreFilterFilter, // eslint-disable-line @typescript-eslint/no-unused-vars - options: CoreFilterFormatTextOptions, // eslint-disable-line @typescript-eslint/no-unused-vars - siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars ): string | Promise { this.template.innerHTML = text; @@ -87,17 +78,7 @@ export class AddonFilterDisplayH5PHandlerService extends CoreFilterDefaultHandle } /** - * Handle HTML. This function is called after "filter", and it will receive an HTMLElement containing the text that was - * filtered. - * - * @param container The HTML container to handle. - * @param filter The filter. - * @param options Options passed to the filters. - * @param viewContainerRef The ViewContainerRef where the container is. - * @param component Component. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return If async, promise resolved when done. + * @inheritdoc */ handleHtml( container: HTMLElement, @@ -106,7 +87,6 @@ export class AddonFilterDisplayH5PHandlerService extends CoreFilterDefaultHandle viewContainerRef: ViewContainerRef, component?: string, componentId?: string | number, - siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars ): void | Promise { const placeholders = Array.from(container.querySelectorAll('div.core-h5p-tmp-placeholder')); diff --git a/src/addons/filter/emailprotect/services/handlers/emailprotect.ts b/src/addons/filter/emailprotect/services/handlers/emailprotect.ts index f56bdcaeb..0fa214c46 100644 --- a/src/addons/filter/emailprotect/services/handlers/emailprotect.ts +++ b/src/addons/filter/emailprotect/services/handlers/emailprotect.ts @@ -33,7 +33,7 @@ export class AddonFilterEmailProtectHandlerService extends CoreFilterDefaultHand * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/emoticon/services/handlers/emoticon.ts b/src/addons/filter/emoticon/services/handlers/emoticon.ts index 9b0c7652c..dab7d5e75 100644 --- a/src/addons/filter/emoticon/services/handlers/emoticon.ts +++ b/src/addons/filter/emoticon/services/handlers/emoticon.ts @@ -33,7 +33,7 @@ export class AddonFilterEmoticonHandlerService extends CoreFilterDefaultHandler * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/glossary/services/handlers/glossary.ts b/src/addons/filter/glossary/services/handlers/glossary.ts index 96e2799ea..fab73b6eb 100644 --- a/src/addons/filter/glossary/services/handlers/glossary.ts +++ b/src/addons/filter/glossary/services/handlers/glossary.ts @@ -33,7 +33,7 @@ export class AddonFilterGlossaryHandlerService extends CoreFilterDefaultHandler * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts b/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts index ba9010260..aca1a8916 100644 --- a/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts +++ b/src/addons/filter/mathjaxloader/services/handlers/mathjaxloader.ts @@ -79,7 +79,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan /** * Initialize MathJax. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async initialize(): Promise { this.loadJS(); @@ -112,7 +112,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * @param filter The filter. * @param options Options passed to the filters. * @param siteId Site ID. If not defined, current site. - * @return Filtered text (or promise resolved with the filtered text). + * @returns Filtered text (or promise resolved with the filtered text). */ async filter( text: string, @@ -163,7 +163,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * @param component Component. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return If async, promise resolved when done. + * @returns If async, promise resolved when done. */ async handleHtml( container: HTMLElement, @@ -185,7 +185,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * @param text The text to modify. * @param start The start index of the substring in text that should be wrapped in the span. * @param end The end index of the substring in text that should be wrapped in the span. - * @return The whole text with the span inserted around the defined substring. + * @returns The whole text with the span inserted around the defined substring. */ protected insertSpan(text: string, start: number, end: number): string { return CoreTextUtils.substrReplace( @@ -273,7 +273,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * Perform a mapping of the app language code to the equivalent for MathJax. * * @param langCode The app language code. - * @return The MathJax language code. + * @returns The MathJax language code. */ protected mapLanguageCode(langCode: string): string { @@ -302,7 +302,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { // Only apply the filter if logged in and we're filtering current site. @@ -313,7 +313,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * Wait for the MathJax library and our JS object to be loaded. * * @param retries Number of times this has been retried. - * @return Promise resolved when ready or if it took too long to load. + * @returns Promise resolved when ready or if it took too long to load. */ protected async waitForReady(retries: number = 0): Promise { if (this.window.MathJax || retries >= 20) { @@ -334,7 +334,7 @@ export class AddonFilterMathJaxLoaderHandlerService extends CoreFilterDefaultHan * mathematics and \( \) for inline mathematics. * * @param text The text to filter. - * @return Object containing the potentially modified text and a boolean that is true if any changes were made to the text. + * @returns Object containing the potentially modified text and a boolean that is true if any changes were made to the text. */ protected wrapMathInNoLink(text: string): {text: string; changed: boolean} { let len = text.length; diff --git a/src/addons/filter/multilang/services/handlers/multilang.ts b/src/addons/filter/multilang/services/handlers/multilang.ts index 518f12f1d..de308f819 100644 --- a/src/addons/filter/multilang/services/handlers/multilang.ts +++ b/src/addons/filter/multilang/services/handlers/multilang.ts @@ -36,7 +36,7 @@ export class AddonFilterMultilangHandlerService extends CoreFilterDefaultHandler * @param filter The filter. * @param options Options passed to the filters. * @param siteId Site ID. If not defined, current site. - * @return Filtered text (or promise resolved with the filtered text). + * @returns Filtered text (or promise resolved with the filtered text). */ async filter( text: string, @@ -75,7 +75,7 @@ export class AddonFilterMultilangHandlerService extends CoreFilterDefaultHandler * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { // The filter should be applied if site is older than 3.7 or the WS didn't filter the text. diff --git a/src/addons/filter/tex/services/handlers/tex.ts b/src/addons/filter/tex/services/handlers/tex.ts index ddeaabe2c..479e79216 100644 --- a/src/addons/filter/tex/services/handlers/tex.ts +++ b/src/addons/filter/tex/services/handlers/tex.ts @@ -33,7 +33,7 @@ export class AddonFilterTexHandlerService extends CoreFilterDefaultHandler { * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/tidy/services/handlers/tidy.ts b/src/addons/filter/tidy/services/handlers/tidy.ts index 60bb56914..542046dc0 100644 --- a/src/addons/filter/tidy/services/handlers/tidy.ts +++ b/src/addons/filter/tidy/services/handlers/tidy.ts @@ -33,7 +33,7 @@ export class AddonFilterTidyHandlerService extends CoreFilterDefaultHandler { * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/filter/urltolink/services/handlers/urltolink.ts b/src/addons/filter/urltolink/services/handlers/urltolink.ts index 816efdb86..4c27a4986 100644 --- a/src/addons/filter/urltolink/services/handlers/urltolink.ts +++ b/src/addons/filter/urltolink/services/handlers/urltolink.ts @@ -33,7 +33,7 @@ export class AddonFilterUrlToLinkHandlerService extends CoreFilterDefaultHandler * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/addons/messageoutput/airnotifier/pages/devices/devices.ts b/src/addons/messageoutput/airnotifier/pages/devices/devices.ts index 9b431bd74..6c7b1087d 100644 --- a/src/addons/messageoutput/airnotifier/pages/devices/devices.ts +++ b/src/addons/messageoutput/airnotifier/pages/devices/devices.ts @@ -44,7 +44,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr /** * Fetches the list of devices. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchDevices(): Promise { try { diff --git a/src/addons/messageoutput/airnotifier/services/airnotifier.ts b/src/addons/messageoutput/airnotifier/services/airnotifier.ts index 3138488cf..7324fc45a 100644 --- a/src/addons/messageoutput/airnotifier/services/airnotifier.ts +++ b/src/addons/messageoutput/airnotifier/services/airnotifier.ts @@ -54,7 +54,7 @@ export class AddonMessageOutputAirnotifierProvider { * @param deviceId Device ID. * @param enable True to enable, false to disable. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ async enableDevice(deviceId: number, enable: boolean, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -84,7 +84,7 @@ export class AddonMessageOutputAirnotifierProvider { /** * Get the cache key for the is system configured call. * - * @return Cache key. + * @returns Cache key. */ protected getSystemConfiguredCacheKey(): string { return ROOT_CACHE_KEY + 'isAirnotifierConfigured'; @@ -94,7 +94,7 @@ export class AddonMessageOutputAirnotifierProvider { * Check if airnotifier is configured. * * @param options Options. - * @return Promise resolved with boolean: whether it's configured. + * @returns Promise resolved with boolean: whether it's configured. */ async isSystemConfigured(options: CoreSitesCommonWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -113,7 +113,7 @@ export class AddonMessageOutputAirnotifierProvider { /** * Get the cache key for the get user devices call. * - * @return Cache key. + * @returns Cache key. */ protected getUserDevicesCacheKey(): string { return ROOT_CACHE_KEY + 'userDevices'; @@ -124,7 +124,7 @@ export class AddonMessageOutputAirnotifierProvider { * * @param ignoreCache Whether to ignore cache. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the devices. + * @returns Promise resolved with the devices. */ async getUserDevices(ignoreCache?: boolean, siteId?: string): Promise { @@ -156,7 +156,7 @@ export class AddonMessageOutputAirnotifierProvider { * Invalidate get user devices. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateUserDevices(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -168,7 +168,7 @@ export class AddonMessageOutputAirnotifierProvider { * Is user is an admin and push are disabled, notify him. * * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async warnPushDisabledForAdmin(siteId?: string): Promise { if (!siteId) { diff --git a/src/addons/messageoutput/airnotifier/services/handlers/messageoutput.ts b/src/addons/messageoutput/airnotifier/services/handlers/messageoutput.ts index f83f8945c..cbee29e1d 100644 --- a/src/addons/messageoutput/airnotifier/services/handlers/messageoutput.ts +++ b/src/addons/messageoutput/airnotifier/services/handlers/messageoutput.ts @@ -31,7 +31,7 @@ export class AddonMessageOutputAirnotifierHandlerService implements AddonMessage /** * Whether or not the module is enabled for the site. * - * @return True if enabled, false otherwise. + * @returns True if enabled, false otherwise. */ async isEnabled(): Promise { return true; @@ -41,7 +41,7 @@ export class AddonMessageOutputAirnotifierHandlerService implements AddonMessage * Returns the data needed to render the handler. * * @param processor The processor object. - * @return Data. + * @returns Data. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars getDisplayData(processor: Record): AddonMessageOutputHandlerData { diff --git a/src/addons/messageoutput/services/messageoutput-delegate.ts b/src/addons/messageoutput/services/messageoutput-delegate.ts index d2f78188a..ba99f0647 100644 --- a/src/addons/messageoutput/services/messageoutput-delegate.ts +++ b/src/addons/messageoutput/services/messageoutput-delegate.ts @@ -31,7 +31,7 @@ export interface AddonMessageOutputHandler extends CoreDelegateHandler { * Returns the data needed to render the handler. * * @param processor The processor object. - * @return Data. + * @returns Data. */ getDisplayData(processor: Record): AddonMessageOutputHandlerData; } @@ -82,7 +82,7 @@ export class AddonMessageOutputDelegateService extends CoreDelegate): AddonMessageOutputHandlerData | undefined { return this.executeFunctionOnEnabled( processor.name, 'getDisplayData', [processor]); diff --git a/src/addons/messages/components/conversation-info/conversation-info.ts b/src/addons/messages/components/conversation-info/conversation-info.ts index 0022f8083..bfca2d625 100644 --- a/src/addons/messages/components/conversation-info/conversation-info.ts +++ b/src/addons/messages/components/conversation-info/conversation-info.ts @@ -57,7 +57,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit { /** * Fetch the required data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { // Get the conversation data first. @@ -76,7 +76,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit { * Get conversation members. * * @param loadingMore Whether we are loading more data or just the first ones. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchMembers(loadingMore?: boolean): Promise { this.loadMoreError = false; @@ -97,7 +97,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit { * Function to load more members. * * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Resolved when done. + * @returns Resolved when done. */ async loadMoreMembers(infiniteComplete?: () => void): Promise { try { @@ -114,7 +114,7 @@ export class AddonMessagesConversationInfoComponent implements OnInit { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(refresher?: IonRefresher): Promise { const promises: Promise[] = []; diff --git a/src/addons/messages/guards/index.ts b/src/addons/messages/guards/index.ts index 9f2d0385f..4863fa74a 100644 --- a/src/addons/messages/guards/index.ts +++ b/src/addons/messages/guards/index.ts @@ -33,6 +33,8 @@ export class AddonMessagesIndexGuard implements CanActivate { /** * Check if there is a pending redirect and trigger it. + * + * @returns The redirection route. */ private guard(route: ActivatedRouteSnapshot): UrlTree { const enabled = AddonMessages.isGroupMessagingEnabled(); diff --git a/src/addons/messages/pages/contacts-35/contacts.page.ts b/src/addons/messages/pages/contacts-35/contacts.page.ts index 34a379992..b552e49c0 100644 --- a/src/addons/messages/pages/contacts-35/contacts.page.ts +++ b/src/addons/messages/pages/contacts-35/contacts.page.ts @@ -124,7 +124,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(refresher?: IonRefresher): Promise { try { @@ -144,7 +144,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy { /** * Fetch contacts. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { this.loadingMessage = this.loadingMessages; @@ -169,7 +169,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy { * Sort user list by fullname * * @param list List to sort. - * @return Sorted list. + * @returns Sorted list. */ protected sortUsers(list: AddonMessagesSearchContactsContact[]): AddonMessagesSearchContactsContact[] { return list.sort((a, b) => { @@ -201,7 +201,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy { * Search users from the UI. * * @param query Text to search for. - * @return Resolved when done. + * @returns Resolved when done. */ search(query: string): Promise { CoreApp.closeKeyboard(); @@ -218,7 +218,7 @@ export class AddonMessagesContacts35Page implements OnInit, OnDestroy { * Perform the search of users. * * @param query Text to search for. - * @return Resolved when done. + * @returns Resolved when done. */ protected async performSearch(query: string): Promise { try { diff --git a/src/addons/messages/pages/contacts/contacts.page.ts b/src/addons/messages/pages/contacts/contacts.page.ts index 963d9d78d..97535862e 100644 --- a/src/addons/messages/pages/contacts/contacts.page.ts +++ b/src/addons/messages/pages/contacts/contacts.page.ts @@ -159,7 +159,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy { * Fetch contacts. * * @param refresh True if we are refreshing contacts, false if we are loading more. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async confirmedFetchData(refresh: boolean = false): Promise { this.confirmedLoadMoreError = false; @@ -185,7 +185,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy { * Fetch contact requests. * * @param refresh True if we are refreshing contact requests, false if we are loading more. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async requestsFetchData(refresh: boolean = false): Promise { this.requestsLoadMoreError = false; @@ -211,7 +211,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy { * Refresh contacts or requests. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(refresher?: IonRefresher): Promise { try { @@ -234,7 +234,7 @@ export class AddonMessagesContactsPage implements OnInit, OnDestroy { * Load more contacts or requests. * * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Resolved when done. + * @returns Resolved when done. */ async loadMore(infiniteComplete?: () => void): Promise { try { diff --git a/src/addons/messages/pages/discussion/discussion.page.ts b/src/addons/messages/pages/discussion/discussion.page.ts index f92159fc3..9dbb10719 100644 --- a/src/addons/messages/pages/discussion/discussion.page.ts +++ b/src/addons/messages/pages/discussion/discussion.page.ts @@ -176,7 +176,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * * @param message Message to be added. * @param keep If set the keep flag or not. - * @return If message is not mine and was recently added. + * @returns If message is not mine and was recently added. */ protected addMessage( message: AddonMessagesConversationMessageFormatted, @@ -225,7 +225,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Convenience function to fetch the conversation data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchData(): Promise { let loader: CoreIonLoadingElement | undefined; @@ -365,7 +365,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * Convenience function to fetch messages. * * @param messagesAreNew If messages loaded are new messages. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchMessages(messagesAreNew: boolean = true): Promise { this.loadMoreError = false; @@ -417,8 +417,8 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Format and load a list of messages into the view. * - * @param messagesAreNew If messages loaded are new messages. * @param messages Messages to load. + * @param messagesAreNew If messages loaded are new messages. */ protected loadMessages( messages: AddonMessagesConversationMessageFormatted[], @@ -531,7 +531,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * * @param conversationId Conversation ID. * @param userId User ID. - * @return Promise resolved with a boolean: whether the conversation exists or not. + * @returns Promise resolved with a boolean: whether the conversation exists or not. */ protected async getConversation(conversationId?: number, userId?: number): Promise { let fallbackConversation: AddonMessagesConversationFormatted | undefined; @@ -611,7 +611,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * * @param pagesToLoad Number of "pages" to load. * @param offset Offset for message list. - * @return Promise resolved with the list of messages. + * @returns Promise resolved with the list of messages. */ protected async getConversationMessages( pagesToLoad: number, @@ -664,7 +664,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * @param lfReceivedRead Number of read received messages already fetched, so fetch will be done from this. * @param lfSentUnread Number of unread sent messages already fetched, so fetch will be done from this. * @param lfSentRead Number of read sent messages already fetched, so fetch will be done from this. - * @return Resolved when done. + * @returns Resolved when done. */ protected async getDiscussionMessages( pagesToLoad: number, @@ -874,7 +874,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Wait until fetching is false. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async waitForFetch(): Promise { if (!this.fetching) { @@ -982,7 +982,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * Function to load previous messages. * * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Resolved when done. + * @returns Resolved when done. */ async loadPrevious(infiniteComplete?: () => void): Promise { if (!this.initialized) { @@ -1189,7 +1189,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * * @param message Current message where to show the date. * @param prevMessage Previous message where to compare the date with. - * @return If date has changed and should be shown. + * @returns If date has changed and should be shown. */ showDate( message: AddonMessagesConversationMessageFormatted, @@ -1211,7 +1211,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * * @param message Current message where to show the user info. * @param prevMessage Previous message. - * @return Whether user data should be shown. + * @returns Whether user data should be shown. */ showUserData( message: AddonMessagesConversationMessageFormatted, @@ -1227,7 +1227,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView * * @param message Current message where to show the user info. * @param nextMessage Next message. - * @return Whether user data should be shown. + * @returns Whether user data should be shown. */ showTail( message: AddonMessagesConversationMessageFormatted, @@ -1378,7 +1378,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Displays a confirmation modal to block the user of the individual conversation. * - * @return Promise resolved when user is blocked or dialog is cancelled. + * @returns Promise resolved when user is blocked or dialog is cancelled. */ async blockUser(): Promise { if (!this.otherMember) { @@ -1465,7 +1465,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Displays a confirmation modal to unblock the user of the individual conversation. * - * @return Promise resolved when user is unblocked or dialog is cancelled. + * @returns Promise resolved when user is unblocked or dialog is cancelled. */ async unblockUser(): Promise { if (!this.otherMember) { @@ -1504,7 +1504,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Displays a confirmation modal to send a contact request to the other user of the individual conversation. * - * @return Promise resolved when the request is sent or the dialog is cancelled. + * @returns Promise resolved when the request is sent or the dialog is cancelled. */ async createContactRequest(): Promise { if (!this.otherMember) { @@ -1543,7 +1543,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Confirms the contact request of the other user of the individual conversation. * - * @return Promise resolved when the request is confirmed. + * @returns Promise resolved when the request is confirmed. */ async confirmContactRequest(): Promise { if (!this.otherMember) { @@ -1569,7 +1569,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Declines the contact request of the other user of the individual conversation. * - * @return Promise resolved when the request is confirmed. + * @returns Promise resolved when the request is confirmed. */ async declineContactRequest(): Promise { if (!this.otherMember) { @@ -1595,7 +1595,7 @@ export class AddonMessagesDiscussionPage implements OnInit, OnDestroy, AfterView /** * Displays a confirmation modal to remove the other user of the conversation from contacts. * - * @return Promise resolved when the request is sent or the dialog is cancelled. + * @returns Promise resolved when the request is sent or the dialog is cancelled. */ async removeContact(): Promise { if (!this.otherMember) { diff --git a/src/addons/messages/pages/discussions-35/discussions.page.ts b/src/addons/messages/pages/discussions-35/discussions.page.ts index a968beeab..ef4df1701 100644 --- a/src/addons/messages/pages/discussions-35/discussions.page.ts +++ b/src/addons/messages/pages/discussions-35/discussions.page.ts @@ -161,7 +161,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy { * * @param refresher Refresher. * @param refreshUnreadCounts Whteher to refresh unread counts. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(refresher?: IonRefresher, refreshUnreadCounts: boolean = true): Promise { const promises: Promise[] = []; @@ -181,7 +181,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy { /** * Fetch discussions. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { this.loadingMessage = this.loadingMessages; @@ -229,7 +229,7 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy { * Search messages cotaining text. * * @param query Text to search for. - * @return Resolved when done. + * @returns Resolved when done. */ async searchMessage(query: string): Promise { CoreApp.closeKeyboard(); @@ -252,7 +252,6 @@ export class AddonMessagesDiscussions35Page implements OnInit, OnDestroy { * * @param discussionUserId Discussion Id to load. * @param messageId Message to scroll after loading the discussion. Used when searching. - * @param onlyWithSplitView Only go to Discussion if split view is on. */ async gotoDiscussion(discussionUserId: number, messageId?: number): Promise { this.discussionUserId = discussionUserId; diff --git a/src/addons/messages/pages/group-conversations/group-conversations.page.ts b/src/addons/messages/pages/group-conversations/group-conversations.page.ts index a423d6412..d54e0b793 100644 --- a/src/addons/messages/pages/group-conversations/group-conversations.page.ts +++ b/src/addons/messages/pages/group-conversations/group-conversations.page.ts @@ -307,7 +307,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * Fetch conversations. * * @param refreshUnreadCounts Whether to refresh unread counts. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(refreshUnreadCounts: boolean = true): Promise { // Load the amount of conversations and contact requests. @@ -359,7 +359,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Fetch data for the expanded option. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchDataForExpandedOption(): Promise { if (this.favourites.expanded === undefined) { @@ -384,7 +384,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * @param option The option to fetch data for. * @param loadingMore Whether we are loading more data or just the first ones. * @param getCounts Whether to get counts data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchDataForOption( option: AddonMessagesGroupConversationOption, @@ -444,7 +444,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Fetch conversation counts. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchConversationCounts(): Promise { // Always try to get the latest data. @@ -462,7 +462,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * @param conversationId The conversation ID to search. * @param userId User ID to search (if no conversationId). * @param option The option to search in. If not defined, search in all options. - * @return Conversation. + * @returns Conversation. */ protected findConversation( conversationId?: number, @@ -488,7 +488,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Get the option that is currently expanded, undefined if they are all collapsed. * - * @return Option currently expanded. + * @returns Option currently expanded. */ protected getExpandedOption(): AddonMessagesGroupConversationOption | undefined { if (this.favourites.expanded) { @@ -541,7 +541,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * * @param option The option to fetch data for. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadMoreConversations(option: AddonMessagesGroupConversationOption, infiniteComplete?: () => void): Promise { try { @@ -559,7 +559,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * * @param option The option where the messages should be loaded. * @param messages Offline messages. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadOfflineMessages( option: AddonMessagesGroupConversationOption, @@ -675,7 +675,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * Given a conversation, return its option (favourites, group, individual). * * @param conversation Conversation to check. - * @return Option object. + * @returns Option object. */ protected getConversationOption( conversation: AddonMessagesConversationForList | AddonMessagesNewMessagedEventData, @@ -696,7 +696,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * * @param refresher Refresher. * @param refreshUnreadCounts Whether to refresh unread counts. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(refresher?: IonRefresher, refreshUnreadCounts: boolean = true): Promise { // Don't invalidate conversations and so, they always try to get latest data. @@ -736,7 +736,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * * @param option The option to expand. * @param getCounts Whether to get counts data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async expandOption(option: AddonMessagesGroupConversationOption, getCounts = false): Promise { // Collapse all and expand the right one. diff --git a/src/addons/messages/pages/search/search.page.ts b/src/addons/messages/pages/search/search.page.ts index f9d1a02aa..160b34f7e 100644 --- a/src/addons/messages/pages/search/search.page.ts +++ b/src/addons/messages/pages/search/search.page.ts @@ -118,7 +118,7 @@ export class AddonMessagesSearchPage implements OnDestroy { * @param query Text to search for. * @param loadMore Load more contacts, noncontacts or messages. If undefined, start a new search. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Resolved when done. + * @returns Resolved when done. */ async search(query: string, loadMore?: 'contacts' | 'noncontacts' | 'messages', infiniteComplete?: () => void): Promise { CoreApp.closeKeyboard(); diff --git a/src/addons/messages/pages/settings/settings.page.ts b/src/addons/messages/pages/settings/settings.page.ts index 05a8b61f1..8b0a1ab78 100644 --- a/src/addons/messages/pages/settings/settings.page.ts +++ b/src/addons/messages/pages/settings/settings.page.ts @@ -79,7 +79,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy { /** * Fetches preference data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchPreferences(): Promise { try { diff --git a/src/addons/messages/services/handlers/contact-request-link.ts b/src/addons/messages/services/handlers/contact-request-link.ts index a06eb6e11..fee8765e5 100644 --- a/src/addons/messages/services/handlers/contact-request-link.ts +++ b/src/addons/messages/services/handlers/contact-request-link.ts @@ -31,7 +31,7 @@ export class AddonMessagesContactRequestLinkHandlerService extends CoreContentLi /** * Get the list of actions for a link (url). * - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions(): CoreContentLinksAction[] | Promise { return [{ @@ -46,7 +46,7 @@ export class AddonMessagesContactRequestLinkHandlerService extends CoreContentLi * If not defined, defaults to true. * * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string): Promise { const enabled = await AddonMessages.isPluginEnabled(siteId); diff --git a/src/addons/messages/services/handlers/discussion-link.ts b/src/addons/messages/services/handlers/discussion-link.ts index 1ec3f28fc..bd36e065a 100644 --- a/src/addons/messages/services/handlers/discussion-link.ts +++ b/src/addons/messages/services/handlers/discussion-link.ts @@ -37,7 +37,7 @@ export class AddonMessagesDiscussionLinkHandlerService extends CoreContentLinksH * @param siteIds List of sites the URL belongs to. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], @@ -59,7 +59,7 @@ export class AddonMessagesDiscussionLinkHandlerService extends CoreContentLinksH * @param siteId The site ID. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string, url: string, params: Record): Promise { const enabled = await AddonMessages.isPluginEnabled(siteId); diff --git a/src/addons/messages/services/handlers/index-link.ts b/src/addons/messages/services/handlers/index-link.ts index d552a6886..86bd38432 100644 --- a/src/addons/messages/services/handlers/index-link.ts +++ b/src/addons/messages/services/handlers/index-link.ts @@ -33,7 +33,7 @@ export class AddonMessagesIndexLinkHandlerService extends CoreContentLinksHandle /** * Get the list of actions for a link (url). * - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions(): CoreContentLinksAction[] | Promise { return [{ @@ -51,7 +51,7 @@ export class AddonMessagesIndexLinkHandlerService extends CoreContentLinksHandle * If not defined, defaults to true. * * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string): Promise { return AddonMessages.isPluginEnabled(siteId); diff --git a/src/addons/messages/services/handlers/mainmenu.ts b/src/addons/messages/services/handlers/mainmenu.ts index 5df64592f..33a78c18c 100644 --- a/src/addons/messages/services/handlers/mainmenu.ts +++ b/src/addons/messages/services/handlers/mainmenu.ts @@ -99,7 +99,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return AddonMessages.isPluginEnabled(); @@ -108,7 +108,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreMainMenuHandlerToDisplay { if (this.handler.loading) { @@ -123,7 +123,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, * * @param siteId Site ID or current Site if undefined. * @param unreadOnly If true only the unread conversations count is refreshed. - * @return Resolve when done. + * @returns Resolve when done. */ async refreshBadge(siteId?: string, unreadOnly?: boolean): Promise { const badgeSiteId = siteId || CoreSites.getCurrentSiteId(); @@ -188,7 +188,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, * Receives the ID of the site affected, undefined for all sites. * * @param siteId ID of the site affected, undefined for all sites. - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ async execute(siteId?: string): Promise { if (!CoreSites.isCurrentSite(siteId)) { @@ -201,7 +201,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { if (!this.isSync()) { @@ -214,7 +214,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, /** * Whether it's a synchronization process or not. * - * @return True if is a sync process, false otherwise. + * @returns True if is a sync process, false otherwise. */ isSync(): boolean { return false; @@ -223,7 +223,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, /** * Whether the process should be executed during a manual sync. * - * @return True if is a manual sync process, false otherwise. + * @returns True if is a manual sync process, false otherwise. */ canManualSync(): boolean { return true; diff --git a/src/addons/messages/services/handlers/push-click.ts b/src/addons/messages/services/handlers/push-click.ts index 6bb3da0eb..dd20e1e3d 100644 --- a/src/addons/messages/services/handlers/push-click.ts +++ b/src/addons/messages/services/handlers/push-click.ts @@ -35,7 +35,7 @@ export class AddonMessagesPushClickHandlerService implements CorePushNotificatio * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: AddonMessagesPushNotificationData): Promise { if (CoreUtils.isTrueOrOne(notification.notif) && notification.name != 'messagecontactrequests') { @@ -50,7 +50,7 @@ export class AddonMessagesPushClickHandlerService implements CorePushNotificatio * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: AddonMessagesPushNotificationData): Promise { try { diff --git a/src/addons/messages/services/handlers/settings.ts b/src/addons/messages/services/handlers/settings.ts index 00b0eef21..2dcf2a384 100644 --- a/src/addons/messages/services/handlers/settings.ts +++ b/src/addons/messages/services/handlers/settings.ts @@ -31,7 +31,7 @@ export class AddonMessagesSettingsHandlerService implements CoreSettingsHandler /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return AddonMessages.isPluginEnabled(); @@ -40,7 +40,7 @@ export class AddonMessagesSettingsHandlerService implements CoreSettingsHandler /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/addons/messages/services/handlers/sync-cron.ts b/src/addons/messages/services/handlers/sync-cron.ts index 30536a0ed..2a0a543bb 100644 --- a/src/addons/messages/services/handlers/sync-cron.ts +++ b/src/addons/messages/services/handlers/sync-cron.ts @@ -30,7 +30,7 @@ export class AddonMessagesSyncCronHandlerService implements CoreCronHandler { * Receives the ID of the site affected, undefined for all sites. * * @param siteId ID of the site affected, undefined for all sites. - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string): Promise { return AddonMessagesSync.syncAllDiscussions(siteId); @@ -39,7 +39,7 @@ export class AddonMessagesSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/addons/messages/services/handlers/user-send-message.ts b/src/addons/messages/services/handlers/user-send-message.ts index aba6b12ed..b7a677645 100644 --- a/src/addons/messages/services/handlers/user-send-message.ts +++ b/src/addons/messages/services/handlers/user-send-message.ts @@ -58,7 +58,7 @@ export class AddonMessagesSendMessageUserHandlerService implements CoreUserProfi /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreUserProfileHandlerData { return { diff --git a/src/addons/messages/services/messages-offline.ts b/src/addons/messages/services/messages-offline.ts index 38ab67f3b..ac4987ae7 100644 --- a/src/addons/messages/services/messages-offline.ts +++ b/src/addons/messages/services/messages-offline.ts @@ -38,7 +38,7 @@ export class AddonMessagesOfflineProvider { * @param message The message. * @param timeCreated The time the message was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteConversationMessage(conversationId: number, message: string, timeCreated: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -55,7 +55,7 @@ export class AddonMessagesOfflineProvider { * * @param conversationId Conversation ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteConversationMessages(conversationId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -72,7 +72,7 @@ export class AddonMessagesOfflineProvider { * @param message The message. * @param timeCreated The time the message was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteMessage(toUserId: number, message: string, timeCreated: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -88,7 +88,7 @@ export class AddonMessagesOfflineProvider { * Get all messages where deviceoffline is set to 1. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with messages. + * @returns Promise resolved with messages. */ async getAllDeviceOfflineMessages( siteId?: string, @@ -118,7 +118,7 @@ export class AddonMessagesOfflineProvider { * Get all offline messages. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with messages. + * @returns Promise resolved with messages. */ async getAllMessages( siteId?: string, @@ -147,7 +147,7 @@ export class AddonMessagesOfflineProvider { * @param conversationId Conversation ID. * @param userIdFrom To add to the conversation messages when parsing. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with messages. + * @returns Promise resolved with messages. */ async getConversationMessages( conversationId: number, @@ -169,7 +169,7 @@ export class AddonMessagesOfflineProvider { * * @param toUserId User ID to get messages to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with messages. + * @returns Promise resolved with messages. */ async getMessages(toUserId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -185,7 +185,7 @@ export class AddonMessagesOfflineProvider { * * @param conversationId Conversation ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline messages, false otherwise. + * @returns Promise resolved with boolean: true if has offline messages, false otherwise. */ async hasConversationMessages(conversationId: number, siteId?: string): Promise { const messages = await this.getConversationMessages(conversationId, undefined, siteId); @@ -198,7 +198,7 @@ export class AddonMessagesOfflineProvider { * * @param toUserId User ID to check. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline messages, false otherwise. + * @returns Promise resolved with boolean: true if has offline messages, false otherwise. */ async hasMessages(toUserId: number, siteId?: string): Promise { const messages = await this.getMessages(toUserId, siteId); @@ -211,7 +211,7 @@ export class AddonMessagesOfflineProvider { * * @param messages List of messages to parse. * @param userIdFrom To add to the conversation messages when parsin. - * @return Parsed messages. + * @returns Parsed messages. */ protected parseConversationMessages( messages: AddonMessagesOfflineConversationMessagesDBRecord[], @@ -240,7 +240,7 @@ export class AddonMessagesOfflineProvider { * Parse some fields of each offline messages. * * @param messages List of messages to parse. - * @return Parsed messages. + * @returns Parsed messages. */ protected parseMessages( messages: AddonMessagesOfflineMessagesDBRecord[], @@ -270,7 +270,7 @@ export class AddonMessagesOfflineProvider { * @param conversation Conversation. * @param message The message to send. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveConversationMessage( conversation: AddonMessagesConversation, @@ -304,7 +304,7 @@ export class AddonMessagesOfflineProvider { * @param toUserId User ID recipient of the message. * @param message The message to send. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveMessage(toUserId: number, message: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -328,7 +328,7 @@ export class AddonMessagesOfflineProvider { * @param messages Messages to update. Should be the same entry as retrieved from the DB. * @param value Value to set. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async setMessagesDeviceOffline( messages: AddonMessagesOfflineAnyMessagesFormatted[], diff --git a/src/addons/messages/services/messages-sync.ts b/src/addons/messages/services/messages-sync.ts index 745a63fc4..fdfbe6bad 100644 --- a/src/addons/messages/services/messages-sync.ts +++ b/src/addons/messages/services/messages-sync.ts @@ -50,7 +50,7 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { const syncFunctionLog = 'all discussions' + (onlyDeviceOffline ? ' (Only offline)' : ''); @@ -82,7 +82,7 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { const userIds: number[] = []; @@ -140,7 +140,7 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -162,7 +162,7 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { const site = await CoreSites.getSite(siteId); @@ -116,7 +116,7 @@ export class AddonMessagesProvider { * * @param userId User ID of the person to block. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async blockContact(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -149,7 +149,7 @@ export class AddonMessagesProvider { * * @param userId ID of the user who made the contact request. * @param siteId Site ID. If not defined, use current site. - * @return Resolved when done. + * @returns Resolved when done. * @since 3.6 */ async confirmContactRequest(userId: number, siteId?: string): Promise { @@ -178,7 +178,7 @@ export class AddonMessagesProvider { * * @param userId ID of the receiver of the contact request. * @param siteId Site ID. If not defined, use current site. - * @return Resolved when done. + * @returns Resolved when done. * @since 3.6 */ async createContactRequest(userId: number, siteId?: string): Promise { @@ -214,7 +214,7 @@ export class AddonMessagesProvider { * * @param userId ID of the user who made the contact request. * @param siteId Site ID. If not defined, use current site. - * @return Resolved when done. + * @returns Resolved when done. * @since 3.6 */ async declineContactRequest(userId: number, siteId?: string): Promise { @@ -242,7 +242,7 @@ export class AddonMessagesProvider { * @param conversationId Conversation to delete. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Promise resolved when the conversation has been deleted. + * @returns Promise resolved when the conversation has been deleted. */ async deleteConversation(conversationId: number, siteId?: string, userId?: number): Promise { await this.deleteConversations([conversationId], siteId, userId); @@ -254,7 +254,7 @@ export class AddonMessagesProvider { * @param conversationIds Conversations to delete. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Promise resolved when the conversations have been deleted. + * @returns Promise resolved when the conversations have been deleted. */ async deleteConversations(conversationIds: number[], siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -282,7 +282,7 @@ export class AddonMessagesProvider { * * @param message Message to delete. * @param deleteForAll Whether the message should be deleted for all users. - * @return Promise resolved when the message has been deleted. + * @returns Promise resolved when the message has been deleted. */ deleteMessage(message: AddonMessagesConversationMessageFormatted, deleteForAll?: boolean): Promise { if ('id' in message) { @@ -308,7 +308,7 @@ export class AddonMessagesProvider { * @param id Message ID. * @param read True if message is read, false otherwise. * @param userId User we want to delete the message for. If not defined, use current user. - * @return Promise resolved when the message has been deleted. + * @returns Promise resolved when the message has been deleted. */ async deleteMessageOnline(id: number, read: boolean, userId?: number): Promise { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -332,7 +332,7 @@ export class AddonMessagesProvider { * * @param id Message ID. * @param userId User we want to delete the message for. If not defined, use current user. - * @return Promise resolved when the message has been deleted. + * @returns Promise resolved when the message has been deleted. */ async deleteMessageForAllOnline(id: number, userId?: number): Promise { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -352,7 +352,7 @@ export class AddonMessagesProvider { * * @param conversation Conversation to format. * @param userId User ID viewing the conversation. - * @return Formatted conversation. + * @returns Formatted conversation. */ protected formatConversation( conversation: AddonMessagesConversationFormatted, @@ -392,7 +392,7 @@ export class AddonMessagesProvider { * Get the cache key for blocked contacts. * * @param userId The user who's contacts we're looking for. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForBlockedContacts(userId: number): string { return ROOT_CACHE_KEY + 'blockedContacts:' + userId; @@ -401,7 +401,7 @@ export class AddonMessagesProvider { /** * Get the cache key for contacts. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForContacts(): string { return ROOT_CACHE_KEY + 'contacts'; @@ -410,7 +410,7 @@ export class AddonMessagesProvider { /** * Get the cache key for comfirmed contacts. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForUserContacts(): string { return ROOT_CACHE_KEY + 'userContacts'; @@ -419,7 +419,7 @@ export class AddonMessagesProvider { /** * Get the cache key for contact requests. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForContactRequests(): string { return ROOT_CACHE_KEY + 'contactRequests'; @@ -428,7 +428,7 @@ export class AddonMessagesProvider { /** * Get the cache key for contact requests count. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForContactRequestsCount(): string { return ROOT_CACHE_KEY + 'contactRequestsCount'; @@ -438,7 +438,7 @@ export class AddonMessagesProvider { * Get the cache key for a discussion. * * @param userId The other person with whom the current user is having the discussion. - * @return Cache key. + * @returns Cache key. */ getCacheKeyForDiscussion(userId: number): string { return ROOT_CACHE_KEY + 'discussion:' + userId; @@ -448,7 +448,7 @@ export class AddonMessagesProvider { * Get the cache key for the message count. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForMessageCount(userId: number): string { return ROOT_CACHE_KEY + 'count:' + userId; @@ -457,7 +457,7 @@ export class AddonMessagesProvider { /** * Get the cache key for unread conversation counts. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForUnreadConversationCounts(): string { return ROOT_CACHE_KEY + 'unreadConversationCounts'; @@ -466,7 +466,7 @@ export class AddonMessagesProvider { /** * Get the cache key for the list of discussions. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForDiscussions(): string { return ROOT_CACHE_KEY + 'discussions'; @@ -477,7 +477,7 @@ export class AddonMessagesProvider { * * @param userId User ID. * @param conversationId Conversation ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForConversation(userId: number, conversationId: number): string { return ROOT_CACHE_KEY + 'conversation:' + userId + ':' + conversationId; @@ -488,7 +488,7 @@ export class AddonMessagesProvider { * * @param userId User ID. * @param otherUserId Other user ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForConversationBetweenUsers(userId: number, otherUserId: number): string { return ROOT_CACHE_KEY + 'conversationBetweenUsers:' + userId + ':' + otherUserId; @@ -499,7 +499,7 @@ export class AddonMessagesProvider { * * @param userId User ID. * @param conversationId Conversation ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForConversationMembers(userId: number, conversationId: number): string { return ROOT_CACHE_KEY + 'conversationMembers:' + userId + ':' + conversationId; @@ -510,7 +510,7 @@ export class AddonMessagesProvider { * * @param userId User ID. * @param conversationId Conversation ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForConversationMessages(userId: number, conversationId: number): string { return ROOT_CACHE_KEY + 'conversationMessages:' + userId + ':' + conversationId; @@ -522,7 +522,7 @@ export class AddonMessagesProvider { * @param userId User ID. * @param type Filter by type. * @param favourites Filter favourites. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForConversations(userId: number, type?: number, favourites?: boolean): string { return this.getCommonCacheKeyForUserConversations(userId) + ':' + type + ':' + favourites; @@ -531,7 +531,7 @@ export class AddonMessagesProvider { /** * Get cache key for conversation counts. * - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForConversationCounts(): string { return ROOT_CACHE_KEY + 'conversationCounts'; @@ -542,7 +542,7 @@ export class AddonMessagesProvider { * * @param userId User ID. * @param otherUserId The other user ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForMemberInfo(userId: number, otherUserId: number): string { return ROOT_CACHE_KEY + 'memberInfo:' + userId + ':' + otherUserId; @@ -552,7 +552,7 @@ export class AddonMessagesProvider { * Get cache key for get self conversation. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getCacheKeyForSelfConversation(userId: number): string { return ROOT_CACHE_KEY + 'selfconversation:' + userId; @@ -562,7 +562,7 @@ export class AddonMessagesProvider { * Get common cache key for get user conversations. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getCommonCacheKeyForUserConversations(userId: number): string { return this.getRootCacheKeyForConversations() + userId; @@ -571,7 +571,7 @@ export class AddonMessagesProvider { /** * Get root cache key for get conversations. * - * @return Cache key. + * @returns Cache key. */ protected getRootCacheKeyForConversations(): string { return ROOT_CACHE_KEY + 'conversations:'; @@ -581,8 +581,8 @@ export class AddonMessagesProvider { * Get all the contacts of the current user. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the WS data. - * @deprecatedonmoodle since Moodle 3.6 + * @returns Promise resolved with the WS data. + * @deprecated since Moodle 3.6 */ async getAllContacts(siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -608,7 +608,7 @@ export class AddonMessagesProvider { * Get all the users blocked by the current user. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the WS data. + * @returns Promise resolved with the WS data. */ async getBlockedContacts(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -633,8 +633,8 @@ export class AddonMessagesProvider { * This excludes the blocked users. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the WS data. - * @deprecatedonmoodle since Moodle 3.6 + * @returns Promise resolved with the WS data. + * @deprecated since Moodle 3.6 */ async getContacts(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -674,7 +674,7 @@ export class AddonMessagesProvider { * @param limitFrom Position of the first contact to fetch. * @param limitNum Number of contacts to fetch. Default is AddonMessagesProvider.LIMIT_CONTACTS. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the list of user contacts. + * @returns Promise resolved with the list of user contacts. * @since 3.6 */ async getUserContacts( @@ -718,7 +718,7 @@ export class AddonMessagesProvider { * @param limitFrom Position of the first contact request to fetch. * @param limitNum Number of contact requests to fetch. Default is AddonMessagesProvider.LIMIT_CONTACTS. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the list of contact requests. + * @returns Promise resolved with the list of contact requests. * @since 3.6 */ async getContactRequests( @@ -764,7 +764,7 @@ export class AddonMessagesProvider { * Get the number of contact requests sent to the current user. * * @param siteId Site ID. If not defined, use current site. - * @return Resolved with the number of contact requests. + * @returns Resolved with the number of contact requests. * @since 3.6 */ async getContactRequestsCount(siteId?: string): Promise { @@ -805,7 +805,7 @@ export class AddonMessagesProvider { * @param newestFirst Whether to order messages by newest first. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. * @since 3.6 */ async getConversation( @@ -864,7 +864,7 @@ export class AddonMessagesProvider { * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. * @param preferCache True if shouldn't call WS if data is cached, false otherwise. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. * @since 3.6 */ async getConversationBetweenUsers( @@ -912,8 +912,10 @@ export class AddonMessagesProvider { * @param conversationId Conversation ID to fetch. * @param limitFrom Offset for members list. * @param limitTo Limit of members. + * @param includeContactRequests Include contact requests. * @param siteId Site ID. If not defined, use current site. - * @param userId User ID. If not defined, current user in + * @param userId User ID. If not defined, current user in. + * @returns Conversation members. * @since 3.6 */ async getConversationMembers( @@ -962,7 +964,7 @@ export class AddonMessagesProvider { * * @param conversationId Conversation ID to fetch. * @param options Options. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. * @since 3.6 */ async getConversationMessages( @@ -1044,7 +1046,7 @@ export class AddonMessagesProvider { * @param userId User ID. If not defined, current user in the site. * @param forceCache True if it should return cached data. Has priority over ignoreCache. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved with the conversations. + * @returns Promise resolved with the conversations. * @since 3.6 */ async getConversations( @@ -1116,7 +1118,7 @@ export class AddonMessagesProvider { * Get conversation counts by type. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with favourite, + * @returns Promise resolved with favourite, * individual, group and self conversation counts. * @since 3.6 */ @@ -1154,7 +1156,7 @@ export class AddonMessagesProvider { * @param lfSentRead Number of read sent messages already fetched, so fetch will be done from this. * @param notUsed Deprecated since 3.9.5 * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with messages and a boolean telling if can load more messages. + * @returns Promise resolved with messages and a boolean telling if can load more messages. */ async getDiscussion( userId: number, @@ -1230,7 +1232,7 @@ export class AddonMessagesProvider { * If the site is 3.6 or higher, please use getConversations. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with an object where the keys are the user ID of the other user. + * @returns Promise resolved with an object where the keys are the user ID of the other user. */ async getDiscussions(siteId?: string): Promise<{[userId: number]: AddonMessagesDiscussion}> { const discussions: { [userId: number]: AddonMessagesDiscussion } = {}; @@ -1320,7 +1322,7 @@ export class AddonMessagesProvider { * * @param discussions List of discussions. * @param siteId Site ID. If not defined, current site. - * @return Promise always resolved. Resolve param is the formatted discussions. + * @returns Promise always resolved. Resolve param is the formatted discussions. */ protected async getDiscussionsUserImg( discussions: { [userId: number]: AddonMessagesDiscussion }, @@ -1352,7 +1354,7 @@ export class AddonMessagesProvider { * @param otherUserId The other user ID. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Promise resolved with the member info. + * @returns Promise resolved with the member info. * @since 3.6 */ async getMemberInfo(otherUserId: number, siteId?: string, userId?: number): Promise { @@ -1382,7 +1384,7 @@ export class AddonMessagesProvider { /** * Get the cache key for the get message preferences call. * - * @return Cache key. + * @returns Cache key. */ protected getMessagePreferencesCacheKey(): string { return ROOT_CACHE_KEY + 'messagePreferences'; @@ -1392,7 +1394,7 @@ export class AddonMessagesProvider { * Get message preferences. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the message preferences. + * @returns Promise resolved with the message preferences. */ async getMessagePreferences(siteId?: string): Promise { this.logger.debug('Get message preferences'); @@ -1425,7 +1427,7 @@ export class AddonMessagesProvider { * @param params Parameters to pass to the WS. * @param preSets Set of presets for the WS. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async getMessages( params: AddonMessagesGetMessagesWSParams, @@ -1458,7 +1460,7 @@ export class AddonMessagesProvider { * @param limitFromRead Number of unread messages already fetched, so fetch will be done from this number. * @param notUsed // Deprecated 3.9.5 * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getRecentMessages( params: AddonMessagesGetMessagesWSParams, @@ -1511,7 +1513,7 @@ export class AddonMessagesProvider { * @param newestFirst Whether to order messages by newest first. * @param siteId Site ID. If not defined, use current site. * @param userId User ID to get the self conversation for. If not defined, current user in the site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. * @since 3.7 */ async getSelfConversation( @@ -1543,7 +1545,7 @@ export class AddonMessagesProvider { * Get unread conversation counts by type. * * @param siteId Site ID. If not defined, use current site. - * @return Resolved with the unread favourite, individual and group conversation counts. + * @returns Resolved with the unread favourite, individual and group conversation counts. */ async getUnreadConversationCounts( siteId?: string, @@ -1591,11 +1593,11 @@ export class AddonMessagesProvider { /** * Get the latest unread received messages. * - * @param toDisplay True if messages will be displayed to the user, either in view or in a notification. + * @param notUsed Not user anymore. * @param forceCache True if it should return cached data. Has priority over ignoreCache. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the message unread count. + * @returns Promise resolved with the message unread count. */ async getUnreadReceivedMessages( notUsed: boolean = true, // eslint-disable-line @typescript-eslint/no-unused-vars @@ -1627,7 +1629,7 @@ export class AddonMessagesProvider { * Invalidate all contacts cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateAllContactsCache(siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1640,7 +1642,6 @@ export class AddonMessagesProvider { /** * Invalidate blocked contacts cache. * - * @param userId The user ID. * @param siteId Site ID. If not defined, current site. */ async invalidateBlockedContactsCache(siteId?: string): Promise { @@ -1655,7 +1656,7 @@ export class AddonMessagesProvider { * Invalidate contacts cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateContactsCache(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1667,7 +1668,7 @@ export class AddonMessagesProvider { * Invalidate user contacts cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateUserContacts(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1679,7 +1680,7 @@ export class AddonMessagesProvider { * Invalidate contact requests cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateContactRequestsCache(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1691,7 +1692,7 @@ export class AddonMessagesProvider { * Invalidate contact requests count cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateContactRequestsCountCache(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1705,7 +1706,7 @@ export class AddonMessagesProvider { * @param conversationId Conversation ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateConversation(conversationId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1720,7 +1721,7 @@ export class AddonMessagesProvider { * @param otherUserId Other user ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateConversationBetweenUsers(otherUserId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1735,7 +1736,7 @@ export class AddonMessagesProvider { * @param conversationId Conversation ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateConversationMembers(conversationId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1751,7 +1752,7 @@ export class AddonMessagesProvider { * @param conversationId Conversation ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateConversationMessages(conversationId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1766,7 +1767,7 @@ export class AddonMessagesProvider { * * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateConversations(siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1780,7 +1781,7 @@ export class AddonMessagesProvider { * Invalidate conversation counts cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateConversationCounts(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1793,7 +1794,7 @@ export class AddonMessagesProvider { * * @param userId The user ID with whom the current user is having the discussion. * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateDiscussionCache(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1807,7 +1808,7 @@ export class AddonMessagesProvider { * Note that {@link this.getDiscussions} uses the contacts, so we need to invalidate contacts too. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateDiscussionsCache(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1825,7 +1826,7 @@ export class AddonMessagesProvider { * @param otherUserId The other user ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateMemberInfo(otherUserId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1839,7 +1840,7 @@ export class AddonMessagesProvider { * Invalidate get message preferences. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateMessagePreferences(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1852,7 +1853,7 @@ export class AddonMessagesProvider { * * @param userId Id of the user to invalidate. * @param site Site object. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateAllMemberInfo(userId: number, site: CoreSite): Promise { await CoreUtils.allPromises([ @@ -1887,7 +1888,7 @@ export class AddonMessagesProvider { * * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateSelfConversation(siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1901,7 +1902,7 @@ export class AddonMessagesProvider { * Invalidate unread conversation counts cache. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateUnreadConversationCounts(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1919,7 +1920,7 @@ export class AddonMessagesProvider { * * @param userId The user ID to check against. * @param siteId Site ID. If not defined, use current site. - * @return Resolved with boolean, rejected when we do not know. + * @returns Resolved with boolean, rejected when we do not know. */ async isBlocked(userId: number, siteId?: string): Promise { if (this.isGroupMessagingEnabled()) { @@ -1941,7 +1942,7 @@ export class AddonMessagesProvider { * * @param userId The user ID to check against. * @param siteId Site ID. If not defined, use current site. - * @return Resolved with boolean, rejected when we do not know. + * @returns Resolved with boolean, rejected when we do not know. */ async isContact(userId: number, siteId?: string): Promise { if (this.isGroupMessagingEnabled()) { @@ -1964,7 +1965,7 @@ export class AddonMessagesProvider { /** * Returns whether or not group messaging is supported. * - * @return If related WS is available on current site. + * @returns If related WS is available on current site. * @since 3.6 */ isGroupMessagingEnabled(): boolean { @@ -1975,7 +1976,7 @@ export class AddonMessagesProvider { * Returns whether or not group messaging is supported in a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether related WS is available on a certain site. + * @returns Promise resolved with boolean: whether related WS is available on a certain site. * @since 3.6 */ async isGroupMessagingEnabledInSite(siteId?: string): Promise { @@ -1994,7 +1995,7 @@ export class AddonMessagesProvider { * This could call a WS so do not abuse this method. * * @param siteId Site ID. If not defined, current site. - * @return Resolved when enabled, otherwise rejected. + * @returns Resolved when enabled, otherwise rejected. */ async isMessagingEnabledForSite(siteId?: string): Promise { const enabled = await this.isPluginEnabled(siteId); @@ -2008,7 +2009,7 @@ export class AddonMessagesProvider { * Returns whether or not a site supports muting or unmuting a conversation. * * @param site The site to check, undefined for current site. - * @return If related WS is available on current site. + * @returns If related WS is available on current site. * @since 3.7 */ isMuteConversationEnabled(site?: CoreSite): boolean { @@ -2021,7 +2022,7 @@ export class AddonMessagesProvider { * Returns whether or not a site supports muting or unmuting a conversation. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether related WS is available on a certain site. + * @returns Promise resolved with boolean: whether related WS is available on a certain site. * @since 3.7 */ async isMuteConversationEnabledInSite(siteId?: string): Promise { @@ -2038,7 +2039,7 @@ export class AddonMessagesProvider { * Returns whether or not the plugin is enabled in a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if enabled, rejected or resolved with false otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2050,7 +2051,7 @@ export class AddonMessagesProvider { * Returns whether or not self conversation is supported in a certain site. * * @param site Site. If not defined, current site. - * @return If related WS is available on the site. + * @returns If related WS is available on the site. * @since 3.7 */ isSelfConversationEnabled(site?: CoreSite): boolean { @@ -2063,7 +2064,7 @@ export class AddonMessagesProvider { * Returns whether or not self conversation is supported in a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether related WS is available on a certain site. + * @returns Promise resolved with boolean: whether related WS is available on a certain site. * @since 3.7 */ async isSelfConversationEnabledInSite(siteId?: string): Promise { @@ -2081,7 +2082,7 @@ export class AddonMessagesProvider { * * @param messageId ID of message to mark as read * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean marking success or not. + * @returns Promise resolved with boolean marking success or not. */ async markMessageRead(messageId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2098,7 +2099,7 @@ export class AddonMessagesProvider { * Mark all messages of a conversation as read. * * @param conversationId Conversation ID. - * @return Promise resolved if success. + * @returns Promise resolved if success. * @since 3.6 */ async markAllConversationMessagesRead(conversationId: number): Promise { @@ -2118,8 +2119,8 @@ export class AddonMessagesProvider { * Mark all messages of a discussion as read. * * @param userIdFrom User Id for the sender. - * @return Promise resolved with boolean marking success or not. - * @deprecatedonmoodle since Moodle 3.6 + * @returns Promise resolved with boolean marking success or not. + * @deprecated since Moodle 3.6 */ async markAllMessagesRead(userIdFrom?: number): Promise { const params: AddonMessagesMarkAllMessagesAsReadWSParams = { @@ -2147,7 +2148,7 @@ export class AddonMessagesProvider { * @param set Whether to mute or unmute. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async muteConversation(conversationId: number, set: boolean, siteId?: string, userId?: number): Promise { await this.muteConversations([conversationId], set, siteId, userId); @@ -2160,7 +2161,7 @@ export class AddonMessagesProvider { * @param set Whether to mute or unmute. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async muteConversations(conversations: number[], set: boolean, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -2188,7 +2189,7 @@ export class AddonMessagesProvider { * Refresh the number of contact requests sent to the current user. * * @param siteId Site ID. If not defined, use current site. - * @return Resolved with the number of contact requests. + * @returns Resolved with the number of contact requests. * @since 3.6 */ async refreshContactRequestsCount(siteId?: string): Promise { @@ -2203,7 +2204,7 @@ export class AddonMessagesProvider { * Refresh unread conversation counts and trigger event. * * @param siteId Site ID. If not defined, use current site. - * @return Resolved with the unread favourite, individual and group conversation counts. + * @returns Resolved with the unread favourite, individual and group conversation counts. */ async refreshUnreadConversationCounts( siteId?: string, @@ -2220,7 +2221,7 @@ export class AddonMessagesProvider { * * @param userId User ID of the person to remove. * @param siteId Site ID. If not defined, use current site. - * @return Resolved when done. + * @returns Resolved when done. */ async removeContact(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2257,7 +2258,7 @@ export class AddonMessagesProvider { * @param query The query string. * @param limit The number of results to return, 0 for none. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the contacts. + * @returns Promise resolved with the contacts. */ async searchContacts(query: string, limit: number = 100, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2290,7 +2291,7 @@ export class AddonMessagesProvider { * @param limitFrom Position of the first result to get. Defaults to 0. * @param limitNum Number of results to get. Defaults to AddonMessagesProvider.LIMIT_SEARCH. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the results. + * @returns Promise resolved with the results. */ async searchMessages( query: string, @@ -2343,7 +2344,7 @@ export class AddonMessagesProvider { * @param limitFrom Position of the first found user to fetch. * @param limitNum Number of found users to fetch. Defaults to AddonMessagesProvider.LIMIT_SEARCH. * @param siteId Site ID. If not defined, use current site. - * @return Resolved with two lists of found users: contacts and non-contacts. + * @returns Resolved with two lists of found users: contacts and non-contacts. * @since 3.6 */ async searchUsers( @@ -2391,10 +2392,10 @@ export class AddonMessagesProvider { /** * Send a message to someone. * - * @param userIdTo User ID to send the message to. + * @param toUserId User ID to send the message to. * @param message The message to send * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with: + * @returns Promise resolved with: * - sent (Boolean) True if message was sent to server, false if stored in device. * - message (Object) If sent=false, contains the stored message. */ @@ -2467,7 +2468,7 @@ export class AddonMessagesProvider { * @param toUserId User ID to send the message to. * @param message The message to send * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected if failure. + * @returns Promise resolved if success, rejected if failure. */ async sendMessageOnline(toUserId: number, message: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -2503,7 +2504,7 @@ export class AddonMessagesProvider { * * @param messages Messages to send. Each message must contain touserid, text and textformat. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected if failure. Promise resolved doesn't mean that messages + * @returns Promise resolved if success, rejected if failure. Promise resolved doesn't mean that messages * have been sent, the resolve param can contain errors for messages not sent. */ async sendMessagesOnline( @@ -2525,7 +2526,7 @@ export class AddonMessagesProvider { * @param conversation Conversation. * @param message The message to send. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with: + * @returns Promise resolved with: * - sent (boolean) True if message was sent to server, false if stored in device. * - message (any) If sent=false, contains the stored message. * @since 3.6 @@ -2598,7 +2599,7 @@ export class AddonMessagesProvider { * @param conversationId Conversation ID. * @param message The message to send * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected if failure. + * @returns Promise resolved if success, rejected if failure. * @since 3.6 */ async sendMessageToConversationOnline( @@ -2632,7 +2633,7 @@ export class AddonMessagesProvider { * @param conversationId Conversation ID. * @param messages Messages to send. Each message must contain text and, optionally, textformat. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected if failure. + * @returns Promise resolved if success, rejected if failure. * @since 3.6 */ async sendMessagesToConversationOnline( @@ -2660,7 +2661,7 @@ export class AddonMessagesProvider { * @param set Whether to set or unset it as favourite. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ setFavouriteConversation(conversationId: number, set: boolean, siteId?: string, userId?: number): Promise { return this.setFavouriteConversations([conversationId], set, siteId, userId); @@ -2673,7 +2674,7 @@ export class AddonMessagesProvider { * @param set Whether to set or unset them as favourites. * @param siteId Site ID. If not defined, use current site. * @param userId User ID. If not defined, current user in the site. - * @return Resolved when done. + * @returns Resolved when done. */ async setFavouriteConversations(conversations: number[], set: boolean, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -2702,7 +2703,7 @@ export class AddonMessagesProvider { * Helper method to sort conversations by last message time. * * @param conversations Array of conversations. - * @return Conversations sorted with most recent last. + * @returns Conversations sorted with most recent last. */ sortConversations(conversations: AddonMessagesConversationFormatted[]): AddonMessagesConversationFormatted[] { return conversations.sort((a, b) => { @@ -2722,7 +2723,7 @@ export class AddonMessagesProvider { * Helper method to sort messages by time. * * @param messages Array of messages containing the key 'timecreated'. - * @return Messages sorted with most recent last. + * @returns Messages sorted with most recent last. */ sortMessages(messages: AddonMessagesConversationMessageFormatted[]): AddonMessagesConversationMessageFormatted[]; sortMessages( @@ -2792,7 +2793,7 @@ export class AddonMessagesProvider { * * @param userId User ID of the person to unblock. * @param siteId Site ID. If not defined, use current site. - * @return Resolved when done. + * @returns Resolved when done. */ async unblockContact(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/assign/classes/base-feedback-plugin-component.ts b/src/addons/mod/assign/classes/base-feedback-plugin-component.ts index d45eb1f07..939343c0c 100644 --- a/src/addons/mod/assign/classes/base-feedback-plugin-component.ts +++ b/src/addons/mod/assign/classes/base-feedback-plugin-component.ts @@ -39,7 +39,7 @@ export class AddonModAssignFeedbackPluginBaseComponent implements IAddonModAssig /** * Open a modal to edit the feedback plugin. * - * @return Promise resolved with the input data, rejected if cancelled. + * @returns Promise resolved with the input data, rejected if cancelled. */ async editFeedback(): Promise { if (!this.canEdit) { @@ -81,7 +81,7 @@ export interface IAddonModAssignFeedbackPluginComponent { /** * Invalidate the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ invalidate(): Promise; diff --git a/src/addons/mod/assign/classes/base-submission-plugin-component.ts b/src/addons/mod/assign/classes/base-submission-plugin-component.ts index 8ec1a4598..56f938d0b 100644 --- a/src/addons/mod/assign/classes/base-submission-plugin-component.ts +++ b/src/addons/mod/assign/classes/base-submission-plugin-component.ts @@ -33,7 +33,7 @@ export class AddonModAssignSubmissionPluginBaseComponent { /** * Invalidate the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidate(): Promise { return; diff --git a/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts b/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts index 6e48aab65..404887898 100644 --- a/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts +++ b/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts @@ -39,8 +39,6 @@ export class AddonModAssignEditFeedbackModalComponent { /** * Close modal checking if there are changes first. - * - * @param data Data to return to the page. */ async closeModal(): Promise { const changed = await this.hasDataChanged(); @@ -71,7 +69,7 @@ export class AddonModAssignEditFeedbackModalComponent { /** * Get the input data. * - * @return Object with the data. + * @returns Object with the data. */ protected getInputData(): CoreFormFields { return CoreForms.getDataFromForm(document.forms['addon-mod_assign-edit-feedback-form']); @@ -80,7 +78,7 @@ export class AddonModAssignEditFeedbackModalComponent { /** * Check if data has changed. * - * @return Promise resolved with boolean: whether the data has changed. + * @returns Promise resolved with boolean: whether the data has changed. */ protected async hasDataChanged(): Promise { const changed = await CoreUtils.ignoreErrors( diff --git a/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts b/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts index 2ea161858..45d6cdac8 100644 --- a/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts +++ b/src/addons/mod/assign/components/feedback-plugin/feedback-plugin.ts @@ -55,7 +55,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { pluginLoaded = false; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.plugin) { @@ -99,7 +99,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { /** * Invalidate the plugin data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidate(): Promise { await this.dynamicComponent.callComponentMethod('invalidate'); diff --git a/src/addons/mod/assign/components/index/index.ts b/src/addons/mod/assign/components/index/index.ts index a29597a92..5f4640723 100644 --- a/src/addons/mod/assign/components/index/index.ts +++ b/src/addons/mod/assign/components/index/index.ts @@ -100,7 +100,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -244,7 +244,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo * Set group to see the summary. * * @param groupId Group ID. - * @return Resolved when done. + * @returns Resolved when done. */ async setGroup(groupId = 0): Promise { this.group = groupId; diff --git a/src/addons/mod/assign/components/submission-plugin/submission-plugin.ts b/src/addons/mod/assign/components/submission-plugin/submission-plugin.ts index 573a7a07a..421aee60c 100644 --- a/src/addons/mod/assign/components/submission-plugin/submission-plugin.ts +++ b/src/addons/mod/assign/components/submission-plugin/submission-plugin.ts @@ -54,7 +54,7 @@ export class AddonModAssignSubmissionPluginComponent implements OnInit { pluginLoaded = false; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.plugin) { @@ -97,7 +97,7 @@ export class AddonModAssignSubmissionPluginComponent implements OnInit { /** * Invalidate the plugin data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidate(): Promise { await this.dynamicComponent.callComponentMethod('invalidate'); diff --git a/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html b/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html index 753b18636..a3e2145f0 100644 --- a/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html +++ b/src/addons/mod/assign/components/submission/addon-mod-assign-submission.html @@ -69,8 +69,8 @@

-

+

diff --git a/src/addons/mod/assign/components/submission/submission.ts b/src/addons/mod/assign/components/submission/submission.ts index d38e423ac..3715161ef 100644 --- a/src/addons/mod/assign/components/submission/submission.ts +++ b/src/addons/mod/assign/components/submission/submission.ts @@ -268,7 +268,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Check if the user can leave the view. If there are changes to be saved, it will ask for confirm. * - * @return Promise resolved with true if can leave the view, rejected otherwise. + * @returns Promise resolved with true if can leave the view, rejected otherwise. */ async canLeave(): Promise { // Check if there is data to save. @@ -286,6 +286,8 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Copy a previous attempt and then go to edit. + * + * @returns Promise resolved when done. */ async copyPrevious(): Promise { if (!this.assign) { @@ -350,7 +352,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Discard feedback drafts. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async discardDrafts(): Promise { if (this.assign && this.feedback && this.feedback.plugins) { @@ -392,7 +394,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can * Check if there's data to save (grade). * * @param isSubmit Whether the user is about to submit the grade. - * @return Promise resolved with boolean: whether there's data to save. + * @returns Promise resolved with boolean: whether there's data to save. */ protected async hasDataToSave(isSubmit = false): Promise { if (!this.canSaveGrades || !this.loaded || !this.assign) { @@ -457,7 +459,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can * Invalidate and refresh data. * * @param sync Whether to try to synchronize data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateAndRefresh(sync = false): Promise { this.loaded = false; @@ -494,7 +496,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can * Load the data to render the submission. * * @param sync Whether to try to synchronize data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadData(sync = false): Promise { let isBlind = !!this.blindId; @@ -595,7 +597,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Load profile of submission's user. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSubmissionUserProfile(): Promise { this.user = await CoreUser.getProfile(this.submitId, this.courseId); @@ -604,7 +606,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Load offline data for the submission (not the submission grade). * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSubmissionOfflineData(): Promise { if (!this.assign) { @@ -629,7 +631,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can * * @param assign Assign data. * @param feedback The feedback data from the submission status. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadFeedback(assign: AddonModAssignAssign, feedback?: AddonModAssignSubmissionFeedback): Promise { this.grade = { @@ -777,7 +779,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Get the submission plugins that don't support editing. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadUnsupportedPlugins(): Promise { this.unsupportedEditPlugins = await AddonModAssign.getUnsupportedEditPlugins(this.userSubmission?.plugins || []); @@ -901,7 +903,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Submit a grade and feedback. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async submitGrade(): Promise { // Check if there's something to be saved. @@ -973,7 +975,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can /** * Treat the grade info. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async treatGradeInfo(): Promise { if (!this.gradeInfo) { @@ -1074,7 +1076,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can * * @param submissionStatus Response of get submission status. * @param lastAttempt Last attempt (if any). - * @param promises List where to add the promises. + * @returns Promises resolved when done. */ protected treatLastAttempt( submissionStatus: AddonModAssignGetSubmissionStatusWSResponse, @@ -1208,7 +1210,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.setGradeSyncBlocked(false); diff --git a/src/addons/mod/assign/feedback/comments/component/comments.ts b/src/addons/mod/assign/feedback/comments/component/comments.ts index 12cfc7579..6271598e2 100644 --- a/src/addons/mod/assign/feedback/comments/component/comments.ts +++ b/src/addons/mod/assign/feedback/comments/component/comments.ts @@ -51,7 +51,7 @@ export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedb } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -106,7 +106,7 @@ export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedb /** * Get the text for the plugin. * - * @return Promise resolved with the text. + * @returns Promise resolved with the text. */ protected async getText(): Promise { // Check if the user already modified the comment. @@ -149,8 +149,8 @@ export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedb /** * Replace @@PLUGINFILE@@ wildcards with the real URL of embedded files. * - * @param Text to treat. - * @return Treated text. + * @param text Text to treat. + * @returns Treated text. */ replacePluginfileUrls(text: string): string { const files = this.plugin.fileareas && this.plugin.fileareas[0] && this.plugin.fileareas[0].files; diff --git a/src/addons/mod/assign/feedback/comments/services/handler.ts b/src/addons/mod/assign/feedback/comments/services/handler.ts index 87de1ee89..803865630 100644 --- a/src/addons/mod/assign/feedback/comments/services/handler.ts +++ b/src/addons/mod/assign/feedback/comments/services/handler.ts @@ -45,10 +45,9 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss /** * Get the text to submit. * - * @param textUtils Text utils instance. * @param plugin Plugin. * @param inputData Data entered in the feedback edit form. - * @return Text to submit. + * @returns Text to submit. */ getTextFromInputData(plugin: AddonModAssignPlugin, inputData: AddonModAssignFeedbackCommentsTextData): string | undefined { if (inputData.assignfeedbackcomments_editor === undefined) { @@ -66,7 +65,6 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. */ discardDraft(assignId: number, userId: number, siteId?: string): void { const id = this.getDraftId(assignId, userId, siteId); @@ -79,7 +77,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type { return AddonModAssignFeedbackCommentsComponent; @@ -91,7 +89,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Data (or promise resolved with the data). + * @returns Data (or promise resolved with the data). */ getDraft(assignId: number, userId: number, siteId?: string): AddonModAssignFeedbackCommentsDraftData | undefined { const id = this.getDraftId(assignId, userId, siteId); @@ -107,7 +105,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Draft ID. + * @returns Draft ID. */ protected getDraftId(assignId: number, userId: number, siteId?: string): string { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -122,7 +120,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles( assign: AddonModAssignAssign, @@ -140,7 +138,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param plugin The plugin object. * @param inputData Data entered by the user for the feedback. * @param userId User ID of the submission. - * @return Boolean (or promise resolved with boolean): whether the data has changed. + * @returns Boolean (or promise resolved with boolean): whether the data has changed. */ async hasDataChanged( assign: AddonModAssignAssign, @@ -179,7 +177,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Boolean or promise resolved with boolean: whether the plugin has draft data. + * @returns Boolean or promise resolved with boolean: whether the plugin has draft data. */ hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise { const draft = this.getDraft(assignId, userId, siteId); @@ -190,7 +188,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { // In here we should check if comments is not disabled in site. @@ -207,7 +205,6 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param plugin The plugin object. * @param pluginData Object where to store the data to send. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. */ prepareFeedbackData( assignId: number, @@ -235,7 +232,6 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss * @param plugin The plugin object. * @param data The data to save. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. */ saveDraft( assignId: number, diff --git a/src/addons/mod/assign/feedback/editpdf/component/editpdf.ts b/src/addons/mod/assign/feedback/editpdf/component/editpdf.ts index fc499adfb..0b4fc30fe 100644 --- a/src/addons/mod/assign/feedback/editpdf/component/editpdf.ts +++ b/src/addons/mod/assign/feedback/editpdf/component/editpdf.ts @@ -30,7 +30,7 @@ export class AddonModAssignFeedbackEditPdfComponent extends AddonModAssignFeedba files: CoreWSFile[] = []; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (this.plugin) { diff --git a/src/addons/mod/assign/feedback/editpdf/services/handler.ts b/src/addons/mod/assign/feedback/editpdf/services/handler.ts index 10b33eba3..17d871a96 100644 --- a/src/addons/mod/assign/feedback/editpdf/services/handler.ts +++ b/src/addons/mod/assign/feedback/editpdf/services/handler.ts @@ -38,7 +38,7 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type { return AddonModAssignFeedbackEditPdfComponent; @@ -51,7 +51,7 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles( assign: AddonModAssignAssign, @@ -64,7 +64,7 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/assign/feedback/file/component/file.ts b/src/addons/mod/assign/feedback/file/component/file.ts index 24a7c5793..2d85f5415 100644 --- a/src/addons/mod/assign/feedback/file/component/file.ts +++ b/src/addons/mod/assign/feedback/file/component/file.ts @@ -30,7 +30,7 @@ export class AddonModAssignFeedbackFileComponent extends AddonModAssignFeedbackP files: CoreWSFile[] = []; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (this.plugin) { diff --git a/src/addons/mod/assign/feedback/file/services/handler.ts b/src/addons/mod/assign/feedback/file/services/handler.ts index b652cd350..3fac9b626 100644 --- a/src/addons/mod/assign/feedback/file/services/handler.ts +++ b/src/addons/mod/assign/feedback/file/services/handler.ts @@ -38,7 +38,7 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type { return AddonModAssignFeedbackFileComponent; @@ -51,7 +51,7 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles( assign: AddonModAssignAssign, @@ -64,7 +64,7 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/assign/pages/edit/edit.html b/src/addons/mod/assign/pages/edit/edit.html index c1675bdb5..b138f8712 100644 --- a/src/addons/mod/assign/pages/edit/edit.html +++ b/src/addons/mod/assign/pages/edit/edit.html @@ -19,7 +19,7 @@ - + diff --git a/src/addons/mod/assign/pages/edit/edit.ts b/src/addons/mod/assign/pages/edit/edit.ts index 4233d4137..634d79773 100644 --- a/src/addons/mod/assign/pages/edit/edit.ts +++ b/src/addons/mod/assign/pages/edit/edit.ts @@ -84,7 +84,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -107,7 +107,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.forceLeave) { @@ -131,7 +131,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { /** * Fetch assignment data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAssignment(): Promise { const currentUserId = CoreSites.getCurrentSiteUserId(); @@ -239,7 +239,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { * * @param submissionStatus Current submission status. * @param options Options. - * @return Promise resolved with the new submission status if it changed, original submission status otherwise. + * @returns Promise resolved with the new submission status if it changed, original submission status otherwise. */ protected async startSubmissionIfNeeded( submissionStatus: AddonModAssignGetSubmissionStatusWSResponse, @@ -276,7 +276,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { /** * Get the input data. * - * @return Input data. + * @returns Input data. */ protected getInputData(): CoreFormFields { return CoreForms.getDataFromForm(document.forms['addon-mod_assign-edit-form']); @@ -285,7 +285,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { /** * Check if data has changed. * - * @return Promise resolved with boolean: whether data has changed. + * @returns Promise resolved with boolean: whether data has changed. */ protected async hasDataChanged(): Promise { // Usually the hasSubmissionDataChanged call will be resolved inmediately, causing the modal to be shown just an instant. @@ -311,7 +311,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { * Get data to submit based on the input data. * * @param inputData The input data. - * @return Promise resolved with the data to submit. + * @returns Promise resolved with the data to submit. */ protected async prepareSubmissionData(inputData: CoreFormFields): Promise { // If there's offline data, always save it in offline. @@ -364,7 +364,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { /** * Save the submission. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async saveSubmission(): Promise { const inputData = this.getInputData(); @@ -474,7 +474,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy, CanLeave { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.isDestroyed = true; diff --git a/src/addons/mod/assign/pages/submission-list/submission-list.page.ts b/src/addons/mod/assign/pages/submission-list/submission-list.page.ts index 9ac31e50e..1670f1dec 100644 --- a/src/addons/mod/assign/pages/submission-list/submission-list.page.ts +++ b/src/addons/mod/assign/pages/submission-list/submission-list.page.ts @@ -163,7 +163,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro * Fetch assignment data. * * @param sync Whether to try to synchronize data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAssignment(sync = false): Promise { try { @@ -177,7 +177,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro * Refresh all the data. * * @param sync Whether to try to synchronize data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshAllData(sync?: boolean): Promise { try { @@ -206,7 +206,7 @@ export class AddonModAssignSubmissionListPage implements AfterViewInit, OnDestro } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.gradedObserver?.off(); diff --git a/src/addons/mod/assign/pages/submission-review/submission-review.ts b/src/addons/mod/assign/pages/submission-review/submission-review.ts index f722bdef6..847d3502d 100644 --- a/src/addons/mod/assign/pages/submission-review/submission-review.ts +++ b/src/addons/mod/assign/pages/submission-review/submission-review.ts @@ -99,7 +99,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (!this.submissionComponent || this.forceLeave) { @@ -127,7 +127,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca /** * Get the submission. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchSubmission(): Promise { this.assign = await AddonModAssign.getAssignment(this.courseId, this.moduleId); @@ -154,7 +154,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit, OnDestroy, Ca /** * Refresh all the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshAllData(): Promise { const promises: Promise[] = []; diff --git a/src/addons/mod/assign/services/assign-helper.ts b/src/addons/mod/assign/services/assign-helper.ts index 01e48419b..36691cf68 100644 --- a/src/addons/mod/assign/services/assign-helper.ts +++ b/src/addons/mod/assign/services/assign-helper.ts @@ -49,7 +49,7 @@ export class AddonModAssignHelperProvider { * * @param assign Assign instance. * @param submission Submission. - * @return End time. + * @returns End time. */ calculateEndTime(assign: AddonModAssignAssign, submission?: AddonModAssignSubmissionFormatted): number { const timeDue = (submission?.timestarted || 0) + (assign.timelimit || 0); @@ -68,7 +68,7 @@ export class AddonModAssignHelperProvider { * * @param assign Assignment. * @param submission Submission. - * @return Whether it can be edited offline. + * @returns Whether it can be edited offline. */ async canEditSubmissionOffline(assign: AddonModAssignAssign, submission?: AddonModAssignSubmission): Promise { if (!submission) { @@ -126,7 +126,7 @@ export class AddonModAssignHelperProvider { * * @param assign Assignment. * @param previousSubmission Submission to copy. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async copyPreviousAttempt(assign: AddonModAssignAssign, previousSubmission: AddonModAssignSubmission): Promise { const pluginData: AddonModAssignSavePluginData = {}; @@ -147,7 +147,7 @@ export class AddonModAssignHelperProvider { /** * Create an empty feedback object. * - * @return Feedback. + * @returns Feedback. */ createEmptyFeedback(): AddonModAssignSubmissionFeedback { return { @@ -160,7 +160,7 @@ export class AddonModAssignHelperProvider { /** * Create an empty submission object. * - * @return Submission. + * @returns Submission. */ createEmptySubmission(): AddonModAssignSubmissionFormatted { return { @@ -181,7 +181,7 @@ export class AddonModAssignHelperProvider { * @param folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteStoredSubmissionFiles(assignId: number, folderName: string, userId?: number, siteId?: string): Promise { const folderPath = await AddonModAssignOffline.getSubmissionPluginFolder(assignId, folderName, userId, siteId); @@ -196,7 +196,7 @@ export class AddonModAssignHelperProvider { * @param userId User Id. * @param feedback Feedback data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async discardFeedbackPluginData( assignId: number, @@ -218,7 +218,7 @@ export class AddonModAssignHelperProvider { * * @param assign Assignment object. * @param submission Submission to inspect. - * @return Whether the submission is empty. + * @returns Whether the submission is empty. */ isSubmissionEmpty(assign: AddonModAssignAssign, submission?: AddonModAssignSubmission): boolean { if (!submission) { @@ -243,7 +243,7 @@ export class AddonModAssignHelperProvider { * @param assign Assignment object. * @param groupId Group Id. * @param options Other options. - * @return Promise resolved with the list of participants and summary of submissions. + * @returns Promise resolved with the list of participants and summary of submissions. */ async getParticipants( assign: AddonModAssignAssign, @@ -291,7 +291,7 @@ export class AddonModAssignHelperProvider { * @param assign Assignment object including all config. * @param subtype Subtype name (assignsubmission or assignfeedback) * @param type Name of the subplugin. - * @return Object containing all configurations of the subplugin selected. + * @returns Object containing all configurations of the subplugin selected. */ getPluginConfig(assign: AddonModAssignAssign, subtype: string, type: string): AddonModAssignPluginConfig { const configs: AddonModAssignPluginConfig = {}; @@ -310,7 +310,7 @@ export class AddonModAssignHelperProvider { * * @param assign Assignment object including all config. * @param subtype Subtype name (assignsubmission or assignfeedback) - * @return List of enabled plugins for the assign. + * @returns List of enabled plugins for the assign. */ getPluginsEnabled(assign: AddonModAssignAssign, subtype: string): AddonModAssignPlugin[] { const enabled: AddonModAssignPlugin[] = []; @@ -335,7 +335,7 @@ export class AddonModAssignHelperProvider { * @param folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getStoredSubmissionFiles( assignId: number, @@ -353,7 +353,7 @@ export class AddonModAssignHelperProvider { * * @param assign Assignment. * @param previousSubmission Submission to copy. - * @return Promise resolved with the size. + * @returns Promise resolved with the size. */ async getSubmissionSizeForCopy(assign: AddonModAssignAssign, previousSubmission: AddonModAssignSubmission): Promise { let totalSize = 0; @@ -378,7 +378,7 @@ export class AddonModAssignHelperProvider { * @param assign Assignment. * @param submission Submission to check data. * @param inputData Data entered in the submission form. - * @return Promise resolved with the size. + * @returns Promise resolved with the size. */ async getSubmissionSizeForEdit( assign: AddonModAssignAssign, @@ -410,7 +410,7 @@ export class AddonModAssignHelperProvider { * @param submissions Submissions to get the data for. * @param groupId Group Id. * @param options Other options. - * @return Promise always resolved. Resolve param is the formatted submissions. + * @returns Promise always resolved. Resolve param is the formatted submissions. */ async getSubmissionsUserData( assign: AddonModAssignAssign, @@ -483,7 +483,7 @@ export class AddonModAssignHelperProvider { * @param submission The submission. * @param feedback Feedback data. * @param userId The user ID. - * @return Promise resolved with true if data has changed, resolved with false otherwise. + * @returns Promise resolved with true if data has changed, resolved with false otherwise. */ async hasFeedbackDataChanged( assign: AddonModAssignAssign, @@ -521,7 +521,7 @@ export class AddonModAssignHelperProvider { * @param assign Assignment. * @param submission Submission to check data. * @param inputData Data entered in the submission form. - * @return Promise resolved with true if data has changed, resolved with false otherwise. + * @returns Promise resolved with true if data has changed, resolved with false otherwise. */ async hasSubmissionDataChanged( assign: AddonModAssignAssign, @@ -560,7 +560,7 @@ export class AddonModAssignHelperProvider { * @param userId User Id. * @param feedback Feedback data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with plugin data to send to server. + * @returns Promise resolved with plugin data to send to server. */ async prepareFeedbackPluginData( assignId: number, @@ -587,7 +587,7 @@ export class AddonModAssignHelperProvider { * @param submission Submission to check data. * @param inputData Data entered in the submission form. * @param offline True to prepare the data for an offline submission, false otherwise. - * @return Promise resolved with plugin data to send to server. + * @returns Promise resolved with plugin data to send to server. */ async prepareSubmissionPluginData( assign: AddonModAssignAssign, @@ -625,7 +625,7 @@ export class AddonModAssignHelperProvider { * @param files List of files. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeSubmissionFiles( assignId: number, @@ -647,7 +647,7 @@ export class AddonModAssignHelperProvider { * @param file Online file or local FileEntry. * @param itemId Draft ID to use. Undefined or 0 to create a new draft ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the itemId. + * @returns Promise resolved with the itemId. */ uploadFile(assignId: number, file: CoreFileEntry, itemId?: number, siteId?: string): Promise { return CoreFileUploader.uploadOrReuploadFile(file, itemId, AddonModAssignProvider.COMPONENT, assignId, siteId); @@ -661,7 +661,7 @@ export class AddonModAssignHelperProvider { * @param assignId Assignment ID. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the itemId. + * @returns Promise resolved with the itemId. */ uploadFiles(assignId: number, files: CoreFileEntry[], siteId?: string): Promise { return CoreFileUploader.uploadOrReuploadFiles(files, AddonModAssignProvider.COMPONENT, assignId, siteId); @@ -676,7 +676,7 @@ export class AddonModAssignHelperProvider { * @param offline True if files sould be stored for offline, false to upload them. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async uploadOrStoreFiles( assignId: number, diff --git a/src/addons/mod/assign/services/assign-offline.ts b/src/addons/mod/assign/services/assign-offline.ts index 36946ebbd..e275a489b 100644 --- a/src/addons/mod/assign/services/assign-offline.ts +++ b/src/addons/mod/assign/services/assign-offline.ts @@ -41,7 +41,7 @@ export class AddonModAssignOfflineProvider { * @param assignId Assignment ID. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteSubmission(assignId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -59,7 +59,7 @@ export class AddonModAssignOfflineProvider { * @param assignId Assignment ID. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteSubmissionGrade(assignId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -75,7 +75,7 @@ export class AddonModAssignOfflineProvider { * Get all the assignments ids that have something to be synced. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with assignments id that have something to be synced. + * @returns Promise resolved with assignments id that have something to be synced. */ async getAllAssigns(siteId?: string): Promise { const promises: @@ -101,7 +101,7 @@ export class AddonModAssignOfflineProvider { * Get all the stored submissions from all the assignments. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submissions. + * @returns Promise resolved with submissions. */ protected async getAllSubmissions(siteId?: string): Promise { return this.getAssignSubmissionsFormatted(undefined, siteId); @@ -112,7 +112,7 @@ export class AddonModAssignOfflineProvider { * * @param assignId Assignment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submissions. + * @returns Promise resolved with submissions. */ async getAssignSubmissions(assignId: number, siteId?: string): Promise { return this.getAssignSubmissionsFormatted({ assignid: assignId }, siteId); @@ -123,7 +123,7 @@ export class AddonModAssignOfflineProvider { * * @param conditions Query conditions. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submissions. + * @returns Promise resolved with submissions. */ protected async getAssignSubmissionsFormatted( conditions: SQLiteDBRecordValues = {}, @@ -151,7 +151,7 @@ export class AddonModAssignOfflineProvider { * Get all the stored submissions grades from all the assignments. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submissions grades. + * @returns Promise resolved with submissions grades. */ protected async getAllSubmissionsGrade(siteId?: string): Promise { return this.getAssignSubmissionsGradeFormatted(undefined, siteId); @@ -162,7 +162,7 @@ export class AddonModAssignOfflineProvider { * * @param assignId Assignment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submissions grades. + * @returns Promise resolved with submissions grades. */ async getAssignSubmissionsGrade( assignId: number, @@ -176,7 +176,7 @@ export class AddonModAssignOfflineProvider { * * @param conditions Query conditions. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submissions grades. + * @returns Promise resolved with submissions grades. */ protected async getAssignSubmissionsGradeFormatted( conditions: SQLiteDBRecordValues = {}, @@ -208,7 +208,7 @@ export class AddonModAssignOfflineProvider { * @param assignId Assignment ID. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submission. + * @returns Promise resolved with submission. */ async getSubmission(assignId: number, userId?: number, siteId?: string): Promise { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -228,7 +228,7 @@ export class AddonModAssignOfflineProvider { * @param assignId Assignment ID. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getSubmissionFolder(assignId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -247,7 +247,7 @@ export class AddonModAssignOfflineProvider { * @param assignId Assignment ID. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submission grade. + * @returns Promise resolved with submission grade. */ async getSubmissionGrade( assignId: number, @@ -272,7 +272,7 @@ export class AddonModAssignOfflineProvider { * @param pluginName Name of the plugin. Must be unique (both in submission and feedback plugins). * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getSubmissionPluginFolder(assignId: number, pluginName: string, userId?: number, siteId?: string): Promise { const folderPath = await this.getSubmissionFolder(assignId, userId, siteId); @@ -285,7 +285,7 @@ export class AddonModAssignOfflineProvider { * * @param assignId Assignment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether the assignment has something to be synced. + * @returns Promise resolved with boolean: whether the assignment has something to be synced. */ async hasAssignOfflineData(assignId: number, siteId?: string): Promise { const promises: @@ -314,7 +314,7 @@ export class AddonModAssignOfflineProvider { * @param timemodified The time the submission was last modified in online. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if marked, rejected if failure. + * @returns Promise resolved if marked, rejected if failure. */ async markSubmitted( assignId: number, @@ -366,7 +366,7 @@ export class AddonModAssignOfflineProvider { * @param submitted True if submission has been submitted, false otherwise. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveSubmission( assignId: number, @@ -410,7 +410,7 @@ export class AddonModAssignOfflineProvider { * @param outcomes Object including all outcomes values. If empty, any of them will be sent. * @param pluginData Plugin data to save. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async submitGradingForm( assignId: number, diff --git a/src/addons/mod/assign/services/assign-sync.ts b/src/addons/mod/assign/services/assign-sync.ts index ee3e7e3d5..3a04878b1 100644 --- a/src/addons/mod/assign/services/assign-sync.ts +++ b/src/addons/mod/assign/services/assign-sync.ts @@ -61,7 +61,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param userId User the grade belongs to. - * @return Sync ID. + * @returns Sync ID. */ getGradeSyncId(assignId: number, userId: number): string { return 'assignGrade#' + assignId + '#' + userId; @@ -72,7 +72,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param options Possible options. * @param selected Selected option to search. - * @return Index of the selected option. + * @returns Index of the selected option. */ protected getSelectedScaleId(options: string, selected: string): number { let optionsList = options.split(','); @@ -94,7 +94,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it has data to sync. + * @returns Promise resolved with boolean: whether it has data to sync. */ hasDataToSync(assignId: number, siteId?: string): Promise { return AddonModAssignOffline.hasAssignOfflineData(assignId, siteId); @@ -105,7 +105,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllAssignments(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all assignments', (siteId) => this.syncAllAssignmentsFunc(!!force, siteId), siteId); @@ -116,7 +116,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. If not defined, sync all sites. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllAssignmentsFunc(force: boolean, siteId: string): Promise { // Get all assignments that have offline data. @@ -143,7 +143,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the assign is synced or it doesn't need to be synced. + * @returns Promise resolved when the assign is synced or it doesn't need to be synced. */ async syncAssignIfNeeded(assignId: number, siteId?: string): Promise { const needed = await this.isSyncNeeded(assignId, siteId); @@ -158,7 +158,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ async syncAssign(assignId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -188,7 +188,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param siteId Site ID. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ protected async performSyncAssign(assignId: number, siteId: string): Promise { // Sync offline logs. @@ -268,7 +268,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param siteId Site ID. If not defined, current site. - * @return Promise with grades. + * @returns Promise with grades. */ protected async getOfflineGrades( assignId: number, @@ -283,7 +283,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param assignId Assign ID. * @param siteId Site ID. If not defined, current site. - * @return Promise with submissions. + * @returns Promise with submissions. */ protected async getOfflineSubmissions( assignId: number, @@ -300,7 +300,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * @param offlineData Submission offline data. * @param warnings List of warnings. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ protected async syncSubmission( assign: AddonModAssignAssign, @@ -377,10 +377,10 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * Delete the submission offline data (not grades). * * @param assign Assign. - * @param submission Submission. * @param offlineData Offline data. + * @param submission Submission. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async deleteSubmissionData( assign: AddonModAssignAssign, @@ -413,7 +413,7 @@ export class AddonModAssignSyncProvider extends CoreCourseActivitySyncBaseProvid * @param warnings List of warnings. * @param courseId Course Id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ protected async syncSubmissionGrade( assign: AddonModAssignAssign, diff --git a/src/addons/mod/assign/services/assign.ts b/src/addons/mod/assign/services/assign.ts index 0bb3f8bac..09f6281dd 100644 --- a/src/addons/mod/assign/services/assign.ts +++ b/src/addons/mod/assign/services/assign.ts @@ -83,7 +83,7 @@ export class AddonModAssignProvider { * * @param assign Assignment instance. * @param submissionStatus Submission status returned by getSubmissionStatus. - * @return Whether it can submit. + * @returns Whether it can submit. */ canSubmitOffline(assign: AddonModAssignAssign, submissionStatus: AddonModAssignGetSubmissionStatusWSResponse): boolean { if (!this.isSubmissionOpen(assign, submissionStatus)) { @@ -124,7 +124,7 @@ export class AddonModAssignProvider { * @param userId User Id (empty for current user). * @param groupId Group Id (empty for all participants). * @param isBlind If blind marking is enabled or not. - * @return Object with fixed params. + * @returns Object with fixed params. */ protected fixSubmissionStatusParams( site: CoreSite, @@ -146,7 +146,7 @@ export class AddonModAssignProvider { * @param courseId Course ID the assignment belongs to. * @param cmId Assignment module ID. * @param options Other options. - * @return Promise resolved with the assignment. + * @returns Promise resolved with the assignment. */ getAssignment(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getAssignmentByField(courseId, 'cmid', cmId, options); @@ -159,7 +159,7 @@ export class AddonModAssignProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the assignment is retrieved. + * @returns Promise resolved when the assignment is retrieved. */ protected async getAssignmentByField( courseId: number, @@ -211,7 +211,7 @@ export class AddonModAssignProvider { * @param courseId Course ID the assignment belongs to. * @param id Assignment instance ID. * @param options Other options. - * @return Promise resolved with the assignment. + * @returns Promise resolved with the assignment. */ getAssignmentById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getAssignmentByField(courseId, 'id', id, options); @@ -221,7 +221,7 @@ export class AddonModAssignProvider { * Get cache key for assignment data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getAssignmentCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'assignment:' + courseId; @@ -233,7 +233,7 @@ export class AddonModAssignProvider { * @param assignId Assignment Id. * @param userId User Id to be blinded. * @param options Other options. - * @return Promise resolved with the user blind id. + * @returns Promise resolved with the user blind id. */ async getAssignmentUserMappings(assignId: number, userId: number, options: CoreCourseCommonModWSOptions = {}): Promise { if (!userId || userId < 0) { @@ -274,7 +274,7 @@ export class AddonModAssignProvider { * Get cache key for assignment user mappings data WS calls. * * @param assignId Assignment ID. - * @return Cache key. + * @returns Cache key. */ protected getAssignmentUserMappingsCacheKey(assignId: number): string { return ROOT_CACHE_KEY + 'usermappings:' + assignId; @@ -285,7 +285,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment Id. * @param options Other options. - * @return Resolved with requested info when done. + * @returns Resolved with requested info when done. */ async getAssignmentGrades(assignId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -321,7 +321,7 @@ export class AddonModAssignProvider { * Get cache key for assignment grades data WS calls. * * @param assignId Assignment ID. - * @return Cache key. + * @returns Cache key. */ protected getAssignmentGradesCacheKey(assignId: number): string { return ROOT_CACHE_KEY + 'assigngrades:' + assignId; @@ -331,7 +331,7 @@ export class AddonModAssignProvider { * Returns the color name for a given grading status name. * * @param status Grading status name - * @return The color name. + * @returns The color name. */ getSubmissionGradingStatusColor(status?: AddonModAssignGradingStates): CoreIonicColorNames { if (!status) { @@ -350,7 +350,7 @@ export class AddonModAssignProvider { * Returns the translation id for a given grading status name. * * @param status Grading Status name - * @return The status translation identifier. + * @returns The status translation identifier. */ getSubmissionGradingStatusTranslationId(status?: AddonModAssignGradingStates): string | undefined { if (!status) { @@ -371,7 +371,7 @@ export class AddonModAssignProvider { * * @param assign Assign. * @param attempt Attempt. - * @return Submission object or null. + * @returns Submission object or null. */ getSubmissionObjectFromAttempt( assign: AddonModAssignAssign, @@ -388,7 +388,7 @@ export class AddonModAssignProvider { * Get attachments of a submission plugin. * * @param submissionPlugin Submission plugin. - * @return Submission plugin attachments. + * @returns Submission plugin attachments. */ getSubmissionPluginAttachments(submissionPlugin: AddonModAssignPlugin): CoreWSFile[] { if (!submissionPlugin.fileareas) { @@ -421,7 +421,7 @@ export class AddonModAssignProvider { * * @param submissionPlugin Submission plugin. * @param keepUrls True if it should keep original URLs, false if they should be replaced. - * @return Submission text. + * @returns Submission text. */ getSubmissionPluginText(submissionPlugin: AddonModAssignPlugin, keepUrls = false): string { if (!submissionPlugin.editorfields) { @@ -445,7 +445,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment id. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async getSubmissions( assignId: number, @@ -484,7 +484,7 @@ export class AddonModAssignProvider { * Get cache key for assignment submissions data WS calls. * * @param assignId Assignment id. - * @return Cache key. + * @returns Cache key. */ protected getSubmissionsCacheKey(assignId: number): string { return ROOT_CACHE_KEY + 'submissions:' + assignId; @@ -495,7 +495,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment instance id. * @param options Other options. - * @return Promise always resolved with the user submission status. + * @returns Promise always resolved with the user submission status. */ async getSubmissionStatus( assignId: number, @@ -544,7 +544,7 @@ export class AddonModAssignProvider { * * @param assign Assignment. * @param options Other options. - * @return Promise always resolved with the user submission status. + * @returns Promise always resolved with the user submission status. */ async getSubmissionStatusWithRetry( assign: AddonModAssignAssign, @@ -579,7 +579,7 @@ export class AddonModAssignProvider { * @param userId User id (empty for current user). * @param groupId Group Id (empty for all participants). * @param isBlind If blind marking is enabled or not. - * @return Cache key. + * @returns Cache key. */ protected getSubmissionStatusCacheKey(assignId: number, userId: number, groupId?: number, isBlind = false): string { return this.getSubmissionsCacheKey(assignId) + ':' + userId + ':' + (isBlind ? 1 : 0) + ':' + groupId; @@ -589,7 +589,7 @@ export class AddonModAssignProvider { * Returns the color name for a given status name. * * @param status Status name - * @return The color name. + * @returns The color name. */ getSubmissionStatusColor(status: AddonModAssignSubmissionStatusValues): CoreIonicColorNames { switch (status) { @@ -612,7 +612,7 @@ export class AddonModAssignProvider { * Given a list of plugins, returns the plugin names that aren't supported for editing. * * @param plugins Plugins to check. - * @return Promise resolved with unsupported plugin names. + * @returns Promise resolved with unsupported plugin names. */ async getUnsupportedEditPlugins(plugins: AddonModAssignPlugin[]): Promise { const notSupported: string[] = []; @@ -636,7 +636,7 @@ export class AddonModAssignProvider { * @param assignId Assignment id. * @param groupId Group id. If not defined, 0. * @param options Other options. - * @return Promise resolved with the list of participants and summary of submissions. + * @returns Promise resolved with the list of participants and summary of submissions. */ async listParticipants( assignId: number, @@ -670,7 +670,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment id. * @param groupId Group id. - * @return Cache key. + * @returns Cache key. */ protected listParticipantsCacheKey(assignId: number, groupId: number): string { return this.listParticipantsPrefixCacheKey(assignId) + ':' + groupId; @@ -680,7 +680,7 @@ export class AddonModAssignProvider { * Get prefix cache key for assignment list participants data WS calls. * * @param assignId Assignment id. - * @return Cache key. + * @returns Cache key. */ protected listParticipantsPrefixCacheKey(assignId: number): string { return ROOT_CACHE_KEY + 'participants:' + assignId; @@ -691,7 +691,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment instance id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllSubmissionData(assignId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -704,7 +704,7 @@ export class AddonModAssignProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAssignmentData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -717,7 +717,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAssignmentUserMappingsData(assignId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -730,7 +730,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAssignmentGradesData(assignId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -744,7 +744,7 @@ export class AddonModAssignProvider { * @param moduleId The module ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -768,7 +768,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment instance id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubmissionData(assignId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -784,7 +784,7 @@ export class AddonModAssignProvider { * @param groupId Group Id (empty for all participants). * @param isBlind Whether blind marking is enabled or not. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubmissionStatusData( assignId: number, @@ -809,7 +809,7 @@ export class AddonModAssignProvider { * * @param assignId Assignment instance id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateListParticipantsData(assignId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -822,7 +822,7 @@ export class AddonModAssignProvider { * * @param assign Assignment instance. * @param submissionStatus Submission status returned by getSubmissionStatus. - * @return Whether submission is open. + * @returns Whether submission is open. */ isSubmissionOpen(assign: AddonModAssignAssign, submissionStatus?: AddonModAssignGetSubmissionStatusWSResponse): boolean { if (!assign || !submissionStatus) { @@ -880,7 +880,7 @@ export class AddonModAssignProvider { * @param assignid Assignment ID. * @param name Name of the assign. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logSubmissionView(assignid: number, name?: string, siteId?: string): Promise { const params: AddonModAssignViewSubmissionStatusWSParams = { @@ -905,7 +905,7 @@ export class AddonModAssignProvider { * @param assignid Assignment ID. * @param name Name of the assign. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logGradingView(assignid: number, name?: string, siteId?: string): Promise { const params: AddonModAssignViewGradingTableWSParams = { @@ -930,7 +930,7 @@ export class AddonModAssignProvider { * @param assignid Assignment ID. * @param name Name of the assign. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(assignid: number, name?: string, siteId?: string): Promise { const params: AddonModAssignViewAssignWSParams = { @@ -954,7 +954,7 @@ export class AddonModAssignProvider { * * @param submission Submission. * @param assignId Assignment ID. - * @return Promise resolved with boolean: whether it needs to be graded or not. + * @returns Promise resolved with boolean: whether it needs to be graded or not. */ async needsSubmissionToBeGraded(submission: AddonModAssignSubmissionFormatted, assignId: number): Promise { if (submission.status != AddonModAssignSubmissionStatusValues.SUBMITTED) { @@ -997,7 +997,7 @@ export class AddonModAssignProvider { * @param allowsDrafts Whether the assignment allows submission drafts. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if sent to server, resolved with false if stored in offline. + * @returns Promise resolved with true if sent to server, resolved with false if stored in offline. */ async saveSubmission( assignId: number, @@ -1055,7 +1055,7 @@ export class AddonModAssignProvider { * @param assignId Assign ID. * @param pluginData Data to save. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when saved, rejected otherwise. + * @returns Promise resolved when saved, rejected otherwise. */ async saveSubmissionOnline(assignId: number, pluginData: AddonModAssignSavePluginData, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1076,7 +1076,7 @@ export class AddonModAssignProvider { * * @param assignId Assign ID. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async startSubmission(assignId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1109,7 +1109,7 @@ export class AddonModAssignProvider { * @param timemodified The time the submission was last modified in online. * @param forceOffline True to always mark it in offline. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if sent to server, resolved with false if stored in offline. + * @returns Promise resolved with true if sent to server, resolved with false if stored in offline. */ async submitForGrading( assignId: number, @@ -1165,7 +1165,7 @@ export class AddonModAssignProvider { * @param assignId Assign ID. * @param acceptStatement True if submission statement is accepted, false otherwise. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when submitted, rejected otherwise. + * @returns Promise resolved when submitted, rejected otherwise. */ async submitForGradingOnline(assignId: number, acceptStatement: boolean, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1197,7 +1197,7 @@ export class AddonModAssignProvider { * @param outcomes Object including all outcomes values. If empty, any of them will be sent. * @param pluginData Feedback plugin data to save. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if sent to server, resolved with false if stored offline. + * @returns Promise resolved with true if sent to server, resolved with false if stored offline. */ async submitGradingForm( assignId: number, @@ -1281,7 +1281,7 @@ export class AddonModAssignProvider { * @param outcomes Object including all outcomes values. If empty, any of them will be sent. * @param pluginData Feedback plugin data to save. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when submitted, rejected otherwise. + * @returns Promise resolved when submitted, rejected otherwise. */ async submitGradingFormOnline( assignId: number, diff --git a/src/addons/mod/assign/services/feedback-delegate.ts b/src/addons/mod/assign/services/feedback-delegate.ts index 253b7c53d..0197c7bce 100644 --- a/src/addons/mod/assign/services/feedback-delegate.ts +++ b/src/addons/mod/assign/services/feedback-delegate.ts @@ -38,7 +38,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ discardDraft?(assignId: number, userId: number, siteId?: string): void | Promise; @@ -47,7 +47,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param plugin The plugin object. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent?(plugin: AddonModAssignPlugin): Type | undefined @@ -59,7 +59,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Data (or promise resolved with the data). + * @returns Data (or promise resolved with the data). */ getDraft?( assignId: number, @@ -75,7 +75,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param submission The submission. * @param plugin The plugin object. * @param siteId Site ID. If not defined, current site. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles?( assign: AddonModAssignAssign, @@ -88,7 +88,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * Get a readable name to use for the plugin. * * @param plugin The plugin object. - * @return The plugin name. + * @returns The plugin name. */ getPluginName?(plugin: AddonModAssignPlugin): string; @@ -100,7 +100,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param plugin The plugin object. * @param inputData Data entered by the user for the feedback. * @param userId User ID of the submission. - * @return Boolean (or promise resolved with boolean): whether the data has changed. + * @returns Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged?( assign: AddonModAssignAssign, @@ -116,7 +116,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param assignId The assignment ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Boolean or promise resolved with boolean: whether the plugin has draft data. + * @returns Boolean or promise resolved with boolean: whether the plugin has draft data. */ hasDraftData?(assignId: number, userId: number, siteId?: string): boolean | Promise; @@ -128,7 +128,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param submission The submission. * @param plugin The plugin object. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch?( assign: AddonModAssignAssign, @@ -145,7 +145,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param plugin The plugin object. * @param pluginData Object where to store the data to send. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ prepareFeedbackData?( assignId: number, @@ -163,7 +163,7 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * @param plugin The plugin object. * @param data The data to save. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ saveDraft?( assignId: number, @@ -195,7 +195,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate( assignId: number, @@ -244,7 +244,7 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate { return true; } /** - * Prefetch any required data for the plugin. - * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. - * - * @return Promise resolved when done. + * @inheritdoc */ async prefetch(): Promise { return; } /** - * Prepare and add to pluginData the data to send to the server based on the draft data saved. - * - * @return If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ prepareFeedbackData(): void { // Nothing to do. } /** - * Save draft data of the feedback plugin. - * - * @return If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ saveDraft(): void { // Nothing to do. diff --git a/src/addons/mod/assign/services/handlers/default-submission.ts b/src/addons/mod/assign/services/handlers/default-submission.ts index 2d2b42cf0..3ab79c0b2 100644 --- a/src/addons/mod/assign/services/handlers/default-submission.ts +++ b/src/addons/mod/assign/services/handlers/default-submission.ts @@ -28,66 +28,49 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub type = 'base'; /** - * Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the - * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit - * unfiltered data. - * - * @return Boolean or promise resolved with boolean: whether it can be edited in offline. + * @inheritdoc */ canEditOffline(): boolean | Promise { return false; } /** - * Check if a plugin has no data. - * - * @return Whether the plugin is empty. + * @inheritdoc */ isEmpty(): boolean { return true; } /** - * Should clear temporary data for a cancelled submission. + * @inheritdoc */ clearTmpData(): void { // Nothing to do. } /** - * This function will be called when the user wants to create a new submission based on the previous one. - * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). - * - * @return If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ copySubmissionData(): void { // Nothing to do. } /** - * Delete any stored data for the plugin and submission. - * - * @return If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ deleteOfflineData(): void { // Nothing to do. } /** - * Get files used by this plugin. - * The files returned by this function will be prefetched when the user prefetches the assign. - * - * @return The files (or promise resolved with the files). + * @inheritdoc */ getPluginFiles(): CoreWSFile[] { return []; } /** - * Get a readable name to use for the plugin. - * - * @param plugin The plugin object. - * @return The plugin name. + * @inheritdoc */ getPluginName(plugin: AddonModAssignPlugin): string { // Check if there's a translated string for the plugin. @@ -108,91 +91,56 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub } /** - * Get the size of data (in bytes) this plugin will send to copy a previous submission. - * - * @param assign The assignment. - * @param plugin The plugin object. - * @return The size (or promise resolved with size). + * @inheritdoc */ getSizeForCopy(): number { return 0; } /** - * Get the size of data (in bytes) this plugin will send to add or edit a submission. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @return The size (or promise resolved with size). + * @inheritdoc */ getSizeForEdit(): number { return 0; } /** - * Check if the submission data has changed for this plugin. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param inputData Data entered by the user for the submission. - * @return Boolean (or promise resolved with boolean): whether the data has changed. + * @inheritdoc */ hasDataChanged(): boolean { return false; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether or not the handler is enabled for edit on a site level. - * - * @return Whether or not the handler is enabled for edit on a site level. + * @inheritdoc */ isEnabledForEdit(): boolean { return false; } /** - * Prefetch any required data for the plugin. - * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. - * - * @return Promise resolved when done. + * @inheritdoc */ async prefetch(): Promise { return; } /** - * Prepare and add to pluginData the data to send to the server based on the input data. - * - * @param assign The assignment. - * @param submission The submission. - * @param plugin The plugin object. - * @param inputData Data entered by the user for the submission. - * @param pluginData Object where to store the data to send. - * @param offline Whether the user is editing in offline. - * @param userId User ID. If not defined, site's current user. - * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ prepareSubmissionData(): void { // Nothing to do. } /** - * Prepare and add to pluginData the data to send to the server based on the offline data stored. - * This will be used when performing a synchronization. - * - * @return If the function is async, it should return a Promise resolved when done. + * @inheritdoc */ prepareSyncData(): void { // Nothing to do. diff --git a/src/addons/mod/assign/services/handlers/prefetch.ts b/src/addons/mod/assign/services/handlers/prefetch.ts index 71302b576..29d6afbfd 100644 --- a/src/addons/mod/assign/services/handlers/prefetch.ts +++ b/src/addons/mod/assign/services/handlers/prefetch.ts @@ -54,7 +54,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can use check_updates. The promise should never be rejected. + * @returns Whether the module can use check_updates. The promise should never be rejected. */ async canUseCheckUpdates(module: CoreCourseAnyModuleData, courseId: number): Promise { // Teachers cannot use the WS because it doesn't check student submissions. @@ -80,7 +80,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved with the list of files. + * @returns Promise resolved with the list of files. */ async getFiles(module: CoreCourseAnyModuleData, courseId: number): Promise { const siteId = CoreSites.getCurrentSiteId(); @@ -147,7 +147,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * @param blindMarking True if blind marking, false otherwise. * @param canViewAllSubmissions Whether the user can view all submissions. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with array of files. + * @returns Promise resolved with array of files. */ protected async getSubmissionFiles( assign: AddonModAssignAssign, @@ -201,7 +201,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * * @param moduleId The module ID. * @param courseId The course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number): Promise { await AddonModAssign.invalidateContent(moduleId, courseId); @@ -211,8 +211,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * Invalidate WS calls needed to determine module status. * * @param module Module. - * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ async invalidateModule(module: CoreCourseAnyModuleData): Promise { return CoreCourse.invalidateModule(module.id); @@ -231,7 +230,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * @param module Module. * @param courseId Course ID the module belongs to. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchAssign(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const userId = CoreSites.getCurrentSiteUserId(); @@ -280,7 +279,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * @param moduleId Module ID. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when prefetched, rejected otherwise. + * @returns Promise resolved when prefetched, rejected otherwise. */ protected async prefetchSubmissions( assign: AddonModAssignAssign, @@ -413,7 +412,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * @param moduleId Module ID. * @param options Other options, see getSubmissionStatusWithRetry. * @param resolveOnNoPermission If true, will avoid throwing if a nopermission error is raised. - * @return Promise resolved when prefetched, rejected otherwise. + * @returns Promise resolved when prefetched, rejected otherwise. */ protected async prefetchSubmission( assign: AddonModAssignAssign, @@ -527,7 +526,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ sync(module: CoreCourseAnyModuleData, courseId: number, siteId?: string): Promise { return AddonModAssignSync.syncAssign(module.instance, siteId); diff --git a/src/addons/mod/assign/services/handlers/push-click.ts b/src/addons/mod/assign/services/handlers/push-click.ts index 1b5714c8c..baddce367 100644 --- a/src/addons/mod/assign/services/handlers/push-click.ts +++ b/src/addons/mod/assign/services/handlers/push-click.ts @@ -35,7 +35,7 @@ export class AddonModAssignPushClickHandlerService implements CorePushNotificati * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: NotificationData): Promise { return CoreUtils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_assign' && @@ -46,7 +46,7 @@ export class AddonModAssignPushClickHandlerService implements CorePushNotificati * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: NotificationData): Promise { const contextUrlParams = CoreUrlUtils.extractUrlParams(notification.contexturl); diff --git a/src/addons/mod/assign/services/handlers/sync-cron.ts b/src/addons/mod/assign/services/handlers/sync-cron.ts index cdda6e33b..dde686fcc 100644 --- a/src/addons/mod/assign/services/handlers/sync-cron.ts +++ b/src/addons/mod/assign/services/handlers/sync-cron.ts @@ -31,7 +31,7 @@ export class AddonModAssignSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModAssignSync.syncAllAssignments(siteId, force); @@ -40,7 +40,7 @@ export class AddonModAssignSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModAssignSync.syncInterval; diff --git a/src/addons/mod/assign/services/submission-delegate.ts b/src/addons/mod/assign/services/submission-delegate.ts index f313f5ffc..b34a6ff05 100644 --- a/src/addons/mod/assign/services/submission-delegate.ts +++ b/src/addons/mod/assign/services/submission-delegate.ts @@ -40,7 +40,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return Boolean or promise resolved with boolean: whether it can be edited in offline. + * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline?( assign: AddonModAssignAssign, @@ -53,7 +53,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * * @param assign The assignment. * @param plugin The plugin object. - * @return Whether the plugin is empty. + * @returns Whether the plugin is empty. */ isEmpty?( assign: AddonModAssignAssign, @@ -84,7 +84,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param pluginData Object where to store the data to send. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ copySubmissionData?( assign: AddonModAssignAssign, @@ -102,7 +102,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param plugin The plugin object. * @param offlineData Offline data stored. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ deleteOfflineData?( assign: AddonModAssignAssign, @@ -118,7 +118,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * * @param plugin The plugin object. * @param edit Whether the user is editing. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent?( plugin: AddonModAssignPlugin, @@ -135,7 +135,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param submission The submission. * @param plugin The plugin object. * @param siteId Site ID. If not defined, current site. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles?( assign: AddonModAssignAssign, @@ -148,7 +148,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * Get a readable name to use for the plugin. * * @param plugin The plugin object. - * @return The plugin name. + * @returns The plugin name. */ getPluginName?(plugin: AddonModAssignPlugin): string; @@ -157,7 +157,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * * @param assign The assignment. * @param plugin The plugin object. - * @return The size (or promise resolved with size). + * @returns The size (or promise resolved with size). */ getSizeForCopy?( assign: AddonModAssignAssign, @@ -171,7 +171,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param submission The submission. * @param plugin The plugin object. * @param inputData Data entered by the user for the submission. - * @return The size (or promise resolved with size). + * @returns The size (or promise resolved with size). */ getSizeForEdit?( assign: AddonModAssignAssign, @@ -187,7 +187,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param submission The submission. * @param plugin The plugin object. * @param inputData Data entered by the user for the submission. - * @return Boolean (or promise resolved with boolean): whether the data has changed. + * @returns Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged?( assign: AddonModAssignAssign, @@ -199,7 +199,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { /** * Whether or not the handler is enabled for edit on a site level. * - * @return Whether or not the handler is enabled for edit on a site level. + * @returns Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit?(): boolean | Promise; @@ -211,7 +211,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param submission The submission. * @param plugin The plugin object. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch?( assign: AddonModAssignAssign, @@ -231,7 +231,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param offline Whether the user is editing in offline. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ prepareSubmissionData?( assign: AddonModAssignAssign, @@ -254,7 +254,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * @param offlineData Offline data stored. * @param pluginData Object where to store the data to send. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ prepareSyncData?( assign: AddonModAssignAssign, @@ -286,7 +286,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate { return this.executeFunctionOnEnabled(plugin.type, 'getSizeForCopy', [assign, plugin]); @@ -425,7 +425,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate { return this.executeFunctionOnEnabled(pluginType, 'isEnabledForEdit'); @@ -487,7 +487,7 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate { return CoreComments.invalidateCommentsData( diff --git a/src/addons/mod/assign/submission/comments/services/handler.ts b/src/addons/mod/assign/submission/comments/services/handler.ts index 7e3fdc6dd..e2f05162d 100644 --- a/src/addons/mod/assign/submission/comments/services/handler.ts +++ b/src/addons/mod/assign/submission/comments/services/handler.ts @@ -34,7 +34,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @return Boolean or promise resolved with boolean: whether it can be edited in offline. + * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(): boolean { // This plugin is read only, but return true to prevent blocking the edition. @@ -47,7 +47,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA * * @param plugin The plugin object. * @param edit Whether the user is editing. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(plugin: AddonModAssignPlugin, edit = false): Type | undefined { return edit ? undefined : AddonModAssignSubmissionCommentsComponent; @@ -56,7 +56,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -65,7 +65,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA /** * Whether or not the handler is enabled for edit on a site level. * - * @return Whether or not the handler is enabled for edit on a site level. + * @returns Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean{ return true; @@ -79,7 +79,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA * @param submission The submission. * @param plugin The plugin object. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetch( assign: AddonModAssignAssign, diff --git a/src/addons/mod/assign/submission/file/component/file.ts b/src/addons/mod/assign/submission/file/component/file.ts index 79d8ecfd0..560757263 100644 --- a/src/addons/mod/assign/submission/file/component/file.ts +++ b/src/addons/mod/assign/submission/file/component/file.ts @@ -41,7 +41,7 @@ export class AddonModAssignSubmissionFileComponent extends AddonModAssignSubmiss maxSubmissions?: number; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { this.acceptedTypes = this.configs?.filetypeslist; diff --git a/src/addons/mod/assign/submission/file/services/handler.ts b/src/addons/mod/assign/submission/file/services/handler.ts index 084119aa1..07f87e6a9 100644 --- a/src/addons/mod/assign/submission/file/services/handler.ts +++ b/src/addons/mod/assign/submission/file/services/handler.ts @@ -49,7 +49,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @return Boolean or promise resolved with boolean: whether it can be edited in offline. + * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(): boolean { // This plugin doesn't use Moodle filters, it can be edited in offline. @@ -61,7 +61,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * * @param assign The assignment. * @param plugin The plugin object. - * @return Whether the plugin is empty. + * @returns Whether the plugin is empty. */ isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean { const files = AddonModAssign.getSubmissionPluginAttachments(plugin); @@ -91,7 +91,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param assign The assignment. * @param plugin The plugin object. * @param pluginData Object where to store the data to send. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ async copySubmissionData( assign: AddonModAssignAssign, @@ -109,7 +109,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type { return AddonModAssignSubmissionFileComponent; @@ -123,7 +123,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param plugin The plugin object. * @param offlineData Offline data stored. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ async deleteOfflineData( assign: AddonModAssignAssign, @@ -150,8 +150,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @param siteId Site ID. If not defined, current site. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles( assign: AddonModAssignAssign, @@ -166,7 +165,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * * @param assign The assignment. * @param plugin The plugin object. - * @return The size (or promise resolved with size). + * @returns The size (or promise resolved with size). */ async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise { const files = AddonModAssign.getSubmissionPluginAttachments(plugin); @@ -180,7 +179,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return The size (or promise resolved with size). + * @returns The size (or promise resolved with size). */ async getSizeForEdit( assign: AddonModAssignAssign, @@ -205,7 +204,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return Boolean (or promise resolved with boolean): whether the data has changed. + * @returns Boolean (or promise resolved with boolean): whether the data has changed. */ async hasDataChanged( assign: AddonModAssignAssign, @@ -246,7 +245,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -255,7 +254,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig /** * Whether or not the handler is enabled for edit on a site level. * - * @return Whether or not the handler is enabled for edit on a site level. + * @returns Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean { return true; @@ -272,7 +271,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param offline Whether the user is editing in offline. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ async prepareSubmissionData( assign: AddonModAssignAssign, @@ -318,7 +317,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param offlineData Offline data stored. * @param pluginData Object where to store the data to send. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ async prepareSyncData( assign: AddonModAssignAssign, @@ -345,7 +344,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig * @param submission The submission. * @param offlineData Offline data stored. * @param siteId Site ID. If not defined, current site. - * @return File entries when is all resolved. + * @returns File entries when is all resolved. */ protected async getSubmissionFilesToSync( assign: AddonModAssignAssign, diff --git a/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts b/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts index 733ce4474..d9f32b708 100644 --- a/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts +++ b/src/addons/mod/assign/submission/onlinetext/component/onlinetext.ts @@ -53,7 +53,7 @@ export class AddonModAssignSubmissionOnlineTextComponent extends AddonModAssignS } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { // Get the text. Check if we have anything offline. diff --git a/src/addons/mod/assign/submission/onlinetext/services/handler.ts b/src/addons/mod/assign/submission/onlinetext/services/handler.ts index 34ae6f298..e0f0a93a5 100644 --- a/src/addons/mod/assign/submission/onlinetext/services/handler.ts +++ b/src/addons/mod/assign/submission/onlinetext/services/handler.ts @@ -45,7 +45,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @return Boolean or promise resolved with boolean: whether it can be edited in offline. + * @returns Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(): boolean { // This plugin uses Moodle filters, it cannot be edited in offline. @@ -57,7 +57,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * * @param assign The assignment. * @param plugin The plugin object. - * @return Whether the plugin is empty. + * @returns Whether the plugin is empty. */ isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean { const text = AddonModAssign.getSubmissionPluginText(plugin, true); @@ -75,7 +75,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * @param pluginData Object where to store the data to send. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. + * @returns If the function is async, it should return a Promise resolved when done. */ async copySubmissionData( assign: AddonModAssignAssign, @@ -105,7 +105,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type { return AddonModAssignSubmissionOnlineTextComponent; @@ -118,7 +118,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @return The files (or promise resolved with the files). + * @returns The files (or promise resolved with the files). */ getPluginFiles( assign: AddonModAssignAssign, @@ -133,7 +133,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * * @param assign The assignment. * @param plugin The plugin object. - * @return The size (or promise resolved with size). + * @returns The size (or promise resolved with size). */ async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise { const text = AddonModAssign.getSubmissionPluginText(plugin, true); @@ -150,8 +150,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * @param assign The assignment. * @param submission The submission. * @param plugin The plugin object. - * @param inputData Data entered by the user for the submission. - * @return The size (or promise resolved with size). + * @returns The size (or promise resolved with size). */ getSizeForEdit( assign: AddonModAssignAssign, @@ -168,7 +167,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * * @param plugin The plugin object. * @param inputData Data entered by the user for the submission. - * @return Text to submit. + * @returns Text to submit. */ protected getTextToSubmit(plugin: AddonModAssignPlugin, inputData: AddonModAssignSubmissionOnlineTextData): string { const text = inputData.onlinetext_editor_text; @@ -184,7 +183,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * @param submission The submission. * @param plugin The plugin object. * @param inputData Data entered by the user for the submission. - * @return Boolean (or promise resolved with boolean): whether the data has changed. + * @returns Boolean (or promise resolved with boolean): whether the data has changed. */ async hasDataChanged( assign: AddonModAssignAssign, @@ -212,7 +211,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -221,7 +220,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo /** * Whether or not the handler is enabled for edit on a site level. * - * @return Whether or not the handler is enabled for edit on a site level. + * @returns Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean { return true; @@ -235,10 +234,6 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * @param plugin The plugin object. * @param inputData Data entered by the user for the submission. * @param pluginData Object where to store the data to send. - * @param offline Whether the user is editing in offline. - * @param userId User ID. If not defined, site's current user. - * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. */ prepareSubmissionData( assign: AddonModAssignAssign, @@ -246,7 +241,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo plugin: AddonModAssignPlugin, inputData: AddonModAssignSubmissionOnlineTextData, pluginData: AddonModAssignSubmissionOnlineTextPluginData, - ): void | Promise { + ): void { let text = this.getTextToSubmit(plugin, inputData); @@ -282,8 +277,6 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo * @param plugin The plugin object. * @param offlineData Offline data stored. * @param pluginData Object where to store the data to send. - * @param siteId Site ID. If not defined, current site. - * @return If the function is async, it should return a Promise resolved when done. */ prepareSyncData( assign: AddonModAssignAssign, @@ -291,7 +284,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo plugin: AddonModAssignPlugin, offlineData: AddonModAssignSubmissionsDBRecordFormatted, pluginData: AddonModAssignSubmissionOnlineTextPluginData, - ): void | Promise { + ): void { const offlinePluginData = (offlineData && offlineData.plugindata); const textData = offlinePluginData.onlinetext_editor; diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.ts b/src/addons/mod/bigbluebuttonbn/components/index/index.ts index 3b7d126cf..b90a7adb9 100644 --- a/src/addons/mod/bigbluebuttonbn/components/index/index.ts +++ b/src/addons/mod/bigbluebuttonbn/components/index/index.ts @@ -95,7 +95,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo * Get meeting info. * * @param updateCache Whether to update info cached data (in server). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchMeetingInfo(updateCache?: boolean): Promise { if (!this.bbb) { @@ -126,7 +126,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo /** * Get recordings. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchRecordings(): Promise { if (!this.bbb || !this.showRecordings) { @@ -204,7 +204,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo * Update meeting info. * * @param updateCache Whether to update info cached data (in server). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async updateMeetingInfo(updateCache?: boolean): Promise { if (!this.bbb) { @@ -242,7 +242,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo /** * Group changed, reload some data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async groupChanged(): Promise { this.showLoading = true; @@ -261,7 +261,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo /** * Join the room. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async joinRoom(): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -287,7 +287,7 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo /** * End the meeting. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async endMeeting(): Promise { if (!this.bbb) { diff --git a/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts b/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts index 03b962739..29c398b13 100644 --- a/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts +++ b/src/addons/mod/bigbluebuttonbn/services/bigbluebuttonbn.ts @@ -40,7 +40,7 @@ export class AddonModBBBService { * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async endMeeting( id: number, @@ -63,7 +63,7 @@ export class AddonModBBBService { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the activity is retrieved. + * @returns Promise resolved when the activity is retrieved. */ async getBBB(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -96,7 +96,7 @@ export class AddonModBBBService { * Get cache key for get BBB WS call. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getBBBsCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'bbb:' + courseId; @@ -108,7 +108,7 @@ export class AddonModBBBService { * @param cmId Course module ID. * @param groupId Group ID, 0 means that the function will determine the user group. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of messages. + * @returns Promise resolved with the list of messages. */ async getJoinUrl( cmId: number, @@ -148,7 +148,7 @@ export class AddonModBBBService { * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. * @param options Other options. - * @return Promise resolved with the list of messages. + * @returns Promise resolved with the list of messages. */ async getMeetingInfo( id: number, @@ -191,7 +191,7 @@ export class AddonModBBBService { * * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. - * @return Cache key. + * @returns Cache key. */ protected getMeetingInfoCacheKey(id: number, groupId: number = 0): string { return this.getMeetingInfoCacheKeyPrefix(id) + groupId; @@ -201,7 +201,7 @@ export class AddonModBBBService { * Get cache key prefix for meeting info WS call. * * @param id BBB ID. - * @return Cache key prefix. + * @returns Cache key prefix. */ protected getMeetingInfoCacheKeyPrefix(id: number): string { return ROOT_CACHE_KEY + 'meetingInfo:' + id + ':'; @@ -213,7 +213,7 @@ export class AddonModBBBService { * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. * @param options Other options. - * @return Promise resolved with the list of messages. + * @returns Promise resolved with the list of messages. */ async getRecordings( id: number, @@ -256,7 +256,7 @@ export class AddonModBBBService { * * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. - * @return Cache key. + * @returns Cache key. */ protected getRecordingsCacheKey(id: number, groupId: number = 0): string { return this.getRecordingsCacheKeyPrefix(id) + groupId; @@ -266,7 +266,7 @@ export class AddonModBBBService { * Get cache key prefix for get recordings WS call. * * @param id BBB ID. - * @return Cache key prefix. + * @returns Cache key prefix. */ protected getRecordingsCacheKeyPrefix(id: number): string { return ROOT_CACHE_KEY + 'recordings:' + id + ':'; @@ -278,7 +278,7 @@ export class AddonModBBBService { * @param id BBB instance ID. * @param name Name of the BBB. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModBBBViewBigBlueButtonBNWSParams = { @@ -302,7 +302,7 @@ export class AddonModBBBService { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateBBBs(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -316,7 +316,7 @@ export class AddonModBBBService { * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateMeetingInfo(id: number, groupId: number = 0, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -329,7 +329,7 @@ export class AddonModBBBService { * * @param id BBB ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllGroupsMeetingInfo(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -343,7 +343,7 @@ export class AddonModBBBService { * @param id BBB ID. * @param groupId Group ID, 0 means that the function will determine the user group. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateRecordings(id: number, groupId: number = 0, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -356,7 +356,7 @@ export class AddonModBBBService { * * @param id BBB ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllGroupsRecordings(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -368,7 +368,7 @@ export class AddonModBBBService { * Returns whether or not the BBB plugin is enabled for a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @returns Promise resolved with true if enabled, resolved with false or rejected otherwise. * @since 4.0, but the WebServices were backported to the plugin so it can be supported in older versions. */ async isPluginEnabled(siteId?: string): Promise { diff --git a/src/addons/mod/book/components/index/index.ts b/src/addons/mod/book/components/index/index.ts index 82747aa77..838f154e8 100644 --- a/src/addons/mod/book/components/index/index.ts +++ b/src/addons/mod/book/components/index/index.ts @@ -63,7 +63,7 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Load book data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadBook(): Promise { this.book = await AddonModBook.getBook(this.courseId, this.module.id); @@ -82,7 +82,7 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Load book TOC. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadTOC(): Promise { const contents = await CoreCourse.getModuleContents(this.module, this.courseId); diff --git a/src/addons/mod/book/pages/contents/contents.ts b/src/addons/mod/book/pages/contents/contents.ts index 9c290473e..55fc00732 100644 --- a/src/addons/mod/book/pages/contents/contents.ts +++ b/src/addons/mod/book/pages/contents/contents.ts @@ -119,7 +119,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { * Download book contents and load the current chapter. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(refresh = false): Promise { try { @@ -158,8 +158,9 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { * If the download call fails the promise won't be rejected, but the error will be included in the returned object. * If module.contents cannot be loaded then the Promise will be rejected. * + * @param module Module to download. * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadResourceIfNeeded( module: CoreCourseModuleData, @@ -212,7 +213,6 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { * Change the current chapter. * * @param chapterId Chapter to load. - * @return Promise resolved when done. */ changeChapter(chapterId: number): void { if (!chapterId) { @@ -226,7 +226,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher): Promise { if (this.manager) { @@ -268,7 +268,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { * Update data related to chapter being viewed. * * @param chapterId Chapter viewed. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async onChapterViewed(chapterId: number): Promise { if (this.displayNavBar) { @@ -299,7 +299,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { * Converts chapters to navigation items. * * @param chapterId Current chapter Id. - * @return Navigation items. + * @returns Navigation items. */ protected getNavigationItems(chapterId: number): CoreNavigationBarItem[] { return this.chapters.map((chapter) => ({ @@ -360,7 +360,7 @@ class AddonModBookSlidesItemsManagerSource extends CoreSwipeSlidesItemsManagerSo /** * Load book data from WS. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadBookData(): Promise<{ module: CoreCourseModuleData; book: AddonModBookBookWSData }> { this.module = await CoreCourse.getModule(this.CM_ID, this.COURSE_ID); @@ -423,7 +423,7 @@ class AddonModBookSlidesItemsManagerSource extends CoreSwipeSlidesItemsManagerSo /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ invalidateContent(): Promise { return AddonModBook.invalidateContent(this.CM_ID, this.COURSE_ID); diff --git a/src/addons/mod/book/services/book.ts b/src/addons/mod/book/services/book.ts index 2c62c96b9..8681ef369 100644 --- a/src/addons/mod/book/services/book.ts +++ b/src/addons/mod/book/services/book.ts @@ -62,7 +62,7 @@ export class AddonModBookProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the book is retrieved. + * @returns Promise resolved when the book is retrieved. */ getBook(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getBookByField(courseId, 'coursemodule', cmId, options); @@ -74,8 +74,8 @@ export class AddonModBookProvider { * @param courseId Course ID. * @param key Name of the property to check. * @param value Value to search. - * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the book is retrieved. + * @param options Common WS options. + * @returns Promise resolved when the book is retrieved. */ protected async getBookByField( courseId: number, @@ -110,7 +110,7 @@ export class AddonModBookProvider { * Get cache key for get book data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getBookDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'book:' + courseId; @@ -122,7 +122,7 @@ export class AddonModBookProvider { * @param contentsMap Contents map returned by getContentsMap. * @param chapterId Chapter to retrieve. * @param moduleId The module ID. - * @return Promise resolved with the contents. + * @returns Promise resolved with the contents. */ async getChapterContent(contentsMap: AddonModBookContentsMap, chapterId: number, moduleId: number): Promise { @@ -152,7 +152,7 @@ export class AddonModBookProvider { * Each chapter has an indexUrl and the list of contents in that chapter. * * @param contents The module contents. - * @return Contents map. + * @returns Contents map. */ getContentsMap(contents: CoreCourseModuleContentFile[]): AddonModBookContentsMap { const map: AddonModBookContentsMap = {}; @@ -206,7 +206,7 @@ export class AddonModBookProvider { * Get the first chapter of a book. * * @param chapters The chapters list. - * @return The chapter id. + * @returns The chapter id. */ getFirstChapter(chapters: AddonModBookTocChapter[]): number | undefined { if (!chapters || !chapters.length) { @@ -221,7 +221,7 @@ export class AddonModBookProvider { * * @param id Book instance ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with last chapter viewed, undefined if none. + * @returns Promise resolved with last chapter viewed, undefined if none. */ async getLastChapterViewed(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -236,7 +236,7 @@ export class AddonModBookProvider { * Get the book toc as an array. * * @param contents The module contents. - * @return The toc. + * @returns The toc. */ getToc(contents: CoreCourseModuleContentFile[]): AddonModBookTocChapterParsed[] { if (!contents || !contents.length || contents[0].content === undefined) { @@ -250,7 +250,7 @@ export class AddonModBookProvider { * Get the book toc as an array of chapters (not nested). * * @param contents The module contents. - * @return The toc as a list. + * @returns The toc as a list. */ getTocList(contents: CoreCourseModuleContentFile[]): AddonModBookTocChapter[] { // Convenience function to get chapter info. @@ -302,7 +302,7 @@ export class AddonModBookProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateBookData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -316,7 +316,7 @@ export class AddonModBookProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -334,7 +334,7 @@ export class AddonModBookProvider { * Check if a file is downloadable. The file param must have a 'type' attribute like in core_course_get_contents response. * * @param file File to check. - * @return Whether it's downloadable. + * @returns Whether it's downloadable. */ isFileDownloadable(file: CoreCourseModuleContentFile): boolean { return file.type === 'file'; @@ -344,7 +344,7 @@ export class AddonModBookProvider { * Return whether or not the plugin is enabled. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -359,7 +359,7 @@ export class AddonModBookProvider { * @param chapterId Chapter ID. * @param name Name of the book. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, chapterId?: number, name?: string, siteId?: string): Promise { const params: AddonModBookViewBookWSParams = { @@ -386,7 +386,7 @@ export class AddonModBookProvider { * @param chapterId Chapter ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with last chapter viewed, undefined if none. + * @returns Promise resolved with last chapter viewed, undefined if none. */ async storeLastChapterViewed(id: number, chapterId: number, courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/book/services/handlers/list-link.ts b/src/addons/mod/book/services/handlers/list-link.ts index b6bd0d7ee..9baecac05 100644 --- a/src/addons/mod/book/services/handlers/list-link.ts +++ b/src/addons/mod/book/services/handlers/list-link.ts @@ -33,7 +33,7 @@ export class AddonModBookListLinkHandlerService extends CoreContentLinksModuleLi * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ isEnabled(): Promise { return AddonModBook.isPluginEnabled(); diff --git a/src/addons/mod/book/services/handlers/prefetch.ts b/src/addons/mod/book/services/handlers/prefetch.ts index c4c127821..a4cd7ac76 100644 --- a/src/addons/mod/book/services/handlers/prefetch.ts +++ b/src/addons/mod/book/services/handlers/prefetch.ts @@ -38,7 +38,7 @@ export class AddonModBookPrefetchHandlerService extends CoreCourseResourcePrefet * @param module The module object returned by WS. * @param courseId Course ID. * @param prefetch True to prefetch, false to download right away. - * @return Promise resolved when all content is downloaded. Data returned is not reliable. + * @returns Promise resolved when all content is downloaded. Data returned is not reliable. */ async downloadOrPrefetch(module: CoreCourseModuleData, courseId: number, prefetch?: boolean): Promise { const promises: Promise[] = []; @@ -54,7 +54,7 @@ export class AddonModBookPrefetchHandlerService extends CoreCourseResourcePrefet * * @param module The module object returned by WS. * @param courseId Course ID. - * @return Promise resolved with list of intro files. + * @returns Promise resolved with list of intro files. */ async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number): Promise { const book = await CoreUtils.ignoreErrors(AddonModBook.getBook(courseId, module.id)); @@ -67,7 +67,7 @@ export class AddonModBookPrefetchHandlerService extends CoreCourseResourcePrefet * * @param moduleId The module ID. * @param courseId Course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number): Promise { await AddonModBook.invalidateContent(moduleId, courseId); @@ -76,7 +76,7 @@ export class AddonModBookPrefetchHandlerService extends CoreCourseResourcePrefet /** * Whether or not the handler is enabled on a site level. * - * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @returns A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): Promise { return AddonModBook.isPluginEnabled(); diff --git a/src/addons/mod/book/services/handlers/tag-area.ts b/src/addons/mod/book/services/handlers/tag-area.ts index 4430bc4d5..fd6da7c45 100644 --- a/src/addons/mod/book/services/handlers/tag-area.ts +++ b/src/addons/mod/book/services/handlers/tag-area.ts @@ -34,7 +34,7 @@ export class AddonModBookTagAreaHandlerService implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return AddonModBook.isPluginEnabled(); @@ -44,7 +44,7 @@ export class AddonModBookTagAreaHandlerService implements CoreTagAreaHandler { * Parses the rendered content of a tag index and returns the items. * * @param content Rendered content. - * @return Area items (or promise resolved with the items). + * @returns Area items (or promise resolved with the items). */ async parseContent(content: string): Promise { const items = CoreTagHelper.parseFeedContent(content); @@ -70,7 +70,7 @@ export class AddonModBookTagAreaHandlerService implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return CoreTagFeedComponent; diff --git a/src/addons/mod/chat/classes/chat-sessions-source.ts b/src/addons/mod/chat/classes/chat-sessions-source.ts index e53b4be01..30c59c06c 100644 --- a/src/addons/mod/chat/classes/chat-sessions-source.ts +++ b/src/addons/mod/chat/classes/chat-sessions-source.ts @@ -105,8 +105,8 @@ export class AddonModChatSessionsSource extends CoreRoutedItemsManagerSource { if (sessionUser.userfullname) { diff --git a/src/addons/mod/chat/pages/chat/chat.ts b/src/addons/mod/chat/pages/chat/chat.ts index 76a53a6a4..8c13924cf 100644 --- a/src/addons/mod/chat/pages/chat/chat.ts +++ b/src/addons/mod/chat/pages/chat/chat.ts @@ -116,7 +116,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave { /** * Convenience function to login the user. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loginUser(): Promise { this.sessionId = await AddonModChat.loginUser(this.chatId); @@ -125,7 +125,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave { /** * Convenience function to fetch chat messages. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchMessages(): Promise { const messagesInfo = await AddonModChat.getLatestMessages(this.sessionId!, this.lastTime); @@ -194,7 +194,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave { * Get the user fullname for a beep. * * @param id User Id before parsing. - * @return User fullname. + * @returns User fullname. */ protected async getUserFullname(id: string): Promise { const idNumber = parseInt(id, 10); @@ -252,7 +252,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave { /** * Convenience function to be called every certain time to fetch chat messages. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchMessagesInterval(): Promise { if (!this.isOnline || this.pollingRunning) { @@ -319,7 +319,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave { /** * Try to reconnect. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async reconnect(): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -351,7 +351,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved with true if we can leave it, rejected if not. + * @returns Resolved with true if we can leave it, rejected if not. */ async canLeave(): Promise { if (! this.messages.some((message) => !message.special)) { diff --git a/src/addons/mod/chat/pages/session-messages/session-messages.ts b/src/addons/mod/chat/pages/session-messages/session-messages.ts index 02d185a30..c59e8af91 100644 --- a/src/addons/mod/chat/pages/session-messages/session-messages.ts +++ b/src/addons/mod/chat/pages/session-messages/session-messages.ts @@ -70,7 +70,7 @@ export class AddonModChatSessionMessagesPage implements OnInit { /** * Fetch session messages. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchMessages(): Promise { try { @@ -113,7 +113,7 @@ export class AddonModChatSessionMessagesPage implements OnInit { * Get the user fullname for a beep. * * @param id User Id before parsing. - * @return User fullname. + * @returns User fullname. */ protected async getUserFullname(id: string): Promise { const idNumber = parseInt(id, 10); diff --git a/src/addons/mod/chat/pages/sessions/sessions.ts b/src/addons/mod/chat/pages/sessions/sessions.ts index 082e9506f..1742da8cf 100644 --- a/src/addons/mod/chat/pages/sessions/sessions.ts +++ b/src/addons/mod/chat/pages/sessions/sessions.ts @@ -86,8 +86,6 @@ export class AddonModChatSessionsPage implements AfterViewInit, OnDestroy { /** * Fetch chat sessions. - * - * @param showLoading Display a loading modal. */ async fetchSessions(): Promise { try { diff --git a/src/addons/mod/chat/services/chat-helper.ts b/src/addons/mod/chat/services/chat-helper.ts index 5ec95bdaa..49f466243 100644 --- a/src/addons/mod/chat/services/chat-helper.ts +++ b/src/addons/mod/chat/services/chat-helper.ts @@ -31,7 +31,7 @@ export class AddonModChatHelperProvider { * @param currentUserId User Id. * @param message Message. * @param prevMessage Previous message (if any). - * @return Message with additional info. + * @returns Message with additional info. */ formatMessage( currentUserId: number, @@ -83,9 +83,10 @@ export class AddonModChatHelperProvider { * Check if the user info should be displayed for the current message. * User data is only displayed if the previous message was from another user. * + * @param currentUserId Current User Id. * @param message Current message where to show the user info. * @param prevMessage Previous message. - * @return Whether user data should be shown. + * @returns Whether user data should be shown. */ protected showUserData( currentUserId: number, @@ -101,7 +102,7 @@ export class AddonModChatHelperProvider { * * @param message Current message where to show the user info. * @param nextMessage Next message. - * @return Whether user data should be shown. + * @returns Whether user data should be shown. */ protected showTail(message: AddonModChatAnyFormattedMessage, nextMessage?: AddonModChatAnyFormattedMessage): boolean { return !nextMessage || nextMessage.userid != message.userid || !!nextMessage.showDate || !!nextMessage.special; @@ -112,7 +113,7 @@ export class AddonModChatHelperProvider { * * @param message New message object. * @param prevMessage Previous message object. - * @return True if messages are from diferent days, false othetwise. + * @returns True if messages are from diferent days, false othetwise. */ protected showDate(message: AddonModChatAnyFormattedMessage, prevMessage?: AddonModChatAnyFormattedMessage): boolean { if (!prevMessage) { diff --git a/src/addons/mod/chat/services/chat.ts b/src/addons/mod/chat/services/chat.ts index 9908aff4f..4b508958f 100644 --- a/src/addons/mod/chat/services/chat.ts +++ b/src/addons/mod/chat/services/chat.ts @@ -39,7 +39,7 @@ export class AddonModChatProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the chat is retrieved. + * @returns Promise resolved when the chat is retrieved. */ async getChat(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -69,7 +69,7 @@ export class AddonModChatProvider { * * @param chatId Chat instance ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS is executed. + * @returns Promise resolved when the WS is executed. */ async loginUser(chatId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -89,7 +89,7 @@ export class AddonModChatProvider { * @param id Chat instance ID. * @param name Name of the chat. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModChatViewChatWSParams = { @@ -115,7 +115,7 @@ export class AddonModChatProvider { * @param message Message text. * @param beepUserId Beep user ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS is executed. + * @returns Promise resolved when the WS is executed. */ async sendMessage(sessionId: string, message: string, beepUserId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -137,7 +137,7 @@ export class AddonModChatProvider { * @param sessionId Chat sessiond ID. * @param lastTime Last time when messages were retrieved. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS is executed. + * @returns Promise resolved when the WS is executed. */ async getLatestMessages( sessionId: string, @@ -162,7 +162,7 @@ export class AddonModChatProvider { * @param messages Messages to get the user data for. * @param courseId ID of the course the messages belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise always resolved with the formatted messages. + * @returns Promise always resolved with the formatted messages. */ async getMessagesUserData(messages: AddonModChatWSMessage[], courseId: number, siteId?: string): Promise; async getMessagesUserData( @@ -197,7 +197,7 @@ export class AddonModChatProvider { * * @param sessionId Chat sessiond ID. * @param options Other options. - * @return Promise resolved when the WS is executed. + * @returns Promise resolved when the WS is executed. */ async getChatUsers(sessionId: string, options: CoreCourseCommonModWSOptions = {}): Promise { // By default, always try to get the latest data. @@ -224,7 +224,7 @@ export class AddonModChatProvider { * @param groupId Group ID, 0 means that the function will determine the user group. * @param showAll Whether to include incomplete sessions or not. * @param options Other options. - * @return Promise resolved with the list of sessions. + * @returns Promise resolved with the list of sessions. */ async getSessions( chatId: number, @@ -260,7 +260,7 @@ export class AddonModChatProvider { * @param sessionEnd Session end time. * @param groupId Group ID, 0 means that the function will determine the user group. * @param options Other options. - * @return Promise resolved with the list of messages. + * @returns Promise resolved with the list of messages. */ async getSessionMessages( chatId: number, @@ -299,7 +299,7 @@ export class AddonModChatProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateChats(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -314,7 +314,7 @@ export class AddonModChatProvider { * @param groupId Group ID, 0 means that the function will determine the user group. * @param showAll Whether to include incomplete sessions or not. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSessions(chatId: number, groupId: number = 0, showAll: boolean = false, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -327,7 +327,7 @@ export class AddonModChatProvider { * * @param chatId Chat ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllSessions(chatId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -342,7 +342,7 @@ export class AddonModChatProvider { * @param sessionStart Session start time. * @param groupId Group ID, 0 means that the function will determine the user group. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSessionMessages(chatId: number, sessionStart: number, groupId: number = 0, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -355,7 +355,7 @@ export class AddonModChatProvider { * * @param chatId Chat ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllSessionMessages(chatId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -367,7 +367,7 @@ export class AddonModChatProvider { * Get cache key for chats WS call. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getChatsCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'chats:' + courseId; @@ -379,7 +379,7 @@ export class AddonModChatProvider { * @param chatId Chat ID. * @param groupId Goup ID, 0 means that the function will determine the user group. * @param showAll Whether to include incomplete sessions or not. - * @return Cache key. + * @returns Cache key. */ protected getSessionsCacheKey(chatId: number, groupId: number, showAll: boolean): string { return this.getSessionsCacheKeyPrefix(chatId) + groupId + ':' + (showAll ? 1 : 0); @@ -389,7 +389,7 @@ export class AddonModChatProvider { * Get cache key prefix for sessions WS call. * * @param chatId Chat ID. - * @return Cache key prefix. + * @returns Cache key prefix. */ protected getSessionsCacheKeyPrefix(chatId: number): string { return ROOT_CACHE_KEY + 'sessions:' + chatId + ':'; @@ -401,7 +401,7 @@ export class AddonModChatProvider { * @param chatId Chat ID. * @param sessionStart Session start time. * @param groupId Group ID, 0 means that the function will determine the user group. - * @return Cache key. + * @returns Cache key. */ protected getSessionMessagesCacheKey(chatId: number, sessionStart: number, groupId: number): string { return this.getSessionMessagesCacheKeyPrefix(chatId) + sessionStart + ':' + groupId; @@ -411,7 +411,7 @@ export class AddonModChatProvider { * Get cache key prefix for session messages WS call. * * @param chatId Chat ID. - * @return Cache key prefix. + * @returns Cache key prefix. */ protected getSessionMessagesCacheKeyPrefix(chatId: number): string { return ROOT_CACHE_KEY + 'sessionsMessages:' + chatId + ':'; diff --git a/src/addons/mod/chat/services/handlers/prefetch.ts b/src/addons/mod/chat/services/handlers/prefetch.ts index a6414a0a2..264d0359b 100644 --- a/src/addons/mod/chat/services/handlers/prefetch.ts +++ b/src/addons/mod/chat/services/handlers/prefetch.ts @@ -67,7 +67,7 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet * @param module The module object returned by WS. * @param courseId Course ID the module belongs to. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchChat(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const options = { @@ -111,7 +111,7 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet * @param courseId Course ID. * @param showAll Whether to include incomplete sessions or not. * @param modOptions Other options. - * @return Promise resolved with the list of sessions. + * @returns Promise resolved with the list of sessions. */ protected async prefetchSessions( chatId: number, @@ -145,7 +145,7 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet * @param groupId Group ID. * @param courseId Course ID the module belongs to. * @param modOptions Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchSession( chatId: number, diff --git a/src/addons/mod/choice/components/index/index.ts b/src/addons/mod/choice/components/index/index.ts index aaa489e82..91b25b58b 100644 --- a/src/addons/mod/choice/components/index/index.ts +++ b/src/addons/mod/choice/components/index/index.ts @@ -158,7 +158,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo * Convenience function to get choice options. * * @param choice Choice data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchOptions(choice: AddonModChoiceChoice): Promise { let options = await AddonModChoice.getOptions(choice.id, { cmId: this.module.id }); @@ -226,7 +226,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo * * @param choice Choice. * @param options Online options. - * @return Promise resolved with the options. + * @returns Promise resolved with the options. */ protected async getOfflineResponses( choice: AddonModChoiceChoice, @@ -284,7 +284,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo * Convenience function to get choice results. * * @param choice Choice. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchResults(choice: AddonModChoiceChoice): Promise { if (this.choiceNotOpenYet) { @@ -327,7 +327,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo * Check if a choice is open. * * @param choice Choice data. - * @return True if choice is open, false otherwise. + * @returns True if choice is open, false otherwise. */ protected isChoiceOpen(choice: AddonModChoiceChoice): boolean { return (!choice.timeopen || choice.timeopen <= this.now) && (!choice.timeclose || choice.timeclose > this.now); @@ -336,7 +336,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Return true if the user has selected at least one option. * - * @return True if the user has responded. + * @returns True if the user has responded. */ canSave(): boolean { if (!this.choice) { @@ -424,7 +424,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo * Function to call when some data has changed. It will refresh/prefetch data. * * @param online Whether the data was sent to server or stored in offline. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async dataUpdated(online: boolean): Promise { if (!online || !this.isPrefetched()) { @@ -456,7 +456,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModChoiceSync.syncChoice(this.choice!.id, this.userId); @@ -466,7 +466,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return Whether it succeed or not. + * @returns Whether it succeed or not. */ protected hasSyncSucceed(result: AddonModChoiceSyncResult): boolean { return result.updated; diff --git a/src/addons/mod/choice/services/choice-offline.ts b/src/addons/mod/choice/services/choice-offline.ts index 9d7738935..137fa5325 100644 --- a/src/addons/mod/choice/services/choice-offline.ts +++ b/src/addons/mod/choice/services/choice-offline.ts @@ -30,7 +30,7 @@ export class AddonModChoiceOfflineProvider { * @param choiceId Choice ID to remove. * @param siteId Site ID. If not defined, current site. * @param userId User the responses belong to. If not defined, current user in site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteResponse(choiceId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -43,7 +43,7 @@ export class AddonModChoiceOfflineProvider { * Get all offline responses. * * @param siteId Site ID. If not defined, current site. - * @return Promi[se resolved with responses. + * @returns Promi[se resolved with responses. */ async getResponses(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -59,7 +59,7 @@ export class AddonModChoiceOfflineProvider { * @param choiceId Choice ID. * @param siteId Site ID. If not defined, current site. * @param userId User the responses belong to. If not defined, current user in site. - * @return Promise resolved with boolean: true if has offline answers, false otherwise. + * @returns Promise resolved with boolean: true if has offline answers, false otherwise. */ async hasResponse(choiceId: number, siteId?: string, userId?: number): Promise { try { @@ -78,7 +78,7 @@ export class AddonModChoiceOfflineProvider { * @param choiceId Choice ID to get. * @param siteId Site ID. If not defined, current site. * @param userId User the responses belong to. If not defined, current user in site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getResponse(choiceId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -96,7 +96,7 @@ export class AddonModChoiceOfflineProvider { * Parse responses. * * @param entry Entry to parse. - * @return Parsed entry. + * @returns Parsed entry. */ protected parseResponse(entry: AddonModChoiceResponsesDBRecord): AddonModChoiceOfflineResponses { return { @@ -115,7 +115,7 @@ export class AddonModChoiceOfflineProvider { * @param deleting If true, the user is deleting responses, if false, submitting. * @param siteId Site ID. If not defined, current site. * @param userId User the responses belong to. If not defined, current user in site. - * @return Promise resolved when results are successfully submitted. + * @returns Promise resolved when results are successfully submitted. */ async saveResponse( choiceId: number, diff --git a/src/addons/mod/choice/services/choice-sync.ts b/src/addons/mod/choice/services/choice-sync.ts index 8c4a691c3..d0b74a684 100644 --- a/src/addons/mod/choice/services/choice-sync.ts +++ b/src/addons/mod/choice/services/choice-sync.ts @@ -45,7 +45,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param choiceId Choice ID. * @param userId User the responses belong to. - * @return Sync ID. + * @returns Sync ID. */ protected getSyncId(choiceId: number, userId: number): string { return choiceId + '#' + userId; @@ -56,7 +56,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllChoices(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all choices', (siteId) => this.syncAllChoicesFunc(!!force, siteId), siteId); @@ -67,7 +67,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllChoicesFunc(force: boolean, siteId: string): Promise { const responses = await AddonModChoiceOffline.getResponses(siteId); @@ -95,7 +95,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid * @param choiceId Choice ID to be synced. * @param userId User the answers belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the choice is synced or it doesn't need to be synced. + * @returns Promise resolved when the choice is synced or it doesn't need to be synced. */ async syncChoiceIfNeeded(choiceId: number, userId: number, siteId?: string): Promise { const syncId = this.getSyncId(choiceId, userId); @@ -113,7 +113,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid * @param choiceId Choice ID to be synced. * @param userId User the answers belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncChoice(choiceId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -139,7 +139,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid * @param choiceId Choice ID to be synced. * @param userId User the answers belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ protected async performSync(choiceId: number, userId: number, siteId?: string): Promise { const syncId = this.getSyncId(choiceId, userId); diff --git a/src/addons/mod/choice/services/choice.ts b/src/addons/mod/choice/services/choice.ts index 284d88109..459bbf3b2 100644 --- a/src/addons/mod/choice/services/choice.ts +++ b/src/addons/mod/choice/services/choice.ts @@ -53,7 +53,7 @@ export class AddonModChoiceProvider { * * @param choice Choice to check. * @param hasAnswered True if user has answered the choice, false otherwise. - * @return True if the students can see the results. + * @returns True if the students can see the results. */ canStudentSeeResults(choice: AddonModChoiceChoice, hasAnswered: boolean): boolean { const now = Date.now(); @@ -71,7 +71,7 @@ export class AddonModChoiceProvider { * @param courseId Course ID the choice belongs to. * @param responses IDs of the answers. If not defined, delete all the answers of the current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if response was sent to server, false if stored in device. + * @returns Promise resolved with boolean: true if response was sent to server, false if stored in device. */ async deleteResponses( choiceId: number, @@ -119,7 +119,7 @@ export class AddonModChoiceProvider { * @param choiceId Choice ID. * @param responses IDs of the answers. If not defined, delete all the answers of the current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when responses are successfully deleted. + * @returns Promise resolved when responses are successfully deleted. */ async deleteResponsesOnline(choiceId: number, responses?: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -151,7 +151,7 @@ export class AddonModChoiceProvider { * Get cache key for choice data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getChoiceDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'choice:' + courseId; @@ -161,7 +161,7 @@ export class AddonModChoiceProvider { * Get cache key for choice options WS calls. * * @param choiceId Choice ID. - * @return Cache key. + * @returns Cache key. */ protected getChoiceOptionsCacheKey(choiceId: number): string { return ROOT_CACHE_KEY + 'options:' + choiceId; @@ -171,7 +171,7 @@ export class AddonModChoiceProvider { * Get cache key for choice results WS calls. * * @param choiceId Choice ID. - * @return Cache key. + * @returns Cache key. */ protected getChoiceResultsCacheKey(choiceId: number): string { return ROOT_CACHE_KEY + 'results:' + choiceId; @@ -184,7 +184,7 @@ export class AddonModChoiceProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the choice is retrieved. + * @returns Promise resolved when the choice is retrieved. */ protected async getChoiceByDataKey( courseId: number, @@ -224,7 +224,7 @@ export class AddonModChoiceProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the choice is retrieved. + * @returns Promise resolved when the choice is retrieved. */ getChoice(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getChoiceByDataKey(courseId, 'coursemodule', cmId, options); @@ -236,7 +236,7 @@ export class AddonModChoiceProvider { * @param courseId Course ID. * @param choiceId Choice ID. * @param options Other options. - * @return Promise resolved when the choice is retrieved. + * @returns Promise resolved when the choice is retrieved. */ getChoiceById(courseId: number, choiceId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getChoiceByDataKey(courseId, 'id', choiceId, options); @@ -247,7 +247,7 @@ export class AddonModChoiceProvider { * * @param choiceId Choice ID. * @param options Other options. - * @return Promise resolved with choice options. + * @returns Promise resolved with choice options. */ async getOptions(choiceId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -278,7 +278,7 @@ export class AddonModChoiceProvider { * * @param choiceId Choice ID. * @param options Other options. - * @return Promise resolved with choice results. + * @returns Promise resolved with choice results. */ async getResults(choiceId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -307,7 +307,7 @@ export class AddonModChoiceProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateChoiceData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -321,7 +321,7 @@ export class AddonModChoiceProvider { * @param moduleId The module ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -341,7 +341,7 @@ export class AddonModChoiceProvider { * * @param choiceId Choice ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateOptions(choiceId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -354,7 +354,7 @@ export class AddonModChoiceProvider { * * @param choiceId Choice ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateResults(choiceId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -368,7 +368,7 @@ export class AddonModChoiceProvider { * @param id Choice ID. * @param name Name of the choice. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModChoiceViewChoiceWSParams = { @@ -395,7 +395,7 @@ export class AddonModChoiceProvider { * @param courseId Course ID the choice belongs to. * @param responses IDs of selected options. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if response was sent to server, false if stored in device. + * @returns Promise resolved with boolean: true if response was sent to server, false if stored in device. */ async submitResponse(choiceId: number, name: string, courseId: number, responses: number[], siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -436,7 +436,7 @@ export class AddonModChoiceProvider { * @param choiceId Choice ID. * @param responses IDs of selected options. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when responses are successfully submitted. + * @returns Promise resolved when responses are successfully submitted. */ async submitResponseOnline(choiceId: number, responses: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/choice/services/handlers/prefetch.ts b/src/addons/mod/choice/services/handlers/prefetch.ts index a45388d8e..b406d1ab5 100644 --- a/src/addons/mod/choice/services/handlers/prefetch.ts +++ b/src/addons/mod/choice/services/handlers/prefetch.ts @@ -49,7 +49,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchChoice( module: CoreCourseAnyModuleData, @@ -81,9 +81,10 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref /** * Prefetch choice results. * - * @param choiceId Choice ID. + * @param choiceId Choice Id. + * @param courseId Course Id. * @param modOptions Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchResults( choiceId: number, @@ -132,7 +133,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise { return AddonModChoice.invalidateChoiceData(courseId); @@ -144,7 +145,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ sync(module: CoreCourseAnyModuleData, courseId: number, siteId?: string): Promise { return AddonModChoiceSync.syncChoice(module.instance, undefined, siteId); diff --git a/src/addons/mod/choice/services/handlers/sync-cron.ts b/src/addons/mod/choice/services/handlers/sync-cron.ts index d59dc5aed..70b20bf18 100644 --- a/src/addons/mod/choice/services/handlers/sync-cron.ts +++ b/src/addons/mod/choice/services/handlers/sync-cron.ts @@ -31,7 +31,7 @@ export class AddonModChoiceSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModChoiceSync.syncAllChoices(siteId, force); @@ -40,7 +40,7 @@ export class AddonModChoiceSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModChoiceSync.syncInterval; diff --git a/src/addons/mod/data/classes/base-field-plugin-component.ts b/src/addons/mod/data/classes/base-field-plugin-component.ts index 221f362a3..6fb1d032f 100644 --- a/src/addons/mod/data/classes/base-field-plugin-component.ts +++ b/src/addons/mod/data/classes/base-field-plugin-component.ts @@ -60,7 +60,7 @@ export abstract class AddonModDataFieldPluginBaseComponent implements OnInit, On } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.init(); @@ -89,7 +89,7 @@ export abstract class AddonModDataFieldPluginBaseComponent implements OnInit, On this.value = value; } - /** Magic mode getters */ + /* Magic mode getters */ get listMode(): boolean { return this.mode == AddonModDataTemplateMode.LIST; } diff --git a/src/addons/mod/data/components/action/action.ts b/src/addons/mod/data/components/action/action.ts index e77896781..20125df2c 100644 --- a/src/addons/mod/data/components/action/action.ts +++ b/src/addons/mod/data/components/action/action.ts @@ -57,7 +57,7 @@ export class AddonModDataActionComponent implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (this.action == AddonModDataAction.USERPICTURE) { @@ -122,7 +122,7 @@ export class AddonModDataActionComponent implements OnInit { /** * Undo delete action. * - * @return Solved when done. + * @returns Solved when done. */ async undoDelete(): Promise { const dataId = this.database.id; diff --git a/src/addons/mod/data/components/field-plugin/field-plugin.ts b/src/addons/mod/data/components/field-plugin/field-plugin.ts index 9dafa2696..e6a24f99a 100644 --- a/src/addons/mod/data/components/field-plugin/field-plugin.ts +++ b/src/addons/mod/data/components/field-plugin/field-plugin.ts @@ -47,7 +47,7 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { fieldLoaded = false; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.field) { diff --git a/src/addons/mod/data/components/index/index.ts b/src/addons/mod/data/components/index/index.ts index dac618687..1feb291b2 100644 --- a/src/addons/mod/data/components/index/index.ts +++ b/src/addons/mod/data/components/index/index.ts @@ -158,7 +158,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -185,7 +185,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModDataAutoSyncData): boolean { if (this.database && syncEventData.dataId == this.database.id && syncEventData.entryId === undefined) { @@ -277,7 +277,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Fetch current database entries. * - * @return Resolved then done. + * @returns Resolved then done. */ protected async fetchEntriesData(): Promise { @@ -407,7 +407,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp * Performs the search and closes the modal. * * @param page Page number. - * @return Resolved when done. + * @returns Resolved when done. */ async searchEntries(page: number): Promise { this.showLoading = true; @@ -441,7 +441,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp * Set group to see the database. * * @param groupId Group ID. - * @return Resolved when new group is selected or rejected if not. + * @returns Resolved when new group is selected or rejected if not. */ async setGroup(groupId: number): Promise { this.selectedGroup = groupId; @@ -511,7 +511,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModDataPrefetchHandler.sync(this.module, this.courseId); @@ -521,7 +521,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModDataSyncResult): boolean { return result.updated; diff --git a/src/addons/mod/data/components/search/search.ts b/src/addons/mod/data/components/search/search.ts index 42fbd7e54..954e944a9 100644 --- a/src/addons/mod/data/components/search/search.ts +++ b/src/addons/mod/data/components/search/search.ts @@ -89,7 +89,7 @@ export class AddonModDataSearchComponent implements OnInit { /** * Displays Advanced Search Fields. * - * @return Generated HTML. + * @returns Generated HTML. */ protected renderAdvancedSearchFields(): string { this.jsData = { @@ -139,7 +139,7 @@ export class AddonModDataSearchComponent implements OnInit { * Retrieve the entered data in search in a form. * * @param searchedData Array with the entered form values. - * @return Array with the answers. + * @returns Array with the answers. */ getSearchDataFromForm(searchedData: CoreFormFields): AddonModDataSearchEntriesAdvancedField[] { const advancedSearch: AddonModDataSearchEntriesAdvancedField[] = []; diff --git a/src/addons/mod/data/fields/checkbox/services/handler.ts b/src/addons/mod/data/fields/checkbox/services/handler.ts index afbf87c6c..2bc249e5e 100644 --- a/src/addons/mod/data/fields/checkbox/services/handler.ts +++ b/src/addons/mod/data/fields/checkbox/services/handler.ts @@ -104,7 +104,7 @@ export class AddonModDataFieldCheckboxHandlerService implements AddonModDataFiel * * @param field Defines the field to be rendered. * @param inputData Data entered in the edit form. - * @return String with the notification or false. + * @returns String with the notification or false. */ getFieldsNotifications(field: AddonModDataField, inputData: AddonModDataSubfieldData[]): string | undefined { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { diff --git a/src/addons/mod/data/fields/file/component/file.ts b/src/addons/mod/data/fields/file/component/file.ts index 712c58d54..11abea5bb 100644 --- a/src/addons/mod/data/fields/file/component/file.ts +++ b/src/addons/mod/data/fields/file/component/file.ts @@ -35,7 +35,7 @@ export class AddonModDataFieldFileComponent extends AddonModDataFieldPluginBaseC * Get the files from the input value. * * @param value Input value. - * @return List of files. + * @returns List of files. */ protected getFiles(value?: Partial): CoreFileEntry[] { let files = value?.files || []; diff --git a/src/addons/mod/data/fields/latlong/component/latlong.ts b/src/addons/mod/data/fields/latlong/component/latlong.ts index 845511de7..38398beae 100644 --- a/src/addons/mod/data/fields/latlong/component/latlong.ts +++ b/src/addons/mod/data/fields/latlong/component/latlong.ts @@ -45,7 +45,7 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa * * @param north Degrees north. * @param east Degrees East. - * @return Readable Latitude and logitude. + * @returns Readable Latitude and logitude. */ formatLatLong(north?: number, east?: number): string { if (north !== undefined || east !== undefined) { @@ -65,7 +65,7 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa * * @param north Degrees north. * @param east Degrees East. - * @return Link to maps depending on platform. + * @returns Link to maps depending on platform. */ getLatLongLink(north?: number, east?: number): SafeUrl { let url = ''; @@ -113,7 +113,7 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa /** * Get user location. * - * @param $event The event. + * @param event The event. */ async getLocation(event: Event): Promise { event.preventDefault(); @@ -151,6 +151,7 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginBa * Get error message from a geolocation error. * * @param error Geolocation error. + * @returns Geolocation message to be translated. */ protected getGeolocationErrorMessage(error: CoreGeolocationError): string { // tslint:disable-next-line: switch-default diff --git a/src/addons/mod/data/fields/picture/component/picture.ts b/src/addons/mod/data/fields/picture/component/picture.ts index ce1493a2c..6b99f0c10 100644 --- a/src/addons/mod/data/fields/picture/component/picture.ts +++ b/src/addons/mod/data/fields/picture/component/picture.ts @@ -43,7 +43,7 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginBa * Get the files from the input value. * * @param value Input value. - * @return List of files. + * @returns List of files. */ protected getFiles(value?: Partial): CoreFileEntry[] { let files = value?.files || []; @@ -61,7 +61,7 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginBa * * @param files File list where to search. * @param filenameSeek Filename to search. - * @return File found or false. + * @returns File found or false. */ protected findFile( files: CoreFileEntry[], diff --git a/src/addons/mod/data/fields/textarea/component/textarea.ts b/src/addons/mod/data/fields/textarea/component/textarea.ts index f49eefdaf..eabe4fd01 100644 --- a/src/addons/mod/data/fields/textarea/component/textarea.ts +++ b/src/addons/mod/data/fields/textarea/component/textarea.ts @@ -34,7 +34,7 @@ export class AddonModDataFieldTextareaComponent extends AddonModDataFieldPluginB * Format value to be shown. Replacing plugin file Urls. * * @param value Value to replace. - * @return Replaced string to be rendered. + * @returns Replaced string to be rendered. */ format(value?: Partial): string { const files: CoreWSFile[] = (value && value.files) || []; diff --git a/src/addons/mod/data/pages/edit/edit.ts b/src/addons/mod/data/pages/edit/edit.ts index 260535741..e95ec4a5e 100644 --- a/src/addons/mod/data/pages/edit/edit.ts +++ b/src/addons/mod/data/pages/edit/edit.ts @@ -122,7 +122,7 @@ export class AddonModDataEditPage implements OnInit { /** * Check if we can leave the page or not and ask to confirm the lost of data. * - * @return True if we can leave, false otherwise. + * @returns True if we can leave, false otherwise. */ async canLeave(): Promise { if (this.forceLeave || !this.entry) { @@ -152,7 +152,7 @@ export class AddonModDataEditPage implements OnInit { * Fetch the entry data. * * @param refresh To refresh all downloaded data. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchEntryData(refresh = false): Promise { try { @@ -240,7 +240,7 @@ export class AddonModDataEditPage implements OnInit { * Saves data. * * @param e Event. - * @return Resolved when done. + * @returns Resolved when done. */ async save(e: Event): Promise { e.preventDefault(); @@ -384,7 +384,7 @@ export class AddonModDataEditPage implements OnInit { * Set group to see the database. * * @param groupId Group identifier to set. - * @return Resolved when done. + * @returns Resolved when done. */ setGroup(groupId: number): Promise { this.selectedGroup = groupId; @@ -396,7 +396,7 @@ export class AddonModDataEditPage implements OnInit { /** * Displays Edit Search Fields. * - * @return Generated HTML. + * @returns Generated HTML. */ protected displayEditFields(): string { this.jsData = { @@ -464,7 +464,7 @@ export class AddonModDataEditPage implements OnInit { /** * Return to the entry list (previous page) discarding temp data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async returnToEntryList(): Promise { const inputData = this.editForm.value; diff --git a/src/addons/mod/data/pages/entry/entry.ts b/src/addons/mod/data/pages/entry/entry.ts index bf24b7ef3..9e5be571d 100644 --- a/src/addons/mod/data/pages/entry/entry.ts +++ b/src/addons/mod/data/pages/entry/entry.ts @@ -157,7 +157,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { * * @param refresh Whether to refresh the current data or not. * @param isPtr Whether is a pull to refresh action. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchEntryData(refresh = false, isPtr = false): Promise { this.isPullingToRefresh = isPtr; @@ -232,7 +232,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { * Go to selected entry without changing state. * * @param offset Entry offset. - * @return Resolved when done. + * @returns Resolved when done. */ async gotoEntry(offset: number): Promise { this.offset = offset; @@ -248,7 +248,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { * Refresh all the data. * * @param isPtr Whether is a pull to refresh action. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshAllData(isPtr?: boolean): Promise { const promises: Promise[] = []; @@ -276,7 +276,6 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. */ refreshDatabase(refresher?: IonRefresher): void { if (!this.entryLoaded) { @@ -292,7 +291,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { * Set group to see the database. * * @param groupId Group identifier to set. - * @return Resolved when done. + * @returns Resolved when done. */ async setGroup(groupId: number): Promise { this.selectedGroup = groupId; @@ -308,7 +307,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { /** * Convenience function to fetch the entry and set next/previous entries. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async setEntryFromOffset(): Promise { if (this.offset === undefined && this.entryId !== undefined) { @@ -412,7 +411,7 @@ export class AddonModDataEntryPage implements OnInit, OnDestroy { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.syncObserver?.off(); diff --git a/src/addons/mod/data/pages/index/index.ts b/src/addons/mod/data/pages/index/index.ts index 0e982371b..4736872dc 100644 --- a/src/addons/mod/data/pages/index/index.ts +++ b/src/addons/mod/data/pages/index/index.ts @@ -31,7 +31,7 @@ export class AddonModDataIndexPage extends CoreCourseModuleMainActivityPage | undefined; @@ -50,7 +50,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * * @param field Defines the field to be rendered. * @param inputData Data entered in the search form. - * @return With name and value of the data to be sent. + * @returns With name and value of the data to be sent. */ getFieldSearchData?( field: AddonModDataField, @@ -62,7 +62,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * * @param field Defines the field to be rendered. * @param inputData Data entered in the edit form. - * @return With name and value of the data to be sent. + * @returns With name and value of the data to be sent. */ getFieldEditData?( field: AddonModDataField, @@ -77,7 +77,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * @param field Defines the field to be rendered. * @param inputData Data entered in the edit form. * @param originalFieldData Original field entered data. - * @return If the field has changes. + * @returns If the field has changes. */ hasFieldDataChanged?( field: AddonModDataField, @@ -89,7 +89,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * Get field edit files in the input data. * * @param field Defines the field.. - * @return With name and value of the data to be sent. + * @returns With name and value of the data to be sent. */ getFieldEditFiles?( field: AddonModDataField, @@ -102,7 +102,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * * @param field Defines the field to be rendered. * @param inputData Data entered in the edit form. - * @return String with the notification or false. + * @returns String with the notification or false. */ getFieldsNotifications?(field: AddonModDataField, inputData: AddonModDataSubfieldData[]): string | undefined; @@ -112,7 +112,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * @param originalContent Original data to be overriden. * @param offlineContent Array with all the offline data to override. * @param offlineFiles Array with all the offline files in the field. - * @return Data overriden + * @returns Data overriden */ overrideData?( originalContent: AddonModDataEntryField, @@ -139,7 +139,7 @@ export class AddonModDataFieldsDelegateService extends CoreDelegate | undefined> { return Promise.resolve(this.executeFunctionOnEnabled(field.type, 'getComponent', [field])); @@ -150,7 +150,7 @@ export class AddonModDataFieldsDelegateService extends CoreDelegate { if (courseId) { @@ -457,7 +457,7 @@ export class AddonModDataHelperProvider { * * @param type Type of template. * @param fields List of database fields. - * @return Template HTML. + * @returns Template HTML. */ getDefaultTemplate(type: AddonModDataTemplateType, fields: AddonModDataField[]): string { if (type == AddonModDataTemplateType.LIST_HEADER || type == AddonModDataTemplateType.LIST_FOOTER) { @@ -542,7 +542,7 @@ export class AddonModDataHelperProvider { * @param entryContents Original entry contents. * @param offline True to prepare the data for an offline uploading, false otherwise. * @param siteId Site ID. If not defined, current site. - * @return That contains object with the answers. + * @returns That contains object with the answers. */ async getEditDataFromForm( inputData: CoreFormFields, @@ -607,7 +607,7 @@ export class AddonModDataHelperProvider { * @param inputData Array with the entered form values. * @param fields Fields that defines every content in the entry. * @param entryContents Original entry contents indexed by field id. - * @return That contains object with the files. + * @returns That contains object with the files. */ async getEditTmpFiles( inputData: CoreFormFields, @@ -634,7 +634,7 @@ export class AddonModDataHelperProvider { * @param entryId Entry ID or, if creating, timemodified. * @param fieldId Field ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getStoredFiles(dataId: number, entryId: number, fieldId: number, siteId?: string): Promise { const folderPath = await AddonModDataOffline.getEntryFieldFolder(dataId, entryId, fieldId, siteId); @@ -653,7 +653,7 @@ export class AddonModDataHelperProvider { * @param data Database object. * @param type Type of template. * @param fields List of database fields. - * @return Template HTML. + * @returns Template HTML. */ getTemplate(data: AddonModDataData, type: AddonModDataTemplateType, fields: AddonModDataField[]): string { let template = data[type] || this.getDefaultTemplate(type, fields); @@ -677,9 +677,8 @@ export class AddonModDataHelperProvider { * * @param inputData Object with the entered form values. * @param fields Fields that defines every content in the entry. - * @param dataId Database Id. If set, fils will be uploaded and itemId set. * @param entryContents Original entry contents indexed by field id. - * @return True if changed, false if not. + * @returns True if changed, false if not. */ hasEditDataChanged( inputData: CoreFormFields, @@ -747,7 +746,7 @@ export class AddonModDataHelperProvider { * @param fieldId Field ID. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeFiles( dataId: number, @@ -772,7 +771,7 @@ export class AddonModDataHelperProvider { * @param files List of files. * @param offline True if files sould be stored for offline, false to upload them. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the itemId for the uploaded file/s. + * @returns Promise resolved with the itemId for the uploaded file/s. */ async uploadOrStoreFiles( dataId: number, diff --git a/src/addons/mod/data/services/data-offline.ts b/src/addons/mod/data/services/data-offline.ts index c4defe031..f098a4f7b 100644 --- a/src/addons/mod/data/services/data-offline.ts +++ b/src/addons/mod/data/services/data-offline.ts @@ -35,7 +35,7 @@ export class AddonModDataOfflineProvider { * @param dataId Database ID. * @param entryId Database entry ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteAllEntryActions(dataId: number, entryId: number, siteId?: string): Promise { const actions = await this.getEntryActions(dataId, entryId, siteId); @@ -54,7 +54,7 @@ export class AddonModDataOfflineProvider { * @param entryId Database entry Id. * @param action Action to be done * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteEntry(dataId: number, entryId: number, action: AddonModDataAction, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -75,7 +75,7 @@ export class AddonModDataOfflineProvider { * @param entryId Database entry ID. * @param action Action to be done. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ protected async deleteEntryFiles(dataId: number, entryId: number, action: AddonModDataAction, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -110,7 +110,7 @@ export class AddonModDataOfflineProvider { * Get all the stored entry data from all the databases. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entries. + * @returns Promise resolved with entries. */ async getAllEntries(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -124,7 +124,7 @@ export class AddonModDataOfflineProvider { * * @param dataId Database ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entries. + * @returns Promise resolved with entries. */ async getDatabaseEntries(dataId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -144,7 +144,7 @@ export class AddonModDataOfflineProvider { * @param entryId Database entry Id. * @param action Action to be done * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entry. + * @returns Promise resolved with entry. */ async getEntry( dataId: number, @@ -168,7 +168,7 @@ export class AddonModDataOfflineProvider { * @param dataId Database ID. * @param entryId Database entry Id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entry actions. + * @returns Promise resolved with entry actions. */ async getEntryActions(dataId: number, entryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -185,7 +185,7 @@ export class AddonModDataOfflineProvider { * * @param dataId Database ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline answers, false otherwise. + * @returns Promise resolved with boolean: true if has offline answers, false otherwise. */ async hasOfflineData(dataId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -200,7 +200,7 @@ export class AddonModDataOfflineProvider { * * @param dataId Database ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ protected async getDatabaseFolder(dataId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -217,7 +217,7 @@ export class AddonModDataOfflineProvider { * @param entryId The ID of the entry. * @param fieldId Field ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getEntryFieldFolder(dataId: number, entryId: number, fieldId: number, siteId?: string): Promise { const folderPath = await this.getDatabaseFolder(dataId, siteId); @@ -229,7 +229,7 @@ export class AddonModDataOfflineProvider { * Parse "fields" of an offline record. * * @param record Record object - * @return Record object with columns parsed. + * @returns Record object with columns parsed. */ protected parseRecord(record: AddonModDataEntryDBRecord): AddonModDataOfflineAction { return Object.assign(record, { @@ -248,7 +248,7 @@ export class AddonModDataOfflineProvider { * @param fields Array of field data of the entry if needed. * @param timemodified The time the entry was modified. If not defined, current time. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveEntry( dataId: number, diff --git a/src/addons/mod/data/services/data-sync.ts b/src/addons/mod/data/services/data-sync.ts index 1cb1de333..5e76877bc 100644 --- a/src/addons/mod/data/services/data-sync.ts +++ b/src/addons/mod/data/services/data-sync.ts @@ -52,7 +52,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param dataId Database ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has data to sync, false otherwise. + * @returns Promise resolved with boolean: true if has data to sync, false otherwise. */ hasDataToSync(dataId: number, siteId?: string): Promise { return AddonModDataOffline.hasOfflineData(dataId, siteId); @@ -63,7 +63,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllDatabases(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all databases', (siteId) => this.syncAllDatabasesFunc(!!force, siteId), siteId); @@ -74,7 +74,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. If not defined, sync all sites. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllDatabasesFunc(force: boolean, siteId: string): Promise { const promises: Promise[] = []; @@ -115,7 +115,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param dataId Database ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is synced or if it doesn't need to be synced. + * @returns Promise resolved when the data is synced or if it doesn't need to be synced. */ async syncDatabaseIfNeeded(dataId: number, siteId?: string): Promise { const needed = await this.isSyncNeeded(dataId, siteId); @@ -130,7 +130,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param dataId Data ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ syncDatabase(dataId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -160,7 +160,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param dataId Data ID. * @param siteId Site ID. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ protected async performSyncDatabase(dataId: number, siteId: string): Promise { // Sync offline logs. @@ -227,7 +227,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * @param entryActions Entry actions. * @param result Object with the result of the sync. * @param siteId Site ID. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ protected async syncEntry( database: AddonModDataData, @@ -259,7 +259,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * @param entryActions Entry actions. * @param result Object with the result of the sync. * @param siteId Site ID. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ protected async performSyncEntry( database: AddonModDataData, @@ -424,7 +424,7 @@ export class AddonModDataSyncProvider extends CoreCourseActivitySyncBaseProvider * @param cmId Course module to be synced. If not defined, sync all databases. * @param force Wether to force sync not depending on last execution. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncRatings(cmId?: number, force?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/addons/mod/data/services/data.ts b/src/addons/mod/data/services/data.ts index 09275a88a..c4b0f18c3 100644 --- a/src/addons/mod/data/services/data.ts +++ b/src/addons/mod/data/services/data.ts @@ -101,7 +101,7 @@ export class AddonModDataProvider { * @param fields The fields that define the contents. * @param siteId Site ID. If not defined, current site. * @param forceOffline Force editing entry in offline. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async addEntry( dataId: number, @@ -174,7 +174,7 @@ export class AddonModDataProvider { * @param data The fields data to be created. * @param groupId Group id, 0 means that the function will determine the user group. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async addEntryOnline( dataId: number, @@ -203,7 +203,7 @@ export class AddonModDataProvider { * @param approve Whether to approve (true) or unapprove the entry. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async approveEntry( dataId: number, @@ -262,7 +262,7 @@ export class AddonModDataProvider { * @param entryId Entry ID. * @param approve Whether to approve (true) or unapprove the entry. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async approveEntryOnline(entryId: number, approve: boolean, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -279,7 +279,7 @@ export class AddonModDataProvider { * * @param fields The fields that define the contents. * @param contents The contents data of the fields. - * @return Array of notifications if any or false. + * @returns Array of notifications if any or false. */ protected checkFields(fields: AddonModDataField[], contents: AddonModDataSubfieldData[]): AddonModDataFieldNotification[] { const notifications: AddonModDataFieldNotification[] = []; @@ -307,7 +307,7 @@ export class AddonModDataProvider { * @param entryId Entry ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async deleteEntry(dataId: number, entryId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -356,7 +356,7 @@ export class AddonModDataProvider { * * @param entryId Entry ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async deleteEntryOnline(entryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -374,7 +374,7 @@ export class AddonModDataProvider { * @param entryId Entry ID. * @param action Action name to delete. * @param siteId Site ID. - * @return Resolved with true if the action has been found and deleted. + * @returns Resolved with true if the action has been found and deleted. */ protected async deleteEntryOfflineAction( dataId: number, @@ -404,7 +404,7 @@ export class AddonModDataProvider { * @param fields The fields that define the contents. * @param siteId Site ID. If not defined, current site. * @param forceOffline Force editing entry in offline. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async editEntry( dataId: number, @@ -473,7 +473,7 @@ export class AddonModDataProvider { * @param entryId Entry ID. * @param data The fields data to be updated. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async editEntryOnline( entryId: number, @@ -494,7 +494,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ fetchAllEntries(dataId: number, options: AddonModDataGetEntriesOptions = {}): Promise { options.siteId = options.siteId || CoreSites.getCurrentSiteId(); @@ -512,7 +512,7 @@ export class AddonModDataProvider { * @param dataId Data ID. * @param entries Entries already fetch (just to concatenate them). * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchEntriesRecursive( dataId: number, @@ -536,7 +536,7 @@ export class AddonModDataProvider { * Get cache key for data data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getDatabaseDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'data:' + courseId; @@ -546,7 +546,7 @@ export class AddonModDataProvider { * Get prefix cache key for all database activity data WS calls. * * @param dataId Data ID. - * @return Cache key. + * @returns Cache key. */ protected getDatabaseDataPrefixCacheKey(dataId: number): string { return ROOT_CACHE_KEY + dataId; @@ -559,7 +559,7 @@ export class AddonModDataProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the data is retrieved. + * @returns Promise resolved when the data is retrieved. */ protected async getDatabaseByKey( courseId: number, @@ -595,7 +595,7 @@ export class AddonModDataProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the data is retrieved. + * @returns Promise resolved when the data is retrieved. */ getDatabase(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getDatabaseByKey(courseId, 'coursemodule', cmId, options); @@ -607,7 +607,7 @@ export class AddonModDataProvider { * @param courseId Course ID. * @param id Data ID. * @param options Other options. - * @return Promise resolved when the data is retrieved. + * @returns Promise resolved when the data is retrieved. */ getDatabaseById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getDatabaseByKey(courseId, 'id', id, options); @@ -617,7 +617,7 @@ export class AddonModDataProvider { * Get prefix cache key for all database access information data WS calls. * * @param dataId Data ID. - * @return Cache key. + * @returns Cache key. */ protected getDatabaseAccessInformationDataPrefixCacheKey(dataId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':access:'; @@ -628,7 +628,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param groupId Group ID. - * @return Cache key. + * @returns Cache key. */ protected getDatabaseAccessInformationDataCacheKey(dataId: number, groupId: number = 0): string { return this.getDatabaseAccessInformationDataPrefixCacheKey(dataId) + groupId; @@ -639,7 +639,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param options Other options. - * @return Promise resolved when the database is retrieved. + * @returns Promise resolved when the database is retrieved. */ async getDatabaseAccessInformation( dataId: number, @@ -669,7 +669,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param options Other options. - * @return Promise resolved when the database is retrieved. + * @returns Promise resolved when the database is retrieved. */ async getEntries(dataId: number, options: AddonModDataGetEntriesOptions = {}): Promise { options = Object.assign({ @@ -714,7 +714,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param groupId Group ID. - * @return Cache key. + * @returns Cache key. */ protected getEntriesCacheKey(dataId: number, groupId: number = 0): string { return this.getEntriesPrefixCacheKey(dataId) + groupId; @@ -724,7 +724,7 @@ export class AddonModDataProvider { * Get prefix cache key for database all entries data WS calls. * * @param dataId Data ID. - * @return Cache key. + * @returns Cache key. */ protected getEntriesPrefixCacheKey(dataId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':entries:'; @@ -736,7 +736,7 @@ export class AddonModDataProvider { * @param dataId Data ID for caching purposes. * @param entryId Entry ID. * @param options Other options. - * @return Promise resolved when the entry is retrieved. + * @returns Promise resolved when the entry is retrieved. */ async getEntry( dataId: number, @@ -782,7 +782,7 @@ export class AddonModDataProvider { * * @param dataId Data ID for caching purposes. * @param entryId Entry ID. - * @return Cache key. + * @returns Cache key. */ protected getEntryCacheKey(dataId: number, entryId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':entry:' + entryId; @@ -793,7 +793,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param options Other options. - * @return Promise resolved when the fields are retrieved. + * @returns Promise resolved when the fields are retrieved. */ async getFields(dataId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -822,7 +822,7 @@ export class AddonModDataProvider { * Get cache key for database fields data WS calls. * * @param dataId Data ID. - * @return Cache key. + * @returns Cache key. */ protected getFieldsCacheKey(dataId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':fields'; @@ -835,7 +835,7 @@ export class AddonModDataProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -865,7 +865,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDatabaseAccessInformationData(dataId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -878,7 +878,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateEntriesData(dataId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -891,7 +891,7 @@ export class AddonModDataProvider { * * @param dataId Data ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateFieldsData(dataId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -904,7 +904,7 @@ export class AddonModDataProvider { * * @param moduleId The module ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the files are invalidated. + * @returns Promise resolved when the files are invalidated. */ async invalidateFiles(moduleId: number, siteId?: string): Promise { await CoreFilepool.invalidateFilesByComponent(siteId, AddonModDataProvider.COMPONENT, moduleId); @@ -915,7 +915,7 @@ export class AddonModDataProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDatabaseData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -928,7 +928,7 @@ export class AddonModDataProvider { * * @param databaseId Data ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDatabaseWSData(databaseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -942,7 +942,7 @@ export class AddonModDataProvider { * @param dataId Data ID for caching purposes. * @param entryId Entry ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateEntryData(dataId: number, entryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -956,7 +956,7 @@ export class AddonModDataProvider { * @param id Module ID. * @param name Name of the data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModDataViewDatabaseWSParams = { @@ -980,7 +980,7 @@ export class AddonModDataProvider { * * @param dataId The data instance id. * @param options Other options. - * @return Promise resolved when the action is done. + * @returns Promise resolved when the action is done. */ async searchEntries(dataId: number, options: AddonModDataSearchEntriesOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); diff --git a/src/addons/mod/data/services/handlers/prefetch.ts b/src/addons/mod/data/services/handlers/prefetch.ts index 47492dd90..49a2027a8 100644 --- a/src/addons/mod/data/services/handlers/prefetch.ts +++ b/src/addons/mod/data/services/handlers/prefetch.ts @@ -44,7 +44,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet * @param dataId Database Id. * @param groups Array of groups in the activity. * @param options Other options. - * @return All unique entries. + * @returns All unique entries. */ protected async getAllUniqueEntries( dataId: number, @@ -76,7 +76,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet * @param courseId Course ID the module belongs to. * @param omitFail True to always return even if fails. Default false. * @param options Other options. - * @return Promise resolved with the info fetched. + * @returns Promise resolved with the info fetched. */ protected async getDatabaseInfoHelper( module: CoreCourseAnyModuleData, @@ -130,7 +130,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet * Returns the file contained in the entries. * * @param entries List of entries to get files from. - * @return List of files. + * @returns List of files. */ protected getEntriesFiles(entries: AddonModDataEntry[]): CoreWSFile[] { let files: CoreWSFile[] = []; @@ -216,7 +216,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet * @param module Module. * @param courseId Course ID the module belongs to. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchDatabase(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const options = { @@ -275,7 +275,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async sync(module: CoreCourseAnyModuleData, courseId: number, siteId?: string): Promise { const promises = [ diff --git a/src/addons/mod/feedback/classes/feedback-attempts-source.ts b/src/addons/mod/feedback/classes/feedback-attempts-source.ts index 62410098d..fe3c6f74d 100644 --- a/src/addons/mod/feedback/classes/feedback-attempts-source.ts +++ b/src/addons/mod/feedback/classes/feedback-attempts-source.ts @@ -70,8 +70,8 @@ export class AddonModFeedbackAttemptsSource extends CoreRoutedItemsManagerSource /** * Type guard to infer AddonModFeedbackWSAttempt objects. * - * @param discussion Item to check. - * @return Whether the item is an identifieable attempt. + * @param attempt Attempt to check. + * @returns Whether the item is an identifieable attempt. */ isIdentifiableAttempt(attempt: AddonModFeedbackAttemptItem): attempt is AddonModFeedbackWSAttempt { return 'fullname' in attempt; @@ -80,8 +80,8 @@ export class AddonModFeedbackAttemptsSource extends CoreRoutedItemsManagerSource /** * Type guard to infer AddonModFeedbackWSAnonAttempt objects. * - * @param discussion Item to check. - * @return Whether the item is an anonymous attempt. + * @param attempt Attempt to check. + * @returns Whether the item is an anonymous attempt. */ isAnonymousAttempt(attempt: AddonModFeedbackAttemptItem): attempt is AddonModFeedbackWSAnonAttempt { return 'number' in attempt; diff --git a/src/addons/mod/feedback/components/index/index.ts b/src/addons/mod/feedback/components/index/index.ts index cb20702f5..c02c0fa53 100644 --- a/src/addons/mod/feedback/components/index/index.ts +++ b/src/addons/mod/feedback/components/index/index.ts @@ -224,7 +224,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to get feedback overview data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchFeedbackOverviewData(): Promise { const promises: Promise[] = []; @@ -258,8 +258,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to get feedback analysis data. * - * @param accessData Retrieved access data. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchFeedbackAnalysisData(): Promise { try { @@ -279,7 +278,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity * Fetch Group info data. * * @param cmId Course module ID. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchGroupInfo(cmId: number): Promise { this.groupInfo = await CoreGroups.getActivityGroupInfo(cmId); @@ -291,7 +290,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity * Parse the analysis info to show the info correctly formatted. * * @param item Item to parse. - * @return Parsed item. + * @returns Parsed item. */ protected parseAnalysisInfo(item: AddonModFeedbackItem): AddonModFeedbackItem { switch (item.typ) { @@ -439,7 +438,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity * Set group to see the analysis. * * @param groupId Group ID. - * @return Resolved when done. + * @returns Resolved when done. */ async setGroup(groupId: number): Promise { this.group = groupId; @@ -489,7 +488,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); diff --git a/src/addons/mod/feedback/pages/attempt/attempt.ts b/src/addons/mod/feedback/pages/attempt/attempt.ts index c83b91289..762aa611c 100644 --- a/src/addons/mod/feedback/pages/attempt/attempt.ts +++ b/src/addons/mod/feedback/pages/attempt/attempt.ts @@ -90,7 +90,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy { /** * Fetch all the data required for the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -143,6 +143,7 @@ export class AddonModFeedbackAttemptPage implements OnInit, OnDestroy { * Check if an attempt is anonymous or not. * * @param attempt Attempt to check. + * @returns If attempt is anonymous. */ isAnonAttempt(attempt: AddonModFeedbackWSAttempt | AddonModFeedbackWSAnonAttempt): attempt is AddonModFeedbackWSAnonAttempt { return !('fullname' in attempt); diff --git a/src/addons/mod/feedback/pages/form/form.ts b/src/addons/mod/feedback/pages/form/form.ts index c3d5a08c5..3ff6d0e44 100644 --- a/src/addons/mod/feedback/pages/form/form.ts +++ b/src/addons/mod/feedback/pages/form/form.ts @@ -154,7 +154,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { /** * Fetch all the data required for the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -195,7 +195,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { * Fetch access information. * * @param options Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAccessData(options: CoreCourseCommonModWSOptions): Promise { try { @@ -218,7 +218,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { * Get resume page from WS. * * @param options Options. - * @return Promise resolved with the page to resume. + * @returns Promise resolved with the page to resume. */ protected async fetchResumePage(options: CoreCourseCommonModWSOptions): Promise { try { @@ -241,7 +241,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { * Fetch page data. * * @param page Page to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchFeedbackPageData(page: number = 0): Promise { this.items = []; @@ -261,7 +261,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { * Fetch page items. * * @param page Page to get. - * @return Promise resolved with WS response. + * @returns Promise resolved with WS response. */ protected async fetchPageItems(page: number): Promise { const options = { @@ -309,7 +309,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { * Function to allow page navigation through the questions form. * * @param goPrevious If true it will go back to the previous page, if false, it will go forward. - * @return Resolved when done. + * @returns Resolved when done. */ async gotoPage(goPrevious: boolean): Promise { this.content?.scrollToTop(); @@ -406,6 +406,8 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { /** * Function to go to the page after submit. + * + * @returns Promise resolved when done. */ async continue(): Promise { if (!this.siteAfterSubmit) { @@ -426,7 +428,7 @@ export class AddonModFeedbackFormPage implements OnInit, OnDestroy, CanLeave { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.onlineObserver.unsubscribe(); diff --git a/src/addons/mod/feedback/pages/index/index.ts b/src/addons/mod/feedback/pages/index/index.ts index a33a9b741..4d050e9ba 100644 --- a/src/addons/mod/feedback/pages/index/index.ts +++ b/src/addons/mod/feedback/pages/index/index.ts @@ -32,7 +32,7 @@ export class AddonModFeedbackIndexPage extends CoreCourseModuleMainActivityPage< selectedGroup?: number; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { super.ngOnInit(); diff --git a/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.ts b/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.ts index db568a32a..a192fc6b4 100644 --- a/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.ts +++ b/src/addons/mod/feedback/pages/nonrespondents/nonrespondents.ts @@ -66,7 +66,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit { * Fetch all the data required for the view. * * @param refresh Empty events array first. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(refresh: boolean = false): Promise { this.page = 0; @@ -95,7 +95,7 @@ export class AddonModFeedbackNonRespondentsPage implements OnInit { * Load Group responses. * * @param groupId If defined it will change group if not, it will load more users for the same group. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadGroupUsers(groupId?: number): Promise { this.loadMoreError = false; diff --git a/src/addons/mod/feedback/services/feedback-helper.ts b/src/addons/mod/feedback/services/feedback-helper.ts index 0403f4556..47920a859 100644 --- a/src/addons/mod/feedback/services/feedback-helper.ts +++ b/src/addons/mod/feedback/services/feedback-helper.ts @@ -50,7 +50,7 @@ export class AddonModFeedbackHelperProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getNonRespondents( feedbackId: number, @@ -67,7 +67,7 @@ export class AddonModFeedbackHelperProvider { * Get page items responses to be sent. * * @param items Items where the values are. - * @return Responses object to be sent. + * @returns Responses object to be sent. */ getPageItemsResponses(items: AddonModFeedbackFormItem[]): Record { const responses: Record = {}; @@ -150,7 +150,7 @@ export class AddonModFeedbackHelperProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getResponsesAnalysis( feedbackId: number, @@ -168,7 +168,7 @@ export class AddonModFeedbackHelperProvider { * * @param params URL params. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleShowEntriesLink(params: Record, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -218,7 +218,7 @@ export class AddonModFeedbackHelperProvider { * Add Image profile url field on some entries. * * @param entries Entries array to get profile from. - * @return Returns the same array with the profileimageurl added if found. + * @returns Returns the same array with the profileimageurl added if found. */ protected async addImageProfile(entries: AddonModFeedbackWSAttempt[]): Promise; protected async addImageProfile(entries: AddonModFeedbackWSNonRespondent[]): Promise; @@ -242,7 +242,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Label. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormLabel(item: AddonModFeedbackItem): AddonModFeedbackFormBasicItem { item.name = ''; @@ -259,7 +259,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Info. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormInfo(item: AddonModFeedbackItem): AddonModFeedbackFormBasicItem | undefined { const formItem: AddonModFeedbackFormBasicItem = Object.assign(item, { @@ -291,7 +291,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Numeric. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormNumeric(item: AddonModFeedbackItem): AddonModFeedbackNumericItem { @@ -315,7 +315,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Text field. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormTextfield(item: AddonModFeedbackItem): AddonModFeedbackTextItem { return Object.assign(item, { @@ -330,7 +330,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Textarea. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormTextarea(item: AddonModFeedbackItem): AddonModFeedbackFormBasicItem { return Object.assign(item, { @@ -344,7 +344,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Multichoice. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormMultichoice(item: AddonModFeedbackItem): AddonModFeedbackMultichoiceItem { @@ -405,7 +405,7 @@ export class AddonModFeedbackHelperProvider { * Helper funtion for item type Captcha. * * @param item Item to process. - * @return Item processed to show form. + * @returns Item processed to show form. */ protected getItemFormCaptcha(item: AddonModFeedbackItem): AddonModFeedbackCaptchaItem { const formItem: AddonModFeedbackCaptchaItem = Object.assign(item, { @@ -429,7 +429,7 @@ export class AddonModFeedbackHelperProvider { * * @param item Item to process. * @param preview Previewing options. - * @return Item processed to show form. + * @returns Item processed to show form. */ getItemForm(item: AddonModFeedbackItem, preview: boolean): AddonModFeedbackFormItem | undefined { switch (item.typ) { @@ -467,7 +467,7 @@ export class AddonModFeedbackHelperProvider { * * @param rangeFrom Range from. * @param rangeTo Range to. - * @return Human-readable boundaries. + * @returns Human-readable boundaries. */ protected getNumericBoundariesForDisplay(rangeFrom: number | string, rangeTo: number | string): string { const rangeFromSet = typeof rangeFrom == 'number'; @@ -488,7 +488,7 @@ export class AddonModFeedbackHelperProvider { * Check if a form item is multichoice. * * @param item Item. - * @return Whether item is multichoice. + * @returns Whether item is multichoice. */ protected isMultiChoiceItem(item: AddonModFeedbackFormItem): item is AddonModFeedbackMultichoiceItem { return item.typ == 'multichoice'; @@ -498,7 +498,7 @@ export class AddonModFeedbackHelperProvider { * Check if a form item is numeric. * * @param item Item. - * @return Whether item is numeric. + * @returns Whether item is numeric. */ protected isNumericItem(item: AddonModFeedbackFormItem): item is AddonModFeedbackNumericItem { return item.typ == 'numeric'; diff --git a/src/addons/mod/feedback/services/feedback-offline.ts b/src/addons/mod/feedback/services/feedback-offline.ts index 1f9187328..2cfaa0a0d 100644 --- a/src/addons/mod/feedback/services/feedback-offline.ts +++ b/src/addons/mod/feedback/services/feedback-offline.ts @@ -32,7 +32,7 @@ export class AddonModFeedbackOfflineProvider { * @param feedbackId Feedback ID. * @param page Page of the form to delete responses from. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteFeedbackPageResponses(feedbackId: number, page: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -47,7 +47,7 @@ export class AddonModFeedbackOfflineProvider { * Get all the stored feedback responses data from all the feedback. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entries. + * @returns Promise resolved with entries. */ async getAllFeedbackResponses(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -62,7 +62,7 @@ export class AddonModFeedbackOfflineProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with responses. + * @returns Promise resolved with responses. */ async getFeedbackResponses(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -80,7 +80,7 @@ export class AddonModFeedbackOfflineProvider { * @param feedbackId Feedback ID. * @param page Page of the form to get responses from. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with responses. + * @returns Promise resolved with responses. */ async getFeedbackPageResponses(feedbackId: number, page: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -100,7 +100,7 @@ export class AddonModFeedbackOfflineProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if the feedback have something to be synced. + * @returns Promise resolved with true if the feedback have something to be synced. */ async hasFeedbackOfflineData(feedbackId: number, siteId?: string): Promise { const responses = await this.getFeedbackResponses(feedbackId, siteId); @@ -111,8 +111,8 @@ export class AddonModFeedbackOfflineProvider { /** * Parse "options" and "attachments" columns of a fetched record. * - * @param records Record object - * @return Record object with columns parsed. + * @param record Record object + * @returns Record object with columns parsed. */ protected parseResponse(record: AddonModFeedbackResponseDBRecord): AddonModFeedbackOfflineResponse { return Object.assign(record, { @@ -128,7 +128,7 @@ export class AddonModFeedbackOfflineProvider { * @param responses The data to be processed the key is the field name (usually type[index]_id) * @param courseId Course ID the feedback belongs to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveResponses( feedbackId: number, diff --git a/src/addons/mod/feedback/services/feedback-sync.ts b/src/addons/mod/feedback/services/feedback-sync.ts index 723198593..5f84a7ceb 100644 --- a/src/addons/mod/feedback/services/feedback-sync.ts +++ b/src/addons/mod/feedback/services/feedback-sync.ts @@ -62,7 +62,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllFeedbacks(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all feedbacks', (siteId) => this.syncAllFeedbacksFunc(!!force, siteId), siteId); @@ -73,7 +73,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. If not defined, sync all sites. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllFeedbacksFunc(force: boolean, siteId?: string): Promise { // Sync all new responses. @@ -108,7 +108,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the feedback is synced or if it doesn't need to be synced. + * @returns Promise resolved when the feedback is synced or if it doesn't need to be synced. */ async syncFeedbackIfNeeded(feedbackId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -125,7 +125,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv * * @param feedbackId Feedback ID to be synced. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ syncFeedback(feedbackId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -153,7 +153,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv * * @param feedbackId Feedback ID. * @param siteId Site ID. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ protected async performSyncFeedback(feedbackId: number, siteId: string): Promise { const result: AddonModFeedbackSyncResult = { @@ -245,7 +245,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv * @param siteId Site Id. * @param timemodified Current completed modification time. * @param result Result object to be modified. - * @return Resolve when done or rejected with error. + * @returns Resolve when done or rejected with error. */ protected async processPage( feedback: AddonModFeedbackWSFeedback, diff --git a/src/addons/mod/feedback/services/feedback.ts b/src/addons/mod/feedback/services/feedback.ts index aac5fc65f..c38e62ff8 100644 --- a/src/addons/mod/feedback/services/feedback.ts +++ b/src/addons/mod/feedback/services/feedback.ts @@ -48,7 +48,7 @@ export class AddonModFeedbackProvider { * * @param items All question items to check dependency. * @param item Item to check. - * @return Return true if dependency is acomplished and it can be shown. False, otherwise. + * @returns Return true if dependency is acomplished and it can be shown. False, otherwise. */ protected checkDependencyItem(items: AddonModFeedbackItem[], item: AddonModFeedbackItem): boolean { const depend = items.find((itemFind) => itemFind.id == item.dependitem); @@ -76,7 +76,7 @@ export class AddonModFeedbackProvider { * * @param item Item to check. * @param dependValue Value to compare. - * @return Return true if dependency is acomplished and it can be shown. False, otherwise. + * @returns Return true if dependency is acomplished and it can be shown. False, otherwise. */ protected compareDependItemMultichoice(item: AddonModFeedbackItem, dependValue: string): boolean { const parts = item.presentation.split(AddonModFeedbackProvider.MULTICHOICE_TYPE_SEP) || []; @@ -127,7 +127,7 @@ export class AddonModFeedbackProvider { * @param feedbackId Feedback ID. * @param items Item to fill the value. * @param options Other options. - * @return Resolved with values when done. + * @returns Resolved with values when done. */ protected async fillValues( feedbackId: number, @@ -212,7 +212,7 @@ export class AddonModFeedbackProvider { * @param feedbackId Feedback ID. * @param options Other options. * @param previous Only for recurrent use. Object with the previous fetched info. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getAllNonRespondents( feedbackId: number, @@ -253,7 +253,7 @@ export class AddonModFeedbackProvider { * @param feedbackId Feedback ID. * @param options Other options. * @param previous Only for recurrent use. Object with the previous fetched info. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getAllResponsesAnalysis( feedbackId: number, @@ -300,7 +300,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the feedback is retrieved. + * @returns Promise resolved when the feedback is retrieved. */ async getAnalysis( feedbackId: number, @@ -330,7 +330,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param groupId Group ID. - * @return Cache key. + * @returns Cache key. */ protected getAnalysisDataCacheKey(feedbackId: number, groupId: number = 0): string { return this.getAnalysisDataPrefixCacheKey(feedbackId) + groupId; @@ -340,7 +340,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for feedback analysis data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getAnalysisDataPrefixCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':analysis:'; @@ -353,7 +353,7 @@ export class AddonModFeedbackProvider { * @param attemptId Attempt ID to find. * @param options Other options. * @param previous Only for recurrent use. Object with the previous fetched info. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getAttempt( feedbackId: number, @@ -408,7 +408,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for feedback completion data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getCompletedDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':completed:'; @@ -419,7 +419,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getCurrentCompletedTimeModified(feedbackId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -452,7 +452,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for feedback current completed temp data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getCurrentCompletedTimeModifiedDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':completedtime:'; @@ -463,7 +463,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getCurrentValues( feedbackId: number, @@ -505,7 +505,7 @@ export class AddonModFeedbackProvider { * Get cache key for get current values feedback data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getCurrentValuesDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':currentvalues'; @@ -516,7 +516,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the feedback is retrieved. + * @returns Promise resolved when the feedback is retrieved. */ async getFeedbackAccessInformation( feedbackId: number, @@ -541,7 +541,7 @@ export class AddonModFeedbackProvider { * Get cache key for feedback access information data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getFeedbackAccessInformationDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':access'; @@ -551,7 +551,7 @@ export class AddonModFeedbackProvider { * Get cache key for feedback data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getFeedbackCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'feedback:' + courseId; @@ -561,7 +561,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for all feedback activity data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getFeedbackDataPrefixCacheKey(feedbackId: number): string { return ROOT_CACHE_KEY + feedbackId; @@ -574,7 +574,7 @@ export class AddonModFeedbackProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the feedback is retrieved. + * @returns Promise resolved when the feedback is retrieved. */ protected async getFeedbackDataByKey( courseId: number, @@ -614,7 +614,7 @@ export class AddonModFeedbackProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the feedback is retrieved. + * @returns Promise resolved when the feedback is retrieved. */ getFeedback(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getFeedbackDataByKey(courseId, 'coursemodule', cmId, options); @@ -626,7 +626,7 @@ export class AddonModFeedbackProvider { * @param courseId Course ID. * @param id Feedback ID. * @param options Other options. - * @return Promise resolved when the feedback is retrieved. + * @returns Promise resolved when the feedback is retrieved. */ getFeedbackById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getFeedbackDataByKey(courseId, 'id', id, options); @@ -637,7 +637,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getItems(feedbackId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -660,7 +660,7 @@ export class AddonModFeedbackProvider { * Get cache key for get items feedback data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getItemsDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':items'; @@ -671,7 +671,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getNonRespondents( feedbackId: number, @@ -703,7 +703,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param groupId Group id, 0 means that the function will determine the user group. - * @return Cache key. + * @returns Cache key. */ protected getNonRespondentsDataCacheKey(feedbackId: number, groupId: number = 0): string { return this.getNonRespondentsDataPrefixCacheKey(feedbackId) + groupId; @@ -713,7 +713,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for feedback non respondents data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getNonRespondentsDataPrefixCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':nonrespondents:'; @@ -725,7 +725,7 @@ export class AddonModFeedbackProvider { * @param feedbackId Feedback ID. * @param page The page to get. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getPageItems(feedbackId: number, page: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -744,7 +744,7 @@ export class AddonModFeedbackProvider { * @param feedbackId Feedback ID. * @param page The page to get. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getPageItemsWithValues( feedbackId: number, @@ -813,7 +813,7 @@ export class AddonModFeedbackProvider { * @param page Page where we want to jump. * @param changePage If page change is forward (1) or backward (-1). * @param options Other options. - * @return Page number where to jump. Or false if completed or first page. + * @returns Page number where to jump. Or false if completed or first page. */ protected async getPageJumpTo( feedbackId: number, @@ -847,7 +847,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getResponsesAnalysis( feedbackId: number, @@ -879,7 +879,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param groupId Group id, 0 means that the function will determine the user group. - * @return Cache key. + * @returns Cache key. */ protected getResponsesAnalysisDataCacheKey(feedbackId: number, groupId: number = 0): string { return this.getResponsesAnalysisDataPrefixCacheKey(feedbackId) + groupId; @@ -889,7 +889,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for feedback responses analysis data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getResponsesAnalysisDataPrefixCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':responsesanalysis:'; @@ -900,7 +900,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getResumePage(feedbackId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -925,7 +925,7 @@ export class AddonModFeedbackProvider { * Get prefix cache key for resume feedback page data WS calls. * * @param feedbackId Feedback ID. - * @return Cache key. + * @returns Cache key. */ protected getResumePageDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':launch'; @@ -936,7 +936,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllFeedbackData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -949,7 +949,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAnalysisData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -964,7 +964,7 @@ export class AddonModFeedbackProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -982,7 +982,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCurrentValuesData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -995,7 +995,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateFeedbackAccessInformationData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1008,7 +1008,7 @@ export class AddonModFeedbackProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateFeedbackData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1021,7 +1021,7 @@ export class AddonModFeedbackProvider { * * @param moduleId The module ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the files are invalidated. + * @returns Promise resolved when the files are invalidated. */ async invalidateFiles(moduleId: number, siteId?: string): Promise { return CoreFilepool.invalidateFilesByComponent(siteId, AddonModFeedbackProvider.COMPONENT, moduleId); @@ -1032,7 +1032,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateNonRespondentsData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1045,7 +1045,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateResponsesAnalysisData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1058,7 +1058,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateResumePageData(feedbackId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1071,7 +1071,7 @@ export class AddonModFeedbackProvider { * * @param feedbackId Feedback ID. * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async isCompleted(feedbackId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -1096,7 +1096,7 @@ export class AddonModFeedbackProvider { * @param name Name of the feedback. * @param formViewed True if form was viewed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, formViewed: boolean = false, siteId?: string): Promise { const params: AddonModFeedbackViewFeedbackWSParams = { @@ -1123,7 +1123,7 @@ export class AddonModFeedbackProvider { * @param page The page being processed. * @param responses The data to be processed the key is the field name (usually type[index]_id). * @param options Other options. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async processPage( feedbackId: number, @@ -1216,7 +1216,7 @@ export class AddonModFeedbackProvider { * @param responses The data to be processed the key is the field name (usually type[index]_id). * @param goPrevious Whether we want to jump to previous page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async processPageOnline( feedbackId: number, diff --git a/src/addons/mod/feedback/services/handlers/prefetch.ts b/src/addons/mod/feedback/services/handlers/prefetch.ts index fcd494519..058465519 100644 --- a/src/addons/mod/feedback/services/handlers/prefetch.ts +++ b/src/addons/mod/feedback/services/handlers/prefetch.ts @@ -123,7 +123,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr * @param module Module. * @param courseId Course ID the module belongs to. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchFeedback(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const commonOptions = { diff --git a/src/addons/mod/feedback/services/handlers/sync-cron.ts b/src/addons/mod/feedback/services/handlers/sync-cron.ts index bf86e90d2..6c1b7e66a 100644 --- a/src/addons/mod/feedback/services/handlers/sync-cron.ts +++ b/src/addons/mod/feedback/services/handlers/sync-cron.ts @@ -31,7 +31,7 @@ export class AddonModFeedbackSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModFeedbackSync.syncAllFeedbacks(siteId, force); @@ -40,7 +40,7 @@ export class AddonModFeedbackSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModFeedbackSync.syncInterval; diff --git a/src/addons/mod/folder/components/index/index.ts b/src/addons/mod/folder/components/index/index.ts index e20e5cf7e..709d92815 100644 --- a/src/addons/mod/folder/components/index/index.ts +++ b/src/addons/mod/folder/components/index/index.ts @@ -46,7 +46,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -71,7 +71,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { await AddonModFolder.invalidateContent(this.module.id, this.courseId); diff --git a/src/addons/mod/folder/pages/index/index.page.ts b/src/addons/mod/folder/pages/index/index.page.ts index 8bb594508..ccae8215f 100644 --- a/src/addons/mod/folder/pages/index/index.page.ts +++ b/src/addons/mod/folder/pages/index/index.page.ts @@ -34,7 +34,7 @@ export class AddonModFolderIndexPage extends CoreCourseModuleMainActivityPage { return this.getFolderByKey(courseId, 'coursemodule', cmId, options); @@ -51,7 +51,7 @@ export class AddonModFolderProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the book is retrieved. + * @returns Promise resolved when the book is retrieved. */ protected async getFolderByKey( courseId: number, @@ -87,7 +87,7 @@ export class AddonModFolderProvider { * Get cache key for folder data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getFolderCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'folder:' + courseId; @@ -114,7 +114,7 @@ export class AddonModFolderProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateFolderData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -128,7 +128,7 @@ export class AddonModFolderProvider { * @param id Module ID. * @param name Name of the folder. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModFolderViewFolderWSParams = { diff --git a/src/addons/mod/folder/services/handlers/module.ts b/src/addons/mod/folder/services/handlers/module.ts index df0e666d7..fde3b78ef 100644 --- a/src/addons/mod/folder/services/handlers/module.ts +++ b/src/addons/mod/folder/services/handlers/module.ts @@ -68,7 +68,7 @@ export class AddonModFolderModuleHandlerService extends CoreModuleHandlerBase im module.description = descriptionElement.innerHTML; } - // @todo: Temporary fix to open inline folders. We should use a more generic solution. + // @todo Temporary fix to open inline folders. We should use a more generic solution. data.action = async (event, module, courseId, options): Promise => { options = options || {}; options.params = options.params || {}; diff --git a/src/addons/mod/forum/classes/forum-discussions-source.ts b/src/addons/mod/forum/classes/forum-discussions-source.ts index 49b12fa60..4b35b9454 100644 --- a/src/addons/mod/forum/classes/forum-discussions-source.ts +++ b/src/addons/mod/forum/classes/forum-discussions-source.ts @@ -57,7 +57,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource * Type guard to infer NewDiscussionForm objects. * * @param discussion Item to check. - * @return Whether the item is a new discussion form. + * @returns Whether the item is a new discussion form. */ isNewDiscussionForm(discussion: AddonModForumDiscussionItem): discussion is AddonModForumNewDiscussionForm { return 'newDiscussion' in discussion; @@ -67,7 +67,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource * Type guard to infer AddonModForumDiscussion objects. * * @param discussion Item to check. - * @return Whether the item is an online discussion. + * @returns Whether the item is an online discussion. */ isOfflineDiscussion(discussion: AddonModForumDiscussionItem): discussion is AddonModForumOfflineDiscussion { return !this.isNewDiscussionForm(discussion) && !this.isOnlineDiscussion(discussion); @@ -77,7 +77,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource * Type guard to infer AddonModForumDiscussion objects. * * @param discussion Item to check. - * @return Whether the item is an online discussion. + * @returns Whether the item is an online discussion. */ isOnlineDiscussion(discussion: AddonModForumDiscussionItem): discussion is AddonModForumDiscussion { return 'id' in discussion; @@ -168,7 +168,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource /** * Load some specific data for current group. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadSelectedGroupData(): Promise { if (!this.usesGroups) { @@ -308,7 +308,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource /** * Invalidate cache data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateCache(): Promise { const promises: Promise[] = []; @@ -327,7 +327,7 @@ export class AddonModForumDiscussionsSource extends CoreRoutedItemsManagerSource /** * Invalidate list cache data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateList(): Promise { if (this.forum) { diff --git a/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts b/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts index 415b18862..43c28b716 100644 --- a/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts +++ b/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts @@ -35,7 +35,7 @@ export class AddonModForumDiscussionOptionsMenuComponent implements OnInit { canPin = false; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!AddonModForum.isSetPinStateAvailableForSite()) { diff --git a/src/addons/mod/forum/components/index/index.ts b/src/addons/mod/forum/components/index/index.ts index 37c1491f2..63d70a8d9 100644 --- a/src/addons/mod/forum/components/index/index.ts +++ b/src/addons/mod/forum/components/index/index.ts @@ -156,7 +156,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom * Check whether a discussion is online. * * @param discussion Discussion - * @return Whether the discussion is online. + * @returns Whether the discussion is online. */ isOnlineDiscussion(discussion: AddonModForumDiscussionItem): boolean { return !!this.discussions?.getSource().isOnlineDiscussion(discussion); @@ -166,14 +166,14 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom * Check whether a discussion is offline. * * @param discussion Discussion - * @return Whether the discussion is offline. + * @returns Whether the discussion is offline. */ isOfflineDiscussion(discussion: AddonModForumDiscussionItem): boolean { return !!this.discussions?.getSource().isOfflineDiscussion(discussion); } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { this.addDiscussionText = Translate.instant('addon.mod_forum.addanewdiscussion'); @@ -312,7 +312,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); @@ -437,8 +437,8 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Convenience function to load more forum discussions. * - * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Promise resolved when done. + * @param complete Infinite scroll complete function. Only used from core-infinite-loading. + * @returns Promise resolved when done. */ async fetchMoreDiscussions(complete: () => void): Promise { const discussions = await this.promisedDiscussions; @@ -459,7 +459,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Convenience function to fetch the sort order preference. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchSortOrderPreference(): Promise { const discussions = await this.promisedDiscussions; @@ -475,7 +475,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -498,7 +498,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModForumPrefetchHandler.sync(this.module, this.courseId); @@ -508,7 +508,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return Whether it succeed or not. + * @returns Whether it succeed or not. */ protected hasSyncSucceed(result: AddonModForumSyncResult): boolean { return result.updated; @@ -518,7 +518,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModForumAutoSyncData | AddonModForumManualSyncData): boolean { return !!this.forum @@ -583,8 +583,6 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Opens the new discussion form. - * - * @param timeCreated Creation time of the offline discussion. */ openNewDiscussion(): void { this.discussions?.select(AddonModForumDiscussionsSource.NEW_DISCUSSION); @@ -729,7 +727,7 @@ class AddonModForumDiscussionsManager extends CoreListItemsManager { if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) { @@ -545,7 +545,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges /** * Scroll to reply/edit form. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async scrollToForm(): Promise { await CoreDom.scrollToElement( diff --git a/src/addons/mod/forum/pages/discussion/discussion.page.ts b/src/addons/mod/forum/pages/discussion/discussion.page.ts index dafc9525d..94289080d 100644 --- a/src/addons/mod/forum/pages/discussion/discussion.page.ts +++ b/src/addons/mod/forum/pages/discussion/discussion.page.ts @@ -281,7 +281,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (AddonModForumHelper.hasPostDataChanged(this.formData, this.originalData)) { @@ -335,7 +335,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes /** * Get sort type configured by the current user. * - * @return Promise resolved with the sort type. + * @returns Promise resolved with the sort type. */ protected async getUserSort(): Promise { try { @@ -369,7 +369,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes /** * Convenience function to get the forum. * - * @return Promise resolved with the forum. + * @returns Promise resolved with the forum. */ protected fetchForum(): Promise { if (this.courseId && this.cmId) { @@ -389,7 +389,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * @param sync Whether to try to synchronize the discussion. * @param showErrors Whether to show errors in a modal. * @param forceMarkAsRead Whether to mark all posts as read. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchPosts(sync?: boolean, showErrors?: boolean, forceMarkAsRead?: boolean): Promise { let onlinePosts: AddonModForumPost[] = []; @@ -585,7 +585,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * @param discussionId Discussion ID. * @param forumId Forum ID. * @param cmId Forum cmid. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadDiscussion(discussionId: number, forumId?: number, cmId?: number): Promise { // Fetch the discussion if not passed as parameter. @@ -601,7 +601,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * Tries to synchronize the posts discussion. * * @param showErrors Whether to show errors in a modal. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async syncDiscussion(showErrors: boolean): Promise { const promises: Promise[] = []; @@ -656,7 +656,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * @param refresher Refresher. * @param done Function to call when done. * @param showErrors If show errors to the user of hide them. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher | null, done?: () => void, showErrors: boolean = false): Promise { if (this.discussionLoaded) { @@ -672,7 +672,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * * @param sync Whether to try to synchronize the discussion. * @param showErrors Whether to show errors in a modal. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshPosts(sync?: boolean, showErrors?: boolean): Promise { this.content.scrollToTop(); @@ -695,7 +695,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * Function to change posts sorting * * @param type Sort type. - * @return Promised resolved when done. + * @returns Promised resolved when done. */ changeSort(type: SortType): Promise { this.discussionLoaded = false; @@ -829,7 +829,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes /** * Get all the posts contained in the discussion. * - * @return Array containing all the posts of the discussion. + * @returns Array containing all the posts of the discussion. */ protected getAllPosts(): Post[] { const allPosts = this.posts.map(post => this.flattenPostHierarchy(post)); @@ -841,7 +841,7 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes * Flatten a post's hierarchy into an array. * * @param parent Parent post. - * @return Array containing all the posts within the hierarchy (including the parent). + * @returns Array containing all the posts within the hierarchy (including the parent). */ protected flattenPostHierarchy(parent: Post): Post[] { const posts = [parent]; diff --git a/src/addons/mod/forum/pages/new-discussion/new-discussion.page.ts b/src/addons/mod/forum/pages/new-discussion/new-discussion.page.ts index a4bb114e9..c6ccedb75 100644 --- a/src/addons/mod/forum/pages/new-discussion/new-discussion.page.ts +++ b/src/addons/mod/forum/pages/new-discussion/new-discussion.page.ts @@ -109,7 +109,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea constructor(protected route: ActivatedRoute, @Optional() protected splitView: CoreSplitViewComponent) {} /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -168,7 +168,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea * Fetch if forum uses groups and the groups it uses. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchDiscussionData(refresh?: boolean): Promise { try { @@ -320,7 +320,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea * Validate which of the groups returned by getActivityAllowedGroups in visible groups should be shown to post to. * * @param forumGroups Forum groups. - * @return Promise resolved with the list of groups. + * @returns Promise resolved with the list of groups. */ protected async validateVisibleGroups(forumGroups: CoreGroup[]): Promise { let response: AddonModForumCanAddDiscussion; @@ -378,7 +378,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea * * @param forumGroups Forum groups. * @param userGroups User groups. - * @return Filtered groups. + * @returns Filtered groups. */ protected filterGroups(forumGroups: CoreGroup[], userGroups: CoreGroup[]): CoreGroup[] { const userGroupsIds = userGroups.map(group => group.id); @@ -389,7 +389,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea /** * Get the initial group ID. * - * @return Initial group ID. + * @returns Initial group ID. */ protected getInitialGroupId(): number { return (this.initialGroupId && this.groups.find(group => group.id === this.initialGroupId)) ? @@ -401,7 +401,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea * * @param groups Groups. * @param check True to check if the user can add a discussion to all participants. - * @return Promise resolved with the list of groups. + * @returns Promise resolved with the list of groups. */ protected addAllParticipantsOption(groups: CoreGroup[], check: boolean): Promise { let promise: Promise; @@ -622,7 +622,7 @@ export class AddonModForumNewDiscussionPage implements OnInit, OnDestroy, CanLea /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.forceLeave) { diff --git a/src/addons/mod/forum/services/forum-helper.ts b/src/addons/mod/forum/services/forum-helper.ts index 020a9498d..16f9f1cc8 100644 --- a/src/addons/mod/forum/services/forum-helper.ts +++ b/src/addons/mod/forum/services/forum-helper.ts @@ -52,7 +52,7 @@ export class AddonModForumHelperProvider { * @param groupIds Groups this discussion belongs to. * @param timeCreated The time the discussion was created. Only used when editing discussion. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with ids of the created discussions or null if stored offline + * @returns Promise resolved with ids of the created discussions or null if stored offline */ async addNewDiscussion( forumId: number, @@ -180,7 +180,7 @@ export class AddonModForumHelperProvider { * * @param offlineReply Offline version of the reply. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object converted to Online. + * @returns Promise resolved with the object converted to Online. */ convertOfflineReplyToOnline(offlineReply: AddonModForumOfflineReply, siteId?: string): Promise { const reply: AddonModForumPost = { @@ -249,7 +249,7 @@ export class AddonModForumHelperProvider { * @param forumId Forum ID. * @param timecreated The time the discussion was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ async deleteNewDiscussionStoredFiles(forumId: number, timecreated: number, siteId?: string): Promise { const folderPath = await AddonModForumOffline.getNewDiscussionFolder(forumId, timecreated, siteId); @@ -265,7 +265,7 @@ export class AddonModForumHelperProvider { * @param postId ID of the post being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the reply belongs to. If not defined, current user in site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ async deleteReplyStoredFiles(forumId: number, postId: number, siteId?: string, userId?: number): Promise { const folderPath = await AddonModForumOffline.getReplyFolder(forumId, postId, siteId, userId); @@ -279,7 +279,7 @@ export class AddonModForumHelperProvider { * * @param forum Forum instance. * @param getDueDateMessage Whether to get due date message. If false, only cutoff date message will be returned. - * @return Message or null if the forum has no cut-off or due date. + * @returns Message or null if the forum has no cut-off or due date. */ getAvailabilityMessage(forum: AddonModForumData, getDueDateMessage = true): string | null { if (this.isCutoffDateReached(forum)) { @@ -312,7 +312,7 @@ export class AddonModForumHelperProvider { * @param cmId Forum cmid * @param discussionId Discussion ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the discussion data. + * @returns Promise resolved with the discussion data. */ getDiscussionById(forumId: number, cmId: number, discussionId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -349,7 +349,7 @@ export class AddonModForumHelperProvider { * @param forumId Forum ID. * @param timecreated The time the discussion was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getNewDiscussionStoredFiles(forumId: number, timecreated: number, siteId?: string): Promise { const folderPath = await AddonModForumOffline.getNewDiscussionFolder(forumId, timecreated, siteId); @@ -364,7 +364,7 @@ export class AddonModForumHelperProvider { * @param postId ID of the post being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the reply belongs to. If not defined, current user in site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getReplyStoredFiles(forumId: number, postId: number, siteId?: string, userId?: number): Promise { const folderPath = await AddonModForumOffline.getReplyFolder(forumId, postId, siteId, userId); @@ -377,7 +377,7 @@ export class AddonModForumHelperProvider { * * @param reply Current data. * @param original Original ata. - * @return True if data has changed, false otherwise. + * @returns True if data has changed, false otherwise. */ hasPostDataChanged(reply: AddonModForumPostData, original?: AddonModForumPostData): boolean { if (!original || original.subject == null) { @@ -400,6 +400,7 @@ export class AddonModForumHelperProvider { * Is the cutoff date for the forum reached? * * @param forum Forum instance. + * @returns If cut off date has been reached. */ isCutoffDateReached(forum: AddonModForumData): boolean { const now = Date.now() / 1000; @@ -411,6 +412,7 @@ export class AddonModForumHelperProvider { * Is the due date for the forum reached? * * @param forum Forum instance. + * @returns If due date has been reached. */ isDueDateReached(forum: AddonModForumData): forum is AddonModForumData & { duedate: number } { const now = Date.now() / 1000; @@ -427,7 +429,7 @@ export class AddonModForumHelperProvider { * @param timecreated The time the discussion was created. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeNewDiscussionFiles( forumId: number, @@ -450,7 +452,7 @@ export class AddonModForumHelperProvider { * @param files List of files. * @param siteId Site ID. If not defined, current site. * @param userId User the reply belongs to. If not defined, current user in site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeReplyFiles( forumId: number, @@ -473,7 +475,7 @@ export class AddonModForumHelperProvider { * @param files List of files. * @param offline True if files sould be stored for offline, false to upload them. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ uploadOrStoreNewDiscussionFiles( forumId: number, @@ -512,7 +514,7 @@ export class AddonModForumHelperProvider { * @param offline True if files sould be stored for offline, false to upload them. * @param siteId Site ID. If not defined, current site. * @param userId User the reply belongs to. If not defined, current user in site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ async uploadOrStoreReplyFiles( forumId: number, diff --git a/src/addons/mod/forum/services/forum-offline.ts b/src/addons/mod/forum/services/forum-offline.ts index 31c9fb8e9..d586decca 100644 --- a/src/addons/mod/forum/services/forum-offline.ts +++ b/src/addons/mod/forum/services/forum-offline.ts @@ -40,7 +40,7 @@ export class AddonModForumOfflineProvider { * @param timeCreated The time the discussion was created. * @param siteId Site ID. If not defined, current site. * @param userId User the discussion belongs to. If not defined, current user in site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteNewDiscussion(forumId: number, timeCreated: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -60,7 +60,7 @@ export class AddonModForumOfflineProvider { * @param timeCreated The time the discussion was created. * @param siteId Site ID. If not defined, current site. * @param userId User the discussion belongs to. If not defined, current user in site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async getNewDiscussion( forumId: number, @@ -84,7 +84,7 @@ export class AddonModForumOfflineProvider { * Get all offline new discussions. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with discussions. + * @returns Promise resolved with discussions. */ async getAllNewDiscussions(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -99,7 +99,7 @@ export class AddonModForumOfflineProvider { * @param forumId Forum ID. * @param siteId Site ID. If not defined, current site. * @param userId User the discussions belong to. If not defined, current user in site. - * @return Promise resolved with boolean: true if has offline answers, false otherwise. + * @returns Promise resolved with boolean: true if has offline answers, false otherwise. */ async hasNewDiscussions(forumId: number, siteId?: string, userId?: number): Promise { try { @@ -119,7 +119,7 @@ export class AddonModForumOfflineProvider { * @param forumId Forum ID to get. * @param siteId Site ID. If not defined, current site. * @param userId User the discussions belong to. If not defined, current user in site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getNewDiscussions(forumId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -146,7 +146,7 @@ export class AddonModForumOfflineProvider { * @param timeCreated The time the discussion was created. If not defined, current time. * @param siteId Site ID. If not defined, current site. * @param userId User the discussion belong to. If not defined, current user in site. - * @return Promise resolved when new discussion is successfully saved. + * @returns Promise resolved when new discussion is successfully saved. */ async addNewDiscussion( forumId: number, @@ -182,7 +182,7 @@ export class AddonModForumOfflineProvider { * @param postId ID of the post being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the reply belongs to. If not defined, current user in site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteReply(postId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -198,7 +198,7 @@ export class AddonModForumOfflineProvider { * Get all offline replies. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with replies. + * @returns Promise resolved with replies. */ async getAllReplies(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -213,7 +213,7 @@ export class AddonModForumOfflineProvider { * @param forumId ID of the forum being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the replies belong to. If not defined, current user in site. - * @return Promise resolved with boolean: true if has offline answers, false otherwise. + * @returns Promise resolved with boolean: true if has offline answers, false otherwise. */ async hasForumReplies(forumId: number, siteId?: string, userId?: number): Promise { try { @@ -233,7 +233,7 @@ export class AddonModForumOfflineProvider { * @param forumId ID of the forum being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the replies belong to. If not defined, current user in site. - * @return Promise resolved with replies. + * @returns Promise resolved with replies. */ async getForumReplies(forumId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -253,7 +253,7 @@ export class AddonModForumOfflineProvider { * @param discussionId ID of the discussion the user is replying to. * @param siteId Site ID. If not defined, current site. * @param userId User the replies belong to. If not defined, current user in site. - * @return Promise resolved with boolean: true if has offline answers, false otherwise. + * @returns Promise resolved with boolean: true if has offline answers, false otherwise. */ async hasDiscussionReplies(discussionId: number, siteId?: string, userId?: number): Promise { try { @@ -273,7 +273,7 @@ export class AddonModForumOfflineProvider { * @param discussionId ID of the discussion the user is replying to. * @param siteId Site ID. If not defined, current site. * @param userId User the replies belong to. If not defined, current user in site. - * @return Promise resolved with discussions. + * @returns Promise resolved with discussions. */ async getDiscussionReplies(discussionId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -300,7 +300,7 @@ export class AddonModForumOfflineProvider { * @param options Options (subscribe, attachments, ...). * @param siteId Site ID. If not defined, current site. * @param userId User the post belong to. If not defined, current user in site. - * @return Promise resolved when the post is created. + * @returns Promise resolved when the post is created. */ async replyPost( postId: number, @@ -336,7 +336,7 @@ export class AddonModForumOfflineProvider { * * @param forumId Forum ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getForumFolder(forumId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -351,7 +351,7 @@ export class AddonModForumOfflineProvider { * @param forumId Forum ID. * @param timeCreated The time the discussion was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getNewDiscussionFolder(forumId: number, timeCreated: number, siteId?: string): Promise { const folderPath = await this.getForumFolder(forumId, siteId); @@ -366,7 +366,7 @@ export class AddonModForumOfflineProvider { * @param postId ID of the post being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the replies belong to. If not defined, current user in site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getReplyFolder(forumId: number, postId: number, siteId?: string, userId?: number): Promise { const folderPath = await this.getForumFolder(forumId, siteId); @@ -380,7 +380,7 @@ export class AddonModForumOfflineProvider { * Parse "options" column of fetched record. * * @param records List of records. - * @return List of records with options parsed. + * @returns List of records with options parsed. */ protected parseRecordsOptions< R extends { options: string }, @@ -393,7 +393,7 @@ export class AddonModForumOfflineProvider { * Parse "options" column of fetched record. * * @param record Record. - * @return Record with options parsed. + * @returns Record with options parsed. */ protected parseRecordOptions< R extends { options: string }, diff --git a/src/addons/mod/forum/services/forum-sync.ts b/src/addons/mod/forum/services/forum-sync.ts index 72d01a868..37e88fc29 100644 --- a/src/addons/mod/forum/services/forum-sync.ts +++ b/src/addons/mod/forum/services/forum-sync.ts @@ -68,7 +68,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ async syncAllForums(siteId?: string, force?: boolean): Promise { await this.syncOnSites('all forums', (siteId) => this.syncAllForumsFunc(!!force, siteId), siteId); @@ -79,7 +79,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllForumsFunc(force: boolean, siteId: string): Promise { const sitePromises: Promise[] = []; @@ -164,7 +164,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param forumId Forum ID. * @param userId User the discussion belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the forum is synced or if it doesn't need to be synced. + * @returns Promise resolved when the forum is synced or if it doesn't need to be synced. */ async syncForumDiscussionsIfNeeded( forumId: number, @@ -188,7 +188,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param forumId Forum ID to be synced. * @param userId User the discussions belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncForumDiscussions( forumId: number, @@ -315,7 +315,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param discussionId Discussion id to be synced. If not defined, sync all discussions. * @param force Wether to force sync not depending on last execution. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncRatings(cmId?: number, discussionId?: number, force?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -359,7 +359,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param forumId Forum ID to be synced. * @param userId User the discussions belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncForumReplies(forumId: number, userId?: number, siteId?: string): Promise { // Get offline forum replies to be sent. @@ -400,7 +400,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param discussionId Discussion ID to be synced. * @param userId User the posts belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the forum discussion is synced or if it doesn't need to be synced. + * @returns Promise resolved when the forum discussion is synced or if it doesn't need to be synced. */ async syncDiscussionRepliesIfNeeded( discussionId: number, @@ -424,7 +424,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param discussionId Discussion ID to be synced. * @param userId User the posts belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncDiscussionReplies(discussionId: number, userId?: number, siteId?: string): Promise { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -532,7 +532,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param timecreated The timecreated of the discussion. * @param siteId Site ID. If not defined, current site. * @param userId User the discussion belongs to. If not defined, current user in site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ protected async deleteNewDiscussion(forumId: number, timecreated: number, siteId?: string, userId?: number): Promise { await Promise.all([ @@ -550,7 +550,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param postId ID of the post being replied. * @param siteId Site ID. If not defined, current site. * @param userId User the discussion belongs to. If not defined, current user in site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ protected async deleteReply(forumId: number, postId: number, siteId?: string, userId?: number): Promise { await Promise.all([ @@ -567,7 +567,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * @param isDiscussion True if it's a new discussion, false if it's a reply. * @param siteId Site ID. If not defined, current site. * @param userId User the reply belongs to. If not defined, current user in site. - * @return Promise resolved with draftid if uploaded, resolved with undefined if nothing to upload. + * @returns Promise resolved with draftid if uploaded, resolved with undefined if nothing to upload. */ protected async uploadAttachments( forumId: number, @@ -615,7 +615,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param forumId Forum ID. * @param userId User the responses belong to.. If not defined, current user. - * @return Sync ID. + * @returns Sync ID. */ getForumSyncId(forumId: number, userId?: number): string { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -628,7 +628,7 @@ export class AddonModForumSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param discussionId Discussion ID. * @param userId User the responses belong to.. If not defined, current user. - * @return Sync ID. + * @returns Sync ID. */ getDiscussionSyncId(discussionId: number, userId?: number): string { userId = userId || CoreSites.getCurrentSiteUserId(); diff --git a/src/addons/mod/forum/services/forum.ts b/src/addons/mod/forum/services/forum.ts index 93bb01e2d..d20f88efc 100644 --- a/src/addons/mod/forum/services/forum.ts +++ b/src/addons/mod/forum/services/forum.ts @@ -78,7 +78,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param groupId Group ID. - * @return Cache key. + * @returns Cache key. */ protected getCanAddDiscussionCacheKey(forumId: number, groupId: number): string { return this.getCommonCanAddDiscussionCacheKey(forumId) + groupId; @@ -89,7 +89,7 @@ export class AddonModForumProvider { * TODO: Use getForumDataCacheKey as a prefix. * * @param forumId Forum ID. - * @return Cache key. + * @returns Cache key. */ protected getCommonCanAddDiscussionCacheKey(forumId: number): string { return ROOT_CACHE_KEY + 'canadddiscussion:' + forumId + ':'; @@ -99,7 +99,7 @@ export class AddonModForumProvider { * Get prefix cache key for all forum activity data WS calls. * * @param forumId Forum ID. - * @return Cache key. + * @returns Cache key. */ protected getForumDataPrefixCacheKey(forumId: number): string { return ROOT_CACHE_KEY + forumId; @@ -111,7 +111,7 @@ export class AddonModForumProvider { * @param forumId Forum ID. * @param discussionId Discussion ID. * @param postId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getDiscussionPostDataCacheKey(forumId: number, discussionId: number, postId: number): string { return this.getForumDiscussionDataCacheKey(forumId, discussionId) + ':post:' + postId; @@ -120,8 +120,9 @@ export class AddonModForumProvider { /** * Get cache key for forum data WS calls. * - * @param courseId Course ID. - * @return Cache key. + * @param forumId Forum ID. + * @param discussionId Discussion ID. + * @returns Cache key. */ protected getForumDiscussionDataCacheKey(forumId: number, discussionId: number): string { return this.getForumDataPrefixCacheKey(forumId) + ':discussion:' + discussionId; @@ -131,7 +132,7 @@ export class AddonModForumProvider { * Get cache key for forum data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getForumDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'forum:' + courseId; @@ -142,7 +143,7 @@ export class AddonModForumProvider { * TODO: Use getForumDataCacheKey as a prefix. * * @param forumId Forum ID. - * @return Cache key. + * @returns Cache key. */ protected getAccessInformationCacheKey(forumId: number): string { return ROOT_CACHE_KEY + 'accessInformation:' + forumId; @@ -153,7 +154,7 @@ export class AddonModForumProvider { * TODO: Use getForumDiscussionDataCacheKey instead. * * @param discussionId Discussion ID. - * @return Cache key. + * @returns Cache key. */ protected getDiscussionPostsCacheKey(discussionId: number): string { return ROOT_CACHE_KEY + 'discussion:' + discussionId; @@ -163,7 +164,7 @@ export class AddonModForumProvider { * Get common cache key for forum discussions list WS calls. * * @param forumId Forum ID. - * @return Cache key. + * @returns Cache key. */ protected getDiscussionsListCommonCacheKey(forumId: number): string { return ROOT_CACHE_KEY + 'discussions:' + forumId; @@ -175,7 +176,7 @@ export class AddonModForumProvider { * @param forumId Forum ID. * @param sortOrder Sort order. * @param groupId Group ID. - * @return Cache key. + * @returns Cache key. */ protected getDiscussionsListCacheKey(forumId: number, sortOrder: number, groupId?: number): string { let key = this.getDiscussionsListCommonCacheKey(forumId); @@ -199,7 +200,7 @@ export class AddonModForumProvider { * @param options Options (subscribe, pin, ...). * @param groupId Group this discussion belongs to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the discussion is created. + * @returns Promise resolved when the discussion is created. */ async addNewDiscussionOnline( forumId: number, @@ -239,7 +240,7 @@ export class AddonModForumProvider { * @param forumId Forum ID. * @param groupId Group ID. * @param options Other options. - * @return Promise resolved with an object with the following properties: + * @returns Promise resolved with an object with the following properties: * - status (boolean) * - canpindiscussions (boolean) * - cancreateattachment (boolean) @@ -284,7 +285,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param options Other options. - * @return Promise resolved with an object with the following properties: + * @returns Promise resolved with an object with the following properties: * - status (boolean) * - canpindiscussions (boolean) * - cancreateattachment (boolean) @@ -298,7 +299,7 @@ export class AddonModForumProvider { * * @param postId Post id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @since 3.8 */ async deletePost(postId: number, siteId?: string): Promise { @@ -314,7 +315,7 @@ export class AddonModForumProvider { * Extract the starting post of a discussion from a list of posts. The post is removed from the array passed as a parameter. * * @param posts Posts to search. - * @return Starting post or undefined if not found. + * @returns Starting post or undefined if not found. */ extractStartingPost(posts: AddonModForumPost[]): AddonModForumPost | undefined { const index = posts.findIndex((post) => !post.parentid); @@ -325,7 +326,7 @@ export class AddonModForumProvider { /** * Returns whether or not getDiscussionPost WS available or not. * - * @return If WS is available. + * @returns If WS is available. * @since 3.8 */ isGetDiscussionPostAvailable(): boolean { @@ -336,7 +337,7 @@ export class AddonModForumProvider { * Returns whether or not getDiscussionPost WS available or not. * * @param site Site. If not defined, current site. - * @return If WS is available. + * @returns If WS is available. * @since 3.7 */ isGetDiscussionPostsAvailable(site?: CoreSite): boolean { @@ -348,7 +349,7 @@ export class AddonModForumProvider { /** * Returns whether or not deletePost WS available or not. * - * @return If WS is available. + * @returns If WS is available. * @since 3.8 */ isDeletePostAvailable(): boolean { @@ -358,7 +359,7 @@ export class AddonModForumProvider { /** * Returns whether or not updatePost WS available or not. * - * @return If WS is available. + * @returns If WS is available. * @since 3.8 */ isUpdatePostAvailable(): boolean { @@ -370,7 +371,7 @@ export class AddonModForumProvider { * * @param cmId Forum cmid. * @param discussions List of discussions to format. - * @return Promise resolved with the formatted discussions. + * @returns Promise resolved with the formatted discussions. */ formatDiscussionsGroups(cmId: number, discussions: AddonModForumDiscussion[]): Promise; formatDiscussionsGroups(cmId: number, discussions: AddonModForumOfflineDiscussion[]): Promise; @@ -414,7 +415,7 @@ export class AddonModForumProvider { * * @param courseId Course ID. * @param options Other options. - * @return Promise resolved when the forums are retrieved. + * @returns Promise resolved when the forums are retrieved. */ async getCourseForums(courseId: number, options: CoreSitesCommonWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -439,7 +440,7 @@ export class AddonModForumProvider { * @param discussionId Discussion ID. * @param postId Post ID. * @param options Other options. - * @return Promise resolved when the post is retrieved. + * @returns Promise resolved when the post is retrieved. */ async getDiscussionPost( forumId: number, @@ -478,7 +479,7 @@ export class AddonModForumProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the forum is retrieved. + * @returns Promise resolved when the forum is retrieved. */ async getForum(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { const forums = await this.getCourseForums(courseId, options); @@ -498,7 +499,7 @@ export class AddonModForumProvider { * @param courseId Course ID. * @param forumId Forum ID. * @param options Other options. - * @return Promise resolved when the forum is retrieved. + * @returns Promise resolved when the forum is retrieved. */ async getForumById(courseId: number, forumId: number, options: CoreSitesCommonWSOptions = {}): Promise { const forums = await this.getCourseForums(courseId, options); @@ -516,7 +517,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param options Other options. - * @return Object with access information. + * @returns Object with access information. * @since 3.7 */ async getAccessInformation( @@ -552,7 +553,7 @@ export class AddonModForumProvider { * * @param discussionId Discussion ID. * @param options Other options. - * @return Promise resolved with forum posts and rating info. + * @returns Promise resolved with forum posts and rating info. */ async getDiscussionPosts(discussionId: number, options: CoreCourseCommonModWSOptions = {}): Promise<{ posts: AddonModForumPost[]; @@ -644,7 +645,7 @@ export class AddonModForumProvider { * @param direction Direction of the sorting (ASC / DESC). */ sortDiscussionPosts(posts: AddonModForumPost[], direction: string): void { - // @todo: Check children when sorting. + // @todo Check children when sorting. posts.sort((a, b) => { const timeCreatedA = Number(a.timecreated) || 0; const timeCreatedB = Number(b.timecreated) || 0; @@ -665,7 +666,7 @@ export class AddonModForumProvider { * Return whether discussion lists can be sorted. * * @param site Site. If not defined, current site. - * @return True if discussion lists can be sorted. + * @returns True if discussion lists can be sorted. */ isDiscussionListSortingAvailable(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -676,7 +677,7 @@ export class AddonModForumProvider { /** * Return the list of available sort orders. * - * @return List of sort orders. + * @returns List of sort orders. */ getAvailableSortOrders(): AddonModForumSortOrder[] { const sortOrders = [ @@ -717,7 +718,7 @@ export class AddonModForumProvider { /** * Get sort order selected by the user. * - * @return Promise resolved with sort order. + * @returns Promise resolved with sort order. */ async getSelectedSortOrder(): Promise { const sortOrders = this.getAvailableSortOrders(); @@ -739,7 +740,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param options Other options. - * @return Promise resolved with an object with: + * @returns Promise resolved with an object with: * - discussions: List of discussions. Note that for every discussion in the list discussion.id is the main post ID but * discussion ID is discussion.discussion. * - canLoadMore: True if there may be more discussions to load. @@ -831,13 +832,8 @@ export class AddonModForumProvider { * If a page fails, the discussions until that page will be returned along with a flag indicating an error occurred. * * @param forumId Forum ID. - * @param cmId Forum cmid. - * @param sortOrder Sort order. - * @param forceCache True to always get the value from cache, false otherwise. - * @param numPages Number of pages to get. If not defined, all pages. - * @param startPage Page to start. If not defined, first page. - * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with an object with: + * @param options Get discussion in pages options. + * @returns Promise resolved with an object with: * - discussions: List of discussions. * - error: True if an error occurred, false otherwise. */ @@ -885,7 +881,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCanAddDiscussion(forumId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -898,7 +894,7 @@ export class AddonModForumProvider { * * @param moduleId The module ID. * @param courseId Course ID. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateContent(moduleId: number, courseId: number): Promise { // Get the forum first, we need the forum ID. @@ -944,7 +940,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAccessInformation(forumId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -958,7 +954,7 @@ export class AddonModForumProvider { * @param discussionId Discussion ID. * @param forumId Forum ID. If not set, we can't invalidate individual post information. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDiscussionPosts(discussionId: number, forumId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -976,7 +972,7 @@ export class AddonModForumProvider { * * @param forumId Forum ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDiscussionsList(forumId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -988,7 +984,7 @@ export class AddonModForumProvider { * Invalidates forum data. * * @param courseId Course ID. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateForumData(courseId: number): Promise { const site = CoreSites.getCurrentSite(); @@ -1002,7 +998,7 @@ export class AddonModForumProvider { * @param id Module ID. * @param name Name of the forum. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -1028,7 +1024,7 @@ export class AddonModForumProvider { * @param forumId Forum ID. * @param name Name of the forum. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logDiscussionView(id: number, forumId: number, name?: string, siteId?: string): Promise { const params = { @@ -1060,7 +1056,7 @@ export class AddonModForumProvider { * @param options Options (subscribe, attachments, ...). * @param siteId Site ID. If not defined, current site. * @param allowOffline True if it can be stored in offline, false otherwise. - * @return Promise resolved with a boolean indicating if the test was sent online or not. + * @returns Promise resolved with a boolean indicating if the test was sent online or not. */ async replyPost( postId: number, @@ -1134,7 +1130,7 @@ export class AddonModForumProvider { * @param message New post's message. * @param options Options (subscribe, attachments, ...). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the created post id. + * @returns Promise resolved with the created post id. */ async replyPostOnline( postId: number, @@ -1175,7 +1171,7 @@ export class AddonModForumProvider { * @param discussionId DIscussion id. * @param locked True to lock, false to unlock. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @since 3.7 */ async setLockState( @@ -1197,8 +1193,7 @@ export class AddonModForumProvider { /** * Returns whether the set pin state WS is available. * - * @param site Site. If not defined, current site. - * @return Whether it's available. + * @returns Whether it's available. * @since 3.7 */ isSetPinStateAvailableForSite(): boolean { @@ -1209,9 +1204,9 @@ export class AddonModForumProvider { * Pin or unpin a discussion. * * @param discussionId Discussion id. - * @param locked True to pin, false to unpin. + * @param pinned True to pin, false to unpin. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @since 3.7 */ async setPinState(discussionId: number, pinned: boolean, siteId?: string): Promise { @@ -1230,7 +1225,7 @@ export class AddonModForumProvider { * @param discussionId Discussion id. * @param starred True to star, false to unstar. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @since 3.7 */ async toggleFavouriteState(discussionId: number, starred: boolean, siteId?: string): Promise { @@ -1291,7 +1286,7 @@ export class AddonModForumProvider { * @param message New post's message. * @param options Options (subscribe, attachments, ...). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with success boolean when done. + * @returns Promise resolved with success boolean when done. */ async updatePost( postId: number, @@ -1326,7 +1321,7 @@ export class AddonModForumProvider { * Convert the new format to the exporter one so it's the same as in other WebServices. * * @param post Post returned by the new WS. - * @return Post using the same format as other WebServices. + * @returns Post using the same format as other WebServices. */ protected translateWSPost(post: AddonModForumWSPost): AddonModForumPost { (post as unknown as AddonModForumPost).tags = (post.tags || []).map((tag) => { diff --git a/src/addons/mod/forum/services/handlers/discussion-link.ts b/src/addons/mod/forum/services/handlers/discussion-link.ts index 922ccf4a1..edb09160b 100644 --- a/src/addons/mod/forum/services/handlers/discussion-link.ts +++ b/src/addons/mod/forum/services/handlers/discussion-link.ts @@ -31,14 +31,7 @@ export class AddonModForumDiscussionLinkHandlerService extends CoreContentLinksH pattern = /\/mod\/forum\/discuss\.php.*([&?]d=\d+)/; /** - * Get the list of actions for a link (url). - * - * @param siteIds List of sites the URL belongs to. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @param data Extra data to handle the URL. - * @return List of (or promise resolved with list of) actions. + * @inheritdoc */ getActions( siteIds: string[], @@ -85,14 +78,7 @@ export class AddonModForumDiscussionLinkHandlerService extends CoreContentLinksH } /** - * Check if the handler is enabled for a certain site (site + user) and a URL. - * If not defined, defaults to true. - * - * @param siteId The site ID. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @return Whether the handler is enabled for the URL and site. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/forum/services/handlers/post-link.ts b/src/addons/mod/forum/services/handlers/post-link.ts index 4349b2aa9..8ac9b1143 100644 --- a/src/addons/mod/forum/services/handlers/post-link.ts +++ b/src/addons/mod/forum/services/handlers/post-link.ts @@ -35,13 +35,7 @@ export class AddonModForumPostLinkHandlerService extends CoreContentLinksHandler pattern = /\/mod\/forum\/post\.php.*([?&](forum)=\d+)/; /** - * Get the list of actions for a link (url). - * - * @param siteIds List of sites the URL belongs to. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @return List of (or promise resolved with list of) actions. + * @inheritdoc */ getActions( siteIds: string[], @@ -73,14 +67,7 @@ export class AddonModForumPostLinkHandlerService extends CoreContentLinksHandler } /** - * Check if the handler is enabled for a certain site (site + user) and a URL. - * If not defined, defaults to true. - * - * @param siteId The site ID. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @return Whether the handler is enabled for the URL and site. + * @inheritdoc */ async isEnabled(siteId: string, url: string, params: Params): Promise { return params.forum !== undefined; diff --git a/src/addons/mod/forum/services/handlers/prefetch.ts b/src/addons/mod/forum/services/handlers/prefetch.ts index 3ad32b0ab..b03910690 100644 --- a/src/addons/mod/forum/services/handlers/prefetch.ts +++ b/src/addons/mod/forum/services/handlers/prefetch.ts @@ -38,12 +38,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe updatesNames = /^configuration$|^.*files$|^discussions$/; /** - * Get list of files. If not defined, we'll assume they're in module.contents. - * - * @param module Module. - * @param courseId Course ID the module belongs to. - * @param single True if we're downloading a single module, false if we're downloading a whole section. - * @return Promise resolved with the list of files. + * @inheritdoc */ async getFiles(module: CoreCourseAnyModuleData, courseId: number): Promise { try { @@ -68,7 +63,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * Given a list of forum posts, return a list with all the files (attachments and embedded files). * * @param posts Forum posts. - * @return Files. + * @returns Files. */ protected getPostsFiles(posts: AddonModForumPost[]): CoreWSFile[] { let files: CoreWSFile[] = []; @@ -93,7 +88,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * * @param forum Forum instance. * @param options Other options. - * @return Promise resolved with array of posts. + * @returns Promise resolved with array of posts. */ protected async getPostsForPrefetch( forum: AddonModForumData, @@ -146,7 +141,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * Prefetch all participants if the user can view them. Otherwise, prefetch the groups the user can view. * * @param forum Forum instance. - * @return Promise resolved with array of group IDs. + * @returns Promise resolved with array of group IDs. */ protected async getGroupsIdsToPrefetch(forum: AddonModForumData): Promise { const groupInfo = await CoreGroups.getActivityGroupInfo(forum.cmid); @@ -176,7 +171,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * * @param moduleId The module ID. * @param courseId The course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return AddonModForum.invalidateContent(moduleId, courseId); @@ -188,7 +183,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ async invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise { // Invalidate forum data to recalculate unread message count badge. @@ -214,7 +209,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchForum( module: CoreCourseAnyModuleData, @@ -263,11 +258,11 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe /** * Prefetch groups info for a forum. * - * @param module The module object returned by WS. - * @param courseI Course ID the module belongs to. + * @param forum The module object returned by WS. + * @param courseId Course ID the module belongs to. * @param canCreateDiscussions Whether the user can create discussions in the forum. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when group data has been prefetched. + * @returns Promise resolved when group data has been prefetched. */ protected async prefetchGroupsInfo( forum: AddonModForumData, @@ -316,7 +311,7 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async sync( module: CoreCourseAnyModuleData, diff --git a/src/addons/mod/forum/services/handlers/push-click.ts b/src/addons/mod/forum/services/handlers/push-click.ts index c9f2efa8f..220a3cce2 100644 --- a/src/addons/mod/forum/services/handlers/push-click.ts +++ b/src/addons/mod/forum/services/handlers/push-click.ts @@ -39,7 +39,7 @@ export class AddonModForumPushClickHandlerService implements CorePushNotificatio * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: NotificationData): Promise { return CoreUtils.isTrueOrOne(notification.notif) @@ -51,7 +51,7 @@ export class AddonModForumPushClickHandlerService implements CorePushNotificatio * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: NotificationData): Promise { const contextUrlParams = CoreUrlUtils.extractUrlParams(notification.contexturl); diff --git a/src/addons/mod/forum/services/handlers/sync-cron.ts b/src/addons/mod/forum/services/handlers/sync-cron.ts index 1cb25bb45..f38cfb81d 100644 --- a/src/addons/mod/forum/services/handlers/sync-cron.ts +++ b/src/addons/mod/forum/services/handlers/sync-cron.ts @@ -31,7 +31,7 @@ export class AddonModForumSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModForumSync.syncAllForums(siteId, force); @@ -40,7 +40,7 @@ export class AddonModForumSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModForumSync.syncInterval; diff --git a/src/addons/mod/forum/services/handlers/tag-area.ts b/src/addons/mod/forum/services/handlers/tag-area.ts index 3c5fb3e31..6681bf05e 100644 --- a/src/addons/mod/forum/services/handlers/tag-area.ts +++ b/src/addons/mod/forum/services/handlers/tag-area.ts @@ -29,29 +29,21 @@ export class AddonModForumTagAreaHandlerService implements CoreTagAreaHandler { type = 'mod_forum/forum_posts'; /** - * Whether or not the handler is enabled on a site level. - * - * @return Whether or not the handler is enabled on a site level. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Parses the rendered content of a tag index and returns the items. - * - * @param content Rendered content. - * @return Area items (or promise resolved with the items). + * @inheritdoc */ parseContent(content: string): CoreTagFeedElement[] { return CoreTagHelper.parseFeedContent(content); } /** - * Get the component to use to display items. - * - * @param injector Injector. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type | Promise> { return CoreTagFeedComponent; diff --git a/src/addons/mod/glossary/classes/glossary-entries-source.ts b/src/addons/mod/glossary/classes/glossary-entries-source.ts index 79aaf675a..7fd2e2814 100644 --- a/src/addons/mod/glossary/classes/glossary-entries-source.ts +++ b/src/addons/mod/glossary/classes/glossary-entries-source.ts @@ -58,7 +58,7 @@ export class AddonModGlossaryEntriesSource extends CoreRoutedItemsManagerSource< * Type guard to infer NewEntryForm objects. * * @param entry Item to check. - * @return Whether the item is a new entry form. + * @returns Whether the item is a new entry form. */ isNewEntryForm(entry: AddonModGlossaryEntryItem): entry is AddonModGlossaryNewEntryForm { return 'newEntry' in entry; @@ -68,7 +68,7 @@ export class AddonModGlossaryEntriesSource extends CoreRoutedItemsManagerSource< * Type guard to infer entry objects. * * @param entry Item to check. - * @return Whether the item is an offline entry. + * @returns Whether the item is an offline entry. */ isOnlineEntry(entry: AddonModGlossaryEntryItem): entry is AddonModGlossaryEntry { return 'id' in entry; @@ -78,7 +78,7 @@ export class AddonModGlossaryEntriesSource extends CoreRoutedItemsManagerSource< * Type guard to infer entry objects. * * @param entry Item to check. - * @return Whether the item is an offline entry. + * @returns Whether the item is an offline entry. */ isOfflineEntry(entry: AddonModGlossaryEntryItem): entry is AddonModGlossaryOfflineEntry { return !this.isNewEntryForm(entry) && !this.isOnlineEntry(entry); diff --git a/src/addons/mod/glossary/components/index/index.ts b/src/addons/mod/glossary/components/index/index.ts index 523c6ffa2..5b22a4cd4 100644 --- a/src/addons/mod/glossary/components/index/index.ts +++ b/src/addons/mod/glossary/components/index/index.ts @@ -217,7 +217,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModGlossaryPrefetchHandler.sync(this.module, this.courseId); @@ -227,7 +227,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return Whether it succeed or not. + * @returns Whether it succeed or not. */ protected hasSyncSucceed(result: AddonModGlossarySyncResult): boolean { return result.updated; @@ -237,7 +237,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModGlossaryAutoSyncData): boolean { return !!this.glossary && syncEventData.glossaryId == this.glossary.id && @@ -301,7 +301,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity * Convenience function to load more entries. * * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadMoreEntries(infiniteComplete?: () => void): Promise { const entries = await this.promisedEntries; @@ -482,7 +482,7 @@ class AddonModGlossaryEntriesManager extends CoreListItemsManager 0 || this.getSource().offlineEntries.length > 0; diff --git a/src/addons/mod/glossary/pages/edit/edit.ts b/src/addons/mod/glossary/pages/edit/edit.ts index 127a5ea4a..334672856 100644 --- a/src/addons/mod/glossary/pages/edit/edit.ts +++ b/src/addons/mod/glossary/pages/edit/edit.ts @@ -90,7 +90,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { constructor(protected route: ActivatedRoute, @Optional() protected splitView: CoreSplitViewComponent) {} /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -132,7 +132,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { /** * Fetch required data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -157,7 +157,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { /** * Load offline data when editing an offline entry. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadOfflineData(): Promise { if (!this.glossary) { @@ -228,7 +228,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.saved) { @@ -371,7 +371,7 @@ export class AddonModGlossaryEditPage implements OnInit, OnDestroy, CanLeave { * Upload entry attachments if any. * * @param timecreated Entry's timecreated. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async uploadAttachments( timecreated: number, diff --git a/src/addons/mod/glossary/pages/entry/entry.ts b/src/addons/mod/glossary/pages/entry/entry.ts index ca53e83e0..f4ee71044 100644 --- a/src/addons/mod/glossary/pages/entry/entry.ts +++ b/src/addons/mod/glossary/pages/entry/entry.ts @@ -117,7 +117,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher): Promise { if (this.glossary?.allowcomments && this.entry && this.entry.id > 0 && this.commentsEnabled && this.comments) { @@ -137,7 +137,7 @@ export class AddonModGlossaryEntryPage implements OnInit, OnDestroy { /** * Convenience function to get the glossary entry. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchEntry(): Promise { try { diff --git a/src/addons/mod/glossary/services/glossary-helper.ts b/src/addons/mod/glossary/services/glossary-helper.ts index ce1dcc587..d51c457d2 100644 --- a/src/addons/mod/glossary/services/glossary-helper.ts +++ b/src/addons/mod/glossary/services/glossary-helper.ts @@ -35,7 +35,7 @@ export class AddonModGlossaryHelperProvider { * @param entryName The name of the entry. * @param timeCreated The time the entry was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ async deleteStoredFiles(glossaryId: number, entryName: string, timeCreated: number, siteId?: string): Promise { const folderPath = await AddonModGlossaryOffline.getEntryFolder(glossaryId, entryName, timeCreated, siteId); @@ -50,7 +50,7 @@ export class AddonModGlossaryHelperProvider { * @param entryName The name of the entry. * @param timeCreated The time the entry was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getStoredFiles(glossaryId: number, entryName: string, timeCreated: number, siteId?: string): Promise { const folderPath = await AddonModGlossaryOffline.getEntryFolder(glossaryId, entryName, timeCreated, siteId); @@ -64,7 +64,7 @@ export class AddonModGlossaryHelperProvider { * @param entry Current data. * @param files Files attached. * @param original Original content. - * @return True if data has changed, false otherwise. + * @returns True if data has changed, false otherwise. */ hasEntryDataChanged( entry: AddonModGlossaryNewEntry, @@ -92,7 +92,7 @@ export class AddonModGlossaryHelperProvider { * @param timeCreated The time the entry was created. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeFiles( glossaryId: number, diff --git a/src/addons/mod/glossary/services/glossary-offline.ts b/src/addons/mod/glossary/services/glossary-offline.ts index 3b69008f3..a0dadeee1 100644 --- a/src/addons/mod/glossary/services/glossary-offline.ts +++ b/src/addons/mod/glossary/services/glossary-offline.ts @@ -36,7 +36,7 @@ export class AddonModGlossaryOfflineProvider { * @param concept Glossary entry concept. * @param timeCreated The time the entry was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteNewEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -54,7 +54,7 @@ export class AddonModGlossaryOfflineProvider { * Get all the stored new entries from all the glossaries. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entries. + * @returns Promise resolved with entries. */ async getAllNewEntries(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -71,7 +71,7 @@ export class AddonModGlossaryOfflineProvider { * @param concept Glossary entry concept. * @param timeCreated The time the entry was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with entry. + * @returns Promise resolved with entry. */ async getNewEntry( glossaryId: number, @@ -98,7 +98,7 @@ export class AddonModGlossaryOfflineProvider { * @param glossaryId Glossary ID. * @param siteId Site ID. If not defined, current site. * @param userId User the entries belong to. If not defined, current user in site. - * @return Promise resolved with entries. + * @returns Promise resolved with entries. */ async getGlossaryNewEntries(glossaryId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -120,7 +120,7 @@ export class AddonModGlossaryOfflineProvider { * @param concept Concept to check. * @param timeCreated Time of the entry we are editing. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if concept is found, false otherwise. + * @returns Promise resolved with true if concept is found, false otherwise. */ async isConceptUsed(glossaryId: number, concept: string, timeCreated?: number, siteId?: string): Promise { try { @@ -163,7 +163,7 @@ export class AddonModGlossaryOfflineProvider { * @param siteId Site ID. If not defined, current site. * @param userId User the entry belong to. If not defined, current user in site. * @param discardEntry The entry provided will be discarded if found. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async addNewEntry( glossaryId: number, @@ -206,7 +206,7 @@ export class AddonModGlossaryOfflineProvider { * * @param glossaryId Glossary ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getGlossaryFolder(glossaryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -224,7 +224,7 @@ export class AddonModGlossaryOfflineProvider { * @param concept The name of the entry. * @param timeCreated Time to allow duplicated entries. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getEntryFolder(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { const folderPath = await this.getGlossaryFolder(glossaryId, siteId); @@ -235,8 +235,8 @@ export class AddonModGlossaryOfflineProvider { /** * Parse "options" and "attachments" columns of a fetched record. * - * @param records Record object - * @return Record object with columns parsed. + * @param record Record object + * @returns Record object with columns parsed. */ protected parseRecord(record: AddonModGlossaryOfflineEntryDBRecord): AddonModGlossaryOfflineEntry { return Object.assign(record, { diff --git a/src/addons/mod/glossary/services/glossary-sync.ts b/src/addons/mod/glossary/services/glossary-sync.ts index dc92cf1d1..8db74bcc1 100644 --- a/src/addons/mod/glossary/services/glossary-sync.ts +++ b/src/addons/mod/glossary/services/glossary-sync.ts @@ -50,7 +50,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllGlossaries(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all glossaries', (siteId) => this.syncAllGlossariesFunc(!!force, siteId), siteId); @@ -61,7 +61,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllGlossariesFunc(force: boolean, siteId: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -77,7 +77,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllGlossariesEntries(force: boolean, siteId: string): Promise { const entries = await AddonModGlossaryOffline.getAllNewEntries(siteId); @@ -113,7 +113,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * @param glossaryId Glossary ID. * @param userId User the entry belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the glossary is synced or if it doesn't need to be synced. + * @returns Promise resolved when the glossary is synced or if it doesn't need to be synced. */ async syncGlossaryEntriesIfNeeded( glossaryId: number, @@ -137,7 +137,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * @param glossaryId Glossary ID to be synced. * @param userId User the entries belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ syncGlossaryEntries(glossaryId: number, userId?: number, siteId?: string): Promise { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -248,7 +248,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * @param cmId Course module to be synced. If not defined, sync all glossaries. * @param force Wether to force sync not depending on last execution. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncRatings(cmId?: number, force?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -285,7 +285,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * @param concept Glossary entry concept. * @param timeCreated Time to allow duplicated entries. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ protected async deleteAddEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { await Promise.all([ @@ -300,7 +300,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * @param glossaryId Glossary ID. * @param entry Offline entry. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with draftid if uploaded, resolved with 0 if nothing to upload. + * @returns Promise resolved with draftid if uploaded, resolved with 0 if nothing to upload. */ protected async uploadAttachments(glossaryId: number, entry: AddonModGlossaryOfflineEntry, siteId?: string): Promise { if (!entry.attachments) { @@ -329,7 +329,7 @@ export class AddonModGlossarySyncProvider extends CoreCourseActivitySyncBaseProv * * @param glossaryId Glossary ID. * @param userId User the entries belong to.. If not defined, current user. - * @return Sync ID. + * @returns Sync ID. */ protected getGlossarySyncId(glossaryId: number, userId?: number): string { userId = userId || CoreSites.getCurrentSiteUserId(); diff --git a/src/addons/mod/glossary/services/glossary.ts b/src/addons/mod/glossary/services/glossary.ts index 60d0ed11a..69645bbee 100644 --- a/src/addons/mod/glossary/services/glossary.ts +++ b/src/addons/mod/glossary/services/glossary.ts @@ -50,7 +50,7 @@ export class AddonModGlossaryProvider { * Get the course glossary cache key. * * @param courseId Course Id. - * @return Cache key. + * @returns Cache key. */ protected getCourseGlossariesCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'courseGlossaries:' + courseId; @@ -61,7 +61,7 @@ export class AddonModGlossaryProvider { * * @param courseId Course Id. * @param options Other options. - * @return Resolved with the glossaries. + * @returns Resolved with the glossaries. */ async getCourseGlossaries(courseId: number, options: CoreSitesCommonWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -90,7 +90,7 @@ export class AddonModGlossaryProvider { * * @param courseId Course Id. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateCourseGlossaries(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -107,7 +107,7 @@ export class AddonModGlossaryProvider { * @param letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. * @param field Search and order using: FIRSTNAME or LASTNAME * @param sort The direction of the order: ASC or DESC - * @return Cache key. + * @returns Cache key. */ protected getEntriesByAuthorCacheKey(glossaryId: number, letter: string, field: string, sort: string): string { return ROOT_CACHE_KEY + 'entriesByAuthor:' + glossaryId + ':' + letter + ':' + field + ':' + sort; @@ -121,7 +121,7 @@ export class AddonModGlossaryProvider { * @param field Search and order using: FIRSTNAME or LASTNAME * @param sort The direction of the order: ASC or DESC * @param options Other options. - * @return Resolved with the entries. + * @returns Resolved with the entries. */ async getEntriesByAuthor( glossaryId: number, @@ -159,7 +159,7 @@ export class AddonModGlossaryProvider { * @param field Search and order using: FIRSTNAME or LASTNAME * @param sort The direction of the order: ASC or DESC * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateEntriesByAuthor( glossaryId: number, @@ -182,7 +182,7 @@ export class AddonModGlossaryProvider { * @param categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or * constant SHOW_NOT_CATEGORISED for uncategorised entries. * @param options Other options. - * @return Resolved with the entries. + * @returns Resolved with the entries. */ async getEntriesByCategory( glossaryId: number, @@ -215,7 +215,7 @@ export class AddonModGlossaryProvider { * @param categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or * constant SHOW_NOT_CATEGORISED for uncategorised entries. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateEntriesByCategory(glossaryId: number, categoryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -231,7 +231,7 @@ export class AddonModGlossaryProvider { * @param glossaryId Glossary Id. * @param categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or * constant SHOW_NOT_CATEGORISED for uncategorised entries. - * @return Cache key. + * @returns Cache key. */ getEntriesByCategoryCacheKey(glossaryId: number, categoryId: number): string { return ROOT_CACHE_KEY + 'entriesByCategory:' + glossaryId + ':' + categoryId; @@ -243,7 +243,7 @@ export class AddonModGlossaryProvider { * @param glossaryId Glossary Id. * @param order The way to order the records. * @param sort The direction of the order. - * @return Cache key. + * @returns Cache key. */ getEntriesByDateCacheKey(glossaryId: number, order: string, sort: string): string { return ROOT_CACHE_KEY + 'entriesByDate:' + glossaryId + ':' + order + ':' + sort; @@ -256,7 +256,7 @@ export class AddonModGlossaryProvider { * @param order The way to order the records. * @param sort The direction of the order. * @param options Other options. - * @return Resolved with the entries. + * @returns Resolved with the entries. */ async getEntriesByDate( glossaryId: number, @@ -291,7 +291,7 @@ export class AddonModGlossaryProvider { * @param order The way to order the records. * @param sort The direction of the order. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateEntriesByDate(glossaryId: number, order: string, sort: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -306,7 +306,7 @@ export class AddonModGlossaryProvider { * * @param glossaryId Glossary Id. * @param letter A letter, or a special keyword. - * @return Cache key. + * @returns Cache key. */ protected getEntriesByLetterCacheKey(glossaryId: number, letter: string): string { return ROOT_CACHE_KEY + 'entriesByLetter:' + glossaryId + ':' + letter; @@ -318,7 +318,7 @@ export class AddonModGlossaryProvider { * @param glossaryId Glossary Id. * @param letter A letter, or a special keyword. * @param options Other options. - * @return Resolved with the entries. + * @returns Resolved with the entries. */ async getEntriesByLetter( glossaryId: number, @@ -364,7 +364,7 @@ export class AddonModGlossaryProvider { * @param glossaryId Glossary Id. * @param letter A letter, or a special keyword. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateEntriesByLetter(glossaryId: number, letter: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -382,7 +382,7 @@ export class AddonModGlossaryProvider { * @param fullSearch Whether or not full search is required. * @param order The way to order the results. * @param sort The direction of the order. - * @return Cache key. + * @returns Cache key. */ protected getEntriesBySearchCacheKey( glossaryId: number, @@ -402,12 +402,8 @@ export class AddonModGlossaryProvider { * @param fullSearch Whether or not full search is required. * @param order The way to order the results. * @param sort The direction of the order. - * @param from Start returning records from here. - * @param limit Number of records to return. - * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. - * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param siteId Site ID. If not defined, current site. - * @return Resolved with the entries. + * @param options Get entries options. + * @returns Resolved with the entries. */ async getEntriesBySearch( glossaryId: number, @@ -448,7 +444,7 @@ export class AddonModGlossaryProvider { * @param order The way to order the results. * @param sort The direction of the order. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateEntriesBySearch( glossaryId: number, @@ -469,7 +465,7 @@ export class AddonModGlossaryProvider { * Get the glossary categories cache key. * * @param glossaryId Glossary Id. - * @return The cache key. + * @returns The cache key. */ protected getCategoriesCacheKey(glossaryId: number): string { return ROOT_CACHE_KEY + 'categories:' + glossaryId; @@ -480,7 +476,7 @@ export class AddonModGlossaryProvider { * * @param glossaryId Glossary Id. * @param options Other options. - * @return Promise resolved with the categories if supported or empty array if not. + * @returns Promise resolved with the categories if supported or empty array if not. */ async getAllCategories(glossaryId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -495,7 +491,7 @@ export class AddonModGlossaryProvider { * @param categories Already fetched categories where to append the fetch. * @param site Site object. * @param options Other options. - * @return Promise resolved with the categories. + * @returns Promise resolved with the categories. */ protected async getCategories( glossaryId: number, @@ -537,7 +533,7 @@ export class AddonModGlossaryProvider { * * @param glossaryId Glossary Id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when categories data has been invalidated, + * @returns Promise resolved when categories data has been invalidated, */ async invalidateCategories(glossaryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -549,7 +545,7 @@ export class AddonModGlossaryProvider { * Get an entry by ID cache key. * * @param entryId Entry Id. - * @return Cache key. + * @returns Cache key. */ protected getEntryCacheKey(entryId: number): string { return ROOT_CACHE_KEY + 'getEntry:' + entryId; @@ -560,7 +556,7 @@ export class AddonModGlossaryProvider { * * @param entryId Entry ID. * @param options Other options. - * @return Promise resolved with the entry. + * @returns Promise resolved with the entry. */ async getEntry(entryId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -606,7 +602,7 @@ export class AddonModGlossaryProvider { * * @param entryId Entry ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the glossary ID and the "from". + * @returns Promise resolved with the glossary ID and the "from". */ async getStoredDataForEntry(entryId: number, siteId?: string): Promise<{glossaryId: number; from: number}> { const site = await CoreSites.getSite(siteId); @@ -631,7 +627,7 @@ export class AddonModGlossaryProvider { * @param from Page to get. * @param loadNext Whether to load next pages if not found. * @param options Options. - * @return Promise resolved with the entry data. + * @returns Promise resolved with the entry data. */ protected async getEntryFromList( glossaryId: number, @@ -670,7 +666,7 @@ export class AddonModGlossaryProvider { * * @param fetchFunction Function to fetch. * @param options Other options. - * @return Promise resolved with all entrries. + * @returns Promise resolved with all entrries. */ fetchAllEntries( fetchFunction: (options?: AddonModGlossaryGetEntriesOptions) => Promise, @@ -699,7 +695,7 @@ export class AddonModGlossaryProvider { * * @param entryId Entry Id. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ async invalidateEntry(entryId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -712,7 +708,7 @@ export class AddonModGlossaryProvider { * * @param entries Entry objects to invalidate. * @param siteId Site ID. If not defined, current site. - * @return Resolved when data is invalidated. + * @returns Resolved when data is invalidated. */ protected async invalidateEntries(entries: AddonModGlossaryEntry[], siteId?: string): Promise { const keys: string[] = []; @@ -731,7 +727,7 @@ export class AddonModGlossaryProvider { * * @param moduleId The module ID. * @param courseId Course ID. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateContent(moduleId: number, courseId: number): Promise { const glossary = await this.getGlossary(courseId, moduleId); @@ -751,7 +747,7 @@ export class AddonModGlossaryProvider { * @param glossary The glossary object. * @param onlyEntriesList If true, entries won't be invalidated. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateGlossaryEntries(glossary: AddonModGlossaryGlossary, onlyEntriesList?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -798,7 +794,7 @@ export class AddonModGlossaryProvider { * @param courseId Course Id. * @param cmId Course Module Id. * @param options Other options. - * @return Promise resolved with the glossary. + * @returns Promise resolved with the glossary. */ async getGlossary(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { const glossaries = await this.getCourseGlossaries(courseId, options); @@ -818,7 +814,7 @@ export class AddonModGlossaryProvider { * @param courseId Course Id. * @param glossaryId Glossary Id. * @param options Other options. - * @return Promise resolved with the glossary. + * @returns Promise resolved with the glossary. */ async getGlossaryById( courseId: number, @@ -846,7 +842,7 @@ export class AddonModGlossaryProvider { * @param entryOptions Options for the entry. * @param attachments Attachments ID if sending online, result of CoreFileUploaderProvider#storeFilesToUpload otherwise. * @param otherOptions Other options. - * @return Promise resolved with entry ID if entry was created in server, false if stored in device. + * @returns Promise resolved with entry ID if entry was created in server, false if stored in device. */ async addEntry( glossaryId: number, @@ -942,7 +938,7 @@ export class AddonModGlossaryProvider { * @param options Options for the entry. * @param attachId Attachments ID (if any attachment). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the entry ID if created, rejected otherwise. + * @returns Promise resolved with the entry ID if created, rejected otherwise. */ async addEntryOnline( glossaryId: number, @@ -980,7 +976,7 @@ export class AddonModGlossaryProvider { * @param glossaryId Glossary ID. * @param concept Concept to check. * @param options Other options. - * @return Promise resolved with true if used, resolved with false if not used or error. + * @returns Promise resolved with true if used, resolved with false if not used or error. */ async isConceptUsed(glossaryId: number, concept: string, options: AddonModGlossaryIsConceptUsedOptions = {}): Promise { try { @@ -1014,7 +1010,7 @@ export class AddonModGlossaryProvider { * @param mode The mode in which the glossary was viewed. * @param name Name of the glossary. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(glossaryId: number, mode: string, name?: string, siteId?: string): Promise { const params: AddonModGlossaryViewGlossaryWSParams = { @@ -1041,7 +1037,7 @@ export class AddonModGlossaryProvider { * @param glossaryId Glossary ID. * @param name Name of the glossary. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logEntryView(entryId: number, glossaryId: number, name?: string, siteId?: string): Promise { const params: AddonModGlossaryViewEntryWSParams = { @@ -1067,7 +1063,7 @@ export class AddonModGlossaryProvider { * @param entries Entries. * @param from The "page" the entries belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async storeEntries( glossaryId: number, @@ -1085,7 +1081,7 @@ export class AddonModGlossaryProvider { * @param entryId Entry ID. * @param from The "page" the entry belongs to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async storeEntryId(glossaryId: number, entryId: number, from: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/glossary/services/handlers/prefetch.ts b/src/addons/mod/glossary/services/handlers/prefetch.ts index c62f67ac2..d6b6cf5f4 100644 --- a/src/addons/mod/glossary/services/handlers/prefetch.ts +++ b/src/addons/mod/glossary/services/handlers/prefetch.ts @@ -64,7 +64,7 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr * @param module Module to get the files. * @param glossary Glossary * @param entries Entries of the Glossary. - * @return List of Files. + * @returns List of Files. */ protected getFilesFromGlossaryAndEntries( module: CoreCourseAnyModuleData, @@ -105,7 +105,7 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr * @param module The module object returned by WS. * @param courseId Course ID the module belongs to. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchGlossary(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const options = { diff --git a/src/addons/mod/h5pactivity/components/index/index.ts b/src/addons/mod/h5pactivity/components/index/index.ts index 4cb9e17ed..a749b6e1d 100644 --- a/src/addons/mod/h5pactivity/components/index/index.ts +++ b/src/addons/mod/h5pactivity/components/index/index.ts @@ -161,7 +161,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Fetch the access info and store it in the right variables. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async checkHasOffline(): Promise { if (!this.h5pActivity) { @@ -174,7 +174,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Fetch the access info and store it in the right variables. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAccessInfo(): Promise { if (!this.h5pActivity) { @@ -190,7 +190,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Fetch the deployed file data if needed and store it in the right variables. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchDeployedFileData(): Promise { if (!this.siteCanDownload || !this.h5pActivity) { @@ -220,7 +220,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Calculate the state of the deployed file. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async calculateFileState(): Promise { if (!this.fileUrl || !this.deployedFile) { @@ -272,7 +272,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv * Download the file and play it. * * @param event Click event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async downloadAndPlay(event?: MouseEvent): Promise { event?.preventDefault(); @@ -311,7 +311,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Download the file automatically. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadAutomatically(): Promise { try { @@ -328,7 +328,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv /** * Download athe H5P deployed file or restores an ongoing download. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadDeployedFile(): Promise { if (!this.fileUrl || !this.deployedFile) { @@ -430,7 +430,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv * Treat an iframe message event. * * @param event Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async onIframeMessage(event: MessageEvent): Promise { const data = event.data; @@ -479,7 +479,7 @@ export class AddonModH5PActivityIndexComponent extends CoreCourseModuleMainActiv * Check if an event is an XAPI post statement of the current activity. * * @param data Event data. - * @return Whether it's an XAPI post statement of the current activity. + * @returns Whether it's an XAPI post statement of the current activity. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any protected isCurrentXAPIPost(data: any): data is AddonModH5PActivityXAPIData { diff --git a/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.ts b/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.ts index 552568111..e54f4017e 100644 --- a/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.ts +++ b/src/addons/mod/h5pactivity/pages/attempt-results/attempt-results.ts @@ -80,7 +80,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit { /** * Get quiz data and attempt data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -110,7 +110,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit { /** * Get user profile. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchUserProfile(): Promise { if (!this.attempt) { @@ -127,7 +127,7 @@ export class AddonModH5PActivityAttemptResultsPage implements OnInit { /** * Refresh the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshData(): Promise { const promises = [ diff --git a/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.ts b/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.ts index c0864d3ec..e91c957bd 100644 --- a/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.ts +++ b/src/addons/mod/h5pactivity/pages/user-attempts/user-attempts.ts @@ -83,7 +83,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit { /** * Get quiz data and attempt data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -112,7 +112,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit { /** * Get attempts. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAttempts(): Promise { if (!this.h5pActivity) { @@ -128,7 +128,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit { /** * Get user profile. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchUserProfile(): Promise { try { @@ -141,7 +141,7 @@ export class AddonModH5PActivityUserAttemptsPage implements OnInit { /** * Refresh the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshData(): Promise { const promises = [ diff --git a/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.ts b/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.ts index d77dca7a2..b2bb4b57b 100644 --- a/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.ts +++ b/src/addons/mod/h5pactivity/pages/users-attempts/users-attempts.ts @@ -79,7 +79,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit { * Get quiz data and attempt data. * * @param refresh Whether user is refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(refresh?: boolean): Promise { try { @@ -104,7 +104,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit { * Get users. * * @param refresh Whether user is refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchUsers(refresh?: boolean): Promise { if (!this.h5pActivity) { @@ -137,7 +137,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit { * * @param h5pActivity Activity data. * @param users Users to format. - * @return Formatted users. + * @returns Formatted users. */ protected async formatUsers( h5pActivity: AddonModH5PActivityData, @@ -186,7 +186,7 @@ export class AddonModH5PActivityUsersAttemptsPage implements OnInit { /** * Refresh the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshData(): Promise { const promises = [ diff --git a/src/addons/mod/h5pactivity/services/h5pactivity-sync.ts b/src/addons/mod/h5pactivity/services/h5pactivity-sync.ts index 37022b939..5eb33e384 100644 --- a/src/addons/mod/h5pactivity/services/h5pactivity-sync.ts +++ b/src/addons/mod/h5pactivity/services/h5pactivity-sync.ts @@ -45,7 +45,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllActivities(siteId?: string, force?: boolean): Promise { return this.syncOnSites('H5P activities', (siteId) => this.syncAllActivitiesFunc(!!force, siteId), siteId); @@ -56,7 +56,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. If not defined, sync all sites. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllActivitiesFunc(force: boolean, siteId?: string): Promise { const entries = await CoreXAPIOffline.getAllStatements(siteId); @@ -83,7 +83,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP * * @param contextId Context ID of the activity. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the activity is synced or it doesn't need to be synced. + * @returns Promise resolved when the activity is synced or it doesn't need to be synced. */ async syncActivityIfNeeded(contextId: number, siteId?: string): Promise { const needed = await this.isSyncNeeded(contextId, siteId); @@ -98,7 +98,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP * * @param contextId Context ID of the activity. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ syncActivity(contextId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -122,7 +122,7 @@ export class AddonModH5PActivitySyncProvider extends CoreCourseActivitySyncBaseP * * @param contextId Context ID of the activity. * @param siteId Site ID. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ protected async syncActivityData(contextId: number, siteId: string): Promise { diff --git a/src/addons/mod/h5pactivity/services/h5pactivity.ts b/src/addons/mod/h5pactivity/services/h5pactivity.ts index 15e4a4a9d..a7b167179 100644 --- a/src/addons/mod/h5pactivity/services/h5pactivity.ts +++ b/src/addons/mod/h5pactivity/services/h5pactivity.ts @@ -50,8 +50,8 @@ export class AddonModH5PActivityProvider { /** * Check if a certain site allows viewing list of users and their attempts. * - * @param site Site ID. If not defined, use current site. - * @return Whether can view users. + * @param siteId Site ID. If not defined, use current site. + * @returns Whether can view users. * @since 3.11 */ async canGetUsersAttempts(siteId?: string): Promise { @@ -64,7 +64,7 @@ export class AddonModH5PActivityProvider { * Check if a certain site allows viewing list of users and their attempts. * * @param site Site. If not defined, use current site. - * @return Whether can view users. + * @returns Whether can view users. * @since 3.11 */ canGetUsersAttemptsInSite(site?: CoreSite): boolean { @@ -77,7 +77,7 @@ export class AddonModH5PActivityProvider { * Format an attempt's data. * * @param attempt Attempt to format. - * @return Formatted attempt. + * @returns Formatted attempt. */ protected formatAttempt(attempt: AddonModH5PActivityWSAttempt): AddonModH5PActivityAttempt { const formattedAttempt: AddonModH5PActivityAttempt = attempt; @@ -101,6 +101,7 @@ export class AddonModH5PActivityProvider { * Format attempt data and results. * * @param attempt Attempt and results to format. + * @returns Attemp data and results. */ protected formatAttemptResults(attempt: AddonModH5PActivityWSAttemptResults): AddonModH5PActivityAttemptResults { const formattedAttempt: AddonModH5PActivityAttemptResults = this.formatAttempt(attempt); @@ -114,7 +115,7 @@ export class AddonModH5PActivityProvider { * Format the attempts of a user. * * @param data Data to format. - * @return Formatted data. + * @returns Formatted data. */ protected formatUserAttempts(data: AddonModH5PActivityWSUserAttempts): AddonModH5PActivityUserAttempts { const formatted: AddonModH5PActivityUserAttempts = data; @@ -132,6 +133,7 @@ export class AddonModH5PActivityProvider { * Format an attempt's result. * * @param result Result to format. + * @returns Attempts results */ protected formatResult(result: AddonModH5PActivityWSResult): AddonModH5PActivityWSResult { result.timecreated = result.timecreated * 1000; // Convert to milliseconds. @@ -143,7 +145,7 @@ export class AddonModH5PActivityProvider { * Get cache key for access information WS calls. * * @param id H5P activity ID. - * @return Cache key. + * @returns Cache key. */ protected getAccessInformationCacheKey(id: number): string { return ROOT_CACHE_KEY + 'accessInfo:' + id; @@ -154,7 +156,7 @@ export class AddonModH5PActivityProvider { * * @param id H5P activity ID. * @param options Other options. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getAccessInformation(id: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -178,7 +180,7 @@ export class AddonModH5PActivityProvider { * * @param id Activity ID. * @param options Other options. - * @return Promise resolved with the results of the attempt. + * @returns Promise resolved with the results of the attempt. */ async getAllAttemptsResults( id: number, @@ -207,7 +209,7 @@ export class AddonModH5PActivityProvider { * * @param id Activity ID. * @param options Other options. - * @return Promise resolved with the list of user. + * @returns Promise resolved with the list of user. */ async getAllUsersAttempts( id: number, @@ -245,7 +247,7 @@ export class AddonModH5PActivityProvider { * * @param id H5P Activity ID. * @param options Options. - * @return Promise resolved with list of users and whether can load more attempts. + * @returns Promise resolved with list of users and whether can load more attempts. * @since 3.11 */ async getUsersAttempts( @@ -300,8 +302,8 @@ export class AddonModH5PActivityProvider { * Get cache key for get users attempts WS calls. * * @param id Instance ID. - * @param attemptsIds Attempts IDs. - * @return Cache key. + * @param options Get attempts options. + * @returns Cache key. */ protected getUsersAttemptsCacheKey(id: number, options: AddonModH5PActivityGetUsersAttemptsOptions): string { return this.getUsersAttemptsCommonCacheKey(id) + `:${options.page}:${options.perPage}` + @@ -312,7 +314,7 @@ export class AddonModH5PActivityProvider { * Get common cache key for get users attempts WS calls. * * @param id Instance ID. - * @return Cache key. + * @returns Cache key. */ protected getUsersAttemptsCommonCacheKey(id: number): string { return ROOT_CACHE_KEY + 'userAttempts:' + id; @@ -323,7 +325,7 @@ export class AddonModH5PActivityProvider { * * @param id Instance ID. * @param attemptsIds Attempts IDs. - * @return Cache key. + * @returns Cache key. */ protected getAttemptResultsCacheKey(id: number, attemptsIds: number[]): string { return this.getAttemptResultsCommonCacheKey(id) + ':' + JSON.stringify(attemptsIds); @@ -333,7 +335,7 @@ export class AddonModH5PActivityProvider { * Get common cache key for results WS calls. * * @param id Instance ID. - * @return Cache key. + * @returns Cache key. */ protected getAttemptResultsCommonCacheKey(id: number): string { return ROOT_CACHE_KEY + 'results:' + id; @@ -345,7 +347,7 @@ export class AddonModH5PActivityProvider { * @param id Activity ID. * @param attemptId Attempt ID. * @param options Other options. - * @return Promise resolved with the results of the attempt. + * @returns Promise resolved with the results of the attempt. */ async getAttemptResults( id: number, @@ -411,7 +413,7 @@ export class AddonModH5PActivityProvider { * @param id Activity ID. * @param attemptsIds Attempts IDs. * @param options Other options. - * @return Promise resolved with all the attempts. + * @returns Promise resolved with all the attempts. */ async getAttemptsResults( id: number, @@ -451,7 +453,7 @@ export class AddonModH5PActivityProvider { * * @param h5pActivity Activity instance. * @param options Options - * @return Promise resolved with the file. + * @returns Promise resolved with the file. */ async getDeployedFile( h5pActivity: AddonModH5PActivityData, @@ -483,7 +485,7 @@ export class AddonModH5PActivityProvider { * Get cache key for H5P activity data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getH5PActivityDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'h5pactivity:' + courseId; @@ -496,7 +498,7 @@ export class AddonModH5PActivityProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved with the activity data. + * @returns Promise resolved with the activity data. */ protected async getH5PActivityByField( courseId: number, @@ -538,7 +540,7 @@ export class AddonModH5PActivityProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved with the activity data. + * @returns Promise resolved with the activity data. */ getH5PActivity(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getH5PActivityByField(courseId, 'coursemodule', cmId, options); @@ -550,7 +552,7 @@ export class AddonModH5PActivityProvider { * @param courseId Course ID. * @param contextId Context ID. * @param options Other options. - * @return Promise resolved with the activity data. + * @returns Promise resolved with the activity data. */ getH5PActivityByContextId( courseId: number, @@ -566,7 +568,7 @@ export class AddonModH5PActivityProvider { * @param courseId Course ID. * @param id Instance ID. * @param options Other options. - * @return Promise resolved with the activity data. + * @returns Promise resolved with the activity data. */ getH5PActivityById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getH5PActivityByField(courseId, 'id', id, options); @@ -577,7 +579,7 @@ export class AddonModH5PActivityProvider { * * @param id Instance ID. * @param userIds User IDs. - * @return Cache key. + * @returns Cache key. */ protected getUserAttemptsCacheKey(id: number, userIds: number[]): string { return this.getUserAttemptsCommonCacheKey(id) + ':' + JSON.stringify(userIds); @@ -587,7 +589,7 @@ export class AddonModH5PActivityProvider { * Get common cache key for attempts WS calls. * * @param id Instance ID. - * @return Cache key. + * @returns Cache key. */ protected getUserAttemptsCommonCacheKey(id: number): string { return ROOT_CACHE_KEY + 'attempts:' + id; @@ -598,7 +600,7 @@ export class AddonModH5PActivityProvider { * * @param id Activity ID. * @param options Other options. - * @return Promise resolved with the attempts of the user. + * @returns Promise resolved with the attempts of the user. */ async getUserAttempts( id: number, @@ -664,7 +666,7 @@ export class AddonModH5PActivityProvider { * * @param id H5P activity ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAccessInformation(id: number, siteId?: string): Promise { @@ -678,7 +680,7 @@ export class AddonModH5PActivityProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateActivityData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -691,7 +693,7 @@ export class AddonModH5PActivityProvider { * * @param id Activity ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllResults(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -705,7 +707,7 @@ export class AddonModH5PActivityProvider { * @param id Activity ID. * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptResults(id: number, attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -718,7 +720,7 @@ export class AddonModH5PActivityProvider { * * @param id Activity ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllUsersAttempts(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -732,7 +734,7 @@ export class AddonModH5PActivityProvider { * @param id Activity ID. * @param userId User ID. If not defined, current user in the site. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserAttempts(id: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -745,7 +747,7 @@ export class AddonModH5PActivityProvider { /** * Delete launcher. * - * @return Promise resolved when the launcher file is deleted. + * @returns Promise resolved when the launcher file is deleted. * @since 3.9 */ async isPluginEnabled(siteId?: string): Promise { @@ -760,7 +762,7 @@ export class AddonModH5PActivityProvider { * @param id H5P activity ID. * @param name Name of the activity. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModH5PActivityViewH5pactivityWSParams = { @@ -785,7 +787,7 @@ export class AddonModH5PActivityProvider { * @param id H5P activity ID. * @param name Name of the activity. * @param options Options. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logViewReport(id: number, name?: string, options: AddonModH5PActivityViewReportOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); diff --git a/src/addons/mod/h5pactivity/services/handlers/prefetch.ts b/src/addons/mod/h5pactivity/services/handlers/prefetch.ts index 3e4a53b11..a4202cb41 100644 --- a/src/addons/mod/h5pactivity/services/handlers/prefetch.ts +++ b/src/addons/mod/h5pactivity/services/handlers/prefetch.ts @@ -86,7 +86,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit * @param module Module. * @param courseId Course ID the module belongs to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchActivity( module: CoreCourseAnyModuleData, @@ -113,7 +113,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit * @param module Module. * @param h5pActivity Activity instance. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchMainFile( module: CoreCourseAnyModuleData, @@ -137,7 +137,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit * * @param h5pActivity Activity instance. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchWSData(h5pActivity: AddonModH5PActivityData, siteId: string): Promise { diff --git a/src/addons/mod/h5pactivity/services/handlers/report-link.ts b/src/addons/mod/h5pactivity/services/handlers/report-link.ts index f3272d2bf..d14933783 100644 --- a/src/addons/mod/h5pactivity/services/handlers/report-link.ts +++ b/src/addons/mod/h5pactivity/services/handlers/report-link.ts @@ -86,7 +86,6 @@ export class AddonModH5PActivityReportLinkHandlerService extends CoreContentLink * @param attemptId Attempt ID. * @param courseId Course ID. * @param siteId Site ID. - * @return Promise resolved when done. */ protected openAttemptResults(cmId: number, attemptId: number, courseId: number, siteId: string): void { const path = AddonModH5PActivityModuleHandlerService.PAGE_NAME + `/${courseId}/${cmId}/attemptresults/${attemptId}`; @@ -104,7 +103,7 @@ export class AddonModH5PActivityReportLinkHandlerService extends CoreContentLink * @param id Instance ID. * @param siteId Site ID. * @param userId User ID. If not defined, current user in site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async openUserAttempts(cmId: number, courseId: number, id: number, siteId: string, userId?: number): Promise { let canViewAllAttempts = false; diff --git a/src/addons/mod/h5pactivity/services/handlers/sync-cron.ts b/src/addons/mod/h5pactivity/services/handlers/sync-cron.ts index 9742b4245..5762587d6 100644 --- a/src/addons/mod/h5pactivity/services/handlers/sync-cron.ts +++ b/src/addons/mod/h5pactivity/services/handlers/sync-cron.ts @@ -32,7 +32,7 @@ export class AddonModH5PActivitySyncCronHandlerService implements CoreCronHandle * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModH5PActivitySync.syncAllActivities(siteId, force); @@ -41,7 +41,7 @@ export class AddonModH5PActivitySyncCronHandlerService implements CoreCronHandle /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModH5PActivitySync.syncInterval; diff --git a/src/addons/mod/imscp/components/index/index.ts b/src/addons/mod/imscp/components/index/index.ts index 97eff0801..bde54ea69 100644 --- a/src/addons/mod/imscp/components/index/index.ts +++ b/src/addons/mod/imscp/components/index/index.ts @@ -50,7 +50,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { await AddonModImscp.invalidateContent(this.module.id, this.courseId); @@ -69,7 +69,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Load IMSCP data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadImscp(): Promise { const imscp = await AddonModImscp.getImscp(this.courseId, this.module.id); @@ -87,7 +87,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Load book TOC. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadTOC(): Promise { // Get contents. No need to refresh, it has been done in downloadResourceIfNeeded. @@ -124,7 +124,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom * Get dummy array for padding. * * @param n Array length. - * @return Dummy array with n elements. + * @returns Dummy array with n elements. */ getNumberForPadding(n: number): number[] { return new Array(n); diff --git a/src/addons/mod/imscp/components/toc/toc.ts b/src/addons/mod/imscp/components/toc/toc.ts index 097f003b7..9378ba647 100644 --- a/src/addons/mod/imscp/components/toc/toc.ts +++ b/src/addons/mod/imscp/components/toc/toc.ts @@ -41,7 +41,7 @@ export class AddonModImscpTocComponent { * Get dummy array for padding. * * @param n Array length. - * @return Dummy array with n elements. + * @returns Dummy array with n elements. */ getNumberForPadding(n: number): number[] { return new Array(n); diff --git a/src/addons/mod/imscp/pages/view/view.ts b/src/addons/mod/imscp/pages/view/view.ts index e491daf2e..ccc01af8e 100644 --- a/src/addons/mod/imscp/pages/view/view.ts +++ b/src/addons/mod/imscp/pages/view/view.ts @@ -76,7 +76,7 @@ export class AddonModImscpViewPage implements OnInit { * Download IMSCP contents and load the current item. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(refresh = false): Promise { try { @@ -140,7 +140,7 @@ export class AddonModImscpViewPage implements OnInit { /** * Load IMSCP data from WS. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadImscpData(): Promise<{ module: CoreCourseModuleData; imscp: AddonModImscpImscp }> { this.module = await CoreCourse.getModule(this.cmId, this.courseId); @@ -157,8 +157,9 @@ export class AddonModImscpViewPage implements OnInit { * If the download call fails the promise won't be rejected, but the error will be included in the returned object. * If module.contents cannot be loaded then the Promise will be rejected. * + * @param module Module data. * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadResourceIfNeeded( module: CoreCourseModuleData, @@ -211,7 +212,7 @@ export class AddonModImscpViewPage implements OnInit { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher): Promise { await CoreUtils.ignoreErrors(Promise.all([ @@ -228,7 +229,7 @@ export class AddonModImscpViewPage implements OnInit { * Loads an item. * * @param itemHref Item Href. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadItemHref(itemHref: string): Promise { if (!this.module) { diff --git a/src/addons/mod/imscp/services/imscp.ts b/src/addons/mod/imscp/services/imscp.ts index 40297c0cc..4c388cf78 100644 --- a/src/addons/mod/imscp/services/imscp.ts +++ b/src/addons/mod/imscp/services/imscp.ts @@ -41,7 +41,7 @@ export class AddonModImscpProvider { * Get the IMSCP toc as an array. * * @param contents The module contents. - * @return The toc. + * @returns The toc. */ protected getToc(contents: CoreCourseModuleContentFile[]): AddonModImscpTocItemTree[] { if (!contents || !contents.length) { @@ -55,7 +55,7 @@ export class AddonModImscpProvider { * Get the imscp toc as an array of items (not nested) to build the navigation tree. * * @param contents The module contents. - * @return The toc as a list. + * @returns The toc as a list. */ createItemList(contents: CoreCourseModuleContentFile[]): AddonModImscpTocItem[] { const items: AddonModImscpTocItem[] = []; @@ -75,7 +75,7 @@ export class AddonModImscpProvider { * Check if we should ommit the file download. * * @param fileName The file name - * @return True if we should ommit the file. + * @returns True if we should ommit the file. */ protected checkSpecialFiles(fileName: string): boolean { return fileName == 'imsmanifest.xml'; @@ -85,7 +85,7 @@ export class AddonModImscpProvider { * Get cache key for imscp data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getImscpDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'imscp:' + courseId; @@ -98,7 +98,7 @@ export class AddonModImscpProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the imscp is retrieved. + * @returns Promise resolved when the imscp is retrieved. */ protected async getImscpByKey( courseId: number, @@ -136,7 +136,7 @@ export class AddonModImscpProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the imscp is retrieved. + * @returns Promise resolved when the imscp is retrieved. */ getImscp(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getImscpByKey(courseId, 'coursemodule', cmId, options); @@ -147,7 +147,7 @@ export class AddonModImscpProvider { * * @param items Module contents. * @param targetFilePath Path of the searched file. - * @return File URL. + * @returns File URL. */ protected getFileUrlFromContents(items: CoreCourseModuleContentFile[], targetFilePath: string): string | undefined { const item = items.find((item) => { @@ -170,7 +170,7 @@ export class AddonModImscpProvider { * * @param module The module object. * @param itemHref Href of item to get. - * @return Promise resolved with the item src. + * @returns Promise resolved with the item src. */ async getIframeSrc(module: CoreCourseModuleData, itemHref: string): Promise { const siteId = CoreSites.getCurrentSiteId(); @@ -202,7 +202,7 @@ export class AddonModImscpProvider { * * @param id IMSCP instance ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with last item viewed's href, undefined if none. + * @returns Promise resolved with last item viewed's href, undefined if none. */ async getLastItemViewed(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -217,7 +217,7 @@ export class AddonModImscpProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the content is invalidated. + * @returns Promise resolved when the content is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -236,7 +236,7 @@ export class AddonModImscpProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateImscpData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -249,7 +249,7 @@ export class AddonModImscpProvider { * like in core_course_get_contents response. * * @param file File to check. - * @return True if downloadable, false otherwise. + * @returns True if downloadable, false otherwise. */ isFileDownloadable(file: CoreCourseModuleContentFile): boolean { return file.type === 'file' && !this.checkSpecialFiles(file.filename); @@ -259,7 +259,7 @@ export class AddonModImscpProvider { * Return whether or not the plugin is enabled in a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -273,7 +273,7 @@ export class AddonModImscpProvider { * @param id Module ID. * @param name Name of the imscp. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModImscpViewImscpWSParams = { @@ -299,7 +299,7 @@ export class AddonModImscpProvider { * @param href Item href. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with last item viewed, undefined if none. + * @returns Promise resolved with last item viewed, undefined if none. */ async storeLastItemViewed(id: number, href: string, courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/label/services/label.ts b/src/addons/mod/label/services/label.ts index 2bea84806..b37ddffb9 100644 --- a/src/addons/mod/label/services/label.ts +++ b/src/addons/mod/label/services/label.ts @@ -35,7 +35,7 @@ export class AddonModLabelProvider { * Get cache key for label data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getLabelDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'label:' + courseId; @@ -48,7 +48,7 @@ export class AddonModLabelProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the label is retrieved. + * @returns Promise resolved when the label is retrieved. */ protected async getLabelByField( courseId: number, @@ -86,7 +86,7 @@ export class AddonModLabelProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the label is retrieved. + * @returns Promise resolved when the label is retrieved. */ getLabel(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getLabelByField(courseId, 'coursemodule', cmId, options); @@ -98,7 +98,7 @@ export class AddonModLabelProvider { * @param courseId Course ID. * @param labelId Label ID. * @param options Other options. - * @return Promise resolved when the label is retrieved. + * @returns Promise resolved when the label is retrieved. */ getLabelById(courseId: number, labelId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getLabelByField(courseId, 'id', labelId, options); @@ -109,7 +109,7 @@ export class AddonModLabelProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLabelData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -123,7 +123,7 @@ export class AddonModLabelProvider { * @param moduleId The module ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/addons/mod/lesson/components/index/index.ts b/src/addons/mod/lesson/components/index/index.ts index d4cd33b9b..5495057e2 100644 --- a/src/addons/mod/lesson/components/index/index.ts +++ b/src/addons/mod/lesson/components/index/index.ts @@ -99,7 +99,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -113,7 +113,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Change the group displayed. * * @param groupId Group ID to display. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changeGroup(groupId: number): Promise { this.reportLoaded = false; @@ -204,7 +204,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Load offline data for the lesson. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadOfflineData(): Promise { if (!this.lesson || !this.accessInfo) { @@ -253,7 +253,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Fetch the reports data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchReportData(): Promise { if (!this.module) { @@ -273,7 +273,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModLessonSyncResult): boolean { if (result.updated || this.dataSent) { @@ -319,7 +319,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Perform the invalidate content function. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -346,7 +346,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModLessonAutoSyncData): boolean { return !!(this.lesson && syncEventData.lessonId == this.lesson.id); @@ -380,7 +380,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Open the lesson player. * * @param continueLast Whether to continue the last retake. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async playLesson(continueLast?: boolean): Promise { if (!this.lesson || !this.accessInfo) { @@ -480,7 +480,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Set a group to view the reports. * * @param groupId Group ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setGroup(groupId: number): Promise { if (!this.lesson) { @@ -639,7 +639,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async sync(): Promise { const result = await AddonModLessonSync.syncLesson(this.lesson!.id, true); @@ -660,7 +660,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Validate a password and retrieve extra data. * * @param password The password to validate. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async validatePassword(password: string): Promise { try { @@ -678,7 +678,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo * Open a certain user retake. * * @param userId User ID to view. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openRetake(userId: number): Promise { CoreNavigator.navigateToSitePath( @@ -687,7 +687,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); diff --git a/src/addons/mod/lesson/pages/index/index.page.ts b/src/addons/mod/lesson/pages/index/index.page.ts index bfb308b25..96f8b121e 100644 --- a/src/addons/mod/lesson/pages/index/index.page.ts +++ b/src/addons/mod/lesson/pages/index/index.page.ts @@ -32,7 +32,7 @@ export class AddonModLessonIndexPage extends CoreCourseModuleMainActivityPage { try { @@ -147,7 +147,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { if (this.lesson) { @@ -159,7 +159,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.forceLeave || !this.questionForm) { @@ -201,7 +201,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * * @param func Function to call. * @param options Options passed to the function. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ protected async callFunction(func: () => Promise, options: CommonOptions): Promise { try { @@ -240,7 +240,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * * @param pageId Page to load. * @param ignoreCurrent If true, allow loading current page. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changePage(pageId: number, ignoreCurrent?: boolean): Promise { if (!ignoreCurrent && !this.eolData && this.currentPage == pageId) { @@ -263,7 +263,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Get the lesson data and load the page. * - * @return Promise resolved with true if success, resolved with false otherwise. + * @returns Promise resolved with true if success, resolved with false otherwise. */ protected async fetchLessonData(): Promise { try { @@ -371,7 +371,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * Finish the retake. * * @param outOfTime Whether the retake is finished because the user ran out of time. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async finishRetake(outOfTime?: boolean): Promise { if (!this.lesson) { @@ -452,7 +452,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * Jump to a certain page after performing an action. * * @param pageId The page to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async jumpToPage(pageId: number): Promise { if (pageId === 0) { @@ -477,7 +477,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * Start or continue a retake. * * @param pageId The page to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async launchRetake(pageId?: number): Promise { let data: AddonModLessonLaunchAttemptWSResponse | undefined; @@ -515,7 +515,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Load the lesson menu. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadMenu(): Promise { if (this.loadingMenu || !this.lesson) { @@ -549,7 +549,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * Load a certain page. * * @param pageId The page to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadPage(pageId: number): Promise { if (pageId == AddonModLessonProvider.LESSON_EOL) { @@ -622,7 +622,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { * * @param data The data to send. * @param formSubmitted Whether a form was submitted. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async processPage(data: CoreFormFields, formSubmitted?: boolean): Promise { if (!this.lesson || !this.pageData) { @@ -780,7 +780,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Show the navigation modal. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async showMenu(): Promise { this.menuShown = true; diff --git a/src/addons/mod/lesson/pages/user-retake/user-retake.page.ts b/src/addons/mod/lesson/pages/user-retake/user-retake.page.ts index 21fbb7fac..d5a894241 100644 --- a/src/addons/mod/lesson/pages/user-retake/user-retake.page.ts +++ b/src/addons/mod/lesson/pages/user-retake/user-retake.page.ts @@ -61,7 +61,7 @@ export class AddonModLessonUserRetakePage implements OnInit { protected previousSelectedRetake?: number; // To be able to detect the previous selected retake when it has changed. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -115,7 +115,7 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Get lesson and retake data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -168,7 +168,7 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Refreshes data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshData(): Promise { const promises: Promise[] = []; @@ -188,7 +188,7 @@ export class AddonModLessonUserRetakePage implements OnInit { * Set the retake to view and load its data. * * @param retakeNumber Retake number to set. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async setRetake(retakeNumber: number): Promise { this.selectedRetake = retakeNumber; @@ -205,8 +205,8 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Format retake data, adding some calculated data. * - * @param data Retake data. - * @return Formatted data. + * @param retakeData Retake data. + * @returns Formatted data. */ protected formatRetake(retakeData: AddonModLessonGetUserAttemptWSResponse): RetakeToDisplay { const formattedData = retakeData; diff --git a/src/addons/mod/lesson/services/handlers/grade-link.ts b/src/addons/mod/lesson/services/handlers/grade-link.ts index c1da1506d..bc77ca7da 100644 --- a/src/addons/mod/lesson/services/handlers/grade-link.ts +++ b/src/addons/mod/lesson/services/handlers/grade-link.ts @@ -44,7 +44,7 @@ export class AddonModLessonGradeLinkHandlerService extends CoreContentLinksModul * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. * @param siteId Site to use. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async goToReview( url: string, diff --git a/src/addons/mod/lesson/services/handlers/index-link.ts b/src/addons/mod/lesson/services/handlers/index-link.ts index 5c0f88f6a..d1f01f87a 100644 --- a/src/addons/mod/lesson/services/handlers/index-link.ts +++ b/src/addons/mod/lesson/services/handlers/index-link.ts @@ -43,7 +43,7 @@ export class AddonModLessonIndexLinkHandlerService extends CoreContentLinksModul * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], @@ -77,7 +77,7 @@ export class AddonModLessonIndexLinkHandlerService extends CoreContentLinksModul * @param courseId Course ID. * @param password Password. * @param siteId Site ID. - * @return Promise resolved when navigated. + * @returns Promise resolved when navigated. */ protected async navigateToModuleWithPassword( moduleId: number, diff --git a/src/addons/mod/lesson/services/handlers/prefetch.ts b/src/addons/mod/lesson/services/handlers/prefetch.ts index 25fcd15b7..e5e354f96 100644 --- a/src/addons/mod/lesson/services/handlers/prefetch.ts +++ b/src/addons/mod/lesson/services/handlers/prefetch.ts @@ -51,7 +51,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref /** * Ask password. * - * @return Promise resolved with the password. + * @returns Promise resolved with the password. */ protected async askUserPassword(): Promise { // Create and show the modal. @@ -72,7 +72,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param module Module. * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. - * @return Promise resolved with the size. + * @returns Promise resolved with the size. */ async getDownloadSize(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise { const siteId = CoreSites.getCurrentSiteId(); @@ -113,7 +113,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async getLessonPassword( lessonId: number, @@ -165,7 +165,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * * @param moduleId The module ID. * @param courseId The course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number): Promise { // Only invalidate the data that doesn't ignore cache when prefetching. @@ -181,7 +181,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ async invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise { // Invalidate data to determine if module is downloadable. @@ -203,7 +203,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can be downloaded. The promise should never be rejected. + * @returns Whether the module can be downloaded. The promise should never be rejected. */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { const siteId = CoreSites.getCurrentSiteId(); @@ -235,7 +235,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchLesson( module: CoreCourseAnyModuleData, @@ -296,6 +296,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param password Password (if needed). * @param modOptions Options. * @param siteId Site ID. + * @returns Access information. */ protected async launchRetake( lessonId: number, @@ -321,7 +322,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param password Password (if needed). * @param retake Retake to prefetch. * @param modOptions Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchPlayData( lesson: AddonModLessonLessonWSData, @@ -350,7 +351,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * * @param lesson Lesson. * @param options Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchPagesData( lesson: AddonModLessonLessonWSData, @@ -397,7 +398,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param lessonId Lesson ID. * @param hasRandomBranch Whether any page has a random branch jump. * @param modOptions Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchPossibleJumps( lessonId: number, @@ -422,7 +423,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param moduleId Module ID. * @param lessonId Lesson ID. * @param modOptions Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchGroupInfo( moduleId: number, @@ -445,7 +446,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param moduleId Module ID. * @param lessonId Lesson ID. * @param modOptions Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchReportsData( moduleId: number, @@ -497,7 +498,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param accessInfo Lesson access info. * @param password Password to check. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async validatePassword( lessonId: number, @@ -529,7 +530,7 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ sync(module: CoreCourseAnyModuleData, courseId: number, siteId?: string): Promise { return AddonModLessonSync.syncLesson(module.instance, false, false, siteId); diff --git a/src/addons/mod/lesson/services/handlers/push-click.ts b/src/addons/mod/lesson/services/handlers/push-click.ts index f78710b25..6d644198b 100644 --- a/src/addons/mod/lesson/services/handlers/push-click.ts +++ b/src/addons/mod/lesson/services/handlers/push-click.ts @@ -35,7 +35,7 @@ export class AddonModLessonPushClickHandlerService implements CorePushNotificati * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler. + * @returns Whether the notification click is handled by this handler. */ async handles(notification: NotificationData): Promise { if (CoreUtils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_lesson' && @@ -51,7 +51,7 @@ export class AddonModLessonPushClickHandlerService implements CorePushNotificati * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ handleClick(notification: NotificationData): Promise { const data = notification.customdata || {}; diff --git a/src/addons/mod/lesson/services/handlers/report-link.ts b/src/addons/mod/lesson/services/handlers/report-link.ts index 355476434..469ce28ef 100644 --- a/src/addons/mod/lesson/services/handlers/report-link.ts +++ b/src/addons/mod/lesson/services/handlers/report-link.ts @@ -39,7 +39,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand * @param siteIds List of sites the URL belongs to. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], @@ -65,7 +65,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand * @param siteId The site ID. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string, url: string, params: Record): Promise { if (params.action == 'reportdetail' && !params.userid) { @@ -82,7 +82,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand * @param moduleId Module ID. * @param groupId Group ID. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async openReportOverview(moduleId: number, groupId?: number, siteId?: string): Promise { @@ -123,7 +123,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand * @param userId User ID. * @param retake Retake to open. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async openUserRetake( moduleId: number, diff --git a/src/addons/mod/lesson/services/handlers/sync-cron.ts b/src/addons/mod/lesson/services/handlers/sync-cron.ts index 1603ab835..2ad2b6984 100644 --- a/src/addons/mod/lesson/services/handlers/sync-cron.ts +++ b/src/addons/mod/lesson/services/handlers/sync-cron.ts @@ -32,7 +32,7 @@ export class AddonModLessonSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModLessonSync.syncAllLessons(siteId, force); @@ -41,7 +41,7 @@ export class AddonModLessonSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModLessonSync.syncInterval; diff --git a/src/addons/mod/lesson/services/lesson-helper.ts b/src/addons/mod/lesson/services/lesson-helper.ts index 6047b8030..9bdb48969 100644 --- a/src/addons/mod/lesson/services/lesson-helper.ts +++ b/src/addons/mod/lesson/services/lesson-helper.ts @@ -42,7 +42,7 @@ export class AddonModLessonHelperProvider { * Given the HTML of next activity link, format it to extract the href and the text. * * @param activityLink HTML of the activity link. - * @return Formatted data. + * @returns Formatted data. */ formatActivityLink(activityLink: string): AddonModLessonActivityLink { const element = CoreDomUtils.convertToElement(activityLink); @@ -68,7 +68,7 @@ export class AddonModLessonHelperProvider { * Given the HTML of an answer from a content page, extract the data to render the answer. * * @param html Answer's HTML. - * @return Data to render the answer. + * @returns Data to render the answer. */ getContentPageAnswerDataFromHtml(html: string): {buttonText: string; content: string} { const data = { @@ -95,7 +95,7 @@ export class AddonModLessonHelperProvider { * Get the buttons to change pages. * * @param html Page's HTML. - * @return List of buttons. + * @returns List of buttons. */ getPageButtonsFromHtml(html: string): AddonModLessonPageButton[] { const buttons: AddonModLessonPageButton[] = []; @@ -147,7 +147,7 @@ export class AddonModLessonHelperProvider { * Given a page data, get the page contents. * * @param data Page data. - * @return Page contents. + * @returns Page contents. */ getPageContentsFromPageData(data: AddonModLessonGetPageDataWSResponse): string { // Search the page contents inside the whole page HTML. Use data.pagecontent because it's filtered. @@ -174,7 +174,7 @@ export class AddonModLessonHelperProvider { * * @param questionForm The form group where to add the controls. * @param pageData Page data. - * @return Question data. + * @returns Question data. */ getQuestionFromPageData(questionForm: FormGroup, pageData: AddonModLessonGetPageDataWSResponse): AddonModLessonQuestion { const element = CoreDomUtils.convertToElement(pageData.pagecontent || ''); @@ -230,7 +230,7 @@ export class AddonModLessonHelperProvider { * @param questionForm The form group where to add the controls. * @param question Basic question data. * @param fieldContainer HTMLElement containing the data. - * @return Question data. + * @returns Question data. */ protected getMultiChoiceQuestionData( questionForm: FormGroup, @@ -302,7 +302,7 @@ export class AddonModLessonHelperProvider { * @param question Basic question data. * @param fieldContainer HTMLElement containing the data. * @param type Type of the input. - * @return Question data. + * @returns Question data. */ protected getInputQuestionData( questionForm: FormGroup, @@ -339,7 +339,7 @@ export class AddonModLessonHelperProvider { * @param questionForm The form group where to add the controls. * @param question Basic question data. * @param fieldContainer HTMLElement containing the data. - * @return Question data. + * @returns Question data. */ protected getEssayQuestionData( questionForm: FormGroup, @@ -381,7 +381,7 @@ export class AddonModLessonHelperProvider { * @param questionForm The form group where to add the controls. * @param question Basic question data. * @param fieldContainer HTMLElement containing the data. - * @return Question data. + * @returns Question data. */ protected getMatchingQuestionData( questionForm: FormGroup, @@ -454,7 +454,7 @@ export class AddonModLessonHelperProvider { * Given the HTML of an answer from a question page, extract the data to render the answer. * * @param html Answer's HTML. - * @return Object with the data to render the answer. If the answer doesn't require any parsing, return a string with the HTML. + * @returns Object with the data to render the answer. If the answer doesn't require any parsing, return a string with the HTML. */ getQuestionPageAnswerDataFromHtml(html: string): AddonModLessonAnswerData { const element = CoreDomUtils.convertToElement(html); @@ -514,7 +514,7 @@ export class AddonModLessonHelperProvider { * * @param retake Retake object. * @param includeDuration Whether to include the duration of the retake. - * @return Retake label. + * @returns Retake label. */ getRetakeLabel(retake: AddonModLessonAttemptsOverviewsAttemptWSData, includeDuration?: boolean): string { const data = { @@ -550,7 +550,7 @@ export class AddonModLessonHelperProvider { * * @param question Question to prepare. * @param data Data to prepare. - * @return Data to send. + * @returns Data to send. */ prepareQuestionData(question: AddonModLessonQuestion, data: CoreFormFields): CoreFormFields { if (question.template == 'essay') { @@ -576,7 +576,7 @@ export class AddonModLessonHelperProvider { * Given the feedback of a process page in HTML, remove the question text. * * @param html Feedback's HTML. - * @return Feedback without the question text. + * @returns Feedback without the question text. */ removeQuestionFromFeedback(html: string): string { const element = CoreDomUtils.convertToElement(html); diff --git a/src/addons/mod/lesson/services/lesson-offline.ts b/src/addons/mod/lesson/services/lesson-offline.ts index 626ed383b..24af2b3f7 100644 --- a/src/addons/mod/lesson/services/lesson-offline.ts +++ b/src/addons/mod/lesson/services/lesson-offline.ts @@ -42,7 +42,7 @@ export class AddonModLessonOfflineProvider { * @param pageId Page ID. * @param timemodified The timemodified of the attempt. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteAttempt(lessonId: number, retake: number, pageId: number, timemodified: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -60,7 +60,7 @@ export class AddonModLessonOfflineProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteRetake(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -75,7 +75,7 @@ export class AddonModLessonOfflineProvider { * @param retake Lesson retake number. * @param pageId Page ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteRetakeAttemptsForPage(lessonId: number, retake: number, pageId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -96,7 +96,7 @@ export class AddonModLessonOfflineProvider { * @param finished Whether retake is finished. * @param outOfTime If the user ran out of time. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async finishRetake( lessonId: number, @@ -123,7 +123,7 @@ export class AddonModLessonOfflineProvider { * Get all the offline page attempts in a certain site. * * @param siteId Site ID. If not set, use current site. - * @return Promise resolved when the offline attempts are retrieved. + * @returns Promise resolved when the offline attempts are retrieved. */ async getAllAttempts(siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -137,7 +137,7 @@ export class AddonModLessonOfflineProvider { * Get all the lessons that have offline data in a certain site. * * @param siteId Site ID. If not set, use current site. - * @return Promise resolved with an object containing the lessons. + * @returns Promise resolved with an object containing the lessons. */ async getAllLessonsWithData(siteId?: string): Promise { const lessons: Record = {}; @@ -157,7 +157,7 @@ export class AddonModLessonOfflineProvider { * Get all the offline retakes in a certain site. * * @param siteId Site ID. If not set, use current site. - * @return Promise resolved when the offline retakes are retrieved. + * @returns Promise resolved when the offline retakes are retrieved. */ async getAllRetakes(siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -171,7 +171,7 @@ export class AddonModLessonOfflineProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the attempt (undefined if no attempts). + * @returns Promise resolved with the attempt (undefined if no attempts). */ async getLastQuestionPageAttempt( lessonId: number, @@ -204,7 +204,7 @@ export class AddonModLessonOfflineProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the attempts. + * @returns Promise resolved with the attempts. */ async getLessonAttempts(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -245,7 +245,7 @@ export class AddonModLessonOfflineProvider { * @param correct True to only fetch correct attempts, false to get them all. * @param pageId If defined, only get attempts on this page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the attempts. + * @returns Promise resolved with the attempts. */ async getQuestionsAttempts( lessonId: number, @@ -270,7 +270,7 @@ export class AddonModLessonOfflineProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the retake. + * @returns Promise resolved with the retake. */ async getRetake(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -284,7 +284,7 @@ export class AddonModLessonOfflineProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the retake attempts. + * @returns Promise resolved with the retake attempts. */ async getRetakeAttempts(lessonId: number, retake: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -307,7 +307,7 @@ export class AddonModLessonOfflineProvider { * @param retake Lesson retake number. * @param pageId Page ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the retake attempts. + * @returns Promise resolved with the retake attempts. */ async getRetakeAttemptsForPage( lessonId: number, @@ -336,7 +336,7 @@ export class AddonModLessonOfflineProvider { * @param retake Retake number. * @param type Type of the pages to get: TYPE_QUESTION or TYPE_STRUCTURE. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the retake attempts. + * @returns Promise resolved with the retake attempts. */ async getRetakeAttemptsForType( lessonId: number, @@ -365,7 +365,7 @@ export class AddonModLessonOfflineProvider { * @param courseId Course ID the lesson belongs to. * @param retake Retake number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the retake. + * @returns Promise resolved with the retake. */ protected async getRetakeWithFallback( lessonId: number, @@ -398,7 +398,7 @@ export class AddonModLessonOfflineProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean. + * @returns Promise resolved with boolean. */ async hasFinishedRetake(lessonId: number, siteId?: string): Promise { try { @@ -415,7 +415,7 @@ export class AddonModLessonOfflineProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean. + * @returns Promise resolved with boolean. */ async hasOfflineData(lessonId: number, siteId?: string): Promise { const [retake, attempts] = await Promise.all([ @@ -432,7 +432,7 @@ export class AddonModLessonOfflineProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with a boolean. + * @returns Promise resolved with a boolean. */ async hasRetakeAttempts(lessonId: number, retake: number, siteId?: string): Promise { try { @@ -448,7 +448,7 @@ export class AddonModLessonOfflineProvider { * Parse some properties of a page attempt. * * @param attempt The attempt to treat. - * @return The treated attempt. + * @returns The treated attempt. */ protected parsePageAttempt(attempt: AddonModLessonPageAttemptDBRecord): AddonModLessonPageAttemptRecord { return { @@ -462,7 +462,7 @@ export class AddonModLessonOfflineProvider { * Parse some properties of some page attempts. * * @param attempts The attempts to treat. - * @return The treated attempts. + * @returns The treated attempts. */ protected parsePageAttempts(attempts: AddonModLessonPageAttemptDBRecord[]): AddonModLessonPageAttemptRecord[] { return attempts.map((attempt) => this.parsePageAttempt(attempt)); @@ -481,7 +481,7 @@ export class AddonModLessonOfflineProvider { * @param correct If answer is correct. Only for question pages. * @param userAnswer The user's answer (userresponse from checkAnswer). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async processPage( lessonId: number, @@ -528,7 +528,7 @@ export class AddonModLessonOfflineProvider { * @param retake Retake number. * @param lastPage ID of the last question page attempted. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async setLastQuestionPageAttempted( lessonId: number, diff --git a/src/addons/mod/lesson/services/lesson-sync.ts b/src/addons/mod/lesson/services/lesson-sync.ts index 604cdc429..1a4241178 100644 --- a/src/addons/mod/lesson/services/lesson-sync.ts +++ b/src/addons/mod/lesson/services/lesson-sync.ts @@ -51,7 +51,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteRetakeFinishedInSync(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -65,7 +65,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the retake entry (undefined if no retake). + * @returns Promise resolved with the retake entry (undefined if no retake). */ async getRetakeFinishedInSync( lessonId: number, @@ -82,7 +82,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * @param lessonId Lesson ID. * @param retake Retake number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it has data to sync. + * @returns Promise resolved with boolean: whether it has data to sync. */ async hasDataToSync(lessonId: number, retake: number, siteId?: string): Promise { @@ -101,7 +101,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * @param retake The retake number. * @param pageId The page ID to start reviewing from. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setRetakeFinishedInSync(lessonId: number, retake: number, pageId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -119,7 +119,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllLessons(siteId?: string, force = false): Promise { return this.syncOnSites('all lessons', (siteId) => this.syncAllLessonsFunc(!!force, siteId), siteId); @@ -130,7 +130,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllLessonsFunc(force: boolean, siteId: string): Promise { // Get all the lessons that have something to be synchronized. @@ -156,9 +156,9 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * Sync a lesson only if a certain time has passed since the last time. * * @param lessonId Lesson ID. - * @param askPreflight Whether we should ask for password if needed. + * @param askPassword Whether we should ask for password if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the lesson is synced or if it doesn't need to be synced. + * @returns Promise resolved when the lesson is synced or if it doesn't need to be synced. */ async syncLessonIfNeeded( lessonId: number, @@ -179,7 +179,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * @param askPassword True if we should ask for password if needed, false otherwise. * @param ignoreBlock True to ignore the sync block setting. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ async syncLesson( lessonId: number, @@ -216,7 +216,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * @param askPassword True if we should ask for password if needed, false otherwise. * @param ignoreBlock True to ignore the sync block setting. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ protected async performSyncLesson( lessonId: number, @@ -264,6 +264,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * @param result Sync result where to store the result. * @param askPassword True if we should ask for password if needed, false otherwise. * @param siteId Site ID. If not defined, current site. + * @returns Password result if any. */ protected async syncAttempts( lessonId: number, @@ -350,7 +351,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid * @param attempt Attempt to send. * @param result Result where to store the data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async sendAttempt( lesson: AddonModLessonLessonWSData, diff --git a/src/addons/mod/lesson/services/lesson.ts b/src/addons/mod/lesson/services/lesson.ts index 4a33b1617..1d5a9ee78 100644 --- a/src/addons/mod/lesson/services/lesson.ts +++ b/src/addons/mod/lesson/services/lesson.ts @@ -100,7 +100,7 @@ export class AddonModLessonProvider { * @param answerFormat Answer format. * @param response Response. * @param className Class to add to the response. - * @return New feedback. + * @returns New feedback. */ protected addAnswerAndResponseToFeedback( feedback: string, @@ -171,7 +171,7 @@ export class AddonModLessonProvider { * Check if an answer page (from getUserRetake) is a content page. * * @param page Answer page. - * @return Whether it's a content page. + * @returns Whether it's a content page. */ answerPageIsContent(page: AddonModLessonUserAttemptAnswerPageWSData): boolean { // The page doesn't have any reliable field to use for checking this. Check qtype first (translated string). @@ -197,7 +197,7 @@ export class AddonModLessonProvider { * Check if an answer page (from getUserRetake) is a question page. * * @param page Answer page. - * @return Whether it's a question page. + * @returns Whether it's a question page. */ answerPageIsQuestion(page: AddonModLessonUserAttemptAnswerPageWSData): boolean { if (!page.answerdata) { @@ -227,7 +227,7 @@ export class AddonModLessonProvider { * * @param lesson Lesson. * @param options Other options. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async calculateOfflineData( lesson: AddonModLessonLessonWSData, @@ -267,7 +267,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param accessInfo Access info. * @param options Other options. - * @return Promise resolved with a number: the progress (scale 0-100). + * @returns Promise resolved with a number: the progress (scale 0-100). */ async calculateProgress( lessonId: number, @@ -333,7 +333,7 @@ export class AddonModLessonProvider { * @param data Data containing the user answer. * @param jumps Possible jumps. * @param pageIndex Object containing all the pages indexed by ID. - * @return Result. + * @returns Result. */ protected checkAnswer( lesson: AddonModLessonLessonWSData, @@ -926,7 +926,7 @@ export class AddonModLessonProvider { * Create a list of pages indexed by page ID based on a list of pages. * * @param pageList List of pages. - * @return Pages index. + * @returns Pages index. */ protected createPagesIndex(pageList: AddonModLessonGetPagesPageWSData[]): Record { // Index the pages by page ID. @@ -945,7 +945,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param courseId Course ID the lesson belongs to. * @param options Other options. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ async finishRetake( lesson: AddonModLessonLessonWSData, @@ -975,7 +975,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ async finishRetakeOnline( lessonId: number, @@ -1015,7 +1015,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param courseId Course ID the lesson belongs to. * @param options Other options. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ protected async finishRetakeOffline( lesson: AddonModLessonLessonWSData, @@ -1049,7 +1049,7 @@ export class AddonModLessonProvider { * @param courseId Course ID the lesson belongs to. * @param options Other options. * @param gradeInfo Lesson grade info. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async processEolPage( lesson: AddonModLessonLessonWSData, @@ -1166,7 +1166,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the access information. + * @returns Promise resolved with the access information. */ async getAccessInformation( lessonId: number, @@ -1192,7 +1192,7 @@ export class AddonModLessonProvider { * Get cache key for access information WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getAccessInformationCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'accessInfo:' + lessonId; @@ -1204,7 +1204,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with an object with the online and offline viewed pages. + * @returns Promise resolved with an object with the online and offline viewed pages. */ async getContentPagesViewed( lessonId: number, @@ -1231,7 +1231,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param retake Retake number. - * @return Cache key. + * @returns Cache key. */ protected getContentPagesViewedCacheKey(lessonId: number, retake: number): string { return this.getContentPagesViewedCommonCacheKey(lessonId) + ':' + retake; @@ -1241,7 +1241,7 @@ export class AddonModLessonProvider { * Get common cache key for get content pages viewed WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getContentPagesViewedCommonCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'contentPagesViewed:' + lessonId; @@ -1253,7 +1253,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with list of IDs. + * @returns Promise resolved with list of IDs. */ async getContentPagesViewedIds( lessonId: number, @@ -1280,7 +1280,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the viewed pages. + * @returns Promise resolved with the viewed pages. */ async getContentPagesViewedOnline( lessonId: number, @@ -1316,7 +1316,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the last content page viewed. + * @returns Promise resolved with the last content page viewed. */ async getLastContentPageViewed( lessonId: number, @@ -1356,7 +1356,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the last page seen. + * @returns Promise resolved with the last page seen. */ async getLastPageSeen( lessonId: number, @@ -1397,9 +1397,9 @@ export class AddonModLessonProvider { * Get a Lesson by module ID. * * @param courseId Course ID. - * @param cmid Course module ID. + * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the lesson is retrieved. + * @returns Promise resolved when the lesson is retrieved. */ getLesson(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getLessonByField(courseId, 'coursemodule', cmId, options); @@ -1412,7 +1412,7 @@ export class AddonModLessonProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the lesson is retrieved. + * @returns Promise resolved when the lesson is retrieved. */ protected async getLessonByField( courseId: number, @@ -1454,7 +1454,7 @@ export class AddonModLessonProvider { * @param courseId Course ID. * @param id Lesson ID. * @param options Other options. - * @return Promise resolved when the lesson is retrieved. + * @returns Promise resolved when the lesson is retrieved. */ getLessonById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getLessonByField(courseId, 'id', id, options); @@ -1464,7 +1464,7 @@ export class AddonModLessonProvider { * Get cache key for Lesson data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getLessonDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'lesson:' + courseId; @@ -1475,7 +1475,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the lesson. + * @returns Promise resolved with the lesson. */ async getLessonWithPassword( lessonId: number, @@ -1520,7 +1520,7 @@ export class AddonModLessonProvider { * Get cache key for get lesson with password WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getLessonWithPasswordCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'lessonWithPswrd:' + lessonId; @@ -1532,7 +1532,7 @@ export class AddonModLessonProvider { * @param pageId Current page ID. * @param jumpTo The jumpto. * @param jumps Possible jumps. - * @return New page ID. + * @returns New page ID. */ protected getNewPageId(pageId: number, jumpTo: number, jumps: AddonModLessonPossibleJumps): number { // If jump not found, return current jumpTo. @@ -1552,7 +1552,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param accessInfo Access info. * @param options Other options. - * @return Promise resolved with the ongoing score message. + * @returns Promise resolved with the ongoing score message. */ getOngoingScoreMessage( lesson: AddonModLessonLessonWSData, @@ -1590,7 +1590,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param pageId Page ID. * @param options Other options. - * @return Promise resolved with the list of possible answers. + * @returns Promise resolved with the list of possible answers. */ protected async getPageAnswers( lesson: AddonModLessonLessonWSData, @@ -1613,7 +1613,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param pageIds List of page IDs. * @param options Other options. - * @return Promise resolved with an object containing the answers. + * @returns Promise resolved with an object containing the answers. */ protected async getPagesAnswers( lesson: AddonModLessonLessonWSData, @@ -1641,7 +1641,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param pageId Page ID. * @param options Other options. - * @return Promise resolved with the page data. + * @returns Promise resolved with the page data. */ async getPageData( lesson: AddonModLessonLessonWSData, @@ -1697,7 +1697,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param pageId Page ID. - * @return Cache key. + * @returns Cache key. */ protected getPageDataCacheKey(lessonId: number, pageId: number): string { return this.getPageDataCommonCacheKey(lessonId) + ':' + pageId; @@ -1707,7 +1707,7 @@ export class AddonModLessonProvider { * Get common cache key for get page data WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getPageDataCommonCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'pageData:' + lessonId; @@ -1718,7 +1718,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the pages. + * @returns Promise resolved with the pages. */ async getPages(lessonId: number, options: AddonModLessonPwdReviewOptions = {}): Promise { @@ -1748,7 +1748,7 @@ export class AddonModLessonProvider { * Get cache key for get pages WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getPagesCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'pages:' + lessonId; @@ -1759,7 +1759,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the jumps. + * @returns Promise resolved with the jumps. */ async getPagesPossibleJumps( lessonId: number, @@ -1801,7 +1801,7 @@ export class AddonModLessonProvider { * Get cache key for get pages possible jumps WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getPagesPossibleJumpsCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'pagesJumps:' + lessonId; @@ -1817,7 +1817,7 @@ export class AddonModLessonProvider { * @param result Result of process page. * @param review If the user wants to review just after finishing (1 hour margin). * @param jumps Possible jumps. - * @return Array with the messages. + * @returns Array with the messages. */ getPageProcessMessages( lesson: AddonModLessonLessonWSData, @@ -1858,7 +1858,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the IDs. + * @returns Promise resolved with the IDs. */ async getPagesIdsWithQuestionAttempts( lessonId: number, @@ -1890,7 +1890,7 @@ export class AddonModLessonProvider { * @param page Page loaded. * @param jumps Possible jumps. * @param options Other options. - * @return Promise resolved with the list of messages. + * @returns Promise resolved with the list of messages. */ async getPageViewMessages( lesson: AddonModLessonLessonWSData, @@ -1955,7 +1955,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the questions attempts. + * @returns Promise resolved with the questions attempts. */ async getQuestionsAttempts( lessonId: number, @@ -1986,7 +1986,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getQuestionsAttemptsCacheKey(lessonId: number, retake: number, userId: number): string { return this.getQuestionsAttemptsCommonCacheKey(lessonId) + ':' + userId + ':' + retake; @@ -1996,7 +1996,7 @@ export class AddonModLessonProvider { * Get common cache key for get questions attempts WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getQuestionsAttemptsCommonCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'questionsAttempts:' + lessonId; @@ -2008,7 +2008,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the questions attempts. + * @returns Promise resolved with the questions attempts. */ async getQuestionsAttemptsOnline( lessonId: number, @@ -2062,7 +2062,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the retakes overview, undefined if no attempts. + * @returns Promise resolved with the retakes overview, undefined if no attempts. */ async getRetakesOverview( lessonId: number, @@ -2098,7 +2098,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param groupId Group ID. - * @return Cache key. + * @returns Cache key. */ protected getRetakesOverviewCacheKey(lessonId: number, groupId: number): string { return this.getRetakesOverviewCommonCacheKey(lessonId) + ':' + groupId; @@ -2108,7 +2108,7 @@ export class AddonModLessonProvider { * Get common cache key for get retakes overview WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getRetakesOverviewCommonCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'retakesOverview:' + lessonId; @@ -2119,7 +2119,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with password on success, rejected otherwise. + * @returns Promise resolved with password on success, rejected otherwise. */ async getStoredPassword(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2136,8 +2136,8 @@ export class AddonModLessonProvider { * * @param pages Index of lesson pages, indexed by page ID. See createPagesIndex. * @param pageId Page ID to get subpages of. - * @param end An array of LESSON_PAGE_* types that signify an end of the subtype. - * @return List of subpages. + * @param ends An array of LESSON_PAGE_* types that signify an end of the subtype. + * @returns List of subpages. */ getSubpagesOf(pages: Record, pageId: number, ends: number[]): AddonModLessonPageWSData[] { const subPages: AddonModLessonPageWSData[] = []; @@ -2159,7 +2159,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param options Other options. - * @return Promise resolved with the pages. + * @returns Promise resolved with the pages. */ async getTimers(lessonId: number, options: AddonModLessonUserOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -2186,7 +2186,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getTimersCacheKey(lessonId: number, userId: number): string { return this.getTimersCommonCacheKey(lessonId) + ':' + userId; @@ -2196,7 +2196,7 @@ export class AddonModLessonProvider { * Get common cache key for get timers WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getTimersCommonCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'timers:' + lessonId; @@ -2206,7 +2206,7 @@ export class AddonModLessonProvider { * Get the list of used answers (with valid answer) in a multichoice question page. * * @param pageData Page data for the page to process. - * @return List of used answers. + * @returns List of used answers. */ protected getUsedAnswersMultichoice(pageData: AddonModLessonGetPageDataWSResponse): AddonModLessonPageAnswerWSData[] { const answers = CoreUtils.clone(pageData.answers); @@ -2218,7 +2218,7 @@ export class AddonModLessonProvider { * Get the user's response in a matching question page. * * @param data Data containing the user answer. - * @return User response. + * @returns User response. */ protected getUserResponseMatching(data: Record): Record { if (data.response) { @@ -2244,7 +2244,7 @@ export class AddonModLessonProvider { * Get the user's response in a multichoice page if multiple answers are allowed. * * @param data Data containing the user answer. - * @return User response. + * @returns User response. */ protected getUserResponseMultichoice(data: Record): number[] | undefined { if (data.answer) { @@ -2274,7 +2274,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number * @param options Other options. - * @return Promise resolved with the retake data. + * @returns Promise resolved with the retake data. */ async getUserRetake( lessonId: number, @@ -2307,7 +2307,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param userId User ID. * @param retake Retake number - * @return Cache key. + * @returns Cache key. */ protected getUserRetakeCacheKey(lessonId: number, userId: number, retake: number): string { return this.getUserRetakeUserCacheKey(lessonId, userId) + ':' + retake; @@ -2318,7 +2318,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getUserRetakeUserCacheKey(lessonId: number, userId: number): string { return this.getUserRetakeLessonCacheKey(lessonId) + ':' + userId; @@ -2328,7 +2328,7 @@ export class AddonModLessonProvider { * Get lesson cache key for get user retake WS calls. * * @param lessonId Lesson ID. - * @return Cache key. + * @returns Cache key. */ protected getUserRetakeLessonCacheKey(lessonId: number): string { return ROOT_CACHE_KEY + 'userRetake:' + lessonId; @@ -2340,7 +2340,7 @@ export class AddonModLessonProvider { * @param info Lesson access info. * @param ignorePassword Whether password protected reason should be ignored (user already entered the password). * @param isReview Whether user is reviewing a retake. - * @return Prevent access reason. + * @returns Prevent access reason. */ getPreventAccessReason( info: AddonModLessonGetAccessInformationWSResponse, @@ -2381,7 +2381,7 @@ export class AddonModLessonProvider { * @param pageId ID of the page from which you are jumping from. * @param jumpTo The jumpto number. * @param pageIndex Object containing all the pages indexed by ID. See createPagesIndex. - * @return Whether jump is correct. + * @returns Whether jump is correct. */ jumptoIsCorrect(pageId: number, jumpTo: number, pageIndex: Record): boolean { // First test the special values. @@ -2417,7 +2417,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAccessInformation(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2430,7 +2430,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContentPagesViewed(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2444,7 +2444,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param retake Retake number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContentPagesViewedForRetake(lessonId: number, retake: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2457,7 +2457,7 @@ export class AddonModLessonProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLessonData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2470,7 +2470,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLessonWithPassword(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2483,7 +2483,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePageData(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2497,7 +2497,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param pageId Page ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePageDataForPage(lessonId: number, pageId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2510,7 +2510,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePages(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2523,7 +2523,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePagesPossibleJumps(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2536,7 +2536,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateQuestionsAttempts(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2551,7 +2551,7 @@ export class AddonModLessonProvider { * @param retake Retake number. * @param siteId Site ID. If not defined, current site.. * @param userId User ID. If not defined, site's user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateQuestionsAttemptsForRetake(lessonId: number, retake: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -2564,7 +2564,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateRetakesOverview(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2578,7 +2578,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param groupId Group ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateRetakesOverviewForGroup(lessonId: number, groupId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2591,7 +2591,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateTimers(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2605,7 +2605,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateTimersForUser(lessonId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -2620,7 +2620,7 @@ export class AddonModLessonProvider { * @param retake Retake number. * @param userId User ID. Undefined for current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserRetake(lessonId: number, retake: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2633,7 +2633,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserRetakesForLesson(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2647,7 +2647,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param userId User ID. Undefined for current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserRetakesForUser(lessonId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -2662,7 +2662,7 @@ export class AddonModLessonProvider { * @param pageId The page ID. * @param answer The answer to check. * @param pageIndex Object containing all the pages indexed by ID. - * @return Whether the answer is correct. + * @returns Whether the answer is correct. */ protected isAnswerCorrect( lesson: AddonModLessonLessonWSData, @@ -2682,7 +2682,7 @@ export class AddonModLessonProvider { * Check if a lesson is enabled to be used in offline. * * @param lesson Lesson. - * @return Whether offline is enabled. + * @returns Whether offline is enabled. */ isLessonOffline(lesson: AddonModLessonLessonWSData): boolean { return !!lesson.allowofflineattempts; @@ -2692,7 +2692,7 @@ export class AddonModLessonProvider { * Check if a lesson is password protected based in the access info. * * @param info Lesson access info. - * @return Whether the lesson is password protected. + * @returns Whether the lesson is password protected. */ isPasswordProtected(info: AddonModLessonGetAccessInformationWSResponse): boolean { if (!info || !info.preventaccessreasons) { @@ -2714,7 +2714,7 @@ export class AddonModLessonProvider { * Check if a page is a question page or a content page. * * @param type Type of the page. - * @return True if question page, false if content page. + * @returns True if question page, false if content page. */ isQuestionPage(type: number): boolean { return type == AddonModLessonProvider.TYPE_QUESTION; @@ -2728,7 +2728,7 @@ export class AddonModLessonProvider { * @param pageId Page id to continue from (only when continuing a retake). * @param review If the user wants to review just after finishing (1 hour margin). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async launchRetake( id: number, @@ -2764,7 +2764,7 @@ export class AddonModLessonProvider { * Check if the user left during a timed session. * * @param info Lesson access info. - * @return True if left during timed, false otherwise. + * @returns True if left during timed, false otherwise. */ leftDuringTimed(info?: AddonModLessonGetAccessInformationWSResponse): boolean { return !!(info?.lastpageseen && info.lastpageseen != AddonModLessonProvider.LESSON_EOL && info.leftduringtimedsession); @@ -2775,7 +2775,7 @@ export class AddonModLessonProvider { * Based on Moodle's lesson_display_teacher_warning. * * @param jumps Possible jumps. - * @return Whether the lesson uses one of those jumps. + * @returns Whether the lesson uses one of those jumps. */ lessonDisplayTeacherWarning(jumps: AddonModLessonPossibleJumps): boolean { if (!jumps) { @@ -2804,7 +2804,7 @@ export class AddonModLessonProvider { * @param lesson Lesson. * @param retake Retake number. * @param options Other options. - * @return Promise resolved with the grade data. + * @returns Promise resolved with the grade data. */ async lessonGrade( lesson: AddonModLessonLessonWSData, @@ -2952,7 +2952,7 @@ export class AddonModLessonProvider { * @param password Lesson password (if any). * @param name Name of the assign. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logViewLesson(id: number, password?: string, name?: string, siteId?: string): Promise { const params: AddonModLessonViewLessonWSParams = { @@ -2983,7 +2983,7 @@ export class AddonModLessonProvider { * @param pageData Page data for the page to process. * @param data Data to save. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async processPage( lesson: AddonModLessonLessonWSData, @@ -3098,7 +3098,7 @@ export class AddonModLessonProvider { * @param pageId Page ID. * @param data Data to save. * @param options Other options. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async processPageOnline( lessonId: number, @@ -3136,7 +3136,7 @@ export class AddonModLessonProvider { * @param jumps Possible jumps. * @param pageIndex Object containing all the pages indexed by ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ protected async recordAttempt( lesson: AddonModLessonLessonWSData, @@ -3338,7 +3338,7 @@ export class AddonModLessonProvider { * * @param lessonId Lesson ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when removed. + * @returns Promise resolved when removed. */ async removeStoredPassword(lessonId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -3352,7 +3352,7 @@ export class AddonModLessonProvider { * @param lessonId Lesson ID. * @param password Password to store. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when stored. + * @returns Promise resolved when stored. */ async storePassword(lessonId: number, password: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -3375,7 +3375,7 @@ export class AddonModLessonProvider { * @param page Page to check. * @param validPages Valid pages, indexed by page ID. * @param viewedPagesIds List of viewed pages IDs. - * @return Next page ID. + * @returns Next page ID. */ validPageAndView( pages: Record, diff --git a/src/addons/mod/lti/services/lti-helper.ts b/src/addons/mod/lti/services/lti-helper.ts index b23cda06a..2d5aaa00b 100644 --- a/src/addons/mod/lti/services/lti-helper.ts +++ b/src/addons/mod/lti/services/lti-helper.ts @@ -56,7 +56,7 @@ export class AddonModLtiHelperProvider { * @param module Module. * @param lti LTI instance. If not provided it will be obtained. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async getDataAndLaunch(courseId: number, module: CoreCourseModuleData, lti?: AddonModLtiLti, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -105,7 +105,7 @@ export class AddonModLtiHelperProvider { * @param ltiId LTI id. * @param name Name of the lti. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async logViewAndCheckCompletion( courseId: number, diff --git a/src/addons/mod/lti/services/lti.ts b/src/addons/mod/lti/services/lti.ts index 81347f9f0..357510506 100644 --- a/src/addons/mod/lti/services/lti.ts +++ b/src/addons/mod/lti/services/lti.ts @@ -40,7 +40,7 @@ export class AddonModLtiProvider { /** * Delete launcher. * - * @return Promise resolved when the launcher file is deleted. + * @returns Promise resolved when the launcher file is deleted. */ deleteLauncher(): Promise { return CoreFile.removeFile(LAUNCHER_FILE_NAME); @@ -51,7 +51,7 @@ export class AddonModLtiProvider { * * @param url Launch URL. * @param params Launch params. - * @return Promise resolved with the file URL. + * @returns Promise resolved with the file URL. */ async generateLauncher(url: string, params: AddonModLtiParam[]): Promise { if (!CoreFile.isAvailable()) { @@ -88,7 +88,7 @@ export class AddonModLtiProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the LTI is retrieved. + * @returns Promise resolved when the LTI is retrieved. */ async getLti(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { const params: AddonModLtiGetLtisByCoursesWSParams = { @@ -117,7 +117,7 @@ export class AddonModLtiProvider { * Get cache key for LTI data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getLtiCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'lti:' + courseId; @@ -128,7 +128,7 @@ export class AddonModLtiProvider { * * @param id LTI id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the launch data is retrieved. + * @returns Promise resolved when the launch data is retrieved. */ async getLtiLaunchData(id: number, siteId?: string): Promise { const params: AddonModLtiGetToolLaunchDataWSParams = { @@ -152,7 +152,7 @@ export class AddonModLtiProvider { * Get cache key for LTI launch data WS calls. * * @param id LTI id. - * @return Cache key. + * @returns Cache key. */ protected getLtiLaunchDataCacheKey(id: number): string { return `${ROOT_CACHE_KEY}launch:${id}`; @@ -163,7 +163,7 @@ export class AddonModLtiProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLti(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -176,7 +176,7 @@ export class AddonModLtiProvider { * * @param id LTI id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateLtiLaunchData(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -189,7 +189,7 @@ export class AddonModLtiProvider { * This setting was added in 3.11. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it's disabled. + * @returns Promise resolved with boolean: whether it's disabled. */ async isLaunchViaSiteDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -202,7 +202,7 @@ export class AddonModLtiProvider { * This setting was added in 3.11. * * @param site Site. If not defined, current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isLaunchViaSiteDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -215,7 +215,7 @@ export class AddonModLtiProvider { * This setting was removed in Moodle 3.11 because the default behaviour of the app changed. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it's disabled. + * @returns Promise resolved with boolean: whether it's disabled. */ async isOpenInAppBrowserDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -228,7 +228,7 @@ export class AddonModLtiProvider { * This setting was removed in Moodle 3.11 because the default behaviour of the app changed. * * @param site Site. If not defined, current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isOpenInAppBrowserDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -241,7 +241,7 @@ export class AddonModLtiProvider { * * @param url Launch URL. * @param params Launch params. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async launch(url: string, params: AddonModLtiParam[]): Promise { if (!CoreUrlUtils.isHttpURL(url)) { @@ -265,7 +265,7 @@ export class AddonModLtiProvider { * @param id LTI id. * @param name Name of the lti. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModLtiViewLtiWSParams = { @@ -288,7 +288,7 @@ export class AddonModLtiProvider { * Check whether the LTI should be launched in browser via the site with auto-login. * * @param siteId Site ID. - * @return Promise resolved with boolean. + * @returns Promise resolved with boolean. */ async shouldLaunchInBrowser(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/page/components/index/index.ts b/src/addons/mod/page/components/index/index.ts index 37d2f0b8e..957a67fe9 100644 --- a/src/addons/mod/page/components/index/index.ts +++ b/src/addons/mod/page/components/index/index.ts @@ -45,7 +45,7 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -56,7 +56,7 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { await AddonModPage.invalidateContent(this.module.id, this.courseId); @@ -84,7 +84,7 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp /** * Load page data from WS. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadPageData(): Promise { // Get latest title, description and some extra data. Data should've been updated in download. diff --git a/src/addons/mod/page/services/handlers/index-link.ts b/src/addons/mod/page/services/handlers/index-link.ts index 378c2e27d..c25e0ba49 100644 --- a/src/addons/mod/page/services/handlers/index-link.ts +++ b/src/addons/mod/page/services/handlers/index-link.ts @@ -33,7 +33,7 @@ export class AddonModPageIndexLinkHandlerService extends CoreContentLinksModuleI * Check if the handler is enabled for a certain site (site + user) and a URL. * * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string): Promise { return AddonModPage.isPluginEnabled(siteId); diff --git a/src/addons/mod/page/services/handlers/list-link.ts b/src/addons/mod/page/services/handlers/list-link.ts index 322de780f..3d5f689a6 100644 --- a/src/addons/mod/page/services/handlers/list-link.ts +++ b/src/addons/mod/page/services/handlers/list-link.ts @@ -33,7 +33,7 @@ export class AddonModPageListLinkHandlerService extends CoreContentLinksModuleLi * Check if the handler is enabled on a site level. * * @param siteId The site ID. - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ isEnabled(siteId: string): Promise { return AddonModPage.isPluginEnabled(siteId); diff --git a/src/addons/mod/page/services/handlers/pluginfile.ts b/src/addons/mod/page/services/handlers/pluginfile.ts index 066fa5765..3dbb6a806 100644 --- a/src/addons/mod/page/services/handlers/pluginfile.ts +++ b/src/addons/mod/page/services/handlers/pluginfile.ts @@ -29,7 +29,7 @@ export class AddonModPagePluginFileHandlerService implements CorePluginFileHandl * Return the RegExp to match the revision on pluginfile URLs. * * @param args Arguments of the pluginfile URL defining component and filearea at least. - * @return RegExp to match the revision on pluginfile URLs. + * @returns RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp(args: string[]): RegExp | undefined { // Check filearea. @@ -42,7 +42,7 @@ export class AddonModPagePluginFileHandlerService implements CorePluginFileHandl /** * Should return the string to remove the revision on pluginfile url. * - * @return String to remove the revision on pluginfile url. + * @returns String to remove the revision on pluginfile url. */ getComponentRevisionReplace(): string { // Component + Filearea + Revision @@ -52,7 +52,7 @@ export class AddonModPagePluginFileHandlerService implements CorePluginFileHandl /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/page/services/handlers/prefetch.ts b/src/addons/mod/page/services/handlers/prefetch.ts index c7b6f3958..484b0b545 100644 --- a/src/addons/mod/page/services/handlers/prefetch.ts +++ b/src/addons/mod/page/services/handlers/prefetch.ts @@ -37,7 +37,7 @@ export class AddonModPagePrefetchHandlerService extends CoreCourseResourcePrefet * @param module The module object returned by WS. * @param courseId Course ID. * @param prefetch True to prefetch, false to download right away. - * @return Promise resolved when all content is downloaded. Data returned is not reliable. + * @returns Promise resolved when all content is downloaded. Data returned is not reliable. */ async downloadOrPrefetch(module: CoreCourseModuleData, courseId: number, prefetch?: boolean): Promise { const promises: Promise[] = []; @@ -53,7 +53,7 @@ export class AddonModPagePrefetchHandlerService extends CoreCourseResourcePrefet * * @param moduleId The module ID. * @param courseId Course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number): Promise { await AddonModPage.invalidateContent(moduleId, courseId); @@ -64,7 +64,7 @@ export class AddonModPagePrefetchHandlerService extends CoreCourseResourcePrefet * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ async invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise { const promises: Promise[] = []; @@ -78,7 +78,7 @@ export class AddonModPagePrefetchHandlerService extends CoreCourseResourcePrefet /** * Whether or not the handler is enabled on a site level. * - * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @returns A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): Promise { return AddonModPage.isPluginEnabled(); diff --git a/src/addons/mod/page/services/page-helper.ts b/src/addons/mod/page/services/page-helper.ts index c993c1bf9..1845b209e 100644 --- a/src/addons/mod/page/services/page-helper.ts +++ b/src/addons/mod/page/services/page-helper.ts @@ -35,7 +35,7 @@ export class AddonModPageHelperProvider { * * @param contents The module contents. * @param moduleId The module ID. - * @return The HTML of the page. + * @returns The HTML of the page. */ async getPageHtml(contents: CoreCourseModuleContentFile[], moduleId: number): Promise { let indexUrl: string | undefined; @@ -90,7 +90,7 @@ export class AddonModPageHelperProvider { * Returns whether the file is the main page of the module. * * @param file An object returned from WS containing file info. - * @return Whether the file is the main page or not. + * @returns Whether the file is the main page or not. */ protected isMainPage(file: CoreCourseModuleContentFile): boolean { const filename = file.filename || ''; diff --git a/src/addons/mod/page/services/page.ts b/src/addons/mod/page/services/page.ts index 1e29c8b7f..6a266342c 100644 --- a/src/addons/mod/page/services/page.ts +++ b/src/addons/mod/page/services/page.ts @@ -39,7 +39,7 @@ export class AddonModPageProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the page is retrieved. + * @returns Promise resolved when the page is retrieved. */ getPageData(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getPageByKey(courseId, 'coursemodule', cmId, options); @@ -52,7 +52,7 @@ export class AddonModPageProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the page is retrieved. + * @returns Promise resolved when the page is retrieved. */ protected async getPageByKey( courseId: number, @@ -86,7 +86,7 @@ export class AddonModPageProvider { * Get cache key for page data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getPageCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'page:' + courseId; @@ -98,6 +98,7 @@ export class AddonModPageProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. + * @returns Promise resolved when done. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -116,7 +117,7 @@ export class AddonModPageProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePageData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -128,7 +129,7 @@ export class AddonModPageProvider { * Return whether or not the plugin is enabled. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -142,7 +143,7 @@ export class AddonModPageProvider { * @param pageid Module ID. * @param name Name of the page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(pageid: number, name?: string, siteId?: string): Promise { const params: AddonModPageViewPageWSParams = { diff --git a/src/addons/mod/quiz/accessrules/delaybetweenattempts/services/handlers/delaybetweenattempts.ts b/src/addons/mod/quiz/accessrules/delaybetweenattempts/services/handlers/delaybetweenattempts.ts index 34f8bcfb8..e706511b6 100644 --- a/src/addons/mod/quiz/accessrules/delaybetweenattempts/services/handlers/delaybetweenattempts.ts +++ b/src/addons/mod/quiz/accessrules/delaybetweenattempts/services/handlers/delaybetweenattempts.ts @@ -27,22 +27,14 @@ export class AddonModQuizAccessDelayBetweenAttemptsHandlerService implements Add ruleName = 'quizaccess_delaybetweenattempts'; /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired(): boolean | Promise { return false; diff --git a/src/addons/mod/quiz/accessrules/ipaddress/services/handlers/ipaddress.ts b/src/addons/mod/quiz/accessrules/ipaddress/services/handlers/ipaddress.ts index 5a92082b5..afab83020 100644 --- a/src/addons/mod/quiz/accessrules/ipaddress/services/handlers/ipaddress.ts +++ b/src/addons/mod/quiz/accessrules/ipaddress/services/handlers/ipaddress.ts @@ -27,22 +27,14 @@ export class AddonModQuizAccessIpAddressHandlerService implements AddonModQuizAc ruleName = 'quizaccess_ipaddress'; /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired(): boolean | Promise { return false; diff --git a/src/addons/mod/quiz/accessrules/numattempts/services/handlers/numattempts.ts b/src/addons/mod/quiz/accessrules/numattempts/services/handlers/numattempts.ts index df8b6ed64..80035944e 100644 --- a/src/addons/mod/quiz/accessrules/numattempts/services/handlers/numattempts.ts +++ b/src/addons/mod/quiz/accessrules/numattempts/services/handlers/numattempts.ts @@ -27,22 +27,14 @@ export class AddonModQuizAccessNumAttemptsHandlerService implements AddonModQuiz ruleName = 'quizaccess_numattempts'; /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired(): boolean | Promise { return false; diff --git a/src/addons/mod/quiz/accessrules/offlineattempts/component/offlineattempts.ts b/src/addons/mod/quiz/accessrules/offlineattempts/component/offlineattempts.ts index b976fcaff..ea9238e3e 100644 --- a/src/addons/mod/quiz/accessrules/offlineattempts/component/offlineattempts.ts +++ b/src/addons/mod/quiz/accessrules/offlineattempts/component/offlineattempts.ts @@ -38,7 +38,7 @@ export class AddonModQuizAccessOfflineAttemptsComponent implements OnInit { constructor(private fb: FormBuilder) { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { // Always set confirmdatasaved to 1. Sending the data means the user accepted. diff --git a/src/addons/mod/quiz/accessrules/offlineattempts/services/handlers/offlineattempts.ts b/src/addons/mod/quiz/accessrules/offlineattempts/services/handlers/offlineattempts.ts index bc1cf2b82..6476cc943 100644 --- a/src/addons/mod/quiz/accessrules/offlineattempts/services/handlers/offlineattempts.ts +++ b/src/addons/mod/quiz/accessrules/offlineattempts/services/handlers/offlineattempts.ts @@ -30,14 +30,7 @@ export class AddonModQuizAccessOfflineAttemptsHandlerService implements AddonMod ruleName = 'quizaccess_offlineattempts'; /** - * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param. - * - * @param quiz The quiz the rule belongs to. - * @param preflightData Object where to add the preflight data. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @inheritdoc */ getFixedPreflightData( quiz: AddonModQuizQuizWSData, @@ -47,39 +40,26 @@ export class AddonModQuizAccessOfflineAttemptsHandlerService implements AddonMod } /** - * Return the Component to use to display the access rule preflight. - * Implement this if your access rule requires a preflight check with user interaction. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getPreflightComponent(): Type | Promise> { return AddonModQuizAccessOfflineAttemptsComponent; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ async isPreflightCheckRequired( quiz: AddonModQuizQuizWSData, attempt?: AddonModQuizAttemptWSData, prefetch?: boolean, - siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars ): Promise { if (prefetch) { // Don't show the warning if the user is prefetching. diff --git a/src/addons/mod/quiz/accessrules/openclosedate/services/handlers/openclosedate.ts b/src/addons/mod/quiz/accessrules/openclosedate/services/handlers/openclosedate.ts index 8cd0628b5..27488cdde 100644 --- a/src/addons/mod/quiz/accessrules/openclosedate/services/handlers/openclosedate.ts +++ b/src/addons/mod/quiz/accessrules/openclosedate/services/handlers/openclosedate.ts @@ -28,34 +28,21 @@ export class AddonModQuizAccessOpenCloseDateHandlerService implements AddonModQu ruleName = 'quizaccess_openclosedate'; /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired(): boolean | Promise { return false; } /** - * Whether or not the time left of an attempt should be displayed. - * - * @param attempt The attempt. - * @param endTime The attempt end time (in seconds). - * @param timeNow The current time in seconds. - * @return Whether it should be displayed. + * @inheritdoc */ shouldShowTimeLeft(attempt: AddonModQuizAttemptWSData, endTime: number, timeNow: number): boolean { // If this is a teacher preview after the close date, do not show the time. diff --git a/src/addons/mod/quiz/accessrules/password/component/password.ts b/src/addons/mod/quiz/accessrules/password/component/password.ts index 95100a976..77ce32ac5 100644 --- a/src/addons/mod/quiz/accessrules/password/component/password.ts +++ b/src/addons/mod/quiz/accessrules/password/component/password.ts @@ -36,7 +36,7 @@ export class AddonModQuizAccessPasswordComponent implements OnInit { constructor(private fb: FormBuilder) { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Add the control for the password. diff --git a/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts b/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts index b61c24d84..b2328c887 100644 --- a/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts +++ b/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts @@ -39,7 +39,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @returns Promise resolved when done if async, void if it's synchronous. */ async getFixedPreflightData( quiz: AddonModQuizQuizWSData, @@ -67,7 +67,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the DB entry on success. + * @returns Promise resolved with the DB entry on success. */ protected async getPasswordEntry(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -80,7 +80,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent(): Type | Promise> { return AddonModQuizAccessPasswordComponent; @@ -89,7 +89,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -102,7 +102,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @returns Whether the rule requires a preflight check. */ async isPreflightCheckRequired( quiz: AddonModQuizQuizWSData, @@ -124,7 +124,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * @param preflightData Preflight data gathered. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @returns Promise resolved when done if async, void if it's synchronous. */ async notifyPreflightCheckPassed( quiz: AddonModQuizQuizWSData, @@ -147,7 +147,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * @param preflightData Preflight data gathered. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @returns Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckFailed?( quiz: AddonModQuizQuizWSData, @@ -165,7 +165,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async removePassword(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -179,7 +179,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * @param quizId Quiz ID. * @param password Password. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async storePassword(quizId: number, password: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/quiz/accessrules/safebrowser/services/handlers/safebrowser.ts b/src/addons/mod/quiz/accessrules/safebrowser/services/handlers/safebrowser.ts index 631e08e56..329d62184 100644 --- a/src/addons/mod/quiz/accessrules/safebrowser/services/handlers/safebrowser.ts +++ b/src/addons/mod/quiz/accessrules/safebrowser/services/handlers/safebrowser.ts @@ -27,22 +27,14 @@ export class AddonModQuizAccessSafeBrowserHandlerService implements AddonModQuiz ruleName = 'quizaccess_safebrowser'; /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired(): boolean | Promise { return false; diff --git a/src/addons/mod/quiz/accessrules/securewindow/services/handlers/securewindow.ts b/src/addons/mod/quiz/accessrules/securewindow/services/handlers/securewindow.ts index ae2d50ea5..36858c522 100644 --- a/src/addons/mod/quiz/accessrules/securewindow/services/handlers/securewindow.ts +++ b/src/addons/mod/quiz/accessrules/securewindow/services/handlers/securewindow.ts @@ -27,22 +27,14 @@ export class AddonModQuizAccessSecureWindowHandlerService implements AddonModQui ruleName = 'quizaccess_securewindow'; /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired(): boolean | Promise { return false; diff --git a/src/addons/mod/quiz/accessrules/timelimit/services/handlers/timelimit.ts b/src/addons/mod/quiz/accessrules/timelimit/services/handlers/timelimit.ts index 232489112..b66d5cee3 100644 --- a/src/addons/mod/quiz/accessrules/timelimit/services/handlers/timelimit.ts +++ b/src/addons/mod/quiz/accessrules/timelimit/services/handlers/timelimit.ts @@ -29,33 +29,21 @@ export class AddonModQuizAccessTimeLimitHandlerService implements AddonModQuizAc ruleName = 'quizaccess_timelimit'; /** - * Return the Component to use to display the access rule preflight. - * Implement this if your access rule requires a preflight check with user interaction. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getPreflightComponent(): Type | Promise> { return AddonModQuizAccessTimeLimitComponent; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @inheritdoc */ isPreflightCheckRequired( quiz: AddonModQuizQuizWSData, @@ -66,12 +54,7 @@ export class AddonModQuizAccessTimeLimitHandlerService implements AddonModQuizAc } /** - * Whether or not the time left of an attempt should be displayed. - * - * @param attempt The attempt. - * @param endTime The attempt end time (in seconds). - * @param timeNow The current time in seconds. - * @return Whether it should be displayed. + * @inheritdoc */ shouldShowTimeLeft(attempt: AddonModQuizAttemptWSData, endTime: number, timeNow: number): boolean { // If this is a teacher preview after the time limit expires, don't show the time left. diff --git a/src/addons/mod/quiz/classes/auto-save.ts b/src/addons/mod/quiz/classes/auto-save.ts index 8ef7b833f..bda15664a 100644 --- a/src/addons/mod/quiz/classes/auto-save.ts +++ b/src/addons/mod/quiz/classes/auto-save.ts @@ -110,7 +110,7 @@ export class AddonModQuizAutoSave { /** * Get answers from a form. * - * @return Answers. + * @returns Answers. */ protected getAnswers(): CoreQuestionsAnswers { return CoreQuestionHelper.getAnswersFromForm(document.forms[this.formName]); @@ -128,7 +128,7 @@ export class AddonModQuizAutoSave { * Returns an observable that will notify when an error happens or stops. * It will send true when there's an error, and false when the error has been ammended. * - * @return Observable. + * @returns Observable. */ onError(): BehaviorSubject { return this.errorObservable; diff --git a/src/addons/mod/quiz/components/index/index.ts b/src/addons/mod/quiz/components/index/index.ts index bae07b503..8a5b7a0a3 100644 --- a/src/addons/mod/quiz/components/index/index.ts +++ b/src/addons/mod/quiz/components/index/index.ts @@ -102,7 +102,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -124,6 +124,8 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Attempt the quiz. + * + * @returns Promise resolved when done. */ async attemptQuiz(): Promise { if (this.showStatusSpinner || !this.quiz) { @@ -240,7 +242,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * Get the user attempts in the quiz and the result info. * * @param quiz Quiz instance. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getAttempts(quiz: AddonModQuizQuizData): Promise { // Always get the best grade because it includes the grade to pass. @@ -321,7 +323,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * Get result info to show. * * @param quiz Quiz. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getResultInfo(quiz: AddonModQuizQuizData): Promise { if (!this.attempts.length || !quiz.showGradeColumn || !this.bestGrade?.hasgrade || @@ -388,7 +390,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to review an attempt that has just been finished. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async goToAutoReview(): Promise { if (!this.autoReview) { @@ -418,7 +420,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModQuizSyncResult): boolean { if (result.attemptFinished) { @@ -473,7 +475,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -497,7 +499,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModQuizAutoSyncData): boolean { if (!this.courseId || !this.module) { @@ -552,7 +554,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModQuizSync.syncQuiz(this.candidateQuiz!, true); @@ -561,8 +563,9 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Treat user attempts. * + * @param quiz Quiz data. * @param attempts The attempts to treat. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async treatAttempts( quiz: AddonModQuizQuizData, @@ -623,7 +626,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Get quiz grade data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getQuizGrade(): Promise { try { @@ -647,7 +650,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to page to view the attempt details. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async viewAttempt(attemptId: number): Promise { await CoreNavigator.navigateToSitePath( @@ -656,7 +659,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); diff --git a/src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts b/src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts index 150ac1df1..486771f1b 100644 --- a/src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts +++ b/src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts @@ -54,7 +54,7 @@ export class AddonModQuizPreflightModalComponent implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { this.title = this.title || Translate.instant('addon.mod_quiz.startattempt'); diff --git a/src/addons/mod/quiz/pages/attempt/attempt.page.ts b/src/addons/mod/quiz/pages/attempt/attempt.page.ts index 8906d97f2..ebc7ca96e 100644 --- a/src/addons/mod/quiz/pages/attempt/attempt.page.ts +++ b/src/addons/mod/quiz/pages/attempt/attempt.page.ts @@ -49,7 +49,7 @@ export class AddonModQuizAttemptPage implements OnInit { protected attemptId!: number; // Attempt to view. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -83,7 +83,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Get quiz data and attempt data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchQuizData(): Promise { try { @@ -127,7 +127,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Get the attempt. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAttempt(): Promise { // Get all the attempts and search the one we want. @@ -148,7 +148,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Get the access info. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAccessInfo(): Promise { const accessInfo = await AddonModQuiz.getQuizAccessInformation(this.quiz!.id, { cmId: this.cmId }); @@ -173,7 +173,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Refresh the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshData(): Promise { const promises: Promise[] = []; @@ -199,7 +199,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Go to the page to review the attempt. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async reviewAttempt(): Promise { CoreNavigator.navigate(`../../review/${this.attempt!.id}`); diff --git a/src/addons/mod/quiz/pages/player/player.page.ts b/src/addons/mod/quiz/pages/player/player.page.ts index 826fe4d67..4eb7dd7ea 100644 --- a/src/addons/mod/quiz/pages/player/player.page.ts +++ b/src/addons/mod/quiz/pages/player/player.page.ts @@ -105,7 +105,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -137,7 +137,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { // Stop auto save. @@ -154,7 +154,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.forceLeave || this.quizAborted || !this.questions.length || this.showSummary) { @@ -253,7 +253,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { * @param page Page to load. -1 means summary. * @param fromModal Whether the page was selected using the navigation modal. * @param slot Slot of the question to scroll to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changePage(page: number, fromModal?: boolean, slot?: number): Promise { if (!this.attempt) { @@ -329,7 +329,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Convenience function to get the quiz data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -395,7 +395,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { * * @param userFinish Whether the user clicked to finish the attempt. * @param timeUp Whether the quiz time is up. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async finishAttempt(userFinish?: boolean, timeUp?: boolean): Promise { let modal: CoreIonLoadingElement | undefined; @@ -432,7 +432,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Fix sequence checks of current page. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fixSequenceChecks(): Promise { // Get current page data again to get the latest sequencechecks. @@ -459,7 +459,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Get the input answers. * - * @return Object with the answers. + * @returns Object with the answers. */ protected getAnswers(): CoreQuestionsAnswers { return CoreQuestionHelper.getAnswersFromForm(document.forms['addon-mod_quiz-player-form']); @@ -491,7 +491,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { * Load a page questions. * * @param page The page to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadPage(page: number): Promise { const data = await AddonModQuiz.getAttemptData(this.attempt!.id, page, this.preflightData, { @@ -533,7 +533,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Load attempt summary. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSummary(): Promise { this.summaryQuestions = []; @@ -559,7 +559,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Load data to navigate the questions using the navigation modal. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadNavigation(): Promise { // We use the attempt summary to build the navigation because it contains all the questions. @@ -577,7 +577,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Open the navigation modal. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openNavigation(): Promise { @@ -612,7 +612,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Prepare the answers to be sent for the attempt. * - * @return Promise resolved with the answers. + * @returns Promise resolved with the answers. */ protected prepareAnswers(): Promise { return CoreQuestionHelper.prepareAnswers( @@ -630,7 +630,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { * @param userFinish Whether the user clicked to finish the attempt. * @param timeUp Whether the quiz time is up. * @param retrying Whether we're retrying the change. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async processAttempt(userFinish?: boolean, timeUp?: boolean, retrying?: boolean): Promise { // Get the answers to send. @@ -730,7 +730,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave { /** * Start or continue an attempt. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async startOrContinueAttempt(): Promise { try { diff --git a/src/addons/mod/quiz/pages/review/review.page.ts b/src/addons/mod/quiz/pages/review/review.page.ts index 957d86304..adb1b02d9 100644 --- a/src/addons/mod/quiz/pages/review/review.page.ts +++ b/src/addons/mod/quiz/pages/review/review.page.ts @@ -81,7 +81,7 @@ export class AddonModQuizReviewPage implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -142,7 +142,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Convenience function to get the quiz data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -171,7 +171,7 @@ export class AddonModQuizReviewPage implements OnInit { * Load a page questions. * * @param page The page to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadPage(page: number): Promise { const data = await AddonModQuiz.getAttemptReview(this.attemptId, { page, cmId: this.quiz!.coursemodule }); @@ -199,7 +199,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Load data to navigate the questions using the navigation modal. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadNavigation(): Promise { // Get all questions in single page to retrieve all the questions. diff --git a/src/addons/mod/quiz/services/access-rules-delegate.ts b/src/addons/mod/quiz/services/access-rules-delegate.ts index 0ec872b03..8df18e1bc 100644 --- a/src/addons/mod/quiz/services/access-rules-delegate.ts +++ b/src/addons/mod/quiz/services/access-rules-delegate.ts @@ -36,7 +36,7 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Whether the rule requires a preflight check. + * @returns Whether the rule requires a preflight check. */ isPreflightCheckRequired( quiz: AddonModQuizQuizWSData, @@ -53,7 +53,7 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @returns Promise resolved when done if async, void if it's synchronous. */ getFixedPreflightData?( quiz: AddonModQuizQuizWSData, @@ -68,7 +68,7 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent?(): undefined | Type | Promise>; @@ -80,7 +80,7 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * @param preflightData Preflight data gathered. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @returns Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckPassed?( quiz: AddonModQuizQuizWSData, @@ -98,7 +98,7 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * @param preflightData Preflight data gathered. * @param prefetch Whether the user is prefetching the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done if async, void if it's synchronous. + * @returns Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckFailed?( quiz: AddonModQuizQuizWSData, @@ -114,7 +114,7 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * @param attempt The attempt. * @param endTime The attempt end time (in seconds). * @param timeNow The current time in seconds. - * @return Whether it should be displayed. + * @returns Whether it should be displayed. */ shouldShowTimeLeft?(attempt: AddonModQuizAttemptWSData, endTime: number, timeNow: number): boolean; } @@ -135,7 +135,7 @@ export class AddonModQuizAccessRuleDelegateService extends CoreDelegate | undefined> { return Promise.resolve(this.executeFunctionOnEnabled(rule, 'getPreflightComponent', [])); @@ -181,7 +181,7 @@ export class AddonModQuizAccessRuleDelegateService extends CoreDelegate { @@ -104,7 +104,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param quiz Quiz. * @param attempts Quiz user attempts. * @param siteId Site ID. If not defined, current site. - * @return List of Files. + * @returns List of Files. */ protected async getAttemptsFeedbackFiles( quiz: AddonModQuizQuizWSData, @@ -145,9 +145,9 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. * @param attempt Attempt to continue. Don't pass any value if the user needs to start a new attempt. * @param askPreflight Whether it should ask for preflight data if needed. - * @param modalTitle Lang key of the title to set to preflight modal (e.g. 'addon.mod_quiz.startattempt'). + * @param title Lang key of the title to set to preflight modal (e.g. 'addon.mod_quiz.startattempt'). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the preflight data. + * @returns Promise resolved with the preflight data. */ async getPreflightData( quiz: AddonModQuizQuizWSData, @@ -191,7 +191,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * * @param moduleId The module ID. * @param courseId The course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return AddonModQuiz.invalidateContent(moduleId, courseId); @@ -202,7 +202,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ async invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise { // Invalidate the calls required to check if a quiz is downloadable. @@ -217,7 +217,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can be downloaded. The promise should never be rejected. + * @returns Whether the module can be downloaded. The promise should never be rejected. */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { if (CoreSites.getCurrentSite()?.isOfflineDisabled()) { @@ -247,7 +247,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet /** * Whether or not the handler is enabled on a site level. * - * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @returns A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ async isEnabled(): Promise { return true; @@ -261,7 +261,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param dirPath Path of the directory where to store all the content files. * @param canStart If true, start a new attempt if needed. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetch( module: SyncedModule, @@ -289,7 +289,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param canStart If true, start a new attempt if needed. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchQuiz( module: CoreCourseAnyModuleData, @@ -400,7 +400,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param attempt Attempt. * @param preflightData Preflight required data (like password). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the prefetch is finished. Data returned is not reliable. + * @returns Promise resolved when the prefetch is finished. Data returned is not reliable. */ async prefetchAttempt( quiz: AddonModQuizQuizWSData, @@ -474,9 +474,9 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * * @param quiz Quiz. * @param attempt Attempt. - * @param options Other options. + * @param modOptions Other options. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchAttemptReviewFiles( quiz: AddonModQuizQuizWSData, @@ -511,7 +511,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param quiz Quiz. * @param modOptions Other options. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchGradeAndFeedback( quiz: AddonModQuizQuizWSData, @@ -536,7 +536,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param quiz Quiz. * @param askPreflight Whether it should ask for preflight data if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetchQuizAndLastAttempt(quiz: AddonModQuizQuizWSData, askPreflight?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -583,7 +583,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * * @param quiz Quiz. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setStatusAfterPrefetch( quiz: AddonModQuizQuizWSData, @@ -620,7 +620,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async sync(module: SyncedModule, courseId: number, siteId?: string): Promise { const quiz = await AddonModQuiz.getQuiz(courseId, module.id, { siteId }); diff --git a/src/addons/mod/quiz/services/handlers/push-click.ts b/src/addons/mod/quiz/services/handlers/push-click.ts index 05492395a..70f59024a 100644 --- a/src/addons/mod/quiz/services/handlers/push-click.ts +++ b/src/addons/mod/quiz/services/handlers/push-click.ts @@ -39,7 +39,7 @@ export class AddonModQuizPushClickHandlerService implements CorePushNotification * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: AddonModQuizPushNotificationData): Promise { return CoreUtils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_quiz' && @@ -50,7 +50,7 @@ export class AddonModQuizPushClickHandlerService implements CorePushNotification * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: AddonModQuizPushNotificationData): Promise { const contextUrlParams = CoreUrlUtils.extractUrlParams(notification.contexturl || ''); diff --git a/src/addons/mod/quiz/services/handlers/review-link.ts b/src/addons/mod/quiz/services/handlers/review-link.ts index d2c7cdd3b..2adb28518 100644 --- a/src/addons/mod/quiz/services/handlers/review-link.ts +++ b/src/addons/mod/quiz/services/handlers/review-link.ts @@ -36,7 +36,7 @@ export class AddonModQuizReviewLinkHandlerService extends CoreContentLinksHandle * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. * @param data Extra data to handle the URL. - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( diff --git a/src/addons/mod/quiz/services/handlers/sync-cron.ts b/src/addons/mod/quiz/services/handlers/sync-cron.ts index 998680fb6..db8ef878e 100644 --- a/src/addons/mod/quiz/services/handlers/sync-cron.ts +++ b/src/addons/mod/quiz/services/handlers/sync-cron.ts @@ -32,7 +32,7 @@ export class AddonModQuizSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return AddonModQuizSync.syncAllQuizzes(siteId, force); @@ -41,7 +41,7 @@ export class AddonModQuizSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return AddonModQuizSync.syncInterval; diff --git a/src/addons/mod/quiz/services/quiz-helper.ts b/src/addons/mod/quiz/services/quiz-helper.ts index 4eeb1755a..66496ced3 100644 --- a/src/addons/mod/quiz/services/quiz-helper.ts +++ b/src/addons/mod/quiz/services/quiz-helper.ts @@ -54,7 +54,7 @@ export class AddonModQuizHelperProvider { * @param title The title to display in the modal and in the submit button. * @param siteId Site ID. If not defined, current site. * @param retrying Whether we're retrying after a failure. - * @return Promise resolved when the preflight data is validated. The resolve param is the attempt. + * @returns Promise resolved when the preflight data is validated. The resolve param is the attempt. */ async getAndCheckPreflightData( quiz: AddonModQuizQuizWSData, @@ -133,7 +133,7 @@ export class AddonModQuizHelperProvider { * @param prefetch Whether the user is prefetching the quiz. * @param title The title to display in the modal and in the submit button. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the preflight data. Rejected if user cancels. + * @returns Promise resolved with the preflight data. Rejected if user cancels. */ async getPreflightData( quiz: AddonModQuizQuizWSData, @@ -184,7 +184,7 @@ export class AddonModQuizHelperProvider { * Example result: "Marked out of 1.00". * * @param html Question's HTML. - * @return Question's mark. + * @returns Question's mark. */ getQuestionMarkFromHtml(html: string): string | undefined { const element = CoreDomUtils.convertToElement(html); @@ -197,7 +197,7 @@ export class AddonModQuizHelperProvider { * * @param attemptId Attempt ID. * @param options Other options. - * @return Promise resolved with the quiz ID. + * @returns Promise resolved with the quiz ID. */ async getQuizIdByAttemptId(attemptId: number, options: { cmId?: number; siteId?: string } = {}): Promise { // Use getAttemptReview to retrieve the quiz ID. @@ -217,7 +217,7 @@ export class AddonModQuizHelperProvider { * @param page Page to load, -1 to all questions in same page. * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleReviewLink(attemptId: number, page?: number, quizId?: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -261,6 +261,7 @@ export class AddonModQuizHelperProvider { * @param bestGrade Quiz's best grade (formatted). Required if highlight=true. * @param isLastAttempt Whether the attempt is the last one. * @param siteId Site ID. + * @returns Quiz attemptw with calculated data. */ async setAttemptCalculatedData( quiz: AddonModQuizQuizData, @@ -307,6 +308,7 @@ export class AddonModQuizHelperProvider { * * @param quiz Quiz. * @param options Review options. + * @returns Quiz data with some calculated more. */ setQuizCalculatedData(quiz: AddonModQuizQuizWSData, options: AddonModQuizCombinedReviewOptions): AddonModQuizQuizData { const formattedQuiz = quiz; @@ -331,11 +333,9 @@ export class AddonModQuizHelperProvider { * @param preflightData Object where to store the preflight data. * @param attempt Attempt to continue. Don't pass any value if the user needs to start a new attempt. * @param offline Whether the attempt is offline. - * @param sent Whether preflight data has been entered by the user. * @param prefetch Whether user is prefetching. - * @param title The title to display in the modal and in the submit button. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the preflight data is validated. + * @returns Promise resolved when the preflight data is validated. */ async validatePreflightData( quiz: AddonModQuizQuizWSData, diff --git a/src/addons/mod/quiz/services/quiz-offline.ts b/src/addons/mod/quiz/services/quiz-offline.ts index 70c72eab5..c14ed939d 100644 --- a/src/addons/mod/quiz/services/quiz-offline.ts +++ b/src/addons/mod/quiz/services/quiz-offline.ts @@ -41,7 +41,7 @@ export class AddonModQuizOfflineProvider { * Classify the answers in questions. * * @param answers List of answers. - * @return Object with the questions, the keys are the slot. Each question contains its answers. + * @returns Object with the questions, the keys are the slot. Each question contains its answers. */ classifyAnswersInQuestions(answers: CoreQuestionsAnswers): AddonModQuizQuestionsWithAnswers { const questionsWithAnswers: AddonModQuizQuestionsWithAnswers = {}; @@ -67,7 +67,7 @@ export class AddonModQuizOfflineProvider { * Given a list of questions with answers classified in it, returns a list of answers (including prefix in the name). * * @param questions Questions. - * @return Answers. + * @returns Answers. */ extractAnswersFromQuestions(questions: AddonModQuizQuestionsWithAnswers): CoreQuestionsAnswers { const answers: CoreQuestionsAnswers = {}; @@ -87,7 +87,7 @@ export class AddonModQuizOfflineProvider { * Get all the offline attempts in a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the offline attempts. + * @returns Promise resolved with the offline attempts. */ async getAllAttempts(siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -100,7 +100,7 @@ export class AddonModQuizOfflineProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the answers. + * @returns Promise resolved with the answers. */ getAttemptAnswers(attemptId: number, siteId?: string): Promise { return CoreQuestion.getAttemptAnswers(AddonModQuizProvider.COMPONENT, attemptId, siteId); @@ -111,7 +111,7 @@ export class AddonModQuizOfflineProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the attempt. + * @returns Promise resolved with the attempt. */ async getAttemptById(attemptId: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -122,10 +122,10 @@ export class AddonModQuizOfflineProvider { /** * Retrieve an attempt from site DB. * - * @param attemptId Attempt ID. + * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, user current site's user. - * @return Promise resolved with the attempts. + * @returns Promise resolved with the attempts. */ async getQuizAttempts(quizId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -139,7 +139,7 @@ export class AddonModQuizOfflineProvider { * @param attemptId Attempt ID. * @param questions List of questions. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadQuestionsLocalStates( attemptId: number, @@ -174,7 +174,7 @@ export class AddonModQuizOfflineProvider { * @param data Data to save. * @param finish Whether to finish the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async processAttempt( quiz: AddonModQuizQuizWSData, @@ -221,7 +221,7 @@ export class AddonModQuizOfflineProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeAttemptAndAnswers(attemptId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -241,7 +241,7 @@ export class AddonModQuizOfflineProvider { * @param attemptId Attempt ID. * @param slot Question slot. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when finished. + * @returns Promise resolved when finished. */ async removeQuestionAndAnswers(attemptId: number, slot: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -261,7 +261,7 @@ export class AddonModQuizOfflineProvider { * @param answers Answers to save. * @param timeMod Time modified to set in the answers. If not defined, current time. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveAnswers( quiz: AddonModQuizQuizWSData, @@ -351,7 +351,7 @@ export class AddonModQuizOfflineProvider { * @param attemptId Attempt ID. * @param page Page to set. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async setAttemptCurrentPage(attemptId: number, page: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); diff --git a/src/addons/mod/quiz/services/quiz-sync.ts b/src/addons/mod/quiz/services/quiz-sync.ts index 1dcacd5c1..68568c798 100644 --- a/src/addons/mod/quiz/services/quiz-sync.ts +++ b/src/addons/mod/quiz/services/quiz-sync.ts @@ -55,7 +55,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * @param courseId Course ID. * @param warnings List of warnings generated by the sync. * @param options Other options. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ protected async finishSync( siteId: string, @@ -122,7 +122,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it has data to sync. + * @returns Promise resolved with boolean: whether it has data to sync. */ async hasDataToSync(quizId: number, siteId?: string): Promise { try { @@ -141,7 +141,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * @param quiz Quiz. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchAfterUpdateQuiz( module: CoreCourseModuleBasicInfo, @@ -178,7 +178,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllQuizzes(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all quizzes', (siteId) => this.syncAllQuizzesFunc(!!force, siteId), siteId); @@ -189,7 +189,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllQuizzesFunc(force: boolean, siteId: string): Promise { // Get all offline attempts. @@ -236,7 +236,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * @param quiz Quiz. * @param askPreflight Whether we should ask for preflight data if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the quiz is synced or if it doesn't need to be synced. + * @returns Promise resolved when the quiz is synced or if it doesn't need to be synced. */ async syncQuizIfNeeded( quiz: AddonModQuizQuizWSData, @@ -257,7 +257,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * @param quiz Quiz. * @param askPreflight Whether we should ask for preflight data if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ syncQuiz(quiz: AddonModQuizQuizWSData, askPreflight?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -284,7 +284,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * @param quiz Quiz. * @param askPreflight Whether we should ask for preflight data if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ async performSyncQuiz(quiz: AddonModQuizQuizWSData, askPreflight?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -435,7 +435,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * @param onlineQuestions Online questions * @param offlineQuestions Offline questions. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if some offline data was discarded, false otherwise. + * @returns Promise resolved with boolean: true if some offline data was discarded, false otherwise. */ async validateQuestions( attemptId: number, diff --git a/src/addons/mod/quiz/services/quiz.ts b/src/addons/mod/quiz/services/quiz.ts index bc8793596..88ba291fd 100644 --- a/src/addons/mod/quiz/services/quiz.ts +++ b/src/addons/mod/quiz/services/quiz.ts @@ -96,7 +96,7 @@ export class AddonModQuizProvider { * * @param grade Grade. * @param decimals Decimals to use. - * @return Grade to display. + * @returns Grade to display. */ formatGrade(grade?: number | null, decimals?: number): string { if (grade === undefined || grade == -1 || grade === null || isNaN(grade)) { @@ -113,7 +113,7 @@ export class AddonModQuizProvider { * @param attempt Attempt. * @param preflightData Preflight required data (like password). * @param options Other options. - * @return Promise resolved with the questions. + * @returns Promise resolved with the questions. */ async getAllQuestionsData( quiz: AddonModQuizQuizWSData, @@ -149,7 +149,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param attemptId Attempt ID. - * @return Cache key. + * @returns Cache key. */ protected getAttemptAccessInformationCacheKey(quizId: number, attemptId: number): string { return this.getAttemptAccessInformationCommonCacheKey(quizId) + ':' + attemptId; @@ -159,7 +159,7 @@ export class AddonModQuizProvider { * Get common cache key for get attempt access information WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getAttemptAccessInformationCommonCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'attemptAccessInformation:' + quizId; @@ -171,7 +171,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param attemptId Attempt ID. 0 for user's last attempt. * @param options Other options. - * @return Promise resolved with the access information. + * @returns Promise resolved with the access information. */ async getAttemptAccessInformation( quizId: number, @@ -200,7 +200,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param page Page. - * @return Cache key. + * @returns Cache key. */ protected getAttemptDataCacheKey(attemptId: number, page: number): string { return this.getAttemptDataCommonCacheKey(attemptId) + ':' + page; @@ -210,7 +210,7 @@ export class AddonModQuizProvider { * Get common cache key for get attempt data WS calls. * * @param attemptId Attempt ID. - * @return Cache key. + * @returns Cache key. */ protected getAttemptDataCommonCacheKey(attemptId: number): string { return ROOT_CACHE_KEY + 'attemptData:' + attemptId; @@ -223,7 +223,7 @@ export class AddonModQuizProvider { * @param page Page number. * @param preflightData Preflight required data (like password). * @param options Other options. - * @return Promise resolved with the attempt data. + * @returns Promise resolved with the attempt data. */ async getAttemptData( attemptId: number, @@ -263,7 +263,7 @@ export class AddonModQuizProvider { * * @param quiz Quiz. * @param attempt Attempt. - * @return Attempt's due date, 0 if no due date or invalid data. + * @returns Attempt's due date, 0 if no due date or invalid data. */ getAttemptDueDate(quiz: AddonModQuizQuizWSData, attempt: AddonModQuizAttemptWSData): number { const deadlines: number[] = []; @@ -304,7 +304,7 @@ export class AddonModQuizProvider { * * @param quiz Quiz. * @param attempt Attempt. - * @return Attempt's warning, undefined if no due date. + * @returns Attempt's warning, undefined if no due date. */ getAttemptDueDateWarning(quiz: AddonModQuizQuizWSData, attempt: AddonModQuizAttemptWSData): string | undefined { const dueDate = this.getAttemptDueDate(quiz, attempt); @@ -324,7 +324,7 @@ export class AddonModQuizProvider { * * @param quiz Quiz. * @param attempt Attempt. - * @return List of state sentences. + * @returns List of state sentences. */ getAttemptReadableState(quiz: AddonModQuizQuizWSData, attempt: AddonModQuizAttempt): string[] { if (attempt.finishedOffline) { @@ -372,7 +372,7 @@ export class AddonModQuizProvider { * Turn attempt's state into a readable state name, without any more data. * * @param state State. - * @return Readable state name. + * @returns Readable state name. */ getAttemptReadableStateName(state: string): string { switch (state) { @@ -398,7 +398,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param page Page. - * @return Cache key. + * @returns Cache key. */ protected getAttemptReviewCacheKey(attemptId: number, page: number): string { return this.getAttemptReviewCommonCacheKey(attemptId) + ':' + page; @@ -408,7 +408,7 @@ export class AddonModQuizProvider { * Get common cache key for get attempt review WS calls. * * @param attemptId Attempt ID. - * @return Cache key. + * @returns Cache key. */ protected getAttemptReviewCommonCacheKey(attemptId: number): string { return ROOT_CACHE_KEY + 'attemptReview:' + attemptId; @@ -419,7 +419,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param options Other options. - * @return Promise resolved with the attempt review. + * @returns Promise resolved with the attempt review. */ async getAttemptReview( attemptId: number, @@ -452,7 +452,7 @@ export class AddonModQuizProvider { * Get cache key for get attempt summary WS calls. * * @param attemptId Attempt ID. - * @return Cache key. + * @returns Cache key. */ protected getAttemptSummaryCacheKey(attemptId: number): string { return ROOT_CACHE_KEY + 'attemptSummary:' + attemptId; @@ -464,7 +464,7 @@ export class AddonModQuizProvider { * @param attemptId Attempt ID. * @param preflightData Preflight required data (like password). * @param options Other options. - * @return Promise resolved with the list of questions for the attempt summary. + * @returns Promise resolved with the list of questions for the attempt summary. */ async getAttemptSummary( attemptId: number, @@ -506,7 +506,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getCombinedReviewOptionsCacheKey(quizId: number, userId: number): string { return this.getCombinedReviewOptionsCommonCacheKey(quizId) + ':' + userId; @@ -516,7 +516,7 @@ export class AddonModQuizProvider { * Get common cache key for get combined review options WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getCombinedReviewOptionsCommonCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'combinedReviewOptions:' + quizId; @@ -527,7 +527,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param options Other options. - * @return Promise resolved with the combined review options. + * @returns Promise resolved with the combined review options. */ async getCombinedReviewOptions( quizId: number, @@ -566,7 +566,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param grade Grade. - * @return Cache key. + * @returns Cache key. */ protected getFeedbackForGradeCacheKey(quizId: number, grade: number): string { return this.getFeedbackForGradeCommonCacheKey(quizId) + ':' + grade; @@ -576,7 +576,7 @@ export class AddonModQuizProvider { * Get common cache key for get feedback for grade WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getFeedbackForGradeCommonCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'feedbackForGrade:' + quizId; @@ -588,7 +588,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param grade Grade. * @param options Other options. - * @return Promise resolved with the feedback. + * @returns Promise resolved with the feedback. */ async getFeedbackForGrade( quizId: number, @@ -617,7 +617,7 @@ export class AddonModQuizProvider { * Based on Moodle's quiz_get_grade_format. * * @param quiz Quiz. - * @return Number of decimals. + * @returns Number of decimals. */ getGradeDecimals(quiz: AddonModQuizQuizWSData): number { if (quiz.questiondecimalpoints === undefined) { @@ -639,7 +639,7 @@ export class AddonModQuizProvider { * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved with an object containing the grade and the feedback. + * @returns Promise resolved with an object containing the grade and the feedback. */ async getGradeFromGradebook( courseId: number, @@ -665,7 +665,7 @@ export class AddonModQuizProvider { * Given a list of attempts, returns the last finished attempt. * * @param attempts Attempts sorted. First attempt should be the first on the list. - * @return Last finished attempt. + * @returns Last finished attempt. */ getLastFinishedAttemptFromList(attempts?: AddonModQuizAttemptWSData[]): AddonModQuizAttemptWSData | undefined { if (!attempts) { @@ -686,7 +686,7 @@ export class AddonModQuizProvider { * Will return an array with the messages to prevent the submit. Empty array if quiz can be submitted. * * @param questions Questions. - * @return List of prevent submit messages. Empty array if quiz can be submitted. + * @returns List of prevent submit messages. Empty array if quiz can be submitted. */ getPreventSubmitMessages(questions: CoreQuestionQuestionParsed[]): string[] { const messages: string[] = []; @@ -714,7 +714,7 @@ export class AddonModQuizProvider { * Get cache key for quiz data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getQuizDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'quiz:' + courseId; @@ -727,7 +727,7 @@ export class AddonModQuizProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the Quiz is retrieved. + * @returns Promise resolved when the Quiz is retrieved. */ protected async getQuizByField( courseId: number, @@ -770,7 +770,7 @@ export class AddonModQuizProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the quiz is retrieved. + * @returns Promise resolved when the quiz is retrieved. */ getQuiz(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getQuizByField(courseId, 'coursemodule', cmId, options); @@ -782,7 +782,7 @@ export class AddonModQuizProvider { * @param courseId Course ID. * @param id Quiz ID. * @param options Other options. - * @return Promise resolved when the quiz is retrieved. + * @returns Promise resolved when the quiz is retrieved. */ getQuizById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getQuizByField(courseId, 'id', id, options); @@ -792,7 +792,7 @@ export class AddonModQuizProvider { * Get cache key for get quiz access information WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getQuizAccessInformationCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'quizAccessInformation:' + quizId; @@ -803,7 +803,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param options Other options. - * @return Promise resolved with the access information. + * @returns Promise resolved with the access information. */ async getQuizAccessInformation( quizId: number, @@ -828,7 +828,7 @@ export class AddonModQuizProvider { * Get a readable Quiz grade method. * * @param method Grading method. - * @return Readable grading method. + * @returns Readable grading method. */ getQuizGradeMethod(method?: number | string): string { if (method === undefined) { @@ -857,7 +857,7 @@ export class AddonModQuizProvider { * Get cache key for get quiz required qtypes WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getQuizRequiredQtypesCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'quizRequiredQtypes:' + quizId; @@ -868,7 +868,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param options Other options. - * @return Promise resolved with the access information. + * @returns Promise resolved with the access information. */ async getQuizRequiredQtypes(quizId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -897,7 +897,7 @@ export class AddonModQuizProvider { * Given an attempt's layout, return the list of pages. * * @param layout Attempt's layout. - * @return Pages. + * @returns Pages. * @description * An attempt's layout is a string with the question numbers separated by commas. A 0 indicates a change of page. * Example: 1,2,3,0,4,5,6,0 @@ -930,7 +930,7 @@ export class AddonModQuizProvider { * * @param layout Attempt's layout. * @param questions List of questions. It needs to be an object where the keys are question slot. - * @return Pages. + * @returns Pages. * @description * An attempt's layout is a string with the question numbers separated by commas. A 0 indicates a change of page. * Example: 1,2,3,0,4,5,6,0 @@ -963,7 +963,7 @@ export class AddonModQuizProvider { * Given a list of question types, returns the types that aren't supported. * * @param questionTypes Question types to check. - * @return Not supported question types. + * @returns Not supported question types. */ getUnsupportedQuestions(questionTypes: string[]): string[] { const notSupported: string[] = []; @@ -981,7 +981,7 @@ export class AddonModQuizProvider { * Given a list of access rules names, returns the rules that aren't supported. * * @param rulesNames Rules to check. - * @return Not supported rules names. + * @returns Not supported rules names. */ getUnsupportedRules(rulesNames: string[]): string[] { const notSupported: string[] = []; @@ -1000,7 +1000,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getUserAttemptsCacheKey(quizId: number, userId: number): string { return this.getUserAttemptsCommonCacheKey(quizId) + ':' + userId; @@ -1010,7 +1010,7 @@ export class AddonModQuizProvider { * Get common cache key for get user attempts WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getUserAttemptsCommonCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'userAttempts:' + quizId; @@ -1021,7 +1021,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param options Other options. - * @return Promise resolved with the attempts. + * @returns Promise resolved with the attempts. */ async getUserAttempts( quizId: number, @@ -1058,7 +1058,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getUserBestGradeCacheKey(quizId: number, userId: number): string { return this.getUserBestGradeCommonCacheKey(quizId) + ':' + userId; @@ -1068,7 +1068,7 @@ export class AddonModQuizProvider { * Get common cache key for get user best grade WS calls. * * @param quizId Quiz ID. - * @return Cache key. + * @returns Cache key. */ protected getUserBestGradeCommonCacheKey(quizId: number): string { return ROOT_CACHE_KEY + 'userBestGrade:' + quizId; @@ -1079,7 +1079,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param options Other options. - * @return Promise resolved with the best grade data. + * @returns Promise resolved with the best grade data. */ async getUserBestGrade(quizId: number, options: AddonModQuizUserOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -1107,7 +1107,7 @@ export class AddonModQuizProvider { * @param attemptId Attempt ID to invalidate some WS calls. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllQuizData( quizId: number, @@ -1146,7 +1146,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptAccessInformation(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1160,7 +1160,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptAccessInformationForAttempt(quizId: number, attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1173,7 +1173,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptData(attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1187,7 +1187,7 @@ export class AddonModQuizProvider { * @param attemptId Attempt ID. * @param page Page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptDataForPage(attemptId: number, page: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1200,7 +1200,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptReview(attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1214,7 +1214,7 @@ export class AddonModQuizProvider { * @param attemptId Attempt ID. * @param page Page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptReviewForPage(attemptId: number, page: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1227,7 +1227,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptSummary(attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1240,7 +1240,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCombinedReviewOptions(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1254,7 +1254,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCombinedReviewOptionsForUser(quizId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1268,7 +1268,7 @@ export class AddonModQuizProvider { * @param moduleId The module ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1292,7 +1292,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateFeedback(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1306,7 +1306,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param grade Grade. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateFeedbackForGrade(quizId: number, grade: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1320,7 +1320,7 @@ export class AddonModQuizProvider { * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateGradeFromGradebook(courseId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1333,7 +1333,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateQuizAccessInformation(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1346,7 +1346,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateQuizRequiredQtypes(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1359,7 +1359,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserAttempts(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1373,7 +1373,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserAttemptsForUser(quizId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1386,7 +1386,7 @@ export class AddonModQuizProvider { * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserBestGrade(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1400,7 +1400,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserBestGradeForUser(quizId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1413,7 +1413,7 @@ export class AddonModQuizProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateQuizData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1425,7 +1425,7 @@ export class AddonModQuizProvider { * Check if an attempt is finished based on its state. * * @param state Attempt's state. - * @return Whether it's finished. + * @returns Whether it's finished. */ isAttemptFinished(state?: string): boolean { return state == AddonModQuizProvider.ATTEMPT_FINISHED || state == AddonModQuizProvider.ATTEMPT_ABANDONED; @@ -1436,7 +1436,7 @@ export class AddonModQuizProvider { * * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if finished in offline but not synced, false otherwise. + * @returns Promise resolved with boolean: true if finished in offline but not synced, false otherwise. */ async isAttemptFinishedOffline(attemptId: number, siteId?: string): Promise { try { @@ -1456,7 +1456,7 @@ export class AddonModQuizProvider { * * @param quiz Quiz. * @param attempt Attempt. - * @return Whether it's nearly over or over. + * @returns Whether it's nearly over or over. */ isAttemptTimeNearlyOver(quiz: AddonModQuizQuizWSData, attempt: AddonModQuizAttemptWSData): boolean { if (attempt.state != AddonModQuizProvider.ATTEMPT_IN_PROGRESS) { @@ -1477,10 +1477,10 @@ export class AddonModQuizProvider { /** * Check if last attempt is offline and unfinished. * - * @param attemptId Attempt ID. + * @param quiz Quiz data. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, user current site's user. - * @return Promise resolved with boolean: true if last offline attempt is unfinished, false otherwise. + * @returns Promise resolved with boolean: true if last offline attempt is unfinished, false otherwise. */ async isLastAttemptOfflineUnfinished(quiz: AddonModQuizQuizWSData, siteId?: string, userId?: number): Promise { try { @@ -1498,7 +1498,7 @@ export class AddonModQuizProvider { * Check if a quiz navigation is sequential. * * @param quiz Quiz. - * @return Whether navigation is sequential. + * @returns Whether navigation is sequential. */ isNavigationSequential(quiz: AddonModQuizQuizWSData): boolean { return quiz.navmethod == 'sequential'; @@ -1508,7 +1508,7 @@ export class AddonModQuizProvider { * Check if a question is blocked. * * @param question Question. - * @return Whether it's blocked. + * @returns Whether it's blocked. */ isQuestionBlocked(question: CoreQuestionQuestionParsed): boolean { const element = CoreDomUtils.convertToElement(question.html); @@ -1520,7 +1520,7 @@ export class AddonModQuizProvider { * Check if a quiz is enabled to be used in offline. * * @param quiz Quiz. - * @return Whether offline is enabled. + * @returns Whether offline is enabled. */ isQuizOffline(quiz: AddonModQuizQuizWSData): boolean { // Don't allow downloading the quiz if offline is disabled to prevent wasting a lot of data when opening it. @@ -1536,7 +1536,7 @@ export class AddonModQuizProvider { * @param offline Whether attempt is offline. * @param quiz Quiz instance. If set, a Firebase event will be stored. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logViewAttempt( attemptId: number, @@ -1584,7 +1584,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param name Name of the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logViewAttemptReview(attemptId: number, quizId: number, name?: string, siteId?: string): Promise { const params: AddonModQuizViewAttemptReviewWSParams = { @@ -1611,7 +1611,7 @@ export class AddonModQuizProvider { * @param quizId Quiz ID. * @param name Name of the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logViewAttemptSummary( attemptId: number, @@ -1647,7 +1647,7 @@ export class AddonModQuizProvider { * @param id Module ID. * @param name Name of the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logViewQuiz(id: number, name?: string, siteId?: string): Promise { const params: AddonModQuizViewQuizWSParams = { @@ -1677,7 +1677,7 @@ export class AddonModQuizProvider { * @param timeUp Whether the quiz time is up, false otherwise. * @param offline Whether the attempt is offline. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async processAttempt( quiz: AddonModQuizQuizWSData, @@ -1705,7 +1705,7 @@ export class AddonModQuizProvider { * @param finish Whether to finish the quiz. * @param timeUp Whether the quiz time is up, false otherwise. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ protected async processAttemptOnline( attemptId: number, @@ -1748,7 +1748,7 @@ export class AddonModQuizProvider { * @param preflightData Preflight required data (like password). * @param finish Whether to finish the quiz. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ protected async processAttemptOffline( quiz: AddonModQuizQuizWSData, @@ -1777,7 +1777,7 @@ export class AddonModQuizProvider { * Check if it's a graded quiz. Based on Moodle's quiz_has_grades. * * @param quiz Quiz. - * @return Whether quiz is graded. + * @returns Whether quiz is graded. */ quizHasGrades(quiz: AddonModQuizQuizWSData): boolean { return quiz.grade! >= 0.000005 && quiz.sumgrades! >= 0.000005; @@ -1791,7 +1791,7 @@ export class AddonModQuizProvider { * @param quiz Quiz. * @param format True to format the results for display, 'question' to format a question grade * (different number of decimal places), false to not format it. - * @return Grade to display. + * @returns Grade to display. */ rescaleGrade( rawGrade: string | number | undefined | null, @@ -1831,7 +1831,7 @@ export class AddonModQuizProvider { * @param preflightData Preflight required data (like password). * @param offline Whether attempt is offline. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ async saveAttempt( quiz: AddonModQuizQuizWSData, @@ -1861,7 +1861,7 @@ export class AddonModQuizProvider { * @param data Data to save. * @param preflightData Preflight required data (like password). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success, rejected otherwise. + * @returns Promise resolved in success, rejected otherwise. */ protected async saveAttemptOnline( attemptId: number, @@ -1898,7 +1898,7 @@ export class AddonModQuizProvider { * @param rules List of active rules names. * @param attempt Attempt. * @param endTime The attempt end time (in seconds). - * @return Whether time left should be displayed. + * @returns Whether time left should be displayed. */ shouldShowTimeLeft(rules: string[], attempt: AddonModQuizAttemptWSData, endTime: number): boolean { const timeNow = CoreTimeUtils.timestamp(); @@ -1917,7 +1917,7 @@ export class AddonModQuizProvider { * @param preflightData Preflight required data (like password). * @param forceNew Whether to force a new attempt or not. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the attempt data. + * @returns Promise resolved with the attempt data. */ async startAttempt( quizId: number, diff --git a/src/addons/mod/resource/components/index/index.ts b/src/addons/mod/resource/components/index/index.ts index 6b4f51679..545082efc 100644 --- a/src/addons/mod/resource/components/index/index.ts +++ b/src/addons/mod/resource/components/index/index.ts @@ -195,7 +195,7 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource * Opens a file. * * @param iOSOpenFileAction Action to do in iOS. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async open(iOSOpenFileAction?: OpenFileAction): Promise { let downloadable = await CoreCourseModulePrefetchDelegate.isModuleDownloadable(this.module, this.courseId); diff --git a/src/addons/mod/resource/services/handlers/module.ts b/src/addons/mod/resource/services/handlers/module.ts index cabdda495..47d637d78 100644 --- a/src/addons/mod/resource/services/handlers/module.ts +++ b/src/addons/mod/resource/services/handlers/module.ts @@ -116,7 +116,7 @@ export class AddonModResourceModuleHandlerService extends CoreModuleHandlerBase * Returns if contents are loaded to show open button. * * @param module The module object. - * @return Resolved when done. + * @returns Resolved when done. */ protected async hideOpenButton(module: CoreCourseModuleData): Promise { if (!module.contentsinfo) { // Not informed before 3.7.6. @@ -133,7 +133,7 @@ export class AddonModResourceModuleHandlerService extends CoreModuleHandlerBase * * @param module The module object. * @param courseId The course ID. - * @return Resource data. + * @returns Resource data. */ protected async getResourceData( module: CoreCourseModuleData, diff --git a/src/addons/mod/resource/services/resource-helper.ts b/src/addons/mod/resource/services/resource-helper.ts index aba1b9533..f1ee994ef 100644 --- a/src/addons/mod/resource/services/resource-helper.ts +++ b/src/addons/mod/resource/services/resource-helper.ts @@ -39,7 +39,7 @@ export class AddonModResourceHelperProvider { * Get the HTML to display an embedded resource. * * @param module The module object. - * @return Promise resolved with the HTML. + * @returns Promise resolved with the HTML. */ async getEmbeddedHtml(module: CoreCourseModuleData): Promise { const contents = await CoreCourse.getModuleContents(module); @@ -59,7 +59,7 @@ export class AddonModResourceHelperProvider { * Download all the files needed and returns the src of the iframe. * * @param module The module object. - * @return Promise resolved with the iframe src. + * @returns Promise resolved with the iframe src. */ async getIframeSrc(module: CoreCourseModuleData): Promise { if (!module.contents?.length) { @@ -94,7 +94,7 @@ export class AddonModResourceHelperProvider { * * @param module The module object. * @param display The display mode (if available). - * @return Whether the resource should be displayed embeded. + * @returns Whether the resource should be displayed embeded. */ isDisplayedEmbedded(module: CoreCourseModuleData, display: number): boolean { const currentSite = CoreSites.getCurrentSite(); @@ -121,7 +121,7 @@ export class AddonModResourceHelperProvider { * Whether the resource has to be displayed in an iframe. * * @param module The module object. - * @return Whether the resource should be displayed in an iframe. + * @returns Whether the resource should be displayed in an iframe. */ isDisplayedInIframe(module: CoreCourseModuleData): boolean { if (!CoreFile.isAvailable()) { @@ -147,7 +147,7 @@ export class AddonModResourceHelperProvider { * * @param module Module instance. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether main file is downloadable. + * @returns Promise resolved with boolean: whether main file is downloadable. */ async isMainFileDownloadable(module: CoreCourseModuleData, siteId?: string): Promise { const contents = await CoreCourse.getModuleContents(module); @@ -167,7 +167,7 @@ export class AddonModResourceHelperProvider { * Check if the resource is a Nextcloud file. * * @param module Module to check. - * @return Whether it's a Nextcloud file. + * @returns Whether it's a Nextcloud file. */ isNextcloudFile(module: CoreCourseAnyModuleData): boolean { if ('contentsinfo' in module && module.contentsinfo) { @@ -183,7 +183,7 @@ export class AddonModResourceHelperProvider { * @param module Module where to get the contents. * @param courseId Course Id, used for completion purposes. * @param options Options to open the file. - * @return Resolved when done. + * @returns Resolved when done. */ async openModuleFile(module: CoreCourseModuleData, courseId: number, options: CoreUtilsOpenFileOptions = {}): Promise { const modal = await CoreDomUtils.showModalLoading(); diff --git a/src/addons/mod/resource/services/resource.ts b/src/addons/mod/resource/services/resource.ts index e9a672728..10c6e1063 100644 --- a/src/addons/mod/resource/services/resource.ts +++ b/src/addons/mod/resource/services/resource.ts @@ -37,7 +37,7 @@ export class AddonModResourceProvider { * Get cache key for resource data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getResourceCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'resource:' + courseId; @@ -50,7 +50,7 @@ export class AddonModResourceProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the resource is retrieved. + * @returns Promise resolved when the resource is retrieved. */ protected async getResourceDataByKey( courseId: number, @@ -91,7 +91,7 @@ export class AddonModResourceProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the resource is retrieved. + * @returns Promise resolved when the resource is retrieved. */ getResourceData(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getResourceDataByKey(courseId, 'coursemodule', cmId, options); @@ -103,7 +103,7 @@ export class AddonModResourceProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -120,9 +120,9 @@ export class AddonModResourceProvider { /** * Invalidates resource data. * - * @param courseid Course ID. + * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateResourceData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -134,7 +134,7 @@ export class AddonModResourceProvider { * Return whether or not the plugin is enabled. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -148,7 +148,7 @@ export class AddonModResourceProvider { * @param id Module ID. * @param name Name of the resource. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModResourceViewResourceWSParams = { diff --git a/src/addons/mod/scorm/classes/data-model-12.ts b/src/addons/mod/scorm/classes/data-model-12.ts index dd37ab93f..3cf3faafb 100644 --- a/src/addons/mod/scorm/classes/data-model-12.ts +++ b/src/addons/mod/scorm/classes/data-model-12.ts @@ -123,7 +123,7 @@ export class AddonModScormDataModel12 { * * @param first First time. * @param second Second time. - * @return Total time. + * @returns Total time. */ protected addTime(first: string, second: string): string { const sFirst = first.split(':'); @@ -178,7 +178,7 @@ export class AddonModScormDataModel12 { /** * Collect all the user tracking data that must be persisted in the system, this is usually called by LMSCommit(). * - * @return Collected data. + * @returns Collected data. */ protected collectData(): AddonModScormDataEntry[] { if (!this.currentUserData[this.scoId]) { @@ -239,7 +239,7 @@ export class AddonModScormDataModel12 { * Get the value of the given element from the non-persistent (current) user data. * * @param el The element - * @return The element value + * @returns The element value */ protected getEl(el: string): string | number { if (this.currentUserData[this.scoId] && this.currentUserData[this.scoId].userdata[el] !== undefined) { @@ -602,7 +602,7 @@ export class AddonModScormDataModel12 { * Commit the changes. * * @param param Param. - * @return "true" if success, "false" otherwise. + * @returns "true" if success, "false" otherwise. */ LMSCommit(param: string): string { if (this.timeout) { @@ -636,7 +636,7 @@ export class AddonModScormDataModel12 { * Finish the data model. * * @param param Param. - * @return "true" if success, "false" otherwise. + * @returns "true" if success, "false" otherwise. */ LMSFinish(param: string): string { this.errorCode = '0'; @@ -679,7 +679,7 @@ export class AddonModScormDataModel12 { * Get diagnostic. * * @param param Param. - * @return Result. + * @returns Result. */ LMSGetDiagnostic(param: string): string { if (param == '') { @@ -693,7 +693,7 @@ export class AddonModScormDataModel12 { * Get the error message for a certain code. * * @param param Error code. - * @return Error message. + * @returns Error message. */ LMSGetErrorString(param: string): string { if (param != '') { @@ -706,7 +706,7 @@ export class AddonModScormDataModel12 { /** * Get the last error code. * - * @return Last error code. + * @returns Last error code. */ LMSGetLastError(): string { return this.errorCode; @@ -716,7 +716,7 @@ export class AddonModScormDataModel12 { * Get the value of a certain element. * * @param element Name of the element to get. - * @return Value. + * @returns Value. */ LMSGetValue(element: string): AddonModScormDataValue { this.errorCode = '0'; @@ -772,7 +772,7 @@ export class AddonModScormDataModel12 { * Initialize the data model. * * @param param Param. - * @return "true" if initialized, "false" otherwise. + * @returns "true" if initialized, "false" otherwise. */ LMSInitialize(param: string): string { this.errorCode = '0'; @@ -798,7 +798,7 @@ export class AddonModScormDataModel12 { * * @param element Name of the element to set. * @param value Value to set. - * @return "true" if success, "false" otherwise. + * @returns "true" if success, "false" otherwise. */ LMSSetValue(element: string, value: AddonModScormDataValue): string { this.errorCode = '0'; @@ -968,7 +968,7 @@ export class AddonModScormDataModel12 { * Persist the current user data (this is usually called by LMSCommit). * * @param storeTotalTime If true, we need to calculate the total time too. - * @return True if success, false otherwise. + * @returns True if success, false otherwise. */ protected storeData(storeTotalTime?: boolean): boolean { if (!this.canSaveTracks) { @@ -1025,7 +1025,7 @@ export class AddonModScormDataModel12 { /** * Utility function for calculating the total time spent in the SCO. * - * @return Total time element. + * @returns Total time element. */ protected totalTime(): AddonModScormDataEntry { const totalTime = this.addTime( this.getEl('cmi.core.total_time'), this.getEl('cmi.core.session_time')); diff --git a/src/addons/mod/scorm/components/index/index.ts b/src/addons/mod/scorm/components/index/index.ts index 439689d15..66ac6508c 100644 --- a/src/addons/mod/scorm/components/index/index.ts +++ b/src/addons/mod/scorm/components/index/index.ts @@ -102,7 +102,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -121,7 +121,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Download a SCORM package or restores an ongoing download. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadScormPackage(): Promise { this.downloading = true; @@ -208,7 +208,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom * Fetch attempt data. * * @param scorm Scorm. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchAttemptData(scorm: AddonModScormScorm): Promise { // Get the number of attempts. @@ -253,7 +253,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Load SCORM package size if needed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadPackageSize(scorm: AddonModScormScorm): Promise { if (scorm.packagesize || this.errorMessage) { @@ -267,7 +267,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Fetch the structure of the SCORM (TOC). * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchStructure(scorm: AddonModScormScorm): Promise { this.organizations = await AddonModScorm.getOrganizations(scorm.id, { cmId: this.module.id }); @@ -290,7 +290,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom * @param attempt The attempt number. * @param offline Whether it's an offline attempt. * @param attempts Object where to add the attempt. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getAttemptGrade( attempt: number, @@ -308,7 +308,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Get the grades of each attempt and the grade of the SCORM. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getReportedGrades(scorm: AddonModScormScorm, attempts: AddonModScormAttemptCountResult): Promise { const promises: Promise[] = []; @@ -364,7 +364,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModScormSyncResult): boolean { if (result.updated || this.dataSent) { @@ -403,7 +403,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -421,7 +421,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModScormAutoSyncEventData): boolean { if (syncEventData.updated && this.scorm && syncEventData.scormId == this.scorm.id) { @@ -448,8 +448,9 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Load the TOC of a certain organization. * + * @param scorm Scorm object. * @param organizationId The organization id. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadOrganizationToc(scorm: AddonModScormScorm, organizationId: string): Promise { if (!scorm.displaycoursestructure) { @@ -481,6 +482,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom * Open a SCORM. It will download the SCORM package if it's not downloaded or it has changed. * * @param event Event. + * @param preview Wether open screen in preview mode or not. * @param scoId SCO that needs to be loaded when the SCORM is opened. If not defined, load first SCO. */ async open(event?: Event, preview: boolean = false, scoId?: number): Promise { @@ -600,7 +602,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom * Performs the sync of the activity. * * @param retries Number of retries done. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async sync(retries = 0): Promise { if (CoreSync.isBlocked(AddonModScormProvider.COMPONENT, this.scorm!.id) && retries < 5) { diff --git a/src/addons/mod/scorm/pages/player/player.ts b/src/addons/mod/scorm/pages/player/player.ts index 5449c840f..5e6e79137 100644 --- a/src/addons/mod/scorm/pages/player/player.ts +++ b/src/addons/mod/scorm/pages/player/player.ts @@ -139,7 +139,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Initialize. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initialize(): Promise { // Get the SCORM instance. @@ -240,7 +240,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { * * @param attemptsData Attempts count. * @param accessInfo Access info. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async determineAttemptAndMode( attemptsData: AddonModScormAttemptCountResult, @@ -303,7 +303,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Fetch data needed to play the SCORM. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { if (!this.scorm) { @@ -343,7 +343,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Fetch the TOC. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchToc(): Promise { this.loadingToc = true; @@ -405,7 +405,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { * Load a SCO. * * @param sco The SCO to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadSco(sco: AddonModScormScoWithData): Promise { if (!this.dataModel) { @@ -450,7 +450,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { * Load SCO src. * * @param sco SCO to load. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadScoSrc(sco: AddonModScormScoWithData): Promise { const src = await AddonModScorm.getScoSrc(this.scorm, sco); @@ -469,7 +469,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { * Given an SCO, mark it as completed. * * @param sco SCO to mark. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async markCompleted(sco: AddonModScormScoWithData): Promise { if (!this.canSaveTracks) { @@ -540,7 +540,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Refresh the TOC. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshToc(): Promise { try { @@ -556,7 +556,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { * Set SCORM start time. * * @param scoId SCO ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async setStartTime(scoId: number): Promise { if (!this.canSaveTracks) { diff --git a/src/addons/mod/scorm/services/handlers/pluginfile.ts b/src/addons/mod/scorm/services/handlers/pluginfile.ts index 500fd6ec1..5c07944bf 100644 --- a/src/addons/mod/scorm/services/handlers/pluginfile.ts +++ b/src/addons/mod/scorm/services/handlers/pluginfile.ts @@ -47,7 +47,7 @@ export class AddonModScormPluginFileHandlerService implements CorePluginFileHand /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; diff --git a/src/addons/mod/scorm/services/handlers/prefetch.ts b/src/addons/mod/scorm/services/handlers/prefetch.ts index a64880029..c283e1520 100644 --- a/src/addons/mod/scorm/services/handlers/prefetch.ts +++ b/src/addons/mod/scorm/services/handlers/prefetch.ts @@ -63,7 +63,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe * @param prefetch True to prefetch, false to download right away. * @param onProgress Function to call on progress. * @param siteId Site ID. - * @return Promise resolved with the "extra" data to store: the hash of the file. + * @returns Promise resolved with the "extra" data to store: the hash of the file. */ protected async downloadOrPrefetchScorm( module: CoreCourseAnyModuleData, @@ -99,7 +99,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe * @param prefetch True if prefetch, false otherwise. * @param onProgress Function to call on progress. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the file is downloaded and unzipped. + * @returns Promise resolved when the file is downloaded and unzipped. */ protected async downloadOrPrefetchMainFile( scorm: AddonModScormScorm, @@ -163,7 +163,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe * @param prefetch True if prefetch, false otherwise. * @param onProgress Function to call on progress. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the file is downloaded and unzipped. + * @returns Promise resolved when the file is downloaded and unzipped. */ protected async downloadOrPrefetchMainFileIfNeeded( scorm: AddonModScormScorm, @@ -207,7 +207,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe * * @param scorm SCORM object. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is prefetched. + * @returns Promise resolved when the data is prefetched. */ async fetchWSData(scorm: AddonModScormScorm, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -292,12 +292,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe } /** - * Get list of files. If not defined, we'll assume they're in module.contents. - * - * @param module Module. - * @param courseId Course ID the module belongs to. - * @param single True if we're downloading a single module, false if we're downloading a whole section. - * @return Promise resolved with the list of files. + * @inheritdoc */ async getFiles(module: CoreCourseAnyModuleData, courseId: number): Promise { try { @@ -384,7 +379,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeFiles(module: CoreCourseAnyModuleData, courseId: number): Promise { const siteId = CoreSites.getCurrentSiteId(); @@ -417,7 +412,7 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async sync(module: CoreCourseAnyModuleData, courseId: number, siteId?: string): Promise { const scorm = await this.getScorm(module, courseId, siteId); diff --git a/src/addons/mod/scorm/services/scorm-helper.ts b/src/addons/mod/scorm/services/scorm-helper.ts index ffc21754c..552b4f373 100644 --- a/src/addons/mod/scorm/services/scorm-helper.ts +++ b/src/addons/mod/scorm/services/scorm-helper.ts @@ -50,7 +50,7 @@ export class AddonModScormHelperProvider { * * @param scorm SCORM to download. * @param isOutdated True if package outdated, false if not outdated, undefined to calculate it. - * @return Promise resolved if the user confirms or no confirmation needed. + * @returns Promise resolved if the user confirms or no confirmation needed. */ async confirmDownload(scorm: AddonModScormScorm, isOutdated?: boolean): Promise { // Check if file should be downloaded. @@ -80,7 +80,7 @@ export class AddonModScormHelperProvider { * @param scorm SCORM. * @param attempt Number of the online attempt. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the attempt is created. + * @returns Promise resolved when the attempt is created. */ async convertAttemptToOffline(scorm: AddonModScormScorm, attempt: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -137,7 +137,7 @@ export class AddonModScormHelperProvider { * @param newAttempt Number of the new attempt. * @param lastOnline Number of the last online attempt. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the attempt is created. + * @returns Promise resolved when the attempt is created. */ async createOfflineAttempt(scorm: AddonModScormScorm, newAttempt: number, lastOnline: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -177,7 +177,7 @@ export class AddonModScormHelperProvider { * @param scorm SCORM object. * @param attempts Attempts count. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the attempt data. + * @returns Promise resolved with the attempt data. */ async determineAttemptToContinue( scorm: AddonModScormScorm, @@ -221,7 +221,7 @@ export class AddonModScormHelperProvider { * @param scormId Scorm ID. * @param attempt Attempt number. * @param options Other options. - * @return Promise resolved with the first SCO. + * @returns Promise resolved with the first SCO. */ async getFirstSco( scormId: number, @@ -253,7 +253,7 @@ export class AddonModScormHelperProvider { * * @param scorm SCORM object. * @param attempts Attempts count. - * @return Last attempt data. + * @returns Last attempt data. */ protected getLastBeforeMax( scorm: AddonModScormScorm, @@ -277,7 +277,7 @@ export class AddonModScormHelperProvider { * * @param toc SCORM's TOC. * @param scoId SCO ID. - * @return Next SCO. + * @returns Next SCO. */ getNextScoFromToc(toc: AddonModScormScoWithData[], scoId: number): AddonModScormScoWithData | undefined { const currentTocIndex = toc.findIndex((item) => item.id == scoId); @@ -295,7 +295,7 @@ export class AddonModScormHelperProvider { * * @param toc SCORM's TOC. * @param scoId SCO ID. - * @return Previous SCO. + * @returns Previous SCO. */ getPreviousScoFromToc(toc: AddonModScormScoWithData[], scoId: number): AddonModScormScoWithData | undefined { const currentTocIndex = toc.findIndex((item) => item.id == scoId); @@ -313,7 +313,7 @@ export class AddonModScormHelperProvider { * * @param toc SCORM's TOC. * @param scoId SCO ID. - * @return SCO. + * @returns SCO. */ getScoFromToc(toc: AddonModScormScoWithData[], scoId: number): AddonModScormScoWithData | undefined { return toc.find(sco => sco.id == scoId); @@ -326,7 +326,7 @@ export class AddonModScormHelperProvider { * @param lastAttempt Last attempt number. * @param incomplete Whether last attempt is incomplete. * @param options Options. - * @return Promise resolved with the TOC. + * @returns Promise resolved with the TOC. */ async getToc( scormId: number, @@ -352,7 +352,7 @@ export class AddonModScormHelperProvider { * @param scormId SCORM ID. * @param attempt Online attempt to get the data. * @param options Other options. - * @return Promise resolved with user data. + * @returns Promise resolved with user data. */ async searchOnlineAttemptUserData( scormId: number, diff --git a/src/addons/mod/scorm/services/scorm-offline.ts b/src/addons/mod/scorm/services/scorm-offline.ts index a7a188102..11af7f045 100644 --- a/src/addons/mod/scorm/services/scorm-offline.ts +++ b/src/addons/mod/scorm/services/scorm-offline.ts @@ -61,7 +61,7 @@ export class AddonModScormOfflineProvider { * @param newAttempt New attempt number. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the attempt number changes. + * @returns Promise resolved when the attempt number changes. */ async changeAttemptNumber( scormId: number, @@ -128,7 +128,7 @@ export class AddonModScormOfflineProvider { * @param snapshot Optional. Snapshot to store in the attempt. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the new attempt is created. + * @returns Promise resolved when the new attempt is created. */ async createNewAttempt( scorm: AddonModScormScorm, @@ -196,7 +196,7 @@ export class AddonModScormOfflineProvider { * @param attempt Attempt number. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when all the data has been deleted. + * @returns Promise resolved when all the data has been deleted. */ async deleteAttempt(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -222,7 +222,7 @@ export class AddonModScormOfflineProvider { * This function is based in Moodle's scorm_format_interactions. * * @param scoUserData Userdata from a certain SCO. - * @return Formatted userdata. + * @returns Formatted userdata. */ protected formatInteractions(scoUserData: Record): Record { const formatted: Record = {}; @@ -277,7 +277,7 @@ export class AddonModScormOfflineProvider { * Get all the offline attempts in a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the offline attempts are retrieved. + * @returns Promise resolved when the offline attempts are retrieved. */ async getAllAttempts(siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -294,7 +294,7 @@ export class AddonModScormOfflineProvider { * @param attempt Attempt number. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved with the attempt. + * @returns Promise resolved with the attempt. */ async getAttempt(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -316,7 +316,7 @@ export class AddonModScormOfflineProvider { * @param attempt Attempt number. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved with time the attempt was created, undefined if attempt not found. + * @returns Promise resolved with time the attempt was created, undefined if attempt not found. */ async getAttemptCreationTime(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { try { @@ -334,7 +334,7 @@ export class AddonModScormOfflineProvider { * @param scormId SCORM ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the offline attempts are retrieved. + * @returns Promise resolved when the offline attempts are retrieved. */ async getAttempts(scormId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -355,7 +355,7 @@ export class AddonModScormOfflineProvider { * @param attempt Attempt number. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved with the snapshot or undefined if no snapshot. + * @returns Promise resolved with the snapshot or undefined if no snapshot. */ async getAttemptSnapshot( scormId: number, @@ -376,7 +376,7 @@ export class AddonModScormOfflineProvider { * Get launch URLs from a list of SCOs, indexing them by SCO ID. * * @param scos List of SCOs. - * @return Launch URLs indexed by SCO ID. + * @returns Launch URLs indexed by SCO ID. */ protected getLaunchUrlsFromScos(scos: AddonModScormWSSco[]): Record { scos = scos || []; @@ -399,7 +399,7 @@ export class AddonModScormOfflineProvider { * @param excludeNotSynced Whether it should only return synced entries. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved with the entries. + * @returns Promise resolved with the entries. */ async getScormStoredData( scormId: number, @@ -442,7 +442,7 @@ export class AddonModScormOfflineProvider { * SCOs that have something stored and cmi.launch_data will be undefined. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the user data is retrieved. + * @returns Promise resolved when the user data is retrieved. */ async getScormUserData( scormId: number, @@ -580,7 +580,7 @@ export class AddonModScormOfflineProvider { * @param scoData User data for the given SCO. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not set use site's current user. - * @return Promise resolved when the insert is done. + * @returns Promise resolved when the insert is done. */ protected async insertTrack( scormId: number, @@ -644,7 +644,7 @@ export class AddonModScormOfflineProvider { * @param element Name of the element to insert. * @param value Value of the element to insert. * @param synchronous True if insert should NOT return a promise. Please use it only if synchronous is a must. - * @return Returns a promise if synchronous=false, otherwise returns a boolean. + * @returns Returns a promise if synchronous=false, otherwise returns a boolean. */ protected insertTrackToDB( db: SQLiteDB, @@ -710,7 +710,7 @@ export class AddonModScormOfflineProvider { * @param forceCompleted True if SCORM forces completed. * @param scoData User data for the given SCO. * @param userId User ID. If not set use current user. - * @return Promise resolved when the insert is done. + * @returns Promise resolved when the insert is done. */ protected insertTrackSync( scormId: number, @@ -776,7 +776,7 @@ export class AddonModScormOfflineProvider { * @param scoId SCO ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when marked. + * @returns Promise resolved when marked. */ async markAsSynced(scormId: number, attempt: number, scoId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -823,7 +823,7 @@ export class AddonModScormOfflineProvider { * Removes the default data form user data. * * @param userData User data. - * @return User data without default data. + * @returns User data without default data. */ protected removeDefaultData(userData: AddonModScormUserDataMap): AddonModScormUserDataMap { const result: AddonModScormUserDataMap = CoreUtils.clone(userData); @@ -845,7 +845,7 @@ export class AddonModScormOfflineProvider { * @param userData User data for this attempt and SCO. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when data is saved. + * @returns Promise resolved when data is saved. */ async saveTracks( scorm: AddonModScormScorm, @@ -891,7 +891,7 @@ export class AddonModScormOfflineProvider { * @param attempt Attempt number. * @param tracks Tracking data to store. * @param userData User data for this attempt and SCO. - * @return True if data to insert is valid, false otherwise. Returning true doesn't mean that the data + * @returns True if data to insert is valid, false otherwise. Returning true doesn't mean that the data * has been stored, this function can return true but the insertion can still fail somehow. */ saveTracksSync( @@ -930,7 +930,7 @@ export class AddonModScormOfflineProvider { * @param userData Contains user's data. * @param param Name of parameter that should be checked. * @param ifEmpty Value to be replaced with if param is not set. - * @return Value from userData[param] if set, ifEmpty otherwise. + * @returns Value from userData[param] if set, ifEmpty otherwise. */ protected scormIsset( userData: Record, @@ -952,7 +952,7 @@ export class AddonModScormOfflineProvider { * @param userData User data to store as snapshot. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when snapshot has been stored. + * @returns Promise resolved when snapshot has been stored. */ async setAttemptSnapshot( scormId: number, diff --git a/src/addons/mod/scorm/services/scorm-sync.ts b/src/addons/mod/scorm/services/scorm-sync.ts index 52ddf4ff9..cfae16dbb 100644 --- a/src/addons/mod/scorm/services/scorm-sync.ts +++ b/src/addons/mod/scorm/services/scorm-sync.ts @@ -60,7 +60,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param lastOfflineIncomplete Whether the last offline attempt is incomplete. * @param warnings Array where to add the warnings. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async addToNewOrDelete( scormId: number, @@ -111,7 +111,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param lastOnline Last online attempt number. * @param cmId Module ID. * @param siteId Site ID. - * @return Promise resolved if can retry the synchronization, rejected otherwise. + * @returns Promise resolved if can retry the synchronization, rejected otherwise. */ protected async canRetrySync( scormId: number, @@ -147,7 +147,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param newAttempts Object with the attempts to create. The keys are the timecreated, the values are the attempt number. * @param lastOffline Number of last offline attempt. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async createNewAttemptsAtEnd( scormId: number, @@ -178,7 +178,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param lastOnlineWasFinished Whether the last online attempt was finished before the sync. * @param initialCount Attempt count before the sync. * @param updated Whether some data was sent to the site. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ protected async finishSync( siteId: string, @@ -239,7 +239,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param attempt Attempt number. * @param cmId Module ID. * @param siteId Site ID. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async getOfflineAttemptData( scormId: number, @@ -275,7 +275,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param lastCollision Last attempt with collision (exists in online and offline). * @param offlineAttempts Numbers of offline attempts. * @param siteId Site ID. - * @return Promise resolved when attempts have been moved. + * @returns Promise resolved when attempts have been moved. */ protected async moveNewAttempts( scormId: number, @@ -356,7 +356,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param attempt Attemot number. * @param cmId Module ID. * @param siteId Site ID. - * @return Promise resolved when the snapshot is stored. + * @returns Promise resolved when the snapshot is stored. */ protected async saveSyncSnapshot(scormId: number, attempt: number, cmId: number, siteId: string): Promise { // Try to get current state from the site. @@ -403,7 +403,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param snapshot Attempt's snapshot. * @param userData Data retrieved from the site. - * @return True if snapshot is equal to the user data, false otherwise. + * @returns True if snapshot is equal to the user data, false otherwise. */ protected snapshotEquals(snapshot: AddonModScormUserDataMap, userData: AddonModScormUserDataMap): boolean { // Check that snapshot contains the data from the site. @@ -442,7 +442,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllScorms(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all SCORMs', (siteId) => this.syncAllScormsFunc(!!force, siteId), siteId); @@ -453,7 +453,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param force Wether to force sync or not. * @param siteId Site ID to sync. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllScormsFunc(force: boolean, siteId: string): Promise { @@ -495,7 +495,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param attempt Attempt number. * @param cmId Module ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the attempt is successfully synced. + * @returns Promise resolved when the attempt is successfully synced. */ protected async syncAttempt(scormId: number, attempt: number, cmId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -559,7 +559,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param scorm SCORM. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the SCORM is synced or if it doesn't need to be synced. + * @returns Promise resolved when the SCORM is synced or if it doesn't need to be synced. */ async syncScormIfNeeded(scorm: AddonModScormScorm, siteId?: string): Promise { const needed = await this.isSyncNeeded(scorm.id, siteId); @@ -574,7 +574,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param scorm SCORM. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ syncScorm(scorm: AddonModScormScorm, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -604,7 +604,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * * @param scorm SCORM. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ protected async performSyncScorm(scorm: AddonModScormScorm, siteId: string): Promise { let warnings: string[] = []; @@ -711,7 +711,7 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * @param offlineAttempts Numbers of offline attempts. * @param cmId Module ID. * @param siteId Site ID. - * @return Promise resolved when the collisions have been treated. It returns warnings array. + * @returns Promise resolved when the collisions have been treated. It returns warnings array. * @description * * Treat collisions found in a SCORM synchronization process. A collision is when an attempt exists both in offline diff --git a/src/addons/mod/scorm/services/scorm.ts b/src/addons/mod/scorm/services/scorm.ts index cd22b9962..92d2416c4 100644 --- a/src/addons/mod/scorm/services/scorm.ts +++ b/src/addons/mod/scorm/services/scorm.ts @@ -110,7 +110,7 @@ export class AddonModScormProvider { * * @param scorm SCORM. * @param onlineAttempts Object with the online attempts. - * @return Grade. -1 if no grade. + * @returns Grade. -1 if no grade. */ calculateScormGrade(scorm: AddonModScormScorm, onlineAttempts: Record): number { if (!onlineAttempts || !Object.keys(onlineAttempts).length) { @@ -167,7 +167,7 @@ export class AddonModScormProvider { * Calculates the size of a SCORM. * * @param scorm SCORM. - * @return Promise resolved with the SCORM size. + * @returns Promise resolved with the SCORM size. */ async calculateScormSize(scorm: AddonModScormScorm): Promise { if (scorm.packagesize) { @@ -182,7 +182,7 @@ export class AddonModScormProvider { * * @param scorm SCORM. * @param attemptsCount Number of attempts performed. - * @return Number of attempts left. + * @returns Number of attempts left. */ countAttemptsLeft(scorm: AddonModScormScorm, attemptsCount: number): number { if (!scorm.maxattempt) { @@ -207,7 +207,7 @@ export class AddonModScormProvider { * @param newAttempt Whether it should start a new attempt. * @param incomplete Whether current attempt is incomplete. * @param canSaveTracks Whether the user can save tracks. - * @return Mode, attempt number and whether to start a new attempt. + * @returns Mode, attempt number and whether to start a new attempt. */ determineAttemptAndMode( scorm: AddonModScormScorm, @@ -289,7 +289,7 @@ export class AddonModScormProvider { * Check if TOC should be displayed in the player. * * @param scorm SCORM. - * @return Whether it should display TOC. + * @returns Whether it should display TOC. */ displayTocInPlayer(scorm: AddonModScormScorm): boolean { return scorm.hidetoc !== 3; @@ -302,7 +302,7 @@ export class AddonModScormProvider { * * @param prerequisites The AICC_SCRIPT prerequisites expression. * @param trackData The tracked user data of each SCO. - * @return Whether the prerequisites are fulfilled. + * @returns Whether the prerequisites are fulfilled. */ evalPrerequisites(prerequisites: string, trackData: Record>): boolean { const stack: string[] = []; // List of prerequisites. @@ -402,7 +402,7 @@ export class AddonModScormProvider { * * @param scorm SCORM. * @param grade Grade. - * @return Grade to display. + * @returns Grade to display. */ formatGrade(scorm: AddonModScormScorm, grade: number): string { if (grade === undefined || grade == -1) { @@ -423,7 +423,7 @@ export class AddonModScormProvider { * * @param toc SCORM's TOC (tree format). * @param level The level of the TOC we're right now. 0 by default. - * @return SCORM's TOC (array format). + * @returns SCORM's TOC (array format). */ formatTocToArray(toc: AddonModScormTOCTreeSco[], level: number = 0): AddonModScormTOCListSco[] { if (!toc || !toc.length) { @@ -448,7 +448,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param options Other options. - * @return Object with access information. + * @returns Object with access information. * @since 3.7 */ async getAccessInformation( @@ -479,7 +479,7 @@ export class AddonModScormProvider { * Get cache key for access information WS calls. * * @param scormId SCORM ID. - * @return Cache key. + * @returns Cache key. */ protected getAccessInformationCacheKey(scormId: number): string { return ROOT_CACHE_KEY + 'accessInfo:' + scormId; @@ -490,7 +490,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async getAttemptCount( scormId: number, @@ -549,7 +549,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param userId User ID. If not defined, current user. - * @return Cache key. + * @returns Cache key. */ protected getAttemptCountCacheKey(scormId: number, userId: number): string { return ROOT_CACHE_KEY + 'attemptcount:' + scormId + ':' + userId; @@ -560,7 +560,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param options Other options. - * @return Promise resolved when the attempt count is retrieved. + * @returns Promise resolved when the attempt count is retrieved. */ async getAttemptCountOnline(scormId: number, options: AddonModScormGetAttemptCountOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -596,7 +596,7 @@ export class AddonModScormProvider { * @param attempt Attempt number. * @param offline Whether the attempt is offline. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the grade. If the attempt hasn't reported grade/completion, it will be -1. + * @returns Promise resolved with the grade. If the attempt hasn't reported grade/completion, it will be -1. */ async getAttemptGrade(scorm: AddonModScormScorm, attempt: number, offline?: boolean, siteId?: string): Promise { const attemptScore = { @@ -662,7 +662,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param options Other options. - * @return Promise resolved with the list of organizations. + * @returns Promise resolved with the list of organizations. */ async getOrganizations(scormId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const scos = await this.getScos(scormId, options); @@ -689,7 +689,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param attempt The attempt number (to populate SCO track data). * @param options Other options. - * @return Promise resolved with the toc object. + * @returns Promise resolved with the toc object. */ async getOrganizationToc( scormId: number, @@ -724,7 +724,7 @@ export class AddonModScormProvider { * Get the package URL of a given SCORM. * * @param scorm SCORM. - * @return Package URL. + * @returns Package URL. */ getPackageUrl(scorm: AddonModScormScorm): string { if (scorm.packageurl) { @@ -743,7 +743,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param attempt Attempt number. * @param options Other options. - * @return Promise resolved when the user data is retrieved. + * @returns Promise resolved when the user data is retrieved. */ async getScormUserData( scormId: number, @@ -769,7 +769,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param attempt Attempt number. - * @return Cache key. + * @returns Cache key. */ protected getScormUserDataCacheKey(scormId: number, attempt: number): string { return this.getScormUserDataCommonCacheKey(scormId) + ':' + attempt; @@ -779,7 +779,7 @@ export class AddonModScormProvider { * Get common cache key for SCORM user data WS calls. * * @param scormId SCORM ID. - * @return Cache key. + * @returns Cache key. */ protected getScormUserDataCommonCacheKey(scormId: number): string { return ROOT_CACHE_KEY + 'userdata:' + scormId; @@ -791,7 +791,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param attempt Attempt number. * @param options Other options. - * @return Promise resolved when the user data is retrieved. + * @returns Promise resolved when the user data is retrieved. */ async getScormUserDataOnline( scormId: number, @@ -836,7 +836,7 @@ export class AddonModScormProvider { * Get cache key for get SCORM scos WS calls. * * @param scormId SCORM ID. - * @return Cache key. + * @returns Cache key. */ protected getScosCacheKey(scormId: number): string { return ROOT_CACHE_KEY + 'scos:' + scormId; @@ -847,7 +847,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param options Other options. - * @return Promise resolved with a list of SCO. + * @returns Promise resolved with a list of SCO. */ async getScos(scormId: number, options: AddonModScormOrganizationOptions = {}): Promise { options.siteId = options.siteId || CoreSites.getCurrentSiteId(); @@ -883,7 +883,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param attempt Attempt number. * @param options Other options. - * @return Promise resolved with a list of SCO objects. + * @returns Promise resolved with a list of SCO objects. */ async getScosWithData( scormId: number, @@ -944,7 +944,7 @@ export class AddonModScormProvider { * @param scorm SCORM. * @param sco SCO. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the URL. + * @returns Promise resolved with the URL. */ async getScoSrc(scorm: AddonModScormScorm, sco: AddonModScormWSSco, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -978,7 +978,7 @@ export class AddonModScormProvider { * * @param moduleUrl Module URL (returned by get_course_contents). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the folder path. + * @returns Promise resolved with the folder path. */ getScormFolder(moduleUrl: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -991,7 +991,7 @@ export class AddonModScormProvider { * It will only return one file: the ZIP package. * * @param scorm SCORM. - * @return File list. + * @returns File list. */ getScormFileList(scorm: AddonModScormScorm): CoreWSFile[] { const files: CoreWSFile[] = []; @@ -1014,7 +1014,7 @@ export class AddonModScormProvider { * * @param sco SCO. * @param incomplete Whether the SCORM is incomplete. - * @return Image URL and description. + * @returns Image URL and description. */ getScoStatusIcon(sco: AddonModScormScoWithData, incomplete?: boolean): AddonModScormScoIcon { let imageName = ''; @@ -1073,7 +1073,7 @@ export class AddonModScormProvider { * Get cache key for SCORM data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getScormDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'scorm:' + courseId; @@ -1086,7 +1086,7 @@ export class AddonModScormProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the SCORM is retrieved. + * @returns Promise resolved when the SCORM is retrieved. */ protected async getScormByField( courseId: number, @@ -1135,7 +1135,7 @@ export class AddonModScormProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the SCORM is retrieved. + * @returns Promise resolved when the SCORM is retrieved. */ getScorm(courseId: number, cmId: number, options: AddonModScormGetScormOptions = {}): Promise { return this.getScormByField(courseId, 'coursemodule', cmId, options); @@ -1147,7 +1147,7 @@ export class AddonModScormProvider { * @param courseId Course ID. * @param id SCORM ID. * @param options Other options. - * @return Promise resolved when the SCORM is retrieved. + * @returns Promise resolved when the SCORM is retrieved. */ getScormById(courseId: number, id: number, options: AddonModScormGetScormOptions = {}): Promise { return this.getScormByField(courseId, 'id', id, options); @@ -1157,7 +1157,7 @@ export class AddonModScormProvider { * Get a readable SCORM grade method. * * @param scorm SCORM. - * @return Grading method. + * @returns Grading method. */ getScormGradeMethod(scorm: AddonModScormScorm): string { if (scorm.maxattempt == 1) { @@ -1200,7 +1200,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAccessInformation(scormId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1214,7 +1214,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllScormData(scormId: number, siteId?: string, userId?: number): Promise { await Promise.all([ @@ -1231,7 +1231,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAttemptCount(scormId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1247,7 +1247,7 @@ export class AddonModScormProvider { * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined use site's current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string, userId?: number): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1265,7 +1265,7 @@ export class AddonModScormProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateScormData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1278,7 +1278,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateScormUserData(scormId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1291,7 +1291,7 @@ export class AddonModScormProvider { * * @param scormId SCORM ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateScos(scormId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1305,7 +1305,7 @@ export class AddonModScormProvider { * @param scormId SCORM ID. * @param attempt Attempt. * @param options Other options. - * @return Promise resolved with a boolean: true if incomplete, false otherwise. + * @returns Promise resolved with a boolean: true if incomplete, false otherwise. */ async isAttemptIncomplete(scormId: number, attempt: number, options: AddonModScormOfflineOptions = {}): Promise { const scos = await this.getScosWithData(scormId, attempt, options); @@ -1318,7 +1318,7 @@ export class AddonModScormProvider { * Based on Moodle's scorm_external_link. * * @param link Link to check. - * @return Whether it's an external link. + * @returns Whether it's an external link. */ protected isExternalLink(link: string): boolean { link = link.toLowerCase(); @@ -1336,7 +1336,7 @@ export class AddonModScormProvider { * Check if the given SCORM is closed. * * @param scorm SCORM to check. - * @return Whether the SCORM is closed. + * @returns Whether the SCORM is closed. */ isScormClosed(scorm: AddonModScormScorm): boolean { return !!(scorm.timeclose && CoreTimeUtils.timestamp() > scorm.timeclose); @@ -1346,7 +1346,7 @@ export class AddonModScormProvider { * Check if the given SCORM is downloadable. * * @param scorm SCORM to check. - * @return Whether the SCORM is downloadable. + * @returns Whether the SCORM is downloadable. */ isScormDownloadable(scorm: AddonModScormScorm): boolean { return scorm.protectpackagedownloads !== undefined && scorm.protectpackagedownloads === false; @@ -1356,7 +1356,7 @@ export class AddonModScormProvider { * Check if the given SCORM is open. * * @param scorm SCORM to check. - * @return Whether the SCORM is open. + * @returns Whether the SCORM is open. */ isScormOpen(scorm: AddonModScormScorm): boolean { return !!(scorm.timeopen && scorm.timeopen > CoreTimeUtils.timestamp()); @@ -1366,7 +1366,7 @@ export class AddonModScormProvider { * Check if a SCORM is unsupported in the app. If it's not, returns the error code to show. * * @param scorm SCORM to check. - * @return String with error code if unsupported, undefined if supported. + * @returns String with error code if unsupported, undefined if supported. */ isScormUnsupported(scorm: AddonModScormScorm): string | undefined { if (!this.isScormValidVersion(scorm)) { @@ -1382,7 +1382,7 @@ export class AddonModScormProvider { * Check if it's a valid SCORM 1.2. * * @param scorm SCORM to check. - * @return Whether the SCORM is valid. + * @returns Whether the SCORM is valid. */ isScormValidVersion(scorm: AddonModScormScorm): boolean { return scorm.version == 'SCORM_1.2'; @@ -1392,7 +1392,7 @@ export class AddonModScormProvider { * Check if a SCO status is incomplete. * * @param status SCO status. - * @return Whether it's incomplete. + * @returns Whether it's incomplete. */ isStatusIncomplete(status?: string): boolean { return !status || status == 'notattempted' || status == 'incomplete' || status == 'browsed'; @@ -1402,7 +1402,7 @@ export class AddonModScormProvider { * Check if a package URL is valid. * * @param packageUrl Package URL. - * @return Whether it's valid. + * @returns Whether it's valid. */ isValidPackageUrl(packageUrl: string): boolean { if (!packageUrl) { @@ -1422,7 +1422,7 @@ export class AddonModScormProvider { * @param scoId SCO ID. * @param name Name of the SCORM. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logLaunchSco(scormId: number, scoId: number, name?: string, siteId?: string): Promise { const params: AddonModScormLaunchScoWSParams = { @@ -1448,7 +1448,7 @@ export class AddonModScormProvider { * @param id Module ID. * @param name Name of the SCORM. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModScormViewScormWSParams = { @@ -1476,7 +1476,7 @@ export class AddonModScormProvider { * @param scorm SCORM. * @param offline Whether the attempt is offline. * @param userData User data for this attempt and SCO. If not defined, it will be retrieved from DB. Recommended. - * @return Promise resolved when data is saved. + * @returns Promise resolved when data is saved. */ async saveTracks( scoId: number, @@ -1518,7 +1518,7 @@ export class AddonModScormProvider { * @param attempt Attempt number. * @param tracks Tracking data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is saved. + * @returns Promise resolved when data is saved. */ async saveTracksOnline( scormId: number, @@ -1560,7 +1560,7 @@ export class AddonModScormProvider { * @param scorm SCORM. * @param offline Whether the attempt is offline. * @param userData User data for this attempt and SCO. Required if offline=true. - * @return In online returns true if data is inserted, false otherwise. + * @returns In online returns true if data is inserted, false otherwise. * In offline returns true if data to insert is valid, false otherwise. True doesn't mean that the * data has been stored, this function can return true but the insertion can still fail somehow. */ @@ -1599,7 +1599,7 @@ export class AddonModScormProvider { * @param scoId Sco ID. * @param attempt Attempt number. * @param tracks Tracking data. - * @return True if success, false otherwise. + * @returns True if success, false otherwise. */ saveTracksSyncOnline(scoId: number, attempt: number, tracks: AddonModScormDataEntry[]): boolean { if (!tracks || !tracks.length) { @@ -1638,7 +1638,7 @@ export class AddonModScormProvider { * @param scorm SCORM to check. * @param isOutdated True if package outdated, false if not downloaded, undefined to calculate it. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if it should be downloaded, false otherwise. + * @returns Promise resolved with true if it should be downloaded, false otherwise. */ async shouldDownloadMainFile(scorm: AddonModScormScorm, isOutdated?: boolean, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1683,7 +1683,7 @@ export class AddonModScormProvider { * @param attempt Attempt number. * @param tracks Tracking data saved. * @param options Other options. - * @return Promise resolved when updated. + * @returns Promise resolved when updated. */ protected async updateUserDataAfterSave( scormId: number, diff --git a/src/addons/mod/survey/components/index/index.ts b/src/addons/mod/survey/components/index/index.ts index d69ea2140..7fa09627b 100644 --- a/src/addons/mod/survey/components/index/index.ts +++ b/src/addons/mod/survey/components/index/index.ts @@ -79,7 +79,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -96,7 +96,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModSurveyAutoSyncData): boolean { if (this.survey && syncEventData.surveyId == this.survey.id && syncEventData.userId == this.currentUserId) { @@ -137,7 +137,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Convenience function to get survey questions. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchQuestions(): Promise { const questions = await AddonModSurvey.getQuestions(this.survey!.id, { cmId: this.module.id }); @@ -172,7 +172,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Check if answers are valid to be submitted. * - * @return If answers are valid + * @returns If answers are valid */ isValidResponse(): boolean { return !this.questions.some((question) => question.required && question.name && @@ -233,7 +233,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModSurveySync.syncSurvey(this.survey!.id, this.currentUserId); @@ -243,7 +243,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModSurveySyncResult): boolean { return result.answersSent; diff --git a/src/addons/mod/survey/services/handlers/prefetch.ts b/src/addons/mod/survey/services/handlers/prefetch.ts index d7bdd4baa..fb1a0239d 100644 --- a/src/addons/mod/survey/services/handlers/prefetch.ts +++ b/src/addons/mod/survey/services/handlers/prefetch.ts @@ -77,7 +77,7 @@ export class AddonModSurveyPrefetchHandlerService extends CoreCourseActivityPref * @param module Module. * @param courseId Course ID the module belongs to. * @param siteId SiteId or current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchSurvey(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const survey = await AddonModSurvey.getSurvey(courseId, module.id, { diff --git a/src/addons/mod/survey/services/survey-helper.ts b/src/addons/mod/survey/services/survey-helper.ts index d1217a03e..7464d6831 100644 --- a/src/addons/mod/survey/services/survey-helper.ts +++ b/src/addons/mod/survey/services/survey-helper.ts @@ -26,7 +26,7 @@ export class AddonModSurveyHelperProvider { * Turns a string with values separated by commas into an array. * * @param value Value to convert. - * @return Array. + * @returns Array. */ protected commaStringToArray(value: string | string[]): string[] { if (typeof value == 'string') { @@ -44,7 +44,7 @@ export class AddonModSurveyHelperProvider { * Gets the parent questions and puts them in an object: ID -> question. * * @param questions Questions. - * @return Object with parent questions. + * @returns Object with parent questions. */ protected getParentQuestions(questions: AddonModSurveyQuestion[]): {[id: number]: AddonModSurveyQuestion} { const parents: { [id: number]: AddonModSurveyQuestion } = {}; @@ -63,7 +63,7 @@ export class AddonModSurveyHelperProvider { * 'num' and 'name'. * * @param questions Questions. - * @return Promise resolved with the formatted questions. + * @returns Promise resolved with the formatted questions. */ formatQuestions(questions: AddonModSurveyQuestion[]): AddonModSurveyQuestionFormatted[] { const strIPreferThat = Translate.instant('addon.mod_survey.ipreferthat'); diff --git a/src/addons/mod/survey/services/survey-offline.ts b/src/addons/mod/survey/services/survey-offline.ts index e13e61c70..e049d3abc 100644 --- a/src/addons/mod/survey/services/survey-offline.ts +++ b/src/addons/mod/survey/services/survey-offline.ts @@ -31,7 +31,7 @@ export class AddonModSurveyOfflineProvider { * @param surveyId Survey ID. * @param siteId Site ID. If not defined, current site. * @param userId User the answers belong to. If not defined, current user in site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteSurveyAnswers(surveyId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -44,7 +44,7 @@ export class AddonModSurveyOfflineProvider { * Get all the stored data from all the surveys. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with answers. + * @returns Promise resolved with answers. */ async getAllData(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -61,7 +61,7 @@ export class AddonModSurveyOfflineProvider { * @param surveyId Survey ID. * @param siteId Site ID. If not defined, current site. * @param userId User the answers belong to. If not defined, current user in site. - * @return Promise resolved with the answers. + * @returns Promise resolved with the answers. */ async getSurveyAnswers(surveyId: number, siteId?: string, userId?: number): Promise { try { @@ -79,7 +79,7 @@ export class AddonModSurveyOfflineProvider { * @param surveyId Survey ID. * @param siteId Site ID. If not defined, current site. * @param userId User the answers belong to. If not defined, current user in site. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getSurveyData(surveyId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -101,7 +101,7 @@ export class AddonModSurveyOfflineProvider { * @param surveyId Survey ID. * @param siteId Site ID. If not defined, current site. * @param userId User the answers belong to. If not defined, current user in site. - * @return Promise resolved with boolean: true if has offline answers, false otherwise. + * @returns Promise resolved with boolean: true if has offline answers, false otherwise. */ async hasAnswers(surveyId: number, siteId?: string, userId?: number): Promise { const answers = await this.getSurveyAnswers(surveyId, siteId, userId); @@ -118,7 +118,7 @@ export class AddonModSurveyOfflineProvider { * @param answers Answers. * @param siteId Site ID. If not defined, current site. * @param userId User the answers belong to. If not defined, current user in site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveAnswers( surveyId: number, diff --git a/src/addons/mod/survey/services/survey-sync.ts b/src/addons/mod/survey/services/survey-sync.ts index d228db82f..455039f7b 100644 --- a/src/addons/mod/survey/services/survey-sync.ts +++ b/src/addons/mod/survey/services/survey-sync.ts @@ -45,7 +45,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid * * @param surveyId Survey ID. * @param userId User the answers belong to. - * @return Sync ID. + * @returns Sync ID. * @protected */ getSyncId(surveyId: number, userId: number): string { @@ -57,7 +57,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid * * @param siteId Site ID to sync. If not defined, sync all sites. * @param force Wether to force sync not depending on last execution. - * @return Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ syncAllSurveys(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all surveys', (siteId) => this.syncAllSurveysFunc(!!force, siteId), siteId); @@ -68,7 +68,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid * * @param force Wether to force sync not depending on last execution. * @param siteId Site ID to sync. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async syncAllSurveysFunc(force: boolean, siteId: string): Promise { // Get all survey answers pending to be sent in the site. @@ -99,7 +99,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid * @param surveyId Survey ID. * @param userId User the answers belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the survey is synced or if it doesn't need to be synced. + * @returns Promise resolved when the survey is synced or if it doesn't need to be synced. */ async syncSurveyIfNeeded(surveyId: number, userId: number, siteId?: string): Promise { const syncId = this.getSyncId(surveyId, userId); @@ -116,7 +116,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid * @param surveyId Survey ID. * @param userId User the answers belong to. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ async syncSurvey(surveyId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -145,7 +145,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid * @param surveyId Survey ID. * @param userId User the answers belong to. If not defined, current user. * @param siteId Site ID. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ protected async performSyncSurvey(surveyId: number, userId: number, siteId: string): Promise { const result: AddonModSurveySyncResult = { diff --git a/src/addons/mod/survey/services/survey.ts b/src/addons/mod/survey/services/survey.ts index 4a77075d5..7ae3d4f52 100644 --- a/src/addons/mod/survey/services/survey.ts +++ b/src/addons/mod/survey/services/survey.ts @@ -40,7 +40,7 @@ export class AddonModSurveyProvider { * * @param surveyId Survey ID. * @param options Other options. - * @return Promise resolved when the questions are retrieved. + * @returns Promise resolved when the questions are retrieved. */ async getQuestions(surveyId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -69,7 +69,7 @@ export class AddonModSurveyProvider { * Get cache key for survey questions WS calls. * * @param surveyId Survey ID. - * @return Cache key. + * @returns Cache key. */ protected getQuestionsCacheKey(surveyId: number): string { return ROOT_CACHE_KEY + 'questions:' + surveyId; @@ -79,7 +79,7 @@ export class AddonModSurveyProvider { * Get cache key for survey data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getSurveyCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'survey:' + courseId; @@ -92,7 +92,7 @@ export class AddonModSurveyProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the survey is retrieved. + * @returns Promise resolved when the survey is retrieved. */ protected async getSurveyDataByKey( courseId: number, @@ -130,7 +130,7 @@ export class AddonModSurveyProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the survey is retrieved. + * @returns Promise resolved when the survey is retrieved. */ getSurvey(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getSurveyDataByKey(courseId, 'coursemodule', cmId, options); @@ -142,7 +142,7 @@ export class AddonModSurveyProvider { * @param courseId Course ID. * @param id Survey ID. * @param options Other options. - * @return Promise resolved when the survey is retrieved. + * @returns Promise resolved when the survey is retrieved. */ getSurveyById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getSurveyDataByKey(courseId, 'id', id, options); @@ -154,7 +154,7 @@ export class AddonModSurveyProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -183,7 +183,7 @@ export class AddonModSurveyProvider { * * @param surveyId Survey ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateQuestions(surveyId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -196,7 +196,7 @@ export class AddonModSurveyProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSurveyData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -210,7 +210,7 @@ export class AddonModSurveyProvider { * @param id Module ID. * @param name Name of the assign. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModSurveyViewSurveyWSParams = { @@ -237,7 +237,7 @@ export class AddonModSurveyProvider { * @param courseId Course ID the survey belongs to. * @param answers Answers. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean if success: true if answers were sent to server, + * @returns Promise resolved with boolean if success: true if answers were sent to server, * false if stored in device. */ async submitAnswers( @@ -286,7 +286,7 @@ export class AddonModSurveyProvider { * @param surveyId Survey ID. * @param answers Answers. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when answers are successfully submitted. + * @returns Promise resolved when answers are successfully submitted. */ async submitAnswersOnline(surveyId: number, answers: AddonModSurveySubmitAnswerData[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/url/components/index/index.ts b/src/addons/mod/url/components/index/index.ts index 6bd96a863..0d69f7f19 100644 --- a/src/addons/mod/url/components/index/index.ts +++ b/src/addons/mod/url/components/index/index.ts @@ -54,7 +54,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); @@ -65,7 +65,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { await AddonModUrl.invalidateContent(this.module.id, this.courseId); @@ -75,7 +75,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo * Download url contents. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(refresh = false): Promise { try { @@ -129,7 +129,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo * Calculate the display options to determine how the URL should be rendered. * * @param url Object with the URL data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async calculateDisplayOptions(url: AddonModUrlUrl): Promise { const displayType = AddonModUrl.getFinalDisplayType(url); @@ -161,7 +161,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo /** * Log view into the site and checks module completion. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async logView(): Promise { try { diff --git a/src/addons/mod/url/services/handlers/module.ts b/src/addons/mod/url/services/handlers/module.ts index 44d3895a0..fae5d0d57 100644 --- a/src/addons/mod/url/services/handlers/module.ts +++ b/src/addons/mod/url/services/handlers/module.ts @@ -135,8 +135,7 @@ export class AddonModUrlModuleHandlerService extends CoreModuleHandlerBase imple * Returns if contents are loaded to show link button. * * @param module The module object. - * @param courseId The course ID. - * @return Resolved when done. + * @returns Resolved when done. */ protected async hideLinkButton(module: CoreCourseModuleData): Promise { try { @@ -161,7 +160,7 @@ export class AddonModUrlModuleHandlerService extends CoreModuleHandlerBase imple * Check whether the link should be opened directly. * * @param module Module. - * @return Promise resolved with boolean. + * @returns Promise resolved with boolean. */ protected async shouldOpenLink(module: CoreCourseModuleData): Promise { try { diff --git a/src/addons/mod/url/services/url.ts b/src/addons/mod/url/services/url.ts index 332663f1a..404138cba 100644 --- a/src/addons/mod/url/services/url.ts +++ b/src/addons/mod/url/services/url.ts @@ -38,7 +38,7 @@ export class AddonModUrlProvider { * Get the final display type for a certain URL. Based on Moodle's url_get_final_display_type. * * @param url URL data. - * @return Final display type. + * @returns Final display type. */ getFinalDisplayType(url?: AddonModUrlUrl): number { if (!url) { @@ -90,7 +90,7 @@ export class AddonModUrlProvider { * Get cache key for url data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getUrlCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'url:' + courseId; @@ -103,7 +103,7 @@ export class AddonModUrlProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the url is retrieved. + * @returns Promise resolved when the url is retrieved. */ protected async getUrlDataByKey( courseId: number, @@ -140,7 +140,7 @@ export class AddonModUrlProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the url is retrieved. + * @returns Promise resolved when the url is retrieved. */ getUrl(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getUrlDataByKey(courseId, 'coursemodule', cmId, options); @@ -150,7 +150,7 @@ export class AddonModUrlProvider { * Guess the icon for a certain URL. Based on Moodle's url_guess_icon. * * @param url URL to check. - * @return Icon, empty if it should use the default icon. + * @returns Icon, empty if it should use the default icon. */ guessIcon(url: string): string { url = url || ''; @@ -180,7 +180,7 @@ export class AddonModUrlProvider { * @param moduleId The module ID. * @param courseId Course ID of the module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -196,9 +196,9 @@ export class AddonModUrlProvider { /** * Invalidates url data. * - * @param courseid Course ID. + * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUrlData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -212,7 +212,7 @@ export class AddonModUrlProvider { * @param id Module ID. * @param name Name of the assign. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModUrlViewUrlWSParams = { diff --git a/src/addons/mod/wiki/components/index/index.ts b/src/addons/mod/wiki/components/index/index.ts index 620576522..333b921d6 100644 --- a/src/addons/mod/wiki/components/index/index.ts +++ b/src/addons/mod/wiki/components/index/index.ts @@ -285,7 +285,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * Get wiki page contents. * * @param pageId Page to get. - * @return Promise resolved with the page data. + * @returns Promise resolved with the page data. */ protected async fetchPageContents(pageId: number): Promise; protected async fetchPageContents(): Promise; @@ -405,7 +405,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Fetch the page to be shown. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchWikiPage(): Promise { // Search the current Subwiki. @@ -464,7 +464,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Get path to the wiki home view. If cannot determine or it's current view, return undefined. * - * @return The path of the home view + * @returns The path of the home view */ protected getWikiHomeView(): string | undefined { if (!this.wiki) { @@ -586,7 +586,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * Open a page or a subwiki in the current wiki. * * @param options Options - * @return Promise. + * @returns Promise. */ protected async openPageOrSubwiki(options: AddonModWikiOpenPageOptions): Promise { const hash = Md5.hashAsciiStr(JSON.stringify({ @@ -656,7 +656,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Checks if there is any subwiki selected. * - * @return Whether there is any subwiki selected. + * @returns Whether there is any subwiki selected. */ protected isAnySubwikiSelected(): boolean { return this.subwikiData.subwikiSelected > 0 || this.subwikiData.userSelected > 0 || this.subwikiData.groupSelected > 0; @@ -666,7 +666,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * Checks if the given subwiki is the one picked on the subwiki picker. * * @param subwiki Subwiki to check. - * @return Whether it's the selected subwiki. + * @returns Whether it's the selected subwiki. */ protected isSubwikiSelected(subwiki: AddonModWikiSubwiki): boolean { if (subwiki.id > 0 && this.subwikiData.subwikiSelected > 0) { @@ -680,7 +680,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * Replace edit links to have full url. * * @param content Content to treat. - * @return Treated content. + * @returns Treated content. */ protected replaceEditLinks(content: string): string { content = content.trim(); @@ -710,7 +710,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModWikiSyncWikiResult | undefined): boolean { if (!result) { @@ -845,7 +845,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async sync(): Promise { if (!this.wiki) { @@ -856,7 +856,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); @@ -873,7 +873,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp * Create the subwiki list for the selector and store it in the cache. * * @param userGroups Groups. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async createSubwikiList(userGroups: CoreGroup[]): Promise { const subwikiList: AddonModWikiSubwikiListSubwiki[] = []; diff --git a/src/addons/mod/wiki/components/map/map.ts b/src/addons/mod/wiki/components/map/map.ts index 8e2a03f7c..87cf410a0 100644 --- a/src/addons/mod/wiki/components/map/map.ts +++ b/src/addons/mod/wiki/components/map/map.ts @@ -59,8 +59,6 @@ export class AddonModWikiMapModalComponent implements OnInit { /** * Construct the map of pages. - * - * @param pages List of pages. */ protected constructMap(): void { let letter: AddonModWikiPagesMapLetter; diff --git a/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts b/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts index de8d7a318..2b234af8d 100644 --- a/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts +++ b/src/addons/mod/wiki/components/subwiki-picker/subwiki-picker.ts @@ -32,7 +32,7 @@ export class AddonModWikiSubwikiPickerComponent { * Checks if the given subwiki is the one currently selected. * * @param subwiki Subwiki to check. - * @return Whether it's the selected subwiki. + * @returns Whether it's the selected subwiki. */ isSubwikiSelected(subwiki: AddonModWikiSubwiki): boolean { diff --git a/src/addons/mod/wiki/pages/edit/edit.ts b/src/addons/mod/wiki/pages/edit/edit.ts index e6b09f027..93b95b0bf 100644 --- a/src/addons/mod/wiki/pages/edit/edit.ts +++ b/src/addons/mod/wiki/pages/edit/edit.ts @@ -135,7 +135,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave { /** * Convenience function to get wiki page data. * - * @return Promise resolved with boolean: whether it was successful. + * @returns Promise resolved with boolean: whether it was successful. */ protected async fetchWikiPageData(): Promise { let canEdit = false; @@ -255,7 +255,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave { /** * Load cmId and courseId if they aren't set. * - * @return Promise. + * @returns Promise. */ protected async fetchModuleAndCourseId(): Promise { if (!this.wikiId || (this.cmId && this.courseId)) { @@ -304,7 +304,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave { /** * Check if data has changed. * - * @return Whether data has changed. + * @returns Whether data has changed. */ protected hasDataChanged(): boolean { const values = this.pageForm!.value; @@ -344,6 +344,8 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave { /** * Save the data. + * + * @returns Promise resolved when done. */ async save(): Promise { const values = this.pageForm!.value; diff --git a/src/addons/mod/wiki/services/handlers/create-link.ts b/src/addons/mod/wiki/services/handlers/create-link.ts index b78a3f632..544808831 100644 --- a/src/addons/mod/wiki/services/handlers/create-link.ts +++ b/src/addons/mod/wiki/services/handlers/create-link.ts @@ -41,7 +41,7 @@ export class AddonModWikiCreateLinkHandlerService extends CoreContentLinksHandle * @param route Activated route if current route is wiki index page, null otherwise. * @param subwikiId Subwiki ID to check. * @param siteId Site ID. - * @return Promise resolved with boolean: whether current view belongs to the same wiki. + * @returns Promise resolved with boolean: whether current view belongs to the same wiki. */ protected async currentStateIsSameWiki(route: ActivatedRoute | null, subwikiId: number, siteId: string): Promise { if (!route) { diff --git a/src/addons/mod/wiki/services/handlers/prefetch.ts b/src/addons/mod/wiki/services/handlers/prefetch.ts index 93b543a41..5fd8a396a 100644 --- a/src/addons/mod/wiki/services/handlers/prefetch.ts +++ b/src/addons/mod/wiki/services/handlers/prefetch.ts @@ -42,7 +42,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet * @param module The module object returned by WS. * @param courseId The course ID. * @param options Other options. - * @return List of pages. + * @returns List of pages. */ protected async getAllPages( module: CoreCourseAnyModuleData, @@ -153,7 +153,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param downloadTime The previous download time, 0 if no previous download. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchWiki( module: CoreCourseAnyModuleData, diff --git a/src/addons/mod/wiki/services/wiki-offline.ts b/src/addons/mod/wiki/services/wiki-offline.ts index 69288f758..062251e32 100644 --- a/src/addons/mod/wiki/services/wiki-offline.ts +++ b/src/addons/mod/wiki/services/wiki-offline.ts @@ -28,7 +28,7 @@ export class AddonModWikiOfflineProvider { * Convert a value to a positive number. If not a number or less than 0, 0 will be returned. * * @param value Value to convert. - * @return Converted value. + * @returns Converted value. */ convertToPositiveNumber(value: string | number | undefined): number { value = Number(value); @@ -45,7 +45,7 @@ export class AddonModWikiOfflineProvider { * @param userId User ID. Optional, will be used create subwiki if not informed. * @param groupId Group ID. Optional, will be used create subwiki if not informed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteNewPage( title: string, @@ -76,7 +76,7 @@ export class AddonModWikiOfflineProvider { * Get all the stored new pages from all the wikis. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with pages. + * @returns Promise resolved with pages. */ async getAllNewPages(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -93,7 +93,7 @@ export class AddonModWikiOfflineProvider { * @param userId User ID. Optional, will be used create subwiki if not informed. * @param groupId Group ID. Optional, will be used create subwiki if not informed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with page. + * @returns Promise resolved with page. */ async getNewPage( title: string, @@ -127,7 +127,7 @@ export class AddonModWikiOfflineProvider { * @param userId User ID. Optional, will be used create subwiki if not informed. * @param groupId Group ID. Optional, will be used create subwiki if not informed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with pages. + * @returns Promise resolved with pages. */ async getSubwikiNewPages( subwikiId?: number, @@ -156,7 +156,7 @@ export class AddonModWikiOfflineProvider { * * @param subwikis List of subwiki. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with pages. + * @returns Promise resolved with pages. */ async getSubwikisNewPages(subwikis: AddonModWikiSubwiki[], siteId?: string): Promise { let pages: AddonModWikiPageDBRecord[] = []; @@ -180,7 +180,7 @@ export class AddonModWikiOfflineProvider { * @param userId User ID. Optional, will be used create subwiki if not informed. * @param groupId Group ID. Optional, will be used create subwiki if not informed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveNewPage( title: string, @@ -215,7 +215,7 @@ export class AddonModWikiOfflineProvider { * * @param subwikis List of subwikis. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it has offline data. + * @returns Promise resolved with boolean: whether it has offline data. */ async subwikisHaveOfflineData(subwikis: AddonModWikiSubwiki[], siteId?: string): Promise { try { diff --git a/src/addons/mod/wiki/services/wiki-sync.ts b/src/addons/mod/wiki/services/wiki-sync.ts index 89586dd5e..906c62365 100644 --- a/src/addons/mod/wiki/services/wiki-sync.ts +++ b/src/addons/mod/wiki/services/wiki-sync.ts @@ -49,7 +49,7 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { return this.syncOnSites('all wikis', (siteId) => this.syncAllWikisFunc(!!force, siteId), siteId); @@ -81,7 +81,7 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { // Get all the pages created in offline. @@ -128,7 +128,7 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/addons/mod/wiki/services/wiki.ts b/src/addons/mod/wiki/services/wiki.ts index 32180ffb9..62932720c 100644 --- a/src/addons/mod/wiki/services/wiki.ts +++ b/src/addons/mod/wiki/services/wiki.ts @@ -68,7 +68,7 @@ export class AddonModWikiProvider { /** * Delete and return the edited page data if any. * - * @return Edited page data, undefined if no data. + * @returns Edited page data, undefined if no data. */ consumeEditedPageData(): AddonModWikiEditedPageData | undefined { const editedPage = this.editedPage; @@ -83,7 +83,7 @@ export class AddonModWikiProvider { * @param pageId Page ID. * @param content content to be saved. * @param section section to get. - * @return Promise resolved with the page ID. + * @returns Promise resolved with the page ID. */ async editPage(pageId: number, content: string, section?: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -107,6 +107,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param path Path. + * @returns The first wiki page opened if any. */ getFirstWikiPageOpened(wikiId: number, path: string): string | undefined { const tab = CoreNavigator.getMainMenuTabFromPath(path); @@ -124,7 +125,7 @@ export class AddonModWikiProvider { * * @param pageId Page ID. * @param options Other options. - * @return Promise resolved with the page data. + * @returns Promise resolved with the page data. */ async getPageContents(pageId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -149,7 +150,7 @@ export class AddonModWikiProvider { * Get cache key for wiki Pages Contents WS calls. * * @param pageId Wiki Page ID. - * @return Cache key. + * @returns Cache key. */ protected getPageContentsCacheKey(pageId: number): string { return ROOT_CACHE_KEY + 'page:' + pageId; @@ -162,7 +163,7 @@ export class AddonModWikiProvider { * @param section Section to get. * @param lockOnly Just renew lock and not return content. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with page contents. + * @returns Promise resolved with page contents. */ async getPageForEditing( pageId: number, @@ -192,7 +193,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param options Other options. - * @return Promise resolved with subwiki files. + * @returns Promise resolved with subwiki files. */ async getSubwikiFiles(wikiId: number, options: AddonModWikiGetSubwikiFilesOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -224,7 +225,7 @@ export class AddonModWikiProvider { * @param wikiId Wiki ID. * @param groupId Group ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getSubwikiFilesCacheKey(wikiId: number, groupId: number, userId: number): string { return this.getSubwikiFilesCacheKeyPrefix(wikiId) + ':' + groupId + ':' + userId; @@ -234,7 +235,7 @@ export class AddonModWikiProvider { * Get cache key for all wiki Subwiki Files WS calls. * * @param wikiId Wiki ID. - * @return Cache key. + * @returns Cache key. */ protected getSubwikiFilesCacheKeyPrefix(wikiId: number): string { return ROOT_CACHE_KEY + 'subwikifiles:' + wikiId; @@ -244,7 +245,7 @@ export class AddonModWikiProvider { * Get a list of subwikis and related data for a certain wiki from the cache. * * @param wikiId wiki Id - * @return Subwiki list and related data. + * @returns Subwiki list and related data. */ getSubwikiList(wikiId: number): AddonModWikiSubwikiListData { return this.subwikiListsCache[wikiId]; @@ -255,7 +256,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param options Other options. - * @return Promise resolved with wiki subwiki pages. + * @returns Promise resolved with wiki subwiki pages. */ async getSubwikiPages(wikiId: number, options: AddonModWikiGetSubwikiPagesOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -294,7 +295,7 @@ export class AddonModWikiProvider { * @param wikiId Wiki ID. * @param groupId Group ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getSubwikiPagesCacheKey(wikiId: number, groupId: number, userId: number): string { return this.getSubwikiPagesCacheKeyPrefix(wikiId) + ':' + groupId + ':' + userId; @@ -304,7 +305,7 @@ export class AddonModWikiProvider { * Get cache key for all wiki Subwiki Pages WS calls. * * @param wikiId Wiki ID. - * @return Cache key. + * @returns Cache key. */ protected getSubwikiPagesCacheKeyPrefix(wikiId: number): string { return ROOT_CACHE_KEY + 'subwikipages:' + wikiId; @@ -315,7 +316,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param options Other options. - * @return Promise resolved with subwikis. + * @returns Promise resolved with subwikis. */ async getSubwikis(wikiId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -343,7 +344,7 @@ export class AddonModWikiProvider { * Get cache key for get wiki subWikis WS calls. * * @param wikiId Wiki ID. - * @return Cache key. + * @returns Cache key. */ protected getSubwikisCacheKey(wikiId: number): string { return ROOT_CACHE_KEY + 'subwikis:' + wikiId; @@ -355,7 +356,7 @@ export class AddonModWikiProvider { * @param courseId Course ID. * @param cmId Course module ID. * @param options Other options. - * @return Promise resolved when the wiki is retrieved. + * @returns Promise resolved when the wiki is retrieved. */ getWiki(courseId: number, cmId: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getWikiByField(courseId, 'coursemodule', cmId, options); @@ -368,7 +369,7 @@ export class AddonModWikiProvider { * @param key Name of the property to check. * @param value Value to search. * @param options Other options. - * @return Promise resolved when the wiki is retrieved. + * @returns Promise resolved when the wiki is retrieved. */ protected async getWikiByField( courseId: number, @@ -404,7 +405,7 @@ export class AddonModWikiProvider { * @param courseId Course ID. * @param id Wiki ID. * @param options Other options. - * @return Promise resolved when the wiki is retrieved. + * @returns Promise resolved when the wiki is retrieved. */ getWikiById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getWikiByField(courseId, 'id', id, options); @@ -414,7 +415,7 @@ export class AddonModWikiProvider { * Get cache key for wiki data WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getWikiDataCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'wiki:' + courseId; @@ -425,7 +426,7 @@ export class AddonModWikiProvider { * * @param wiki Wiki. * @param options Other options. - * @return Promise resolved with the list of files. + * @returns Promise resolved with the list of files. */ async getWikiFileList(wiki: AddonModWikiWiki, options: CoreSitesCommonWSOptions = {}): Promise { options.siteId = options.siteId || CoreSites.getCurrentSiteId(); @@ -458,7 +459,7 @@ export class AddonModWikiProvider { * * @param wiki Wiki. * @param options Other options. - * @return Page list. + * @returns Page list. */ async getWikiPageList(wiki: AddonModWikiWiki, options: CoreSitesCommonWSOptions = {}): Promise { options.siteId = options.siteId || CoreSites.getCurrentSiteId(); @@ -491,7 +492,7 @@ export class AddonModWikiProvider { * @param moduleId The module ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -511,7 +512,7 @@ export class AddonModWikiProvider { * * @param pageId Wiki Page ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePage(pageId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -524,7 +525,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubwikiFiles(wikiId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -537,7 +538,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubwikiPages(wikiId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -550,7 +551,7 @@ export class AddonModWikiProvider { * * @param wikiId Wiki ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubwikis(wikiId: number, siteId?: string): Promise { this.clearSubwikiList(wikiId); @@ -565,7 +566,7 @@ export class AddonModWikiProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateWikiData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -580,7 +581,7 @@ export class AddonModWikiProvider { * @param subwikiId Subwiki ID. * @param title Page title. * @param options Other options. - * @return Promise resolved with true if used, resolved with false if not used or cannot determine. + * @returns Promise resolved with true if used, resolved with false if not used or cannot determine. */ async isTitleUsed( wikiId: number, @@ -622,7 +623,7 @@ export class AddonModWikiProvider { * @param wikiId Wiki ID. * @param name Name of the wiki. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logPageView(id: number, wikiId: number, name?: string, siteId?: string): Promise { const params: AddonModWikiViewPageWSParams = { @@ -647,7 +648,7 @@ export class AddonModWikiProvider { * @param id Wiki ID. * @param name Name of the wiki. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModWikiViewWikiWSParams = { @@ -672,7 +673,7 @@ export class AddonModWikiProvider { * @param title Title to create the page. * @param content Content to save on the page. * @param options Other options. - * @return Promise resolved with page ID if page was created in server, -1 if stored in device. + * @returns Promise resolved with page ID if page was created in server, -1 if stored in device. */ async newPage(title: string, content: string, options: AddonModWikiNewPageOptions = {}): Promise { @@ -741,7 +742,7 @@ export class AddonModWikiProvider { * @param title Title to create the page. * @param content Content to save on the page. * @param options Other options. - * @return Promise resolved with the page ID if created, rejected otherwise. + * @returns Promise resolved with the page ID if created, rejected otherwise. */ async newPageOnline(title: string, content: string, options: AddonModWikiNewPageOnlineOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -809,7 +810,7 @@ export class AddonModWikiProvider { * * @param pages Pages to sort. * @param desc True to sort in descendent order, false to sort in ascendent order. Defaults to false. - * @return Sorted pages. + * @returns Sorted pages. */ sortPagesByTitle( pages: T[], @@ -832,7 +833,7 @@ export class AddonModWikiProvider { * @param wikiId Wiki ID. * @param subwikiId Subwiki ID to search. * @param options Other options. - * @return Promise resolved with true if it has subwiki, resolved with false otherwise. + * @returns Promise resolved with true if it has subwiki, resolved with false otherwise. */ async wikiHasSubwiki(wikiId: number, subwikiId: number, options: CoreCourseCommonModWSOptions = {}): Promise { try { diff --git a/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts b/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts index 81c20524e..e749b2da6 100644 --- a/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts +++ b/src/addons/mod/workshop/components/assessment-strategy/assessment-strategy.ts @@ -95,7 +95,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe }; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.assessmentId || !this.strategy) { @@ -154,7 +154,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe /** * Convenience function to load the assessment data. * - * @return Promised resvoled when data is loaded. + * @returns Promised resvoled when data is loaded. */ protected async load(): Promise { this.data.assessment = await AddonModWorkshopHelper.getReviewerAssessmentById(this.workshop.id, this.assessmentId, { @@ -242,7 +242,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe /** * Check if data has changed. * - * @return True if data has changed. + * @returns True if data has changed. */ hasDataChanged(): boolean { if (!this.assessmentStrategyLoaded) { @@ -278,7 +278,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDe /** * Save the assessment. * - * @return Promise resolved when done, rejected if assessment could not be saved. + * @returns Promise resolved when done, rejected if assessment could not be saved. */ async saveAssessment(): Promise { const files = CoreFileSession.getFiles( diff --git a/src/addons/mod/workshop/components/assessment/assessment.ts b/src/addons/mod/workshop/components/assessment/assessment.ts index 5ca172f55..1e6464bc0 100644 --- a/src/addons/mod/workshop/components/assessment/assessment.ts +++ b/src/addons/mod/workshop/components/assessment/assessment.ts @@ -59,7 +59,7 @@ export class AddonModWorkshopAssessmentComponent implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { const canAssess = this.access && this.access.assessingallowed; diff --git a/src/addons/mod/workshop/components/index/index.ts b/src/addons/mod/workshop/components/index/index.ts index 1059ca513..035c4ebfe 100644 --- a/src/addons/mod/workshop/components/index/index.ts +++ b/src/addons/mod/workshop/components/index/index.ts @@ -160,7 +160,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { const promises: Promise[] = []; @@ -191,7 +191,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data receiven on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: AddonModWorkshopAutoSyncData): boolean { if (this.workshop && syncEventData.workshopId == this.workshop.id) { @@ -261,7 +261,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity * Retrieves and shows submissions grade page. * * @param page Page number to be retrieved. - * @return Resolved when done. + * @returns Resolved when done. */ async gotoSubmissionsPage(page: number): Promise { const report = await AddonModWorkshop.getGradesReport(this.workshop!.id, { @@ -399,7 +399,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity * Set group to see the workshop. * * @param groupId Group Id. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setGroup(groupId: number): Promise { this.group = groupId; @@ -410,7 +410,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to set current phase information. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async setPhaseInfo(): Promise { this.submission = undefined; @@ -516,7 +516,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected sync(): Promise { return AddonModWorkshopSync.syncWorkshop(this.workshop!.id); @@ -526,14 +526,14 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ protected hasSyncSucceed(result: AddonModWorkshopSyncResult): boolean { return result.updated; } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); diff --git a/src/addons/mod/workshop/components/submission/submission.ts b/src/addons/mod/workshop/components/submission/submission.ts index fc05e97b3..1e3d0c766 100644 --- a/src/addons/mod/workshop/components/submission/submission.ts +++ b/src/addons/mod/workshop/components/submission/submission.ts @@ -67,7 +67,7 @@ export class AddonModWorkshopSubmissionComponent implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.componentId = this.module.instance; diff --git a/src/addons/mod/workshop/pages/assessment/assessment.ts b/src/addons/mod/workshop/pages/assessment/assessment.ts index c15c1195f..961591bac 100644 --- a/src/addons/mod/workshop/pages/assessment/assessment.ts +++ b/src/addons/mod/workshop/pages/assessment/assessment.ts @@ -114,7 +114,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -139,7 +139,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.forceLeave || !this.evaluating) { @@ -161,7 +161,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea /** * Fetch the assessment data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchAssessmentData(): Promise { try { @@ -268,7 +268,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea /** * Check if data has changed. * - * @return True if changed, false otherwise. + * @returns True if changed, false otherwise. */ protected hasEvaluationChanged(): boolean { if (!this.loaded || !this.evaluating) { @@ -297,7 +297,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea /** * Convenience function to refresh all the data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async refreshAllData(): Promise { const promises: Promise[] = []; @@ -349,7 +349,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea /** * Sends the evaluation to be saved on the server. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async sendEvaluation(): Promise { const modal = await CoreDomUtils.showModalLoading('core.sending', true); @@ -389,7 +389,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy, CanLea } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.isDestroyed = true; 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 23b7e7e5e..0878cdbce 100644 --- a/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts +++ b/src/addons/mod/workshop/pages/edit-submission/edit-submission.ts @@ -97,7 +97,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -131,7 +131,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (this.forceLeave) { @@ -157,7 +157,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca /** * Fetch the submission data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchSubmissionData(): Promise { try { @@ -244,7 +244,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca /** * Get the form input data. * - * @return Object with all the info. + * @returns Object with all the info. */ protected getInputData(): AddonModWorkshopEditSubmissionInputData { const values: AddonModWorkshopEditSubmissionInputData = { @@ -267,7 +267,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca /** * Check if data has changed. * - * @return True if changed or false if not. + * @returns True if changed or false if not. */ protected hasDataChanged(): boolean { if (!this.loaded) { @@ -308,7 +308,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca /** * Send submission and save. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async saveSubmission(): Promise { const inputData = this.getInputData(); @@ -470,7 +470,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.isDestroyed = true; diff --git a/src/addons/mod/workshop/pages/submission/submission.ts b/src/addons/mod/workshop/pages/submission/submission.ts index e6c1fa6a2..6534c0cbd 100644 --- a/src/addons/mod/workshop/pages/submission/submission.ts +++ b/src/addons/mod/workshop/pages/submission/submission.ts @@ -128,7 +128,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -164,7 +164,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { const assessmentHasChanged = this.assessmentStrategy?.hasDataChanged(); @@ -210,7 +210,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea /** * Fetch the submission data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchSubmissionData(): Promise { try { @@ -366,7 +366,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea * Parse assessment to be shown. * * @param assessment Original assessment. - * @return Parsed assessment. + * @returns Parsed assessment. */ protected parseAssessment( assessment: AddonModWorkshopSubmissionAssessmentWithFormData, @@ -392,7 +392,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea /** * Check if data has changed. * - * @return True if changed, false otherwise. + * @returns True if changed, false otherwise. */ protected hasEvaluationChanged(): boolean { if (!this.loaded || !this.access.canoverridegrades) { @@ -419,7 +419,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea /** * Convenience function to refresh all the data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async refreshAllData(): Promise { const promises: Promise[] = []; @@ -495,7 +495,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea /** * Sends the evaluation to be saved on the server. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async sendEvaluation(): Promise { const modal = await CoreDomUtils.showModalLoading('core.sending', true); @@ -575,7 +575,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea /** * Undo the submission delete action. * - * @return Resolved when done. + * @returns Resolved when done. */ async undoDeleteSubmission(): Promise { await AddonModWorkshopOffline.deleteSubmissionAction( @@ -613,7 +613,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy, CanLea } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.isDestroyed = true; diff --git a/src/addons/mod/workshop/services/assessment-strategy-delegate.ts b/src/addons/mod/workshop/services/assessment-strategy-delegate.ts index b3ad2256d..913154672 100644 --- a/src/addons/mod/workshop/services/assessment-strategy-delegate.ts +++ b/src/addons/mod/workshop/services/assessment-strategy-delegate.ts @@ -32,7 +32,7 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param injector Injector. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent?(): Type; @@ -41,7 +41,7 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand * * @param form Original data of the form. * @param workshopId WorkShop Id - * @return Promise resolved with original values sorted. + * @returns Promise resolved with original values sorted. */ getOriginalValues?( form: AddonModWorkshopGetAssessmentFormDefinitionData, @@ -53,7 +53,7 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand * * @param originalValues Original values of the form. * @param currentValues Current values of the form. - * @return True if data has changed, false otherwise. + * @returns True if data has changed, false otherwise. */ hasDataChanged?( originalValues: AddonModWorkshopGetAssessmentFormFieldsParsedData[], @@ -65,7 +65,7 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand * * @param currentValues Current values of the form. * @param form Assessment form data. - * @return Promise resolved with the data to be sent. Or rejected with the input errors object. + * @returns Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData( currentValues: AddonModWorkshopGetAssessmentFormFieldsParsedData[], @@ -90,7 +90,7 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate * Check if an assessment strategy plugin is supported. * * @param workshopStrategy Assessment strategy name. - * @return True if supported, false otherwise. + * @returns True if supported, false otherwise. */ isPluginSupported(workshopStrategy: string): boolean { return this.hasHandler(workshopStrategy, true); @@ -99,9 +99,8 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate /** * Get the directive to use for a certain assessment strategy plugin. * - * @param injector Injector. * @param workshopStrategy Assessment strategy name. - * @return The component, undefined if not found. + * @returns The component, undefined if not found. */ getComponentForPlugin(workshopStrategy: string): Type | undefined { return this.executeFunctionOnEnabled(workshopStrategy, 'getComponent'); @@ -113,7 +112,7 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate * @param workshopStrategy Workshop strategy. * @param form Original data of the form. * @param workshopId Workshop ID. - * @return Resolved with original values sorted. + * @returns Resolved with original values sorted. */ getOriginalValues( workshopStrategy: string, @@ -129,7 +128,7 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate * @param workshopStrategy Workshop strategy. * @param originalValues Original values of the form. * @param currentValues Current values of the form. - * @return True if data has changed, false otherwise. + * @returns True if data has changed, false otherwise. */ hasDataChanged( workshopStrategy: string, @@ -145,7 +144,7 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate * @param workshopStrategy Workshop strategy to follow. * @param currentValues Current values of the form. * @param form Assessment form data. - * @return Promise resolved with the data to be sent. Or rejected with the input errors object. + * @returns Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData( workshopStrategy: string, diff --git a/src/addons/mod/workshop/services/handlers/prefetch.ts b/src/addons/mod/workshop/services/handlers/prefetch.ts index 22b4fcc44..1b62c5f55 100644 --- a/src/addons/mod/workshop/services/handlers/prefetch.ts +++ b/src/addons/mod/workshop/services/handlers/prefetch.ts @@ -62,7 +62,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr * @param module Module to get the files. * @param courseId Course ID the module belongs to. * @param options Other options. - * @return Promise resolved with the info fetched. + * @returns Promise resolved with the info fetched. */ protected async getWorkshopInfoHelper( module: CoreCourseAnyModuleData, @@ -188,7 +188,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can be downloaded. The promise should never be rejected. + * @returns Whether the module can be downloaded. The promise should never be rejected. */ async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { const workshop = await AddonModWorkshop.getWorkshop(courseId, module.id, { @@ -215,7 +215,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr * @param groups Array of groups in the activity. * @param cmId Module ID. * @param siteId Site ID. If not defined, current site. - * @return All unique entries. + * @returns All unique entries. */ protected async getAllGradesReport( workshopId: number, @@ -249,7 +249,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr * @param module The module object returned by WS. * @param courseId Course ID the module belongs to. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async prefetchWorkshop(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise { const userIds: number[] = []; diff --git a/src/addons/mod/workshop/services/workshop-helper.ts b/src/addons/mod/workshop/services/workshop-helper.ts index 3588ca192..aefb60346 100644 --- a/src/addons/mod/workshop/services/workshop-helper.ts +++ b/src/addons/mod/workshop/services/workshop-helper.ts @@ -54,7 +54,7 @@ export class AddonModWorkshopHelperProvider { * * @param tasks Array of tasks. * @param taskCode Unique task code. - * @return Task requested + * @returns Task requested */ getTask(tasks: AddonModWorkshopPhaseTaskData[], taskCode: string): AddonModWorkshopPhaseTaskData | undefined { return tasks.find((task) => task.code == taskCode); @@ -65,7 +65,7 @@ export class AddonModWorkshopHelperProvider { * * @param tasks Array of tasks. * @param taskCode Unique task code. - * @return True if task is completed. + * @returns True if task is completed. */ isTaskDone(tasks: AddonModWorkshopPhaseTaskData[], taskCode: string): boolean { const task = this.getTask(tasks, taskCode); @@ -84,7 +84,7 @@ export class AddonModWorkshopHelperProvider { * @param workshop Workshop info. * @param access Access information. * @param tasks Array of tasks. - * @return True if the user can submit the workshop. + * @returns True if the user can submit the workshop. */ canSubmit( workshop: AddonModWorkshopData, @@ -105,7 +105,7 @@ export class AddonModWorkshopHelperProvider { * * @param workshop Workshop info. * @param access Access information. - * @return True if the user can assess the workshop. + * @returns True if the user can assess the workshop. */ canAssess(workshop: AddonModWorkshopData, access: AddonModWorkshopGetWorkshopAccessInformationWSResponse): boolean { const examplesMust = workshop.useexamples && @@ -121,7 +121,7 @@ export class AddonModWorkshopHelperProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Resolved with the submission, resolved with false if not found. + * @returns Resolved with the submission, resolved with false if not found. */ async getUserSubmission( workshopId: number, @@ -140,7 +140,7 @@ export class AddonModWorkshopHelperProvider { * @param workshopId Workshop ID. * @param submissionId Submission ID. * @param options Other options. - * @return Resolved with the submission, resolved with false if not found. + * @returns Resolved with the submission, resolved with false if not found. */ async getSubmissionById( workshopId: number, @@ -168,7 +168,7 @@ export class AddonModWorkshopHelperProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param options Other options. - * @return Resolved with the assessment. + * @returns Resolved with the assessment. */ async getReviewerAssessmentById( workshopId: number, @@ -198,7 +198,7 @@ export class AddonModWorkshopHelperProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getReviewerAssessments( workshopId: number, @@ -233,7 +233,7 @@ export class AddonModWorkshopHelperProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ async deleteSubmissionStoredFiles(workshopId: number, siteId?: string): Promise { const folderPath = await AddonModWorkshopOffline.getSubmissionFolder(workshopId, siteId); @@ -249,7 +249,7 @@ export class AddonModWorkshopHelperProvider { * @param workshopId Workshop ID. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeSubmissionFiles( workshopId: number, @@ -271,7 +271,7 @@ export class AddonModWorkshopHelperProvider { * @param editing If the submission is being edited or added otherwise. * @param offline True if files sould be stored for offline, false to upload them. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ uploadOrStoreSubmissionFiles( workshopId: number, @@ -302,10 +302,8 @@ export class AddonModWorkshopHelperProvider { * Get a list of stored attachment files for a submission. See AddonModWorkshopHelperProvider#storeFiles. * * @param workshopId Workshop ID. - * @param submissionId If not editing, it will refer to timecreated. - * @param editing If the submission is being edited or added otherwise. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getStoredSubmissionFiles( workshopId: number, @@ -323,7 +321,7 @@ export class AddonModWorkshopHelperProvider { * @param filesObject Files object combining offline and online information. * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getSubmissionFilesFromOfflineFilesObject( filesObject: CoreFileUploaderStoreFilesResult, @@ -341,7 +339,7 @@ export class AddonModWorkshopHelperProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted. + * @returns Promise resolved when deleted. */ async deleteAssessmentStoredFiles(workshopId: number, assessmentId: number, siteId?: string): Promise { const folderPath = await AddonModWorkshopOffline.getAssessmentFolder(workshopId, assessmentId, siteId); @@ -358,7 +356,7 @@ export class AddonModWorkshopHelperProvider { * @param assessmentId Assessment ID. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected otherwise. + * @returns Promise resolved if success, rejected otherwise. */ async storeAssessmentFiles( workshopId: number, @@ -380,7 +378,7 @@ export class AddonModWorkshopHelperProvider { * @param files List of files. * @param offline True if files sould be stored for offline, false to upload them. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ uploadOrStoreAssessmentFiles( workshopId: number, @@ -416,7 +414,7 @@ export class AddonModWorkshopHelperProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getStoredAssessmentFiles(workshopId: number, assessmentId: number, siteId?: string): Promise { const folderPath = await AddonModWorkshopOffline.getAssessmentFolder(workshopId, assessmentId, siteId); @@ -432,7 +430,7 @@ export class AddonModWorkshopHelperProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getAssessmentFilesFromOfflineFilesObject( filesObject: CoreFileUploaderStoreFilesResult, @@ -450,7 +448,7 @@ export class AddonModWorkshopHelperProvider { * * @param submission Submission object to be modified. * @param actions Offline actions to be applied to the given submission. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async applyOfflineData( submission?: AddonModWorkshopSubmissionDataWithOfflineData, @@ -517,10 +515,9 @@ export class AddonModWorkshopHelperProvider { * @param workshop Workshop object. * @param selectedValues Assessment current values * @param feedbackText Feedback text. - * @param feedbackFiles Feedback attachments. * @param form Assessment form original data. * @param attachmentsId The draft file area id for attachments. - * @return Promise resolved with the data to be sent. Or rejected with the input errors object. + * @returns Promise resolved with the data to be sent. Or rejected with the input errors object. */ async prepareAssessmentData( workshop: AddonModWorkshopData, @@ -551,7 +548,7 @@ export class AddonModWorkshopHelperProvider { * @param value Percentual value from 0 to 100. * @param max The maximal grade. * @param decimals Decimals to show in the formatted grade. - * @return Real grade formatted. + * @returns Real grade formatted. */ protected realGradeValueHelper(value?: number | string, max = 0, decimals = 0): string | undefined { if (typeof value == 'string') { @@ -577,7 +574,7 @@ export class AddonModWorkshopHelperProvider { * * @param workshop Workshop object. * @param assessment Assessment data. - * @return Assessment with real grades. + * @returns Assessment with real grades. */ realGradeValue( workshop: AddonModWorkshopData, @@ -599,7 +596,7 @@ export class AddonModWorkshopHelperProvider { * Check grade should be shown * * @param grade Grade to be shown - * @return If grade should be shown or not. + * @returns If grade should be shown or not. */ showGrade(grade?: number|string): boolean { return grade !== undefined && grade !== null; diff --git a/src/addons/mod/workshop/services/workshop-offline.ts b/src/addons/mod/workshop/services/workshop-offline.ts index f566a2855..370da3e28 100644 --- a/src/addons/mod/workshop/services/workshop-offline.ts +++ b/src/addons/mod/workshop/services/workshop-offline.ts @@ -43,7 +43,7 @@ export class AddonModWorkshopOfflineProvider { * Get all the workshops ids that have something to be synced. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with workshops id that have something to be synced. + * @returns Promise resolved with workshops id that have something to be synced. */ async getAllWorkshops(siteId?: string): Promise { const promiseResults = await Promise.all([ @@ -71,7 +71,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId Workshop ID to remove. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline data, false otherwise. + * @returns Promise resolved with boolean: true if has offline data, false otherwise. */ async hasWorkshopOfflineData(workshopId: number, siteId?: string): Promise { try { @@ -93,10 +93,9 @@ export class AddonModWorkshopOfflineProvider { * Delete workshop submission action. * * @param workshopId Workshop ID. - * @param submissionId Submission ID. * @param action Action to be done. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteSubmissionAction( workshopId: number, @@ -118,7 +117,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteAllSubmissionActions(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -134,7 +133,7 @@ export class AddonModWorkshopOfflineProvider { * Get the all the submissions to be synced. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the objects to be synced. + * @returns Promise resolved with the objects to be synced. */ async getAllSubmissions(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -149,7 +148,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId ID of the workshop. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getSubmissions(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -169,7 +168,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId ID of the workshop. * @param action Action to be done. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getSubmissionAction( workshopId: number, @@ -200,7 +199,7 @@ export class AddonModWorkshopOfflineProvider { * If set to 0, current time is used. * @param action Action to be done. ['add', 'update', 'delete'] * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when submission action is successfully saved. + * @returns Promise resolved when submission action is successfully saved. */ async saveSubmission( workshopId: number, @@ -235,6 +234,7 @@ export class AddonModWorkshopOfflineProvider { * Parse "attachments" column of a submission record. * * @param record Submission record, modified in place. + * @returns The offline submission parsed. */ protected parseSubmissionRecord(record: AddonModWorkshopSubmissionDBRecord): AddonModWorkshopOfflineSubmission { return { @@ -249,7 +249,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -266,7 +266,7 @@ export class AddonModWorkshopOfflineProvider { * Get the all the assessments to be synced. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the objects to be synced. + * @returns Promise resolved with the objects to be synced. */ async getAllAssessments(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -281,7 +281,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId ID of the workshop. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getAssessments(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -301,7 +301,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId ID of the workshop. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -324,7 +324,7 @@ export class AddonModWorkshopOfflineProvider { * @param courseId Course ID the workshop belongs to. * @param inputData Assessment data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when assessment is successfully saved. + * @returns Promise resolved when assessment is successfully saved. */ async saveAssessment( workshopId: number, @@ -350,6 +350,7 @@ export class AddonModWorkshopOfflineProvider { * Parse "inpudata" column of an assessment record. * * @param record Assessnent record, modified in place. + * @returns The offline assessment parsed. */ protected parseAssessmentRecord(record: AddonModWorkshopAssessmentDBRecord): AddonModWorkshopOfflineAssessment { return { @@ -364,7 +365,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId Workshop ID. * @param submissionId Submission ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteEvaluateSubmission(workshopId: number, submissionId: number, siteId?: string): Promise { const conditions: Partial = { @@ -381,7 +382,7 @@ export class AddonModWorkshopOfflineProvider { * Get the all the evaluate submissions to be synced. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the objects to be synced. + * @returns Promise resolved with the objects to be synced. */ async getAllEvaluateSubmissions(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -396,7 +397,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId ID of the workshop. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getEvaluateSubmissions(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -417,7 +418,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId ID of the workshop. * @param submissionId Submission ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getEvaluateSubmission( workshopId: number, @@ -447,7 +448,7 @@ export class AddonModWorkshopOfflineProvider { * @param published Whether to publish the submission for other users. * @param gradeOver The new submission grade (empty for no overriding the grade). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when submission evaluation is successfully saved. + * @returns Promise resolved when submission evaluation is successfully saved. */ async saveEvaluateSubmission( workshopId: number, @@ -477,6 +478,7 @@ export class AddonModWorkshopOfflineProvider { * Parse "published" and "gradeover" columns of an evaluate submission record. * * @param record Evaluate submission record, modified in place. + * @returns The offline evaluate submission parsed. */ protected parseEvaluateSubmissionRecord( record: AddonModWorkshopEvaluateSubmissionDBRecord, @@ -494,7 +496,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteEvaluateAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -511,7 +513,7 @@ export class AddonModWorkshopOfflineProvider { * Get the all the evaluate assessments to be synced. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the objects to be synced. + * @returns Promise resolved with the objects to be synced. */ async getAllEvaluateAssessments(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -526,7 +528,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId ID of the workshop. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getEvaluateAssessments(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -547,7 +549,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId ID of the workshop. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the object to be synced. + * @returns Promise resolved with the object to be synced. */ async getEvaluateAssessment( workshopId: number, @@ -577,7 +579,7 @@ export class AddonModWorkshopOfflineProvider { * @param weight The new weight for the assessment. * @param gradingGradeOver The new grading grade (empty for no overriding the grade). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when assessment evaluation is successfully saved. + * @returns Promise resolved when assessment evaluation is successfully saved. */ async saveEvaluateAssessment( workshopId: number, @@ -607,6 +609,7 @@ export class AddonModWorkshopOfflineProvider { * Parse "gradinggradeover" column of an evaluate assessment record. * * @param record Evaluate assessment record, modified in place. + * @returns The offline evaluate assessment parsed. */ protected parseEvaluateAssessmentRecord( record: AddonModWorkshopEvaluateAssessmentDBRecord, @@ -622,7 +625,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getWorkshopFolder(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -638,7 +641,7 @@ export class AddonModWorkshopOfflineProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getSubmissionFolder(workshopId: number, siteId?: string): Promise { const folderPath = await this.getWorkshopFolder(workshopId, siteId); @@ -652,7 +655,7 @@ export class AddonModWorkshopOfflineProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the path. + * @returns Promise resolved with the path. */ async getAssessmentFolder(workshopId: number, assessmentId: number, siteId?: string): Promise { let folderPath = await this.getWorkshopFolder(workshopId, siteId); diff --git a/src/addons/mod/workshop/services/workshop-sync.ts b/src/addons/mod/workshop/services/workshop-sync.ts index 7f5d4768b..695afa417 100644 --- a/src/addons/mod/workshop/services/workshop-sync.ts +++ b/src/addons/mod/workshop/services/workshop-sync.ts @@ -59,7 +59,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { return AddonModWorkshopOffline.hasWorkshopOfflineData(workshopId, siteId); @@ -70,7 +70,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { return this.syncOnSites('all workshops', (siteId) => this.syncAllWorkshopsFunc(!!force, siteId), siteId); @@ -81,7 +81,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { const workshopIds = await AddonModWorkshopOffline.getAllWorkshops(siteId); @@ -109,7 +109,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { const needed = await this.isSyncNeeded(workshopId, siteId); @@ -124,7 +124,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -154,7 +154,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { const result: AddonModWorkshopSyncResult = { @@ -269,7 +269,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { return this.getWorkshopByKey(courseId, 'coursemodule', cmId, options); @@ -294,7 +294,7 @@ export class AddonModWorkshopProvider { * @param courseId Course ID. * @param id Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop is retrieved. + * @returns Promise resolved when the workshop is retrieved. */ getWorkshopById(courseId: number, id: number, options: CoreSitesCommonWSOptions = {}): Promise { return this.getWorkshopByKey(courseId, 'id', id, options); @@ -305,7 +305,7 @@ export class AddonModWorkshopProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the workshop is invalidated. + * @returns Promise resolved when the workshop is invalidated. */ async invalidateWorkshopData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -318,7 +318,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the workshop is invalidated. + * @returns Promise resolved when the workshop is invalidated. */ async invalidateWorkshopWSData(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -331,7 +331,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop is retrieved. + * @returns Promise resolved when the workshop is retrieved. */ async getWorkshopAccessInformation( workshopId: number, @@ -362,7 +362,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateWorkshopAccessInformationData(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -375,7 +375,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getUserPlanPhases( workshopId: number, @@ -405,7 +405,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserPlanPhasesData(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -417,7 +417,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop submissions are retrieved. + * @returns Promise resolved when the workshop submissions are retrieved. */ async getSubmissions( workshopId: number, @@ -454,7 +454,7 @@ export class AddonModWorkshopProvider { * @param userId User ID. * @param groupId Group ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubmissionsData(workshopId: number, userId: number = 0, groupId: number = 0, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -468,7 +468,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param submissionId Submission ID. * @param options Other options. - * @return Promise resolved when the workshop submission data is retrieved. + * @returns Promise resolved when the workshop submission data is retrieved. */ async getSubmission( workshopId: number, @@ -499,7 +499,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param submissionId Submission ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubmissionData(workshopId: number, submissionId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -512,7 +512,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop grades data is retrieved. + * @returns Promise resolved when the workshop grades data is retrieved. */ async getGrades(workshopId: number, options: CoreCourseCommonModWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -536,7 +536,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateGradesData(workshopId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -549,7 +549,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getGradesReport( workshopId: number, @@ -583,7 +583,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ fetchAllGradeReports( workshopId: number, @@ -603,7 +603,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param grades Grades already fetched (just to concatenate them). * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchGradeReportsRecursive( workshopId: number, @@ -630,7 +630,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param groupId Group ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateGradeReportData(workshopId: number, groupId: number = 0, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -644,7 +644,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param submissionId Submission ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getSubmissionAssessments( workshopId: number, @@ -679,7 +679,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param submissionId Submission ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSubmissionAssesmentsData(workshopId: number, submissionId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -697,7 +697,7 @@ export class AddonModWorkshopProvider { * @param attachmentsId The draft file area id for attachments. * @param siteId Site ID. If not defined, current site. * @param allowOffline True if it can be stored in offline, false otherwise. - * @return Promise resolved with submission ID if sent online or false if stored offline. + * @returns Promise resolved with submission ID if sent online or false if stored offline. */ async addSubmission( workshopId: number, @@ -755,7 +755,7 @@ export class AddonModWorkshopProvider { * @param content The submission text content. * @param attachmentsId The draft file area id for attachments. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the submission is created. + * @returns Promise resolved when the submission is created. */ async addSubmissionOnline( workshopId: number, @@ -792,7 +792,7 @@ export class AddonModWorkshopProvider { * @param attachmentsId The draft file area id for attachments. * @param siteId Site ID. If not defined, current site. * @param allowOffline True if it can be stored in offline, false otherwise. - * @return Promise resolved with submission ID if sent online or false if stored offline. + * @returns Promise resolved with submission ID if sent online or false if stored offline. */ async updateSubmission( workshopId: number, @@ -851,7 +851,7 @@ export class AddonModWorkshopProvider { * @param content The submission text content. * @param attachmentsId The draft file area id for attachments. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the submission is updated. + * @returns Promise resolved when the submission is updated. */ async updateSubmissionOnline( submissionId: number, @@ -884,7 +884,7 @@ export class AddonModWorkshopProvider { * @param submissionId Submission ID. * @param courseId Course ID the workshop belongs to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with submission ID if sent online, resolved with false if stored offline. + * @returns Promise resolved with submission ID if sent online, resolved with false if stored offline. */ async deleteSubmission(workshopId: number, submissionId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -927,7 +927,7 @@ export class AddonModWorkshopProvider { * * @param submissionId Submission ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the submission is deleted. + * @returns Promise resolved when the submission is deleted. */ async deleteSubmissionOnline(submissionId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -946,7 +946,7 @@ export class AddonModWorkshopProvider { * * @param workshopId Workshop ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getReviewerAssessments( workshopId: number, @@ -981,7 +981,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param userId User ID. If not defined, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateReviewerAssesmentsData(workshopId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -995,7 +995,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getAssessment( workshopId: number, @@ -1025,7 +1025,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAssessmentData(workshopId: number, assessmentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1039,7 +1039,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param assessmentId Assessment ID. * @param options Other options. - * @return Promise resolved when the workshop data is retrieved. + * @returns Promise resolved when the workshop data is retrieved. */ async getAssessmentForm( workshopId: number, @@ -1084,7 +1084,7 @@ export class AddonModWorkshopProvider { * Parse fieldes into a more handful format. * * @param fields Fields to parse - * @return Parsed fields + * @returns Parsed fields */ parseFields(fields: AddonModWorkshopGetAssessmentFormFieldData[]): AddonModWorkshopGetAssessmentFormFieldsParsedData[] { const parsedFields: AddonModWorkshopGetAssessmentFormFieldsParsedData[] = []; @@ -1129,7 +1129,7 @@ export class AddonModWorkshopProvider { * @param assessmentId Assessment ID. * @param mode Mode assessment (default) or preview. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAssessmentFormData( workshopId: number, @@ -1152,7 +1152,7 @@ export class AddonModWorkshopProvider { * @param inputData Assessment data. * @param siteId Site ID. If not defined, current site. * @param allowOffline True if it can be stored in offline, false otherwise. - * @return Promise resolved with true if sent online, or false if stored offline. + * @returns Promise resolved with true if sent online, or false if stored offline. */ async updateAssessment( workshopId: number, @@ -1198,7 +1198,7 @@ export class AddonModWorkshopProvider { * @param assessmentId Assessment ID. * @param inputData Assessment data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the grade of the submission. + * @returns Promise resolved with the grade of the submission. */ async updateAssessmentOnline(assessmentId: number, inputData: CoreFormFields, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1224,7 +1224,7 @@ export class AddonModWorkshopProvider { * @param published Whether to publish the submission for other users. * @param gradeOver The new submission grade (empty for no overriding the grade). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when submission is evaluated if sent online, + * @returns Promise resolved when submission is evaluated if sent online, * resolved with false if stored offline. */ async evaluateSubmission( @@ -1278,7 +1278,7 @@ export class AddonModWorkshopProvider { * @param published Whether to publish the submission for other users. * @param gradeOver The new submission grade (empty for no overriding the grade). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the submission is evaluated. + * @returns Promise resolved when the submission is evaluated. */ async evaluateSubmissionOnline( submissionId: number, @@ -1315,7 +1315,7 @@ export class AddonModWorkshopProvider { * @param weight The new weight for the assessment. * @param gradingGradeOver The new grading grade (empty for no overriding the grade). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when assessment is evaluated if sent online, + * @returns Promise resolved when assessment is evaluated if sent online, * resolved with false if stored offline. */ async evaluateAssessment( @@ -1366,7 +1366,7 @@ export class AddonModWorkshopProvider { * @param weight The new weight for the assessment. * @param gradingGradeOver The new grading grade (empty for no overriding the grade). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the assessment is evaluated. + * @returns Promise resolved when the assessment is evaluated. */ async evaluateAssessmentOnline( assessmentId: number, @@ -1399,7 +1399,7 @@ export class AddonModWorkshopProvider { * @param moduleId The module ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promised resolved when content is invalidated. + * @returns Promised resolved when content is invalidated. */ async invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1418,7 +1418,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when content is invalidated. + * @returns Promise resolved when content is invalidated. */ async invalidateContentById(workshopId: number, courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1438,7 +1438,7 @@ export class AddonModWorkshopProvider { * @param id Workshop ID. * @param name Name of the workshop. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(id: number, name?: string, siteId?: string): Promise { const params: AddonModWorkshopViewWorkshopWSParams = { @@ -1464,7 +1464,7 @@ export class AddonModWorkshopProvider { * @param workshopId Workshop ID. * @param name Name of the workshop. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logViewSubmission(id: number, workshopId: number, name?: string, siteId?: string): Promise { const params: AddonModWorkshopViewSubmissionWSParams = { diff --git a/src/addons/notes/pages/list/list.page.ts b/src/addons/notes/pages/list/list.page.ts index 8f5547af5..951f764e6 100644 --- a/src/addons/notes/pages/list/list.page.ts +++ b/src/addons/notes/pages/list/list.page.ts @@ -88,7 +88,7 @@ export class AddonNotesListPage implements OnInit, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { await this.fetchNotes(true); @@ -99,7 +99,7 @@ export class AddonNotesListPage implements OnInit, OnDestroy { * * @param sync When to resync notes. * @param showErrors When to display errors or not. - * @return Promise with the notes. + * @returns Promise with the notes. */ protected async fetchNotes(sync = false, showErrors = false): Promise { if (sync) { @@ -267,7 +267,7 @@ export class AddonNotesListPage implements OnInit, OnDestroy { * Tries to synchronize course notes. * * @param showErrors Whether to display errors or not. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async syncNotes(showErrors: boolean): Promise { try { diff --git a/src/addons/notes/services/notes-offline.ts b/src/addons/notes/services/notes-offline.ts index 4666e07c9..28be2233a 100644 --- a/src/addons/notes/services/notes-offline.ts +++ b/src/addons/notes/services/notes-offline.ts @@ -32,7 +32,7 @@ export class AddonNotesOfflineProvider { * @param content The note content. * @param timecreated The time the note was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async deleteOfflineNote(userId: number, content: string, timecreated: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -48,7 +48,7 @@ export class AddonNotesOfflineProvider { * Get all offline deleted notes. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getAllDeletedNotes(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -61,7 +61,7 @@ export class AddonNotesOfflineProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getCourseDeletedNotes(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -73,7 +73,7 @@ export class AddonNotesOfflineProvider { * Get all offline notes. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getAllNotes(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -88,7 +88,7 @@ export class AddonNotesOfflineProvider { * @param content The note content. * @param timecreated The time the note was created. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the notes. + * @returns Promise resolved with the notes. */ async getNote(userId: number, content: string, timecreated: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -106,7 +106,7 @@ export class AddonNotesOfflineProvider { * @param courseId Course ID. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getNotesForCourseAndUser(courseId: number, userId?: number, siteId?: string): Promise { if (!userId) { @@ -123,7 +123,7 @@ export class AddonNotesOfflineProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getNotesForCourse(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -136,7 +136,7 @@ export class AddonNotesOfflineProvider { * * @param userId User ID the notes are about. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getNotesForUser(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -149,7 +149,7 @@ export class AddonNotesOfflineProvider { * * @param state Publish state ('personal', 'site' or 'course'). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with notes. + * @returns Promise resolved with notes. */ async getNotesWithPublishState(state: AddonNotesPublishState, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -162,7 +162,7 @@ export class AddonNotesOfflineProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline notes, false otherwise. + * @returns Promise resolved with boolean: true if has offline notes, false otherwise. */ async hasNotesForCourse(courseId: number, siteId?: string): Promise { const notes = await this.getNotesForCourse(courseId, siteId); @@ -175,7 +175,7 @@ export class AddonNotesOfflineProvider { * * @param userId User ID the notes are about. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline notes, false otherwise. + * @returns Promise resolved with boolean: true if has offline notes, false otherwise. */ async hasNotesForUser(userId: number, siteId?: string): Promise { const notes = await this.getNotesForUser(userId, siteId); @@ -188,7 +188,7 @@ export class AddonNotesOfflineProvider { * * @param state Publish state ('personal', 'site' or 'course'). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline notes, false otherwise. + * @returns Promise resolved with boolean: true if has offline notes, false otherwise. */ async hasNotesWithPublishState(state: AddonNotesPublishState, siteId?: string): Promise { const notes = await this.getNotesWithPublishState(state, siteId); @@ -204,7 +204,7 @@ export class AddonNotesOfflineProvider { * @param state Publish state ('personal', 'site' or 'course'). * @param content The note content. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveNote( userId: number, @@ -235,7 +235,7 @@ export class AddonNotesOfflineProvider { * @param noteId Note ID. * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteNote(noteId: number, courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -254,7 +254,7 @@ export class AddonNotesOfflineProvider { * * @param noteId Note ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async undoDeleteNote(noteId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/notes/services/notes-sync.ts b/src/addons/notes/services/notes-sync.ts index dc6f1eae4..749bb5af6 100644 --- a/src/addons/notes/services/notes-sync.ts +++ b/src/addons/notes/services/notes-sync.ts @@ -42,7 +42,7 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { return this.syncOnSites('all notes', (siteId) => this.syncAllNotesFunc(!!force, siteId), siteId); @@ -53,7 +53,7 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { const notesArray = await Promise.all([ @@ -92,7 +92,7 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { const needed = await this.isSyncNeeded(courseId, siteId); @@ -107,7 +107,7 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -130,7 +130,7 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { const result: AddonNotesSyncResult = { diff --git a/src/addons/notes/services/notes.ts b/src/addons/notes/services/notes.ts index 0e3578aa1..71e4d3c06 100644 --- a/src/addons/notes/services/notes.ts +++ b/src/addons/notes/services/notes.ts @@ -40,7 +40,7 @@ export class AddonNotesProvider { * @param publishState Personal, Site or Course. * @param noteText The note text. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if note was sent to server, false if stored in device. + * @returns Promise resolved with boolean: true if note was sent to server, false if stored in device. */ async addNote( userId: number, @@ -86,7 +86,7 @@ export class AddonNotesProvider { * @param publishState Personal, Site or Course. * @param noteText The note text. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when added, rejected otherwise. + * @returns Promise resolved when added, rejected otherwise. */ async addNoteOnline( userId: number, @@ -119,7 +119,7 @@ export class AddonNotesProvider { * * @param notes Notes to save. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when added, rejected otherwise. Promise resolved doesn't mean that notes + * @returns Promise resolved when added, rejected otherwise. Promise resolved doesn't mean that notes * have been added, the resolve param can contain errors for notes not sent. */ async addNotesOnline(notes: AddonNotesCreateNoteData[], siteId?: string): Promise { @@ -142,7 +142,7 @@ export class AddonNotesProvider { * @param note Note object to delete. * @param courseId Course ID where the note belongs. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes + * @returns Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes * have been deleted, the resolve param can contain errors for notes not deleted. */ async deleteNote(note: AddonNotesNoteFormatted, courseId: number, siteId?: string): Promise { @@ -187,7 +187,7 @@ export class AddonNotesProvider { * @param noteIds Note IDs to delete. * @param courseId Course ID where the note belongs. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes + * @returns Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes * have been deleted, the resolve param can contain errors for notes not deleted. */ async deleteNotesOnline(noteIds: number[], courseId: number, siteId?: string): Promise { @@ -209,7 +209,7 @@ export class AddonNotesProvider { * check, we should not be calling WS from here. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @returns Promise resolved with true if enabled, resolved with false or rejected otherwise. */ async isPluginEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -222,7 +222,7 @@ export class AddonNotesProvider { * * @param courseId ID of the course. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @returns Promise resolved with true if enabled, resolved with false or rejected otherwise. */ async isPluginAddNoteEnabledForCourse(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -254,7 +254,7 @@ export class AddonNotesProvider { * * @param courseId ID of the course. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @returns Promise resolved with true if enabled, resolved with false or rejected otherwise. */ isPluginViewNotesEnabledForCourse(courseId: number, siteId?: string): Promise { return CoreUtils.promiseWorks(this.getNotes(courseId, undefined, false, true, siteId)); @@ -264,7 +264,7 @@ export class AddonNotesProvider { * Get prefix cache key for course notes. * * @param courseId ID of the course to get the notes from. - * @return Cache key. + * @returns Cache key. */ getNotesPrefixCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'notes:' + courseId + ':'; @@ -275,7 +275,7 @@ export class AddonNotesProvider { * * @param courseId ID of the course to get the notes from. * @param userId ID of the user to get the notes from if requested. - * @return Cache key. + * @returns Cache key. */ getNotesCacheKey(courseId: number, userId?: number): string { return this.getNotesPrefixCacheKey(courseId) + (userId ? userId : ''); @@ -289,7 +289,7 @@ export class AddonNotesProvider { * @param ignoreCache True when we should not get the value from the cache. * @param onlyOnline True to return only online notes, false to return both online and offline. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the notes are retrieved. + * @returns Promise to be resolved when the notes are retrieved. */ async getNotes( courseId: number, @@ -341,7 +341,7 @@ export class AddonNotesProvider { * @param notes Array of notes. * @param courseId ID of the course the notes belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setOfflineDeletedNotes( notes: AddonNotesNoteFormatted[], @@ -359,7 +359,7 @@ export class AddonNotesProvider { * Get user data for notes since they only have userid. * * @param notes Notes to get the data for. - * @return Promise always resolved. Resolve param is the formatted notes. + * @returns Promise always resolved. Resolve param is the formatted notes. */ async getNotesUserData(notes: AddonNotesNoteFormatted[]): Promise { const promises = notes.map((note) => @@ -384,7 +384,7 @@ export class AddonNotesProvider { * @param courseId Course ID. * @param userId User ID if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateNotes(courseId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -404,7 +404,7 @@ export class AddonNotesProvider { * @param courseId ID of the course. * @param userId User ID if needed. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(courseId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/notifications/pages/list/list.ts b/src/addons/notifications/pages/list/list.ts index cf6e48803..e26e0f344 100644 --- a/src/addons/notifications/pages/list/list.ts +++ b/src/addons/notifications/pages/list/list.ts @@ -169,7 +169,7 @@ export class AddonNotificationsListPage implements AfterViewInit, OnDestroy { /** * Mark all notifications as read. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async markAllNotificationsAsRead(): Promise { this.loadingMarkAllNotificationsAsRead = true; @@ -186,7 +186,7 @@ export class AddonNotificationsListPage implements AfterViewInit, OnDestroy { /** * Load mark all notifications as read button. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadMarkAllAsReadButton(): Promise { // Check if mark all as read should be displayed (there are unread notifications). diff --git a/src/addons/notifications/pages/notification/notification.ts b/src/addons/notifications/pages/notification/notification.ts index 153c7f9c7..eea8ff181 100644 --- a/src/addons/notifications/pages/notification/notification.ts +++ b/src/addons/notifications/pages/notification/notification.ts @@ -116,7 +116,7 @@ export class AddonNotificationsNotificationPage implements OnInit, OnDestroy { * Obtain notification by passed id. * * @param notificationId Notification id. - * @return Found notification. + * @returns Found notification. */ getNotificationById(notificationId: number): AddonNotificationsNotification | undefined { const source = CoreRoutedItemsManagerSourcesTracker.getOrCreateSource( @@ -151,7 +151,7 @@ export class AddonNotificationsNotificationPage implements OnInit, OnDestroy { * Load notification actions * * @param notification Notification. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadActions(notification: AddonNotificationsNotification): Promise { if (!notification.contexturl && (!notification.customdata || !notification.customdata.appurl)) { diff --git a/src/addons/notifications/pages/settings/settings.ts b/src/addons/notifications/pages/settings/settings.ts index a9fbe1210..b41f96611 100644 --- a/src/addons/notifications/pages/settings/settings.ts +++ b/src/addons/notifications/pages/settings/settings.ts @@ -67,7 +67,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (this.canChangeSound) { @@ -80,7 +80,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { /** * Fetches preferences data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchPreferences(): Promise { try { @@ -150,7 +150,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { /** * Update preferences. The purpose is to store the updated data, it won't be reflected in the view. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async updatePreferences(): Promise { await CoreUtils.ignoreErrors(AddonNotifications.invalidateNotificationPreferences()); @@ -189,7 +189,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { /** * Open extra preferences. * - * @param handlerData + * @param handlerData The handler data to open. */ openExtraPreferences(handlerData: AddonMessageOutputHandlerData): void { CoreNavigator.navigateToSitePath(handlerData.page, { params: handlerData.pageParams }); @@ -200,7 +200,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { * * @param notification Notification object. * @param state State name, ['loggedin', 'loggedoff']. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changePreferenceLegacy(notification: AddonNotificationsPreferencesNotificationFormatted, state: string): Promise { const processor = notification.processorsByName?.[this.currentProcessorName]; @@ -240,7 +240,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { * Change the value of a certain preference. * * @param notification Notification object. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changePreference(notification: AddonNotificationsPreferencesNotificationFormatted): Promise { const processor = notification.processorsByName?.[this.currentProcessorName]; @@ -279,7 +279,7 @@ export class AddonNotificationsSettingsPage implements OnInit, OnDestroy { * Enable all notifications changed. * * @param enable Whether to enable or disable. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async enableAll(enable?: boolean): Promise { if (!this.preferences) { diff --git a/src/addons/notifications/services/handlers/cron.ts b/src/addons/notifications/services/handlers/cron.ts index 882978cc7..eebd2e1cb 100644 --- a/src/addons/notifications/services/handlers/cron.ts +++ b/src/addons/notifications/services/handlers/cron.ts @@ -32,7 +32,7 @@ export class AddonNotificationsCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return CorePlatform.isMobile() ? 600000 : 60000; // 1 or 10 minutes. @@ -41,7 +41,7 @@ export class AddonNotificationsCronHandlerService implements CoreCronHandler { /** * Check whether it's a synchronization process or not. True if not defined. * - * @return Whether it's a synchronization process or not. + * @returns Whether it's a synchronization process or not. */ isSync(): boolean { return false; @@ -50,7 +50,7 @@ export class AddonNotificationsCronHandlerService implements CoreCronHandler { /** * Check whether the sync can be executed manually. Call isSync if not defined. * - * @return Whether the sync can be executed manually. + * @returns Whether the sync can be executed manually. */ canManualSync(): boolean { return true; @@ -62,7 +62,7 @@ export class AddonNotificationsCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. If the promise is rejected, this function + * @returns Promise resolved when done, rejected if failure. If the promise is rejected, this function * will be called again often, it shouldn't be abused. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/addons/notifications/services/handlers/mainmenu.ts b/src/addons/notifications/services/handlers/mainmenu.ts index de21bc147..ddf7ce72d 100644 --- a/src/addons/notifications/services/handlers/mainmenu.ts +++ b/src/addons/notifications/services/handlers/mainmenu.ts @@ -79,7 +79,7 @@ export class AddonNotificationsMainMenuHandlerService implements CoreMainMenuHan /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; @@ -88,7 +88,7 @@ export class AddonNotificationsMainMenuHandlerService implements CoreMainMenuHan /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreMainMenuHandlerData { if (this.handlerData.loading) { @@ -102,7 +102,7 @@ export class AddonNotificationsMainMenuHandlerService implements CoreMainMenuHan * Triggers an update for the badge number and loading status. Mandatory if showBadge is enabled. * * @param siteId Site ID or current Site if undefined. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async updateBadge(siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/addons/notifications/services/handlers/push-click.ts b/src/addons/notifications/services/handlers/push-click.ts index 28e6de9b9..197ac86b8 100644 --- a/src/addons/notifications/services/handlers/push-click.ts +++ b/src/addons/notifications/services/handlers/push-click.ts @@ -39,7 +39,7 @@ export class AddonNotificationsPushClickHandlerService implements CorePushNotifi * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: AddonNotificationsNotificationData): Promise { if (!notification.moodlecomponent) { @@ -61,7 +61,7 @@ export class AddonNotificationsPushClickHandlerService implements CorePushNotifi * Mark the notification as read. * * @param notification Notification to mark. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async markAsRead(notification: AddonNotificationsNotificationData): Promise { await CoreUtils.ignoreErrors(AddonNotificationsHelper.markNotificationAsRead(notification)); @@ -71,7 +71,7 @@ export class AddonNotificationsPushClickHandlerService implements CorePushNotifi * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: AddonNotificationsNotificationData): Promise { diff --git a/src/addons/notifications/services/handlers/settings.ts b/src/addons/notifications/services/handlers/settings.ts index fad86d300..9c7ba2d7b 100644 --- a/src/addons/notifications/services/handlers/settings.ts +++ b/src/addons/notifications/services/handlers/settings.ts @@ -31,7 +31,7 @@ export class AddonNotificationsSettingsHandlerService implements CoreSettingsHan /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; @@ -40,7 +40,7 @@ export class AddonNotificationsSettingsHandlerService implements CoreSettingsHan /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/addons/notifications/services/notifications-helper.ts b/src/addons/notifications/services/notifications-helper.ts index 38d79ddc6..6dec099d1 100644 --- a/src/addons/notifications/services/notifications-helper.ts +++ b/src/addons/notifications/services/notifications-helper.ts @@ -41,6 +41,7 @@ export class AddonNotificationsHelperProvider { * Formats the text of a notification. * * @param notification The notification object. + * @returns The notification formatted to render. */ formatNotificationText( notification: AddonNotificationsNotificationMessageFormatted, @@ -64,7 +65,7 @@ export class AddonNotificationsHelperProvider { * Format preferences data. * * @param preferences Preferences to format. - * @return Formatted preferences. + * @returns Formatted preferences. */ formatPreferences(preferences: AddonNotificationsPreferences): AddonNotificationsPreferencesFormatted { const formattedPreferences: AddonNotificationsPreferencesFormatted = preferences; @@ -87,7 +88,7 @@ export class AddonNotificationsHelperProvider { * * @param processorName Name of the processor to filter. * @param components Array of components. - * @return Filtered components. + * @returns Filtered components. */ getProcessorComponents( processorName: string, @@ -124,7 +125,7 @@ export class AddonNotificationsHelperProvider { * Mark notification as read, trigger event and invalidate data. * * @param notification Notification object. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async markNotificationAsRead( notification: AddonNotificationsNotificationMessageFormatted | AddonNotificationsNotificationData, diff --git a/src/addons/notifications/services/notifications.ts b/src/addons/notifications/services/notifications.ts index 1b29afa61..3e7e3f715 100644 --- a/src/addons/notifications/services/notifications.ts +++ b/src/addons/notifications/services/notifications.ts @@ -60,7 +60,7 @@ export class AddonNotificationsProvider { * Function to format notification data. * * @param notifications List of notifications. - * @return Promise resolved with notifications. + * @returns Promise resolved with notifications. */ protected async formatNotificationsData( notifications: AddonNotificationsNotificationMessage[], @@ -119,7 +119,7 @@ export class AddonNotificationsProvider { /** * Get the cache key for the get notification preferences call. * - * @return Cache key. + * @returns Cache key. */ protected getNotificationPreferencesCacheKey(): string { return ROOT_CACHE_KEY + 'notificationPreferences'; @@ -129,7 +129,7 @@ export class AddonNotificationsProvider { * Get notification preferences. * * @param options Options. - * @return Promise resolved with the notification preferences. + * @returns Promise resolved with the notification preferences. */ async getNotificationPreferences(options: CoreSitesCommonWSOptions = {}): Promise { this.logger.debug('Get notification preferences'); @@ -153,7 +153,7 @@ export class AddonNotificationsProvider { /** * Get cache key for notification list WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getNotificationsCacheKey(): string { return ROOT_CACHE_KEY + 'list'; @@ -164,7 +164,7 @@ export class AddonNotificationsProvider { * * @param notifications Current list of loaded notifications. It's used to calculate the offset. * @param options Other options. - * @return Promise resolved with notifications and if can load more. + * @returns Promise resolved with notifications and if can load more. * @deprecated since 4.1. Use getNotificationsWithStatus instead. */ async getNotifications( @@ -230,7 +230,7 @@ export class AddonNotificationsProvider { * * @param read True if should get read notifications, false otherwise. * @param options Other options. - * @return Promise resolved with notifications. + * @returns Promise resolved with notifications. */ async getNotificationsWithStatus( read: AddonNotificationsGetReadType, @@ -273,7 +273,7 @@ export class AddonNotificationsProvider { * * @param userId The user id who received the notification. If not defined, use current user. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the message notifications count. + * @returns Promise resolved with the message notifications count. */ async getUnreadNotificationsCount(userId?: number, siteId?: string): Promise<{ count: number; hasMore: boolean} > { const site = await CoreSites.getSite(siteId); @@ -330,7 +330,7 @@ export class AddonNotificationsProvider { * Get cache key for unread notifications count WS calls. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getUnreadNotificationsCountCacheKey(userId: number): string { return `${ROOT_CACHE_KEY}count:${userId}`; @@ -339,7 +339,7 @@ export class AddonNotificationsProvider { /** * Mark all message notification as read. * - * @return Resolved when done. + * @returns Resolved when done. */ async markAllNotificationsAsRead(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -356,7 +356,7 @@ export class AddonNotificationsProvider { * * @param notificationId ID of notification to mark as read * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async markNotificationRead( notificationId: number, @@ -377,7 +377,7 @@ export class AddonNotificationsProvider { * Invalidate get notification preferences. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when data is invalidated. + * @returns Promise resolved when data is invalidated. */ async invalidateNotificationPreferences(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -389,7 +389,7 @@ export class AddonNotificationsProvider { * Invalidates notifications list WS calls. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the list is invalidated. + * @returns Promise resolved when the list is invalidated. */ async invalidateNotificationsList(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/privatefiles/pages/index/index.ts b/src/addons/privatefiles/pages/index/index.ts index ecd8bcfe5..6cf24b9f7 100644 --- a/src/addons/privatefiles/pages/index/index.ts +++ b/src/addons/privatefiles/pages/index/index.ts @@ -66,7 +66,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { try { @@ -127,9 +127,9 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy { * * @param refresher Refresher. */ - refreshData(event?: IonRefresher): void { + refreshData(refresher?: IonRefresher): void { this.refreshFiles().finally(() => { - event?.complete(); + refresher?.complete(); }); } @@ -177,7 +177,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy { /** * Fetch the files. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchFiles(): Promise { try { @@ -220,7 +220,7 @@ export class AddonPrivateFilesIndexPage implements OnInit, OnDestroy { /** * Refresh the displayed files. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async refreshFiles(): Promise { try { diff --git a/src/addons/privatefiles/services/privatefiles-helper.ts b/src/addons/privatefiles/services/privatefiles-helper.ts index e4032e01a..a00f2bd94 100644 --- a/src/addons/privatefiles/services/privatefiles-helper.ts +++ b/src/addons/privatefiles/services/privatefiles-helper.ts @@ -31,7 +31,7 @@ export class AddonPrivateFilesHelperProvider { * Select a file, upload it and move it to private files. * * @param info Private files info. See AddonPrivateFilesProvider.getPrivateFilesInfo. - * @return Promise resolved when a file is uploaded, rejected otherwise. + * @returns Promise resolved when a file is uploaded, rejected otherwise. */ async uploadPrivateFile(info?: AddonPrivateFilesGetUserInfoWSResult): Promise { // Calculate the max size. diff --git a/src/addons/privatefiles/services/privatefiles.ts b/src/addons/privatefiles/services/privatefiles.ts index 49c29eafc..d1194fdba 100644 --- a/src/addons/privatefiles/services/privatefiles.ts +++ b/src/addons/privatefiles/services/privatefiles.ts @@ -35,7 +35,7 @@ export class AddonPrivateFilesProvider { /** * Check if user can view his private files. * - * @return Whether the user can view his private files. + * @returns Whether the user can view his private files. */ canViewPrivateFiles(): boolean { const currentSite = CoreSites.getCurrentSite(); @@ -49,7 +49,7 @@ export class AddonPrivateFilesProvider { /** * Check if user can view site files. * - * @return Whether the user can view site files. + * @returns Whether the user can view site files. */ canViewSiteFiles(): boolean { return !this.isSiteFilesDisabledInSite(); @@ -58,7 +58,7 @@ export class AddonPrivateFilesProvider { /** * Check if user can upload private files. * - * @return Whether the user can upload private files. + * @returns Whether the user can upload private files. */ canUploadFiles(): boolean { const currentSite = CoreSites.getCurrentSite(); @@ -74,7 +74,7 @@ export class AddonPrivateFilesProvider { * * @param params A list of parameters accepted by the Web service. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getFiles(params: AddonPrivateFilesGetFilesWSParams, siteId?: string): Promise { @@ -109,7 +109,7 @@ export class AddonPrivateFilesProvider { * Get cache key for file list WS calls. * * @param params Params of the WS. - * @return Cache key. + * @returns Cache key. */ protected getFilesListCacheKey(params: AddonPrivateFilesGetFilesWSParams): string { const root = !params.component ? 'site' : 'my'; @@ -120,7 +120,7 @@ export class AddonPrivateFilesProvider { /** * Get the private files of the current user. * - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ getPrivateFiles(): Promise { return this.getFiles(this.getPrivateFilesRootParams()); @@ -129,7 +129,7 @@ export class AddonPrivateFilesProvider { /** * Get params to get root private files directory. * - * @return Params. + * @returns Params. */ protected getPrivateFilesRootParams(): AddonPrivateFilesGetFilesWSParams { return { @@ -149,7 +149,7 @@ export class AddonPrivateFilesProvider { * * @param userId User ID. If not defined, current user in the site. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the info. + * @returns Promise resolved with the info. */ async getPrivateFilesInfo(userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -171,7 +171,7 @@ export class AddonPrivateFilesProvider { * Get the cache key for private files info WS calls. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getPrivateFilesInfoCacheKey(userId: number): string { return this.getPrivateFilesInfoCommonCacheKey() + ':' + userId; @@ -180,7 +180,7 @@ export class AddonPrivateFilesProvider { /** * Get the common part of the cache keys for private files info WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getPrivateFilesInfoCommonCacheKey(): string { return ROOT_CACHE_KEY + 'privateInfo'; @@ -189,7 +189,7 @@ export class AddonPrivateFilesProvider { /** * Get the site files. * - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ getSiteFiles(): Promise { return this.getFiles(this.getSiteFilesRootParams()); @@ -198,7 +198,7 @@ export class AddonPrivateFilesProvider { /** * Get params to get root site files directory. * - * @return Params. + * @returns Params. */ protected getSiteFilesRootParams(): AddonPrivateFilesGetFilesWSParams { return { @@ -217,7 +217,7 @@ export class AddonPrivateFilesProvider { * @param root Root of the directory ('my' for private files, 'site' for site files). * @param params Params to the directory. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDirectory(root?: 'my' | 'site', params?: AddonPrivateFilesGetFilesWSParams, siteId?: string): Promise { if (!root) { @@ -241,7 +241,7 @@ export class AddonPrivateFilesProvider { * Invalidates private files info for all users. * * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePrivateFilesInfo(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -254,7 +254,7 @@ export class AddonPrivateFilesProvider { * * @param userId User ID. If not defined, current user in the site. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidatePrivateFilesInfoForUser(userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -266,7 +266,7 @@ export class AddonPrivateFilesProvider { * Check if Files is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -278,7 +278,7 @@ export class AddonPrivateFilesProvider { * Check if Files is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isDisabledInSite(site: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -289,7 +289,7 @@ export class AddonPrivateFilesProvider { /** * Return whether or not the plugin is enabled. * - * @return True if enabled, false otherwise. + * @returns True if enabled, false otherwise. */ isPluginEnabled(): boolean { return this.canViewPrivateFiles() || this.canViewSiteFiles() || this.canUploadFiles(); @@ -299,7 +299,7 @@ export class AddonPrivateFilesProvider { * Check if private files is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isPrivateFilesDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -311,7 +311,7 @@ export class AddonPrivateFilesProvider { * Check if private files is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isPrivateFilesDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -323,7 +323,7 @@ export class AddonPrivateFilesProvider { * Check if site files is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isSiteFilesDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -335,7 +335,7 @@ export class AddonPrivateFilesProvider { * Check if site files is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isSiteFilesDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -347,7 +347,7 @@ export class AddonPrivateFilesProvider { * Check if upload files is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isUploadDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -359,7 +359,7 @@ export class AddonPrivateFilesProvider { * Check if upload files is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isUploadDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -371,8 +371,8 @@ export class AddonPrivateFilesProvider { * Move a file from draft area to private files. * * @param draftId The draft area ID of the file. - * @param siteid ID of the site. If not defined, use current site. - * @return Promise resolved in success, rejected otherwise. + * @param siteId ID of the site. If not defined, use current site. + * @returns Promise resolved in success, rejected otherwise. */ async moveFromDraftToPrivate(draftId: number, siteId?: string): Promise { const params: AddonPrivateFilesAddUserPrivateFilesWSParams = { diff --git a/src/addons/qbehaviour/adaptive/services/handlers/adaptive.ts b/src/addons/qbehaviour/adaptive/services/handlers/adaptive.ts index 9829fb062..7819ed1b8 100644 --- a/src/addons/qbehaviour/adaptive/services/handlers/adaptive.ts +++ b/src/addons/qbehaviour/adaptive/services/handlers/adaptive.ts @@ -29,13 +29,7 @@ export class AddonQbehaviourAdaptiveHandlerService implements CoreQuestionBehavi type = 'adaptive'; /** - * Handle a question behaviour. - * If the behaviour requires a submit button, it should add it to question.behaviourButtons. - * If the behaviour requires to show some extra data, it should return the components to render it. - * - * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @inheritdoc */ handleQuestion(question: CoreQuestionQuestionParsed): void { // Just extract the button, it doesn't need any specific component. @@ -43,9 +37,7 @@ export class AddonQbehaviourAdaptiveHandlerService implements CoreQuestionBehavi } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/adaptivenopenalty/services/handlers/adaptivenopenalty.ts b/src/addons/qbehaviour/adaptivenopenalty/services/handlers/adaptivenopenalty.ts index 9c9abc641..675cd37e1 100644 --- a/src/addons/qbehaviour/adaptivenopenalty/services/handlers/adaptivenopenalty.ts +++ b/src/addons/qbehaviour/adaptivenopenalty/services/handlers/adaptivenopenalty.ts @@ -29,13 +29,7 @@ export class AddonQbehaviourAdaptiveNoPenaltyHandlerService implements CoreQuest type = 'adaptivenopenalty'; /** - * Handle a question behaviour. - * If the behaviour requires a submit button, it should add it to question.behaviourButtons. - * If the behaviour requires to show some extra data, it should return the components to render it. - * - * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @inheritdoc */ handleQuestion(question: CoreQuestionQuestionParsed): void { // Just extract the button, it doesn't need any specific component. @@ -43,9 +37,7 @@ export class AddonQbehaviourAdaptiveNoPenaltyHandlerService implements CoreQuest } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/deferredcbm/services/handlers/deferredcbm.ts b/src/addons/qbehaviour/deferredcbm/services/handlers/deferredcbm.ts index f5d3edec2..f7eabd3ea 100644 --- a/src/addons/qbehaviour/deferredcbm/services/handlers/deferredcbm.ts +++ b/src/addons/qbehaviour/deferredcbm/services/handlers/deferredcbm.ts @@ -39,7 +39,7 @@ export class AddonQbehaviourDeferredCBMHandlerService implements CoreQuestionBeh * @param question The question. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return New state (or promise resolved with state). + * @returns New state (or promise resolved with state). */ determineNewState( component: string, @@ -66,7 +66,7 @@ export class AddonQbehaviourDeferredCBMHandlerService implements CoreQuestionBeh * If the behaviour requires to show some extra data, it should return the components to render it. * * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question + * @returns Components (or promise resolved with components) to render some extra data in the question * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(question: CoreQuestionQuestionParsed): void | Type[] { @@ -82,7 +82,7 @@ export class AddonQbehaviourDeferredCBMHandlerService implements CoreQuestionBeh * @param answers Object with the question answers (without prefix). * @param component The component the question is related to. * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @returns 1 if complete, 0 if not complete, -1 if cannot determine. */ protected isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -103,7 +103,7 @@ export class AddonQbehaviourDeferredCBMHandlerService implements CoreQuestionBeh /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -119,7 +119,7 @@ export class AddonQbehaviourDeferredCBMHandlerService implements CoreQuestionBeh * @param newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). * @param component The component the question is related to. * @param componentId Component ID. - * @return Whether they're the same. + * @returns Whether they're the same. */ protected isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qbehaviour/deferredfeedback/services/handlers/deferredfeedback.ts b/src/addons/qbehaviour/deferredfeedback/services/handlers/deferredfeedback.ts index 4aa1d011c..c0cc4ab23 100644 --- a/src/addons/qbehaviour/deferredfeedback/services/handlers/deferredfeedback.ts +++ b/src/addons/qbehaviour/deferredfeedback/services/handlers/deferredfeedback.ts @@ -42,7 +42,7 @@ export class AddonQbehaviourDeferredFeedbackHandlerService implements CoreQuesti * @param question The question. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return New state (or promise resolved with state). + * @returns New state (or promise resolved with state). */ determineNewState( component: string, @@ -64,7 +64,7 @@ export class AddonQbehaviourDeferredFeedbackHandlerService implements CoreQuesti * @param siteId Site ID. If not defined, current site. * @param isCompleteFn Function to override the default isCompleteResponse check. * @param isSameFn Function to override the default isSameResponse check. - * @return Promise resolved with state. + * @returns Promise resolved with state. */ async determineNewStateDeferred( component: string, @@ -166,7 +166,7 @@ export class AddonQbehaviourDeferredFeedbackHandlerService implements CoreQuesti /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -183,7 +183,7 @@ export const AddonQbehaviourDeferredFeedbackHandler = makeSingleton(AddonQbehavi * @param answers Object with the question answers (without prefix). * @param component The component the question is related to. * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @returns 1 if complete, 0 if not complete, -1 if cannot determine. */ export type isCompleteResponseFunction = ( question: CoreQuestionQuestionParsed, @@ -202,7 +202,7 @@ export type isCompleteResponseFunction = ( * @param newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). * @param component The component the question is related to. * @param componentId Component ID. - * @return Whether they're the same. + * @returns Whether they're the same. */ export type isSameResponseFunction = ( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qbehaviour/immediatecbm/services/handlers/immediatecbm.ts b/src/addons/qbehaviour/immediatecbm/services/handlers/immediatecbm.ts index 6037d96d7..de16a549c 100644 --- a/src/addons/qbehaviour/immediatecbm/services/handlers/immediatecbm.ts +++ b/src/addons/qbehaviour/immediatecbm/services/handlers/immediatecbm.ts @@ -35,7 +35,7 @@ export class AddonQbehaviourImmediateCBMHandlerService implements CoreQuestionBe * If the behaviour requires to show some extra data, it should return the components to render it. * * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question + * @returns Components (or promise resolved with components) to render some extra data in the question * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(question: CoreQuestionQuestionParsed): void | Type[] { @@ -50,7 +50,7 @@ export class AddonQbehaviourImmediateCBMHandlerService implements CoreQuestionBe /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/immediatefeedback/services/handlers/immediatefeedback.ts b/src/addons/qbehaviour/immediatefeedback/services/handlers/immediatefeedback.ts index 5e1f6b638..e2ec35ce3 100644 --- a/src/addons/qbehaviour/immediatefeedback/services/handlers/immediatefeedback.ts +++ b/src/addons/qbehaviour/immediatefeedback/services/handlers/immediatefeedback.ts @@ -29,13 +29,7 @@ export class AddonQbehaviourImmediateFeedbackHandlerService implements CoreQuest type = 'immediatefeedback'; /** - * Handle a question behaviour. - * If the behaviour requires a submit button, it should add it to question.behaviourButtons. - * If the behaviour requires to show some extra data, it should return the components to render it. - * - * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @inheritdoc */ handleQuestion(question: CoreQuestionQuestionParsed): void { // Just extract the button, it doesn't need any specific component. @@ -45,9 +39,7 @@ export class AddonQbehaviourImmediateFeedbackHandlerService implements CoreQuest } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/informationitem/services/handlers/informationitem.ts b/src/addons/qbehaviour/informationitem/services/handlers/informationitem.ts index a6e2b61aa..67182e14e 100644 --- a/src/addons/qbehaviour/informationitem/services/handlers/informationitem.ts +++ b/src/addons/qbehaviour/informationitem/services/handlers/informationitem.ts @@ -30,14 +30,7 @@ export class AddonQbehaviourInformationItemHandlerService implements CoreQuestio type = 'informationitem'; /** - * Determine a question new state based on its answer(s). - * - * @param component Component the question belongs to. - * @param attemptId Attempt ID the question belongs to. - * @param question The question. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return New state (or promise resolved with state). + * @inheritdoc */ determineNewState( component: string, @@ -52,13 +45,7 @@ export class AddonQbehaviourInformationItemHandlerService implements CoreQuestio } /** - * Handle a question behaviour. - * If the behaviour requires a submit button, it should add it to question.behaviourButtons. - * If the behaviour requires to show some extra data, it should return the components to render it. - * - * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @inheritdoc */ handleQuestion(question: CoreQuestionQuestionParsed): void | Type[] { if (CoreQuestionHelper.extractQbehaviourSeenInput(question)) { @@ -67,9 +54,7 @@ export class AddonQbehaviourInformationItemHandlerService implements CoreQuestio } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/interactive/services/handlers/interactive.ts b/src/addons/qbehaviour/interactive/services/handlers/interactive.ts index 410144893..ae269bea0 100644 --- a/src/addons/qbehaviour/interactive/services/handlers/interactive.ts +++ b/src/addons/qbehaviour/interactive/services/handlers/interactive.ts @@ -29,13 +29,7 @@ export class AddonQbehaviourInteractiveHandlerService implements CoreQuestionBeh type = 'interactive'; /** - * Handle a question behaviour. - * If the behaviour requires a submit button, it should add it to question.behaviourButtons. - * If the behaviour requires to show some extra data, it should return the components to render it. - * - * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @inheritdoc */ handleQuestion(question: CoreQuestionQuestionParsed): void { // Just extract the button, it doesn't need any specific component. @@ -43,9 +37,7 @@ export class AddonQbehaviourInteractiveHandlerService implements CoreQuestionBeh } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/interactivecountback/services/handlers/interactivecountback.ts b/src/addons/qbehaviour/interactivecountback/services/handlers/interactivecountback.ts index 5edc89f41..0f4382149 100644 --- a/src/addons/qbehaviour/interactivecountback/services/handlers/interactivecountback.ts +++ b/src/addons/qbehaviour/interactivecountback/services/handlers/interactivecountback.ts @@ -29,13 +29,7 @@ export class AddonQbehaviourInteractiveCountbackHandlerService implements CoreQu type = 'interactivecountback'; /** - * Handle a question behaviour. - * If the behaviour requires a submit button, it should add it to question.behaviourButtons. - * If the behaviour requires to show some extra data, it should return the components to render it. - * - * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @inheritdoc */ handleQuestion(question: CoreQuestionQuestionParsed): void { // Just extract the button, it doesn't need any specific component. @@ -43,9 +37,7 @@ export class AddonQbehaviourInteractiveCountbackHandlerService implements CoreQu } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; diff --git a/src/addons/qbehaviour/manualgraded/services/handlers/manualgraded.ts b/src/addons/qbehaviour/manualgraded/services/handlers/manualgraded.ts index 59ec623f5..cc2e6b3e0 100644 --- a/src/addons/qbehaviour/manualgraded/services/handlers/manualgraded.ts +++ b/src/addons/qbehaviour/manualgraded/services/handlers/manualgraded.ts @@ -36,7 +36,7 @@ export class AddonQbehaviourManualGradedHandlerService implements CoreQuestionBe * @param question The question. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return New state (or promise resolved with state). + * @returns New state (or promise resolved with state). */ determineNewState( component: string, @@ -58,7 +58,7 @@ export class AddonQbehaviourManualGradedHandlerService implements CoreQuestionBe /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; diff --git a/src/addons/qtype/calculated/component/calculated.ts b/src/addons/qtype/calculated/component/calculated.ts index 5a3aff42d..5543ab34e 100644 --- a/src/addons/qtype/calculated/component/calculated.ts +++ b/src/addons/qtype/calculated/component/calculated.ts @@ -32,7 +32,7 @@ export class AddonQtypeCalculatedComponent extends CoreQuestionBaseComponent imp } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initCalculatedComponent(); diff --git a/src/addons/qtype/calculated/services/handlers/calculated.ts b/src/addons/qtype/calculated/services/handlers/calculated.ts index 887a5ff24..58f6ac24a 100644 --- a/src/addons/qtype/calculated/services/handlers/calculated.ts +++ b/src/addons/qtype/calculated/services/handlers/calculated.ts @@ -39,11 +39,7 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { type = 'qtype_calculated'; /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeCalculatedComponent; @@ -53,7 +49,7 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { * Check if the units are in a separate field for the question. * * @param question Question. - * @return Whether units are in a separate field. + * @returns Whether units are in a separate field. */ hasSeparateUnitField(question: CoreQuestionQuestionParsed): boolean { if (!question.parsedSettings) { @@ -67,21 +63,13 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { - if (!this.isGradableResponse(question, answers, component, componentId)) { + if (!this.isGradableResponse(question, answers)) { return 0; } @@ -120,49 +108,29 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, // eslint-disable-line @typescript-eslint/no-unused-vars - componentId: string | number, // eslint-disable-line @typescript-eslint/no-unused-vars ): number { return this.isValidValue( answers.answer) ? 1 : 0; } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, prevAnswers: CoreQuestionsAnswers, newAnswers: CoreQuestionsAnswers, - component: string, // eslint-disable-line @typescript-eslint/no-unused-vars - componentId: string | number, // eslint-disable-line @typescript-eslint/no-unused-vars ): boolean { return CoreUtils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer') && CoreUtils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'unit'); @@ -172,7 +140,7 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { * Check if a value is valid (not empty). * * @param value Value to check. - * @return Whether the value is valid. + * @returns Whether the value is valid. */ isValidValue(value: string | number | null): boolean { return !!value || value === '0' || value === 0; @@ -183,7 +151,7 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { * * @param question Question. * @param answer Answer. - * @return Answer and unit. + * @returns Answer and unit. */ parseAnswer(question: CoreQuestionQuestionParsed, answer: string): { answer: number | null; unit: string | null } { if (!answer) { diff --git a/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts b/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts index 100beb0f7..65abda13a 100644 --- a/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts +++ b/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts @@ -30,11 +30,7 @@ export class AddonQtypeCalculatedMultiHandlerService implements CoreQuestionHand type = 'qtype_calculatedmulti'; /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { // Calculated multi behaves like a multichoice, use the same component. @@ -42,13 +38,7 @@ export class AddonQtypeCalculatedMultiHandlerService implements CoreQuestionHand } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -59,23 +49,14 @@ export class AddonQtypeCalculatedMultiHandlerService implements CoreQuestionHand } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -86,14 +67,7 @@ export class AddonQtypeCalculatedMultiHandlerService implements CoreQuestionHand } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts b/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts index 2488af0d7..4a7f60532 100644 --- a/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts +++ b/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts @@ -30,11 +30,7 @@ export class AddonQtypeCalculatedSimpleHandlerService implements CoreQuestionHan type = 'qtype_calculatedsimple'; /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { // Calculated simple behaves like a calculated, use the same component. @@ -42,72 +38,44 @@ export class AddonQtypeCalculatedSimpleHandlerService implements CoreQuestionHan } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { // This question type depends on calculated. - return AddonQtypeCalculatedHandler.isCompleteResponse(question, answers, component, componentId); + return AddonQtypeCalculatedHandler.isCompleteResponse(question, answers); } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { // This question type depends on calculated. - return AddonQtypeCalculatedHandler.isGradableResponse(question, answers, component, componentId); + return AddonQtypeCalculatedHandler.isGradableResponse(question, answers); } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, prevAnswers: CoreQuestionsAnswers, newAnswers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): boolean { // This question type depends on calculated. - return AddonQtypeCalculatedHandler.isSameResponse(question, prevAnswers, newAnswers, component, componentId); + return AddonQtypeCalculatedHandler.isSameResponse(question, prevAnswers, newAnswers); } } diff --git a/src/addons/qtype/ddimageortext/classes/ddimageortext.ts b/src/addons/qtype/ddimageortext/classes/ddimageortext.ts index ad3dc527b..eaacb6a66 100644 --- a/src/addons/qtype/ddimageortext/classes/ddimageortext.ts +++ b/src/addons/qtype/ddimageortext/classes/ddimageortext.ts @@ -70,7 +70,7 @@ export class AddonQtypeDdImageOrTextQuestion { * Convert the X and Y position of the BG IMG to a position relative to the window. * * @param bgImgXY X and Y of the BG IMG relative position. - * @return Position relative to the window. + * @returns Position relative to the window. */ convertToWindowXY(bgImgXY: number[]): number[] { const bgImg = this.doc.bgImg(); @@ -239,7 +239,7 @@ export class AddonQtypeDdImageOrTextQuestion { * * @param choice Choice number. * @param drop Drop zone. - * @return Draggable elements. + * @returns Draggable elements. */ getChoicesForDrop(choice: number, drop: HTMLElement): HTMLElement[] { if (!this.doc.topNode) { @@ -256,7 +256,7 @@ export class AddonQtypeDdImageOrTextQuestion { * * @param choice Choice number. * @param drop Drop zone. - * @return Unplaced draggable element. + * @returns Unplaced draggable element. */ getUnplacedChoiceForDrop(choice: number, drop: HTMLElement): HTMLElement | null { const dragItems = this.getChoicesForDrop(choice, drop); @@ -316,8 +316,6 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Initialize the question. - * - * @param question Question. */ initializer(): void { this.doc = new AddonQtypeDdImageOrTextQuestionDocStructure(this.container, this.question.slot); diff --git a/src/addons/qtype/ddimageortext/component/ddimageortext.ts b/src/addons/qtype/ddimageortext/component/ddimageortext.ts index 993f64f04..c55d7459a 100644 --- a/src/addons/qtype/ddimageortext/component/ddimageortext.ts +++ b/src/addons/qtype/ddimageortext/component/ddimageortext.ts @@ -42,7 +42,7 @@ export class AddonQtypeDdImageOrTextComponent extends CoreQuestionBaseComponent } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (!this.question) { @@ -126,7 +126,7 @@ export class AddonQtypeDdImageOrTextComponent extends CoreQuestionBaseComponent } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.destroyed = true; diff --git a/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts b/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts index 02a0b418a..ad9431be5 100644 --- a/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts +++ b/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts @@ -29,12 +29,7 @@ export class AddonQtypeDdImageOrTextHandlerService implements CoreQuestionHandle type = 'qtype_ddimageortext'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { if (behaviour === 'interactive') { @@ -45,24 +40,14 @@ export class AddonQtypeDdImageOrTextHandlerService implements CoreQuestionHandle } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeDdImageOrTextComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -81,23 +66,14 @@ export class AddonQtypeDdImageOrTextHandlerService implements CoreQuestionHandle } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -114,14 +90,7 @@ export class AddonQtypeDdImageOrTextHandlerService implements CoreQuestionHandle } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qtype/ddmarker/classes/ddmarker.ts b/src/addons/qtype/ddmarker/classes/ddmarker.ts index 667a744d7..e29bd2042 100644 --- a/src/addons/qtype/ddmarker/classes/ddmarker.ts +++ b/src/addons/qtype/ddmarker/classes/ddmarker.ts @@ -83,7 +83,7 @@ export class AddonQtypeDdMarkerQuestion { * * @param dragHome The element to clone. * @param itemNo The number of the new item. - * @return The new element. + * @returns The new element. */ cloneNewDragItem(dragHome: HTMLElement, itemNo: number): HTMLElement { // Clone the element and add the right classes. @@ -107,7 +107,7 @@ export class AddonQtypeDdMarkerQuestion { * Convert the X and Y position of the BG IMG to a position relative to the window. * * @param bgImgXY X and Y of the BG IMG relative position. - * @return Position relative to the window. + * @returns Position relative to the window. */ convertToWindowXY(bgImgXY: string): number[] { const bgImg = this.doc.bgImg(); @@ -127,7 +127,7 @@ export class AddonQtypeDdMarkerQuestion { * Returns elements coordinates relative to ddarea container. * * @param element Element. - * @return Array of X and Y coordinates. + * @returns Array of X and Y coordinates. */ protected getElementCoordinates(element: HTMLElement): number[] { const ddArea = this.container.querySelector('.ddarea'); @@ -144,7 +144,7 @@ export class AddonQtypeDdMarkerQuestion { * Check if some coordinates (X, Y) are inside the background image. * * @param coords Coordinates to check. - * @return Whether they're inside the background image. + * @returns Whether they're inside the background image. */ coordsInImg(coords: CoreCoordinates): boolean { const bgImg = this.doc.bgImg(); @@ -218,7 +218,7 @@ export class AddonQtypeDdMarkerQuestion { * Get the coordinates of the drag home of a certain choice. * * @param choiceNo Choice number. - * @return Coordinates. + * @returns Coordinates. */ dragHomeXY(choiceNo: number): number[] { const dragItemHome = this.doc.dragItemHome(choiceNo); @@ -324,7 +324,7 @@ export class AddonQtypeDdMarkerQuestion { * @param dropZoneNo Number of the drop zone. * @param coordinates Coordinates of the circle. * @param colour Colour of the circle. - * @return X and Y position of the center of the circle. + * @returns X and Y position of the center of the circle. */ drawShapeCircle(dropZoneNo: number, coordinates: string, colour: string): CoreCoordinates | null { if (!coordinates.match(/^\d+(\.\d+)?,\d+(\.\d+)?;\d+(\.\d+)?$/)) { @@ -363,7 +363,7 @@ export class AddonQtypeDdMarkerQuestion { * @param dropZoneNo Number of the drop zone. * @param coordinates Coordinates of the rectangle. * @param colour Colour of the rectangle. - * @return X and Y position of the center of the rectangle. + * @returns X and Y position of the center of the rectangle. */ drawShapeRectangle(dropZoneNo: number, coordinates: string, colour: string): CoreCoordinates | null { if (!coordinates.match(/^\d+(\.\d+)?,\d+(\.\d+)?;\d+(\.\d+)?,\d+(\.\d+)?$/)) { @@ -406,7 +406,7 @@ export class AddonQtypeDdMarkerQuestion { * @param dropZoneNo Number of the drop zone. * @param coordinates Coordinates of the polygon. * @param colour Colour of the polygon. - * @return X and Y position of the center of the polygon. + * @returns X and Y position of the center of the polygon. */ drawShapePolygon(dropZoneNo: number, coordinates: string, colour: string): CoreCoordinates | null { if (!coordinates.match(/^\d+(\.\d+)?,\d+(\.\d+)?(?:;\d+(\.\d+)?,\d+(\.\d+)?)*$/)) { @@ -456,7 +456,7 @@ export class AddonQtypeDdMarkerQuestion { * Make a point from the string representation. * * @param coordinates "x,y". - * @return Coordinates to the point. + * @returns Coordinates to the point. */ parsePoint(coordinates: string): CoreCoordinates { const bits = coordinates.split(','); @@ -471,7 +471,7 @@ export class AddonQtypeDdMarkerQuestion { * Make proportional position of the point. * * @param point Point coordinates. - * @return Converted point. + * @returns Converted point. */ makePointProportional(point: CoreCoordinates): CoreCoordinates { return { @@ -507,7 +507,7 @@ export class AddonQtypeDdMarkerQuestion { * dragged based on contents of hidden inputs and whether drags are 'infinite' or how many drags should be shown. * * @param input The input element. - * @return List of coordinates. + * @returns List of coordinates. */ getCoords(input: HTMLElement): number[][] { const choiceNo = this.getChoiceNoForNode(input); @@ -538,7 +538,7 @@ export class AddonQtypeDdMarkerQuestion { * Get the choice number from an HTML element. * * @param node Element to check. - * @return Choice number. + * @returns Choice number. */ getChoiceNoForNode(node: HTMLElement): number { return Number(this.doc.getClassnameNumericSuffix(node, 'choice')); @@ -548,7 +548,7 @@ export class AddonQtypeDdMarkerQuestion { * Get the coordinates (X, Y) of a draggable element. * * @param dragItem The draggable item. - * @return Coordinates. + * @returns Coordinates. */ getDragXY(dragItem: HTMLElement): number[] { const position = this.getElementCoordinates(dragItem); @@ -573,7 +573,7 @@ export class AddonQtypeDdMarkerQuestion { * Get the item number from an HTML element. * * @param node Element to check. - * @return Choice number. + * @returns Choice number. */ getItemNoForNode(node: HTMLElement): number { return Number(this.doc.getClassnameNumericSuffix(node, 'item')); @@ -582,7 +582,7 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the next colour. * - * @return Colour. + * @returns Colour. */ getNextColour(): string { const colour = this.COLOURS[this.nextColourIndex]; @@ -600,7 +600,7 @@ export class AddonQtypeDdMarkerQuestion { * Get the number of drags from an HTML element. * * @param node Element to check. - * @return Choice number. + * @returns Choice number. */ getNoOfDragsForNode(node: HTMLElement): number { return Number(this.doc.getClassnameNumericSuffix(node, 'noofdrags')); @@ -608,8 +608,6 @@ export class AddonQtypeDdMarkerQuestion { /** * Initialize the question. - * - * @param question Question. */ initializer(): void { this.doc = new AddonQtypeDdMarkerQuestionDocStructure(this.container); diff --git a/src/addons/qtype/ddmarker/classes/graphics_api.ts b/src/addons/qtype/ddmarker/classes/graphics_api.ts index 4b865f6c0..c071fc8f0 100644 --- a/src/addons/qtype/ddmarker/classes/graphics_api.ts +++ b/src/addons/qtype/ddmarker/classes/graphics_api.ts @@ -30,7 +30,7 @@ export class AddonQtypeDdMarkerGraphicsApi { * * @param shapeAttribs Attributes for the shape: type and color. * @param styles Object with the styles for the shape (name -> value). - * @return The new shape. + * @returns The new shape. */ addShape(shapeAttribs: {type: string; color: string}, styles: {[name: string]: number | string}): SVGElement { const shape = document.createElementNS(this.NS, shapeAttribs.type); diff --git a/src/addons/qtype/ddmarker/component/ddmarker.ts b/src/addons/qtype/ddmarker/component/ddmarker.ts index 27bd8ca14..56aea8ac5 100644 --- a/src/addons/qtype/ddmarker/component/ddmarker.ts +++ b/src/addons/qtype/ddmarker/component/ddmarker.ts @@ -47,7 +47,7 @@ export class AddonQtypeDdMarkerComponent extends CoreQuestionBaseComponent imple } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (!this.question) { @@ -168,7 +168,7 @@ export class AddonQtypeDdMarkerComponent extends CoreQuestionBaseComponent imple } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.destroyed = true; diff --git a/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts b/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts index eb74174dc..03ce4ff7a 100644 --- a/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts +++ b/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts @@ -31,12 +31,7 @@ export class AddonQtypeDdMarkerHandlerService implements CoreQuestionHandler { type = 'qtype_ddmarker'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { if (behaviour === 'interactive') { @@ -47,30 +42,18 @@ export class AddonQtypeDdMarkerHandlerService implements CoreQuestionHandler { } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeDdMarkerComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, // eslint-disable-line @typescript-eslint/no-unused-vars - componentId: string | number, // eslint-disable-line @typescript-eslint/no-unused-vars ): number { // If 1 dragitem is set we assume the answer is complete (like Moodle does). for (const name in answers) { @@ -83,42 +66,24 @@ export class AddonQtypeDdMarkerHandlerService implements CoreQuestionHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { - return this.isCompleteResponse(question, answers, component, componentId); + return this.isCompleteResponse(question, answers); } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, @@ -129,11 +94,7 @@ export class AddonQtypeDdMarkerHandlerService implements CoreQuestionHandler { } /** - * Get the list of files that needs to be downloaded in addition to the files embedded in the HTML. - * - * @param question Question. - * @param usageId Usage ID. - * @return List of files or URLs. + * @inheritdoc */ getAdditionalDownloadableFiles(question: CoreQuestionQuestionParsed, usageId?: number): CoreWSFile[] { const treatedQuestion: CoreQuestionQuestion = question; diff --git a/src/addons/qtype/ddwtos/classes/ddwtos.ts b/src/addons/qtype/ddwtos/classes/ddwtos.ts index 8c04a3505..152b38766 100644 --- a/src/addons/qtype/ddwtos/classes/ddwtos.ts +++ b/src/addons/qtype/ddwtos/classes/ddwtos.ts @@ -130,7 +130,7 @@ export class AddonQtypeDdwtosQuestion { * Get the choice number of an element. It is extracted from the classes. * * @param node Element to check. - * @return Choice number. + * @returns Choice number. */ getChoice(node: HTMLElement | null): number | undefined { return this.getClassnameNumericSuffix(node, 'choice'); @@ -141,7 +141,7 @@ export class AddonQtypeDdwtosQuestion { * * @param node The element to check. * @param prefix Prefix of the class to check. - * @return The number in the class. + * @returns The number in the class. */ getClassnameNumericSuffix(node: HTMLElement | null, prefix: string): number | undefined { if (node?.classList.length) { @@ -164,7 +164,7 @@ export class AddonQtypeDdwtosQuestion { * Get the group number of an element. It is extracted from the classes. * * @param node Element to check. - * @return Group number. + * @returns Group number. */ getGroup(node: HTMLElement | null): number | undefined { return this.getClassnameNumericSuffix(node, 'group'); @@ -174,7 +174,7 @@ export class AddonQtypeDdwtosQuestion { * Get the number of an element ('no'). It is extracted from the classes. * * @param node Element to check. - * @return Number. + * @returns Number. */ getNo(node: HTMLElement | null): number | undefined { return this.getClassnameNumericSuffix(node, 'no'); @@ -184,7 +184,7 @@ export class AddonQtypeDdwtosQuestion { * Get the place number of an element. It is extracted from the classes. * * @param node Element to check. - * @return Place number. + * @returns Place number. */ getPlace(node: HTMLElement | null): number | undefined { return this.getClassnameNumericSuffix(node, 'place'); @@ -422,7 +422,7 @@ export class AddonQtypeDdwtosQuestion { /** * Wait for the drag home items to be in DOM. * - * @return Promise resolved when ready in the DOM. + * @returns Promise resolved when ready in the DOM. */ protected async waitForReady(): Promise { await CoreDom.waitToBeInDOM(this.container); diff --git a/src/addons/qtype/ddwtos/component/ddwtos.ts b/src/addons/qtype/ddwtos/component/ddwtos.ts index befd2c3a3..834d1a956 100644 --- a/src/addons/qtype/ddwtos/component/ddwtos.ts +++ b/src/addons/qtype/ddwtos/component/ddwtos.ts @@ -44,7 +44,7 @@ export class AddonQtypeDdwtosComponent extends CoreQuestionBaseComponent impleme } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (!this.question) { @@ -148,7 +148,7 @@ export class AddonQtypeDdwtosComponent extends CoreQuestionBaseComponent impleme } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.destroyed = true; diff --git a/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts b/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts index 6dc78c078..dc05ebf92 100644 --- a/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts +++ b/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts @@ -29,12 +29,7 @@ export class AddonQtypeDdwtosHandlerService implements CoreQuestionHandler { type = 'qtype_ddwtos'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { if (behaviour === 'interactive') { @@ -45,24 +40,14 @@ export class AddonQtypeDdwtosHandlerService implements CoreQuestionHandler { } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeDdwtosComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -79,23 +64,14 @@ export class AddonQtypeDdwtosHandlerService implements CoreQuestionHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -112,14 +88,7 @@ export class AddonQtypeDdwtosHandlerService implements CoreQuestionHandler { } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qtype/description/component/description.ts b/src/addons/qtype/description/component/description.ts index 5422b1ff5..0e5c21d0f 100644 --- a/src/addons/qtype/description/component/description.ts +++ b/src/addons/qtype/description/component/description.ts @@ -32,7 +32,7 @@ export class AddonQtypeDescriptionComponent extends CoreQuestionBaseComponent im } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { const questionEl = this.initComponent(); diff --git a/src/addons/qtype/description/services/handlers/description.ts b/src/addons/qtype/description/services/handlers/description.ts index f8ebaeed7..7a0630ed8 100644 --- a/src/addons/qtype/description/services/handlers/description.ts +++ b/src/addons/qtype/description/services/handlers/description.ts @@ -28,44 +28,28 @@ export class AddonQtypeDescriptionHandlerService implements CoreQuestionHandler type = 'qtype_description'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(): string { return 'informationitem'; } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeDescriptionComponent; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Validate if an offline sequencecheck is valid compared with the online one. - * This function only needs to be implemented if a specific compare is required. - * - * @param question The question. - * @param offlineSequenceCheck Sequence check stored in offline. - * @return Whether sequencecheck is valid. + * @inheritdoc */ validateSequenceCheck(): boolean { // Descriptions don't have any answer so we'll always treat them as valid. diff --git a/src/addons/qtype/essay/component/essay.ts b/src/addons/qtype/essay/component/essay.ts index 64df2a9fc..3ec404ea8 100644 --- a/src/addons/qtype/essay/component/essay.ts +++ b/src/addons/qtype/essay/component/essay.ts @@ -42,7 +42,7 @@ export class AddonQtypeEssayComponent extends CoreQuestionBaseComponent implemen } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.uploadFilesSupported = this.question?.responsefileareas !== undefined; @@ -59,7 +59,7 @@ export class AddonQtypeEssayComponent extends CoreQuestionBaseComponent implemen /** * Load attachments. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadAttachments(): Promise { if (this.offlineEnabled && this.essayQuestion?.localAnswers?.attachments_offline) { diff --git a/src/addons/qtype/essay/services/handlers/essay.ts b/src/addons/qtype/essay/services/handlers/essay.ts index 94b3912b0..96c39cd18 100644 --- a/src/addons/qtype/essay/services/handlers/essay.ts +++ b/src/addons/qtype/essay/services/handlers/essay.ts @@ -39,11 +39,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { type = 'qtype_essay'; /** - * Clear temporary data after the data has been saved. - * - * @param question Question. - * @param component The component the question is related to. - * @param componentId Component ID. + * @inheritdoc */ clearTmpData(question: CoreQuestionQuestionParsed, component: string, componentId: string | number): void { const questionComponentId = CoreQuestion.getQuestionComponentId(question, componentId); @@ -57,13 +53,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Delete any stored data for the question. - * - * @param question Question. - * @param component The component the question is related to. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @inheritdoc */ deleteOfflineData( question: CoreQuestionQuestionParsed, @@ -75,11 +65,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Get the list of files that needs to be downloaded in addition to the files embedded in the HTML. - * - * @param question Question. - * @param usageId Usage ID. - * @return List of files or URLs. + * @inheritdoc */ getAdditionalDownloadableFiles(question: CoreQuestionQuestionParsed): CoreWSFile[] { if (!question.responsefileareas) { @@ -93,7 +79,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { * Check whether the question allows text and/or attachments. * * @param question Question to check. - * @return Allowed options. + * @returns Allowed options. */ protected getAllowedOptions(question: CoreQuestionQuestionParsed): { text: boolean; attachments: boolean } { if (question.parsedSettings) { @@ -112,34 +98,21 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(): string { return 'manualgraded'; } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeEssayComponent; } /** - * Check if a question can be submitted. - * If a question cannot be submitted it should return a message explaining why (translated or not). - * - * @param question The question. - * @return Prevent submit message. Undefined or empty if can be submitted. + * @inheritdoc */ getPreventSubmitMessage(question: CoreQuestionQuestionParsed): string | undefined { const element = CoreDomUtils.convertToElement(question.html); @@ -180,9 +153,9 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { * Check the input word count and return a message to user when the number of words are outside the boundary settings. * * @param question The question. - * @param answers Object with the question answers (without prefix). + * @param answer Object with the question answers (without prefix). * @param onlineError Online validation error. - * @return Error message if there's a validation error, undefined otherwise. + * @returns Error message if there's a validation error, undefined otherwise. */ protected checkInputWordCount( question: CoreQuestionQuestionParsed, @@ -213,13 +186,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -257,23 +224,14 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -293,14 +251,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, @@ -330,15 +281,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { } /** - * Prepare and add to answers the data to send to server based in the input. - * - * @param question Question. - * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param offline Whether the data should be saved in offline. - * @param component The component the question is related to. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return Return a promise resolved when done if async, void if sync. + * @inheritdoc */ async prepareAnswers( question: CoreQuestionQuestionParsed, @@ -374,7 +317,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { * @param componentId Component ID. * @param attachmentsInput The HTML input containing the draft ID for attachments. * @param siteId Site ID. If not defined, current site. - * @return Return a promise resolved when done if async, void if sync. + * @returns Return a promise resolved when done if async, void if sync. */ async prepareAttachments( question: CoreQuestionQuestionParsed, @@ -421,7 +364,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prepareSyncData( question: CoreQuestionQuestionParsed, @@ -483,7 +426,7 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. * @param textarea The textarea HTML element of the question. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prepareTextAnswer( question: AddonModQuizEssayQuestion, diff --git a/src/addons/qtype/gapselect/component/gapselect.ts b/src/addons/qtype/gapselect/component/gapselect.ts index 2f38213f8..df11ebe71 100644 --- a/src/addons/qtype/gapselect/component/gapselect.ts +++ b/src/addons/qtype/gapselect/component/gapselect.ts @@ -32,7 +32,7 @@ export class AddonQtypeGapSelectComponent extends CoreQuestionBaseComponent impl } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initOriginalTextComponent('.qtext'); diff --git a/src/addons/qtype/gapselect/services/handlers/gapselect.ts b/src/addons/qtype/gapselect/services/handlers/gapselect.ts index f8e2392ee..5337943ce 100644 --- a/src/addons/qtype/gapselect/services/handlers/gapselect.ts +++ b/src/addons/qtype/gapselect/services/handlers/gapselect.ts @@ -29,12 +29,7 @@ export class AddonQtypeGapSelectHandlerService implements CoreQuestionHandler { type = 'qtype_gapselect'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { if (behaviour === 'interactive') { @@ -45,24 +40,14 @@ export class AddonQtypeGapSelectHandlerService implements CoreQuestionHandler { } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeGapSelectComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -80,23 +65,14 @@ export class AddonQtypeGapSelectHandlerService implements CoreQuestionHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -114,14 +90,7 @@ export class AddonQtypeGapSelectHandlerService implements CoreQuestionHandler { } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qtype/match/component/match.ts b/src/addons/qtype/match/component/match.ts index 8a15cb210..a316b7be3 100644 --- a/src/addons/qtype/match/component/match.ts +++ b/src/addons/qtype/match/component/match.ts @@ -33,7 +33,7 @@ export class AddonQtypeMatchComponent extends CoreQuestionBaseComponent implemen } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initMatchComponent(); diff --git a/src/addons/qtype/match/services/handlers/match.ts b/src/addons/qtype/match/services/handlers/match.ts index f982e859b..20784b47a 100644 --- a/src/addons/qtype/match/services/handlers/match.ts +++ b/src/addons/qtype/match/services/handlers/match.ts @@ -29,12 +29,7 @@ export class AddonQtypeMatchHandlerService implements CoreQuestionHandler { type = 'qtype_match'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { if (behaviour === 'interactive') { @@ -45,24 +40,14 @@ export class AddonQtypeMatchHandlerService implements CoreQuestionHandler { } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeMatchComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -80,23 +65,14 @@ export class AddonQtypeMatchHandlerService implements CoreQuestionHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -114,14 +90,7 @@ export class AddonQtypeMatchHandlerService implements CoreQuestionHandler { } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qtype/multianswer/component/multianswer.ts b/src/addons/qtype/multianswer/component/multianswer.ts index 4ea34b164..bef6cbe7e 100644 --- a/src/addons/qtype/multianswer/component/multianswer.ts +++ b/src/addons/qtype/multianswer/component/multianswer.ts @@ -31,7 +31,7 @@ export class AddonQtypeMultiAnswerComponent extends CoreQuestionBaseComponent im } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initOriginalTextComponent('.formulation'); diff --git a/src/addons/qtype/multianswer/services/handlers/multianswer.ts b/src/addons/qtype/multianswer/services/handlers/multianswer.ts index b00857b24..a09a50b3e 100644 --- a/src/addons/qtype/multianswer/services/handlers/multianswer.ts +++ b/src/addons/qtype/multianswer/services/handlers/multianswer.ts @@ -30,12 +30,7 @@ export class AddonQtypeMultiAnswerHandlerService implements CoreQuestionHandler type = 'qtype_multianswer'; /** - * Return the name of the behaviour to use for the question. - * If the question should use the default behaviour you shouldn't implement this function. - * - * @param question The question. - * @param behaviour The default behaviour. - * @return The behaviour to use. + * @inheritdoc */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { if (behaviour === 'interactive') { @@ -46,24 +41,14 @@ export class AddonQtypeMultiAnswerHandlerService implements CoreQuestionHandler } /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeMultiAnswerComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, @@ -84,23 +69,14 @@ export class AddonQtypeMultiAnswerHandlerService implements CoreQuestionHandler } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, @@ -118,14 +94,7 @@ export class AddonQtypeMultiAnswerHandlerService implements CoreQuestionHandler } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, @@ -136,12 +105,7 @@ export class AddonQtypeMultiAnswerHandlerService implements CoreQuestionHandler } /** - * Validate if an offline sequencecheck is valid compared with the online one. - * This function only needs to be implemented if a specific compare is required. - * - * @param question The question. - * @param offlineSequenceCheck Sequence check stored in offline. - * @return Whether sequencecheck is valid. + * @inheritdoc */ validateSequenceCheck(question: CoreQuestionQuestionParsed, offlineSequenceCheck: string): boolean { if (question.sequencecheck == Number(offlineSequenceCheck)) { diff --git a/src/addons/qtype/multichoice/component/multichoice.ts b/src/addons/qtype/multichoice/component/multichoice.ts index db3a3d139..705484815 100644 --- a/src/addons/qtype/multichoice/component/multichoice.ts +++ b/src/addons/qtype/multichoice/component/multichoice.ts @@ -33,7 +33,7 @@ export class AddonQtypeMultichoiceComponent extends CoreQuestionBaseComponent im } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initMultichoiceComponent(); diff --git a/src/addons/qtype/multichoice/services/handlers/multichoice.ts b/src/addons/qtype/multichoice/services/handlers/multichoice.ts index 55dadcb8d..fa8998af6 100644 --- a/src/addons/qtype/multichoice/services/handlers/multichoice.ts +++ b/src/addons/qtype/multichoice/services/handlers/multichoice.ts @@ -31,30 +31,18 @@ export class AddonQtypeMultichoiceHandlerService implements CoreQuestionHandler type = 'qtype_multichoice'; /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeMultichoiceComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, // eslint-disable-line @typescript-eslint/no-unused-vars - componentId: string | number, // eslint-disable-line @typescript-eslint/no-unused-vars ): number { let isSingle = true; let isMultiComplete = false; @@ -81,39 +69,28 @@ export class AddonQtypeMultichoiceHandlerService implements CoreQuestionHandler /** * Check if a response is complete. Only for single answer. * - * @param question The question.uestion answers (without prefix). - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @param answers The question answers (without prefix). + * @returns 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponseSingle(answers: CoreQuestionsAnswers): number { return (answers.answer && answers.answer !== '') ? 1 : 0; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { - return this.isCompleteResponse(question, answers, component, componentId); + return this.isCompleteResponse(question, answers); } /** @@ -121,21 +98,14 @@ export class AddonQtypeMultichoiceHandlerService implements CoreQuestionHandler * or whether it must be considered aborted. Only for single answer. * * @param answers Object with the question answers (without prefix). - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @returns 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponseSingle(answers: CoreQuestionsAnswers): number { return this.isCompleteResponseSingle(answers); } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, @@ -168,22 +138,14 @@ export class AddonQtypeMultichoiceHandlerService implements CoreQuestionHandler * * @param prevAnswers Object with the previous question answers. * @param newAnswers Object with the new question answers. - * @return Whether they're the same. + * @returns Whether they're the same. */ isSameResponseSingle(prevAnswers: CoreQuestionsAnswers, newAnswers: CoreQuestionsAnswers): boolean { return CoreUtils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer'); } /** - * Prepare and add to answers the data to send to server based in the input. Return promise if async. - * - * @param question Question. - * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param offline Whether the data should be saved in offline. - * @param component The component the question is related to. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return Return a promise resolved when done if async, void if sync. + * @inheritdoc */ prepareAnswers( question: AddonModQuizMultichoiceQuestion, diff --git a/src/addons/qtype/shortanswer/component/shortanswer.ts b/src/addons/qtype/shortanswer/component/shortanswer.ts index 77cfcb83e..a2a5adf28 100644 --- a/src/addons/qtype/shortanswer/component/shortanswer.ts +++ b/src/addons/qtype/shortanswer/component/shortanswer.ts @@ -33,7 +33,7 @@ export class AddonQtypeShortAnswerComponent extends CoreQuestionBaseComponent im } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initInputTextComponent(); diff --git a/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts b/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts index 6e241cee1..02b21c7f5 100644 --- a/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts +++ b/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts @@ -30,71 +30,41 @@ export class AddonQtypeShortAnswerHandlerService implements CoreQuestionHandler type = 'qtype_shortanswer'; /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { return AddonQtypeShortAnswerComponent; } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, // eslint-disable-line @typescript-eslint/no-unused-vars - componentId: string | number, // eslint-disable-line @typescript-eslint/no-unused-vars ): number { return answers.answer ? 1 : 0; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { - return this.isCompleteResponse(question, answers, component, componentId); + return this.isCompleteResponse(question, answers); } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, diff --git a/src/addons/qtype/truefalse/services/handlers/truefalse.ts b/src/addons/qtype/truefalse/services/handlers/truefalse.ts index aaceeb122..0a9bd8a28 100644 --- a/src/addons/qtype/truefalse/services/handlers/truefalse.ts +++ b/src/addons/qtype/truefalse/services/handlers/truefalse.ts @@ -31,11 +31,7 @@ export class AddonQtypeTrueFalseHandlerService implements CoreQuestionHandler { type = 'qtype_truefalse'; /** - * Return the Component to use to display the question. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getComponent(): Type { // True/false behaves like a multichoice, use the same component. @@ -43,60 +39,34 @@ export class AddonQtypeTrueFalseHandlerService implements CoreQuestionHandler { } /** - * Check if a response is complete. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @inheritdoc */ isCompleteResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, // eslint-disable-line @typescript-eslint/no-unused-vars - componentId: string | number, // eslint-disable-line @typescript-eslint/no-unused-vars ): number { return answers.answer ? 1 : 0; } /** - * Whether or not the handler is enabled on a site level. - * - * @return True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if a student has provided enough of an answer for the question to be graded automatically, - * or whether it must be considered aborted. - * - * @param question The question. - * @param answers Object with the question answers (without prefix). - * @param component The component the question is related to. - * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @inheritdoc */ isGradableResponse( question: CoreQuestionQuestionParsed, answers: CoreQuestionsAnswers, - component: string, - componentId: string | number, ): number { - return this.isCompleteResponse(question, answers, component, componentId); + return this.isCompleteResponse(question, answers); } /** - * Check if two responses are the same. - * - * @param question Question. - * @param prevAnswers Object with the previous question answers. - * @param newAnswers Object with the new question answers. - * @param component The component the question is related to. - * @param componentId Component ID. - * @return Whether they're the same. + * @inheritdoc */ isSameResponse( question: CoreQuestionQuestionParsed, @@ -107,15 +77,7 @@ export class AddonQtypeTrueFalseHandlerService implements CoreQuestionHandler { } /** - * Prepare and add to answers the data to send to server based in the input. Return promise if async. - * - * @param question Question. - * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param offline Whether the data should be saved in offline. - * @param component The component the question is related to. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return Return a promise resolved when done if async, void if sync. + * @inheritdoc */ prepareAnswers( question: AddonModQuizMultichoiceQuestion, diff --git a/src/addons/remotethemes/services/remotethemes-handler.ts b/src/addons/remotethemes/services/remotethemes-handler.ts index 6fea80158..cf2673c1a 100644 --- a/src/addons/remotethemes/services/remotethemes-handler.ts +++ b/src/addons/remotethemes/services/remotethemes-handler.ts @@ -101,7 +101,7 @@ export class AddonRemoteThemesHandlerService implements CoreStyleHandler { * Get styles from the url. * * @param url Url to get the code from. - * @return The styles. + * @returns The styles. */ protected async getRemoteStyles(url?: string): Promise { if (!url) { @@ -116,7 +116,7 @@ export class AddonRemoteThemesHandlerService implements CoreStyleHandler { * * @param siteId Site ID. * @param url File URL. - * @return Promise resolved when the file is downloaded. + * @returns Promise resolved when the file is downloaded. */ protected async downloadFileAndRemoveOld(siteId: string, url: string): Promise { diff --git a/src/addons/report/insights/services/insights.ts b/src/addons/report/insights/services/insights.ts index 003a18612..509e4fe44 100644 --- a/src/addons/report/insights/services/insights.ts +++ b/src/addons/report/insights/services/insights.ts @@ -30,7 +30,7 @@ export class AddonReportInsightsService { * Check if site supports sending insight actions. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it's supported. + * @returns Promise resolved with boolean: whether it's supported. */ async canSendActionInSite(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -42,7 +42,7 @@ export class AddonReportInsightsService { * Check if site supports sending insight actions. * * @param site Site. If not defined, current site. - * @return Whether it's supported. + * @returns Whether it's supported. */ canSendAction(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -56,7 +56,7 @@ export class AddonReportInsightsService { * @param actionName Action name. * @param ids List of IDs. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ async sendActionExecuted(actionName: string, ids: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/storagemanager/pages/course-storage/course-storage.ts b/src/addons/storagemanager/pages/course-storage/course-storage.ts index ef3f3059c..7ad1d6f52 100644 --- a/src/addons/storagemanager/pages/course-storage/course-storage.ts +++ b/src/addons/storagemanager/pages/course-storage/course-storage.ts @@ -142,7 +142,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { /** * Init course prefetch information. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initCoursePrefetch(): Promise { if (!this.downloadCourseEnabled || this.courseStatusObserver) { @@ -183,7 +183,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { /** * Init module prefetch information. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initModulePrefetch(): Promise { if (!this.downloadEnabled || this.sectionStatusObserver) { @@ -300,7 +300,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { * * @param modules Modules. * @param section Section the modules belong to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async updateModulesSizes( modules: AddonStorageManagerModule[], @@ -460,7 +460,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { * * @param modules Modules to delete * @param section Section the modules belong to. - * @return Promise Once deleting has finished + * @returns Promise Once deleting has finished */ protected async deleteModules(modules: AddonStorageManagerModule[], section?: AddonStorageManagerCourseSection): Promise { const modal = await CoreDomUtils.showModalLoading('core.deleting', true); @@ -561,7 +561,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { * * @param module Module to prefetch. * @param refresh Whether it's refreshing. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetchModule( module: AddonStorageManagerModule, @@ -616,7 +616,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { * Calculate and show module status. * * @param module Module to update. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async calculateModuleStatus(module: AddonStorageManagerModule): Promise { if (!module) { @@ -631,7 +631,7 @@ export class AddonStorageManagerCourseStoragePage implements OnInit, OnDestroy { /** * Determines the prefetch icon of the course. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async determineCoursePrefetchIcon(): Promise { this.prefetchCourseData = await CoreCourseHelper.getCourseStatusIconAndTitle(this.courseId); diff --git a/src/addons/storagemanager/pages/courses-storage/courses-storage.ts b/src/addons/storagemanager/pages/courses-storage/courses-storage.ts index 6a459959d..1266f98bf 100644 --- a/src/addons/storagemanager/pages/courses-storage/courses-storage.ts +++ b/src/addons/storagemanager/pages/courses-storage/courses-storage.ts @@ -104,7 +104,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy /** * Delete all courses that have been downloaded. * - * @param event: Event Object. + * @param event Event Object. */ async deleteCompletelyDownloadedCourses(event: Event): Promise { event.preventDefault(); @@ -137,7 +137,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy /** * Delete course. * - * @param event: Event Object. + * @param event Event Object. * @param course Course to delete. */ async deleteCourse(event: Event, course: DownloadedCourse): Promise { @@ -209,7 +209,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy * Get downloaded course data. * * @param course Course. - * @return Course info. + * @returns Course info. */ private async getDownloadedCourse(course: CoreEnrolledCourseData): Promise { const totalSize = await this.calculateDownloadedCourseSize(course.id); @@ -227,7 +227,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy * Calculate the size of a downloaded course. * * @param courseId Downloaded course id. - * @return Promise to be resolved with the course size. + * @returns Promise to be resolved with the course size. */ private async calculateDownloadedCourseSize(courseId: number): Promise { const sections = await CoreCourse.getSections(courseId); @@ -254,7 +254,7 @@ export class AddonStorageManagerCoursesStoragePage implements OnInit, OnDestroy /** * Deletes files of a site and the tables that can be cleared. * - * @param event: Event Object. + * @param event Event Object. */ async deleteSiteStorage(event: Event): Promise { event.preventDefault(); diff --git a/src/addons/userprofilefield/checkbox/component/checkbox.ts b/src/addons/userprofilefield/checkbox/component/checkbox.ts index 96dc9b922..5fdf29d0f 100644 --- a/src/addons/userprofilefield/checkbox/component/checkbox.ts +++ b/src/addons/userprofilefield/checkbox/component/checkbox.ts @@ -31,7 +31,7 @@ export class AddonUserProfileFieldCheckboxComponent extends CoreUserProfileField /** * Create the Form control. * - * @return Form control. + * @returns Form control. */ protected createFormControl(field: AuthEmailSignupProfileField): FormControl { const formData = { diff --git a/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts b/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts index 643738a62..3aa1804c5 100644 --- a/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts +++ b/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts @@ -33,7 +33,7 @@ export class AddonUserProfileFieldCheckboxHandlerService implements CoreUserProf /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -46,7 +46,7 @@ export class AddonUserProfileFieldCheckboxHandlerService implements CoreUserProf * @param signup True if user is in signup page. * @param registerAuth Register auth method. E.g. 'email'. * @param formValues Form Values. - * @return Data to send for the field. + * @returns Data to send for the field. */ async getData( field: AuthEmailSignupProfileField | CoreUserProfileField, @@ -69,7 +69,7 @@ export class AddonUserProfileFieldCheckboxHandlerService implements CoreUserProf * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return AddonUserProfileFieldCheckboxComponent; diff --git a/src/addons/userprofilefield/datetime/component/datetime.ts b/src/addons/userprofilefield/datetime/component/datetime.ts index eac0d6ec2..1a48918f5 100644 --- a/src/addons/userprofilefield/datetime/component/datetime.ts +++ b/src/addons/userprofilefield/datetime/component/datetime.ts @@ -85,7 +85,7 @@ export class AddonUserProfileFieldDatetimeComponent extends CoreUserProfileField /** * Create the Form control. * - * @return Form control. + * @returns Form control. */ protected createFormControl(field: AuthEmailSignupProfileField): FormControl { const formData = { diff --git a/src/addons/userprofilefield/datetime/services/handlers/datetime.ts b/src/addons/userprofilefield/datetime/services/handlers/datetime.ts index 96f3deaba..9c0663f45 100644 --- a/src/addons/userprofilefield/datetime/services/handlers/datetime.ts +++ b/src/addons/userprofilefield/datetime/services/handlers/datetime.ts @@ -34,7 +34,7 @@ export class AddonUserProfileFieldDatetimeHandlerService implements CoreUserProf /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -47,7 +47,7 @@ export class AddonUserProfileFieldDatetimeHandlerService implements CoreUserProf * @param signup True if user is in signup page. * @param registerAuth Register auth method. E.g. 'email'. * @param formValues Form Values. - * @return Data to send for the field. + * @returns Data to send for the field. */ async getData( field: AuthEmailSignupProfileField | CoreUserProfileField, @@ -70,7 +70,7 @@ export class AddonUserProfileFieldDatetimeHandlerService implements CoreUserProf * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return AddonUserProfileFieldDatetimeComponent; diff --git a/src/addons/userprofilefield/menu/services/handlers/menu.ts b/src/addons/userprofilefield/menu/services/handlers/menu.ts index ad111bd7e..bee7848d2 100644 --- a/src/addons/userprofilefield/menu/services/handlers/menu.ts +++ b/src/addons/userprofilefield/menu/services/handlers/menu.ts @@ -33,7 +33,7 @@ export class AddonUserProfileFieldMenuHandlerService implements CoreUserProfileF /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -46,7 +46,7 @@ export class AddonUserProfileFieldMenuHandlerService implements CoreUserProfileF * @param signup True if user is in signup page. * @param registerAuth Register auth method. E.g. 'email'. * @param formValues Form Values. - * @return Data to send for the field. + * @returns Data to send for the field. */ async getData( field: AuthEmailSignupProfileField | CoreUserProfileField, @@ -69,7 +69,7 @@ export class AddonUserProfileFieldMenuHandlerService implements CoreUserProfileF * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return AddonUserProfileFieldMenuComponent; diff --git a/src/addons/userprofilefield/text/services/handlers/text.ts b/src/addons/userprofilefield/text/services/handlers/text.ts index ac1edda13..72ff5c7a1 100644 --- a/src/addons/userprofilefield/text/services/handlers/text.ts +++ b/src/addons/userprofilefield/text/services/handlers/text.ts @@ -34,7 +34,7 @@ export class AddonUserProfileFieldTextHandlerService implements CoreUserProfileF /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -47,7 +47,7 @@ export class AddonUserProfileFieldTextHandlerService implements CoreUserProfileF * @param signup True if user is in signup page. * @param registerAuth Register auth method. E.g. 'email'. * @param formValues Form Values. - * @return Data to send for the field. + * @returns Data to send for the field. */ async getData( field: AuthEmailSignupProfileField | CoreUserProfileField, @@ -68,7 +68,7 @@ export class AddonUserProfileFieldTextHandlerService implements CoreUserProfileF * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return AddonUserProfileFieldTextComponent; diff --git a/src/addons/userprofilefield/textarea/services/handlers/textarea.ts b/src/addons/userprofilefield/textarea/services/handlers/textarea.ts index 3a6823027..e0bb9d578 100644 --- a/src/addons/userprofilefield/textarea/services/handlers/textarea.ts +++ b/src/addons/userprofilefield/textarea/services/handlers/textarea.ts @@ -34,7 +34,7 @@ export class AddonUserProfileFieldTextareaHandlerService implements CoreUserProf /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -47,7 +47,7 @@ export class AddonUserProfileFieldTextareaHandlerService implements CoreUserProf * @param signup True if user is in signup page. * @param registerAuth Register auth method. E.g. 'email'. * @param formValues Form Values. - * @return Data to send for the field. + * @returns Data to send for the field. */ async getData( field: AuthEmailSignupProfileField | CoreUserProfileField, @@ -77,7 +77,7 @@ export class AddonUserProfileFieldTextareaHandlerService implements CoreUserProf * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return AddonUserProfileFieldTextareaComponent; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3704e74c3..2218e4001 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -31,7 +31,7 @@ import { CoreArray } from '@singletons/array'; * Build app routes. * * @param injector Module injector. - * @return App routes. + * @returns App routes. */ function buildAppRoutes(injector: Injector): Routes { return CoreArray.flatten(injector.get(APP_ROUTES, [])); @@ -42,7 +42,7 @@ function buildAppRoutes(injector: Injector): Routes { * * @param pathOrMatcher Original path or matcher configured in the route. * @param condition Condition. - * @return Conditional url matcher. + * @returns Conditional url matcher. */ function buildConditionalUrlMatcher(pathOrMatcher: string | UrlMatcher, condition: () => boolean): UrlMatcher { // Create a matcher based on Angular's default matcher. @@ -136,7 +136,7 @@ export type ModuleRoutesConfig = Routes | Partial; * * @param routes Routes. * @param condition Condition to determine if routes should be activated or not. - * @return Conditional routes. + * @returns Conditional routes. */ export function conditionalRoutes(routes: Routes, condition: () => boolean): Routes { return routes.map(route => { @@ -155,7 +155,7 @@ export function conditionalRoutes(routes: Routes, condition: () => boolean): Rou * * @param injector Module injector. * @param token Routes injection token. - * @return Routes. + * @returns Routes. */ export function resolveModuleRoutes(injector: Injector, token: InjectionToken): ModuleRoutes { const configs = injector.get(token, []); diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 50afe4835..4ee1e03d1 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -45,7 +45,7 @@ export class AppComponent implements OnInit, AfterViewInit { @ViewChild(IonRouterOutlet) outlet?: IonRouterOutlet; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -171,7 +171,7 @@ export class AppComponent implements OnInit, AfterViewInit { }); }); - // @todo: Pause Youtube videos in Android when app is put in background or screen is locked? + // @todo Pause Youtube videos in Android when app is put in background or screen is locked? // See: https://github.com/moodlehq/moodleapp/blob/ionic3/src/app/app.component.ts#L312 } diff --git a/src/assets/js/iframe-treat-links.js b/src/assets/js/iframe-treat-links.js index e1a507545..6582397ec 100644 --- a/src/assets/js/iframe-treat-links.js +++ b/src/assets/js/iframe-treat-links.js @@ -73,7 +73,7 @@ * * @param leftPath Left path. * @param rightPath Right path. - * @return Concatenated path. + * @returns Concatenated path. */ function concatenatePaths(leftPath, rightPath) { if (!leftPath) { @@ -98,7 +98,7 @@ * Get the root window. * * @param win Current window to check. - * @return Root window. + * @returns Root window. */ function getRootWindow(win) { if (win.parent === win) { @@ -112,7 +112,7 @@ * Get the scheme from a URL. * * @param url URL to treat. - * @return Scheme, undefined if no scheme found. + * @returns Scheme, undefined if no scheme found. */ function getUrlScheme(url) { if (!url) { @@ -129,7 +129,7 @@ * Check if a URL is absolute. * * @param url URL to treat. - * @return Whether it's absolute. + * @returns Whether it's absolute. */ function isAbsoluteUrl(url) { return /^[^:]{2,}:\/\//i.test(url); @@ -139,7 +139,7 @@ * Check whether a URL scheme belongs to a local file. * * @param scheme Scheme to check. - * @return Whether the scheme belongs to a local file. + * @returns Whether the scheme belongs to a local file. */ function isLocalFileUrlScheme(scheme) { if (scheme) { @@ -199,7 +199,7 @@ * Convert a URL to an absolute URL if needed using the frame src. * * @param url URL to convert. - * @return Absolute URL. + * @returns Absolute URL. */ function toAbsolute(url) { if (isAbsoluteUrl(url)) { diff --git a/src/core/classes/aria-role-tab.ts b/src/core/classes/aria-role-tab.ts index 3459ca41a..3c7ea6938 100644 --- a/src/core/classes/aria-role-tab.ts +++ b/src/core/classes/aria-role-tab.ts @@ -58,7 +58,6 @@ export class CoreAriaRoleTab { * * @param tabFindIndex Tab findable index. * @param e Event. - * @return Promise resolved when done. */ keyUp(tabFindIndex: string, e: KeyboardEvent): void { e.preventDefault(); diff --git a/src/core/classes/base-sync.ts b/src/core/classes/base-sync.ts index 27de5e84e..d25a0797b 100644 --- a/src/core/classes/base-sync.ts +++ b/src/core/classes/base-sync.ts @@ -85,7 +85,7 @@ export class CoreSyncBaseProvider { * @param id Unique sync identifier per component. * @param promise The promise of the sync to add. * @param siteId Site ID. If not defined, current site. - * @return The sync promise. + * @returns The sync promise. */ async addOngoingSync(id: string | number, promise: Promise, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -114,7 +114,7 @@ export class CoreSyncBaseProvider { * * @param name Instance name. * @param error Specific error message. - * @return Warning message. + * @returns Warning message. */ protected getOfflineDataDeletedWarning(name: string, error: CoreAnyError): string { return Translate.instant('core.warningofflinedatadeleted', { @@ -129,7 +129,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise of the current sync or undefined if there isn't any. + * @returns Promise of the current sync or undefined if there isn't any. */ getOngoingSync(id: string | number, siteId?: string): Promise | undefined { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -145,7 +145,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the readable time. + * @returns Promise resolved with the readable time. */ async getReadableSyncTime(id: string | number, siteId?: string): Promise { const time = await this.getSyncTime(id, siteId); @@ -157,7 +157,7 @@ export class CoreSyncBaseProvider { * Given a timestamp return it in a human readable format. * * @param timestamp Timestamp - * @return Human readable time. + * @returns Human readable time. */ getReadableTimeFromTimestamp(timestamp: number): string { if (!timestamp) { @@ -172,7 +172,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the time. + * @returns Promise resolved with the time. */ async getSyncTime(id: string | number, siteId?: string): Promise { try { @@ -189,7 +189,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the warnings. + * @returns Promise resolved with the warnings. */ async getSyncWarnings(id: string | number, siteId?: string): Promise { try { @@ -205,7 +205,7 @@ export class CoreSyncBaseProvider { * Create a unique identifier from component and id. * * @param id Unique sync identifier per component. - * @return Unique identifier from component and id. + * @returns Unique identifier from component and id. */ protected getUniqueSyncId(id: string | number): string { return this.component + '#' + id; @@ -216,7 +216,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Whether it's synchronizing. + * @returns Whether it's synchronizing. */ isSyncing(id: string | number, siteId?: string): boolean { return !!this.getOngoingSync(id, siteId); @@ -227,7 +227,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether sync is needed. + * @returns Promise resolved with boolean: whether sync is needed. */ async isSyncNeeded(id: string | number, siteId?: string): Promise { const time = await this.getSyncTime(id, siteId); @@ -241,7 +241,7 @@ export class CoreSyncBaseProvider { * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. * @param time Time to set. If not defined, current time. - * @return Promise resolved when the time is set. + * @returns Promise resolved when the time is set. */ async setSyncTime(id: string | number, siteId?: string, time?: number): Promise { time = time !== undefined ? time : Date.now(); @@ -255,7 +255,7 @@ export class CoreSyncBaseProvider { * @param id Unique sync identifier per component. * @param warnings Warnings to set. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setSyncWarnings(id: string | number, warnings: string[], siteId?: string): Promise { const warningsText = JSON.stringify(warnings || []); @@ -269,7 +269,7 @@ export class CoreSyncBaseProvider { * @param syncFunctionLog Log message to explain the sync function purpose. * @param syncFunction Sync function to execute. * @param siteId Site ID to sync. If not defined, sync all sites. - * @return Resolved with siteIds selected. Rejected if offline. + * @returns Resolved with siteIds selected. Rejected if offline. */ async syncOnSites(syncFunctionLog: string, syncFunction: (siteId: string) => void, siteId?: string): Promise { if (!CoreNetwork.isOnline()) { @@ -300,7 +300,7 @@ export class CoreSyncBaseProvider { * * @param id Unique sync identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when there's no sync going on for the identifier. + * @returns Promise resolved when there's no sync going on for the identifier. */ async waitForSync(id: string | number, siteId?: string): Promise { const promise = this.getOngoingSync(id, siteId); @@ -319,7 +319,7 @@ export class CoreSyncBaseProvider { /** * Get component name translated. * - * @return Component name translated. + * @returns Component name translated. */ protected get componentTranslate(): string { if (!this.componentTranslateInternal) { diff --git a/src/core/classes/cache.ts b/src/core/classes/cache.ts index 325669148..64f888ba7 100644 --- a/src/core/classes/cache.ts +++ b/src/core/classes/cache.ts @@ -37,7 +37,7 @@ export class CoreCache { * Get all the data stored in the cache for a certain id. * * @param id The ID to identify the entry. - * @return The data from the cache. Undefined if not found. + * @returns The data from the cache. Undefined if not found. */ getEntry(id: string): CoreCacheEntry { if (!this.cacheStore[id]) { @@ -53,7 +53,7 @@ export class CoreCache { * @param id The ID to identify the entry. * @param name Name of the value to get. * @param ignoreInvalidate Whether it should always return the cached data, even if it's expired. - * @return Cached value. Undefined if not cached or expired. + * @returns Cached value. Undefined if not cached or expired. */ getValue(id: string, name: string, ignoreInvalidate = false): T | undefined { const entry = this.getEntry(id); @@ -87,7 +87,7 @@ export class CoreCache { * @param id The ID to identify the entry. * @param name Name of the value to set. * @param value Value to set. - * @return The set value. + * @returns The set value. */ setValue(id: string, name: string, value: T): T { const entry = this.getEntry(id); diff --git a/src/core/classes/database/database-table.ts b/src/core/classes/database/database-table.ts index 807f5dad1..20fbf8a86 100644 --- a/src/core/classes/database/database-table.ts +++ b/src/core/classes/database/database-table.ts @@ -44,6 +44,8 @@ export class CoreDatabaseTable< /** * Get database configuration. + * + * @returns The database configuration. */ getConfig(): Partial { return this.config; @@ -135,6 +137,7 @@ export class CoreDatabaseTable< * method should be favored otherwise for better performance. * * @param conditions Matching conditions in SQL and JavaScript. + * @returns Records matching the given conditions. */ getManyWhere(conditions: CoreDatabaseConditions): Promise { return this.database.getRecordsSelect(this.tableName, conditions.sql, conditions.sqlParams); diff --git a/src/core/classes/database/debug-database-table.ts b/src/core/classes/database/debug-database-table.ts index db146144b..1328a8eea 100644 --- a/src/core/classes/database/debug-database-table.ts +++ b/src/core/classes/database/debug-database-table.ts @@ -45,6 +45,8 @@ export class CoreDebugDatabaseTable< /** * Get underlying table instance. + * + * @returns Table instance. */ getTarget(): CoreDatabaseTable { return this.target; diff --git a/src/core/classes/delegate-sorted.ts b/src/core/classes/delegate-sorted.ts index 30827a99b..76910315f 100644 --- a/src/core/classes/delegate-sorted.ts +++ b/src/core/classes/delegate-sorted.ts @@ -34,7 +34,6 @@ export class CoreSortedDelegate< * Constructor of the Delegate. * * @param delegateName Delegate name used for logging purposes. - * @param listenSiteEvents Whether to update the handler when a site event occurs (login, site updated, ...). */ constructor(delegateName: string) { super(delegateName, true); @@ -53,7 +52,7 @@ export class CoreSortedDelegate< /** * Check if handlers are loaded. * - * @return True if handlers are loaded, false otherwise. + * @returns True if handlers are loaded, false otherwise. */ areHandlersLoaded(): boolean { return this.loaded; @@ -71,7 +70,7 @@ export class CoreSortedDelegate< /** * Get the handlers for the current site. * - * @return An observable that will receive the handlers. + * @returns An observable that will receive the handlers. */ getHandlers(): DisplayType[] { return this.sortedHandlers; @@ -80,7 +79,7 @@ export class CoreSortedDelegate< /** * Get the handlers for the current site. * - * @return An observable that will receive the handlers. + * @returns An observable that will receive the handlers. */ getHandlersObservable(): Subject { return this.sortedHandlersRxJs; @@ -89,7 +88,7 @@ export class CoreSortedDelegate< /** * Get the handlers for the current site once they're loaded. * - * @return Promise resolved with the handlers. + * @returns Promise resolved with the handlers. */ async getHandlersWhenLoaded(): Promise { if (this.loaded) { diff --git a/src/core/classes/delegate.ts b/src/core/classes/delegate.ts index 7d34c7450..76801adb5 100644 --- a/src/core/classes/delegate.ts +++ b/src/core/classes/delegate.ts @@ -118,7 +118,7 @@ export class CoreDelegate { * @param handlerName The handler name. * @param fnName Name of the function to execute. * @param params Parameters to pass to the function. - * @return Function returned value or default value. + * @returns Function returned value or default value. */ protected executeFunctionOnEnabled(handlerName: string, fnName: string, params?: unknown[]): T | undefined { return this.execute(this.enabledHandlers[handlerName], fnName, params); @@ -131,7 +131,7 @@ export class CoreDelegate { * @param handlerName The handler name. * @param fnName Name of the function to execute. * @param params Parameters to pass to the function. - * @return Function returned value or default value. + * @returns Function returned value or default value. */ protected executeFunction(handlerName: string, fnName: string, params?: unknown[]): T | undefined { return this.execute(this.handlers[handlerName], fnName, params); @@ -144,7 +144,7 @@ export class CoreDelegate { * @param handler The handler. * @param fnName Name of the function to execute. * @param params Parameters to pass to the function. - * @return Function returned value or default value. + * @returns Function returned value or default value. */ private execute(handler: HandlerType, fnName: string, params?: unknown[]): T | undefined { if (handler && handler[fnName]) { @@ -159,7 +159,7 @@ export class CoreDelegate { * * @param handlerName The handler name. * @param enabled Only enabled, or any. - * @return Handler. + * @returns Handler. */ protected getHandler(handlerName: string, enabled: boolean = false): HandlerType { return enabled ? this.enabledHandlers[handlerName] : this.handlers[handlerName]; @@ -170,7 +170,7 @@ export class CoreDelegate { * E.g. blocks are indexed by blockName. If you call this function passing the blockName it will return the name. * * @param name Name used to indentify the handler. - * @return Full name of corresponding handler. + * @returns Full name of corresponding handler. */ getHandlerName(name: string): string { const handler = this.getHandler(name, true); @@ -188,7 +188,7 @@ export class CoreDelegate { * @param handlerName The handler name. * @param fnName Name of the function to execute. * @param onlyEnabled If check only enabled handlers or all. - * @return Function returned value or default value. + * @returns Function returned value or default value. */ protected hasFunction(handlerName: string, fnName: string, onlyEnabled: boolean = true): boolean { const handler = onlyEnabled ? this.enabledHandlers[handlerName] : this.handlers[handlerName]; @@ -201,7 +201,7 @@ export class CoreDelegate { * * @param name The handler name. * @param enabled Only enabled, or any. - * @return If the handler is registered or not. + * @returns If the handler is registered or not. */ hasHandler(name: string, enabled: boolean = false): boolean { return enabled ? this.enabledHandlers[name] !== undefined : this.handlers[name] !== undefined; @@ -212,7 +212,7 @@ export class CoreDelegate { * This is to handle the cases where updateHandlers don't finish in the same order as they're called. * * @param time Time to check. - * @return Whether it's the last call. + * @returns Whether it's the last call. */ isLastUpdateCall(time: number): boolean { if (!this.lastUpdateHandlersStart) { @@ -226,7 +226,7 @@ export class CoreDelegate { * Register a handler. * * @param handler The handler delegate object to register. - * @return True when registered, false if already registered. + * @returns True when registered, false if already registered. */ registerHandler(handler: HandlerType): boolean { const key = handler[this.handlerNameProperty] || handler.name; @@ -247,8 +247,7 @@ export class CoreDelegate { * Update the handler for the current site. * * @param handler The handler to check. - * @param time Time this update process started. - * @return Resolved when done. + * @returns Resolved when done. */ protected updateHandler(handler: HandlerType): Promise { const siteId = CoreSites.getCurrentSiteId(); @@ -295,7 +294,7 @@ export class CoreDelegate { * * @param handler Handler to check. * @param site Site to check. - * @return Whether is enabled or disabled in site. + * @returns Whether is enabled or disabled in site. */ protected isFeatureDisabled(handler: HandlerType, site: CoreSite): boolean { return this.featurePrefix !== undefined && site.isFeatureDisabled(this.featurePrefix + handler.name); @@ -304,7 +303,7 @@ export class CoreDelegate { /** * Update the handlers for the current site. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async updateHandlers(): Promise { const promises: Promise[] = []; @@ -357,7 +356,7 @@ export interface CoreDelegateHandler { /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ isEnabled(): Promise; } @@ -389,7 +388,7 @@ export interface CoreDelegateDisplayHandler { /** * Return a promise that is resolved when the data is loaded. * - * @return Promise. + * @returns Promise. */ waitForLoaded(): Promise { return this.loadedPromise; diff --git a/src/core/classes/items-management/items-manager.ts b/src/core/classes/items-management/items-manager.ts index 2cc88a2ac..dd4bc269b 100644 --- a/src/core/classes/items-management/items-manager.ts +++ b/src/core/classes/items-management/items-manager.ts @@ -91,7 +91,7 @@ export abstract class CoreItemsManager< /** * Get selected item. * - * @return Selected item, null if none. + * @returns Selected item, null if none. */ getSelectedItem(): Item | null { return this.selectedItem; @@ -160,7 +160,7 @@ export abstract class CoreItemsManager< * Get item by ID. * * @param id ID - * @return Item, null if not found. + * @returns Item, null if not found. */ getItemById(id: string | number): Item | null { return this.itemsMap?.[id] ?? null; @@ -170,7 +170,7 @@ export abstract class CoreItemsManager< * Get an ID to identify an item. * * @param item Data about the item. - * @return Item ID. + * @returns Item ID. */ abstract getItemId(item: Item): string | number; diff --git a/src/core/classes/items-management/list-items-manager.ts b/src/core/classes/items-management/list-items-manager.ts index aceac334a..744eb25bf 100644 --- a/src/core/classes/items-management/list-items-manager.ts +++ b/src/core/classes/items-management/list-items-manager.ts @@ -100,7 +100,7 @@ export class CoreListItemsManager< * Check whether the given item is selected or not. * * @param item Item. - * @return Whether the given item is selected. + * @returns Whether the given item is selected. */ isSelected(item: Item): boolean { return this.selectedItem === item; @@ -110,7 +110,7 @@ export class CoreListItemsManager< * Return the current aria value. * * @param item Item. - * @return Will return the current value of the item if selected, false otherwise. + * @returns Will return the current value of the item if selected, false otherwise. */ getItemAriaCurrent(item: Item): string { return this.isSelected(item) ? 'page' : 'false'; @@ -202,6 +202,8 @@ export class CoreListItemsManager< /** * Get the item that should be selected by default. + * + * @returns The default item or null if none. */ protected getDefaultItem(): Item | null { return this.items[0] || null; @@ -237,7 +239,7 @@ export class CoreListItemsManager< * Get the page route given a child route on the splitview outlet. * * @param route Child route. - * @return Page route. + * @returns Page route. */ private getPageRouteFromSplitViewOutlet(route: ActivatedRouteSnapshot | null): ActivatedRouteSnapshot | null { const isPageRoute = this.buildRouteMatcher(); diff --git a/src/core/classes/items-management/routed-items-manager-source.ts b/src/core/classes/items-management/routed-items-manager-source.ts index 6b53c913a..294d65cc6 100644 --- a/src/core/classes/items-management/routed-items-manager-source.ts +++ b/src/core/classes/items-management/routed-items-manager-source.ts @@ -35,7 +35,7 @@ export abstract class CoreRoutedItemsManagerSource extends CoreI /** * Check whether there are more pages to be loaded. * - * @return Whether there are more pages to be loaded. + * @returns Whether there are more pages to be loaded. */ isCompleted(): boolean { return !this.hasMoreItems; @@ -103,14 +103,14 @@ export abstract class CoreRoutedItemsManagerSource extends CoreI * Load page items. * * @param page Page number (starting at 0). - * @return Page items data. + * @returns Page items data. */ protected abstract loadPageItems(page: number): Promise<{ items: Item[]; hasMoreItems?: boolean }>; /** * Get the length of each page in the collection. * - * @return Page length; null for collections that don't support pagination. + * @returns Page length; null for collections that don't support pagination. */ protected getPageLength(): number | null { return null; @@ -132,7 +132,7 @@ export abstract class CoreRoutedItemsManagerSource extends CoreI * Get the query parameters to use when navigating to an item page. * * @param item Item. - * @return Query parameters to use when navigating to the item page. + * @returns Query parameters to use when navigating to the item page. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars getItemQueryParams(item: Item): Params { @@ -143,7 +143,7 @@ export abstract class CoreRoutedItemsManagerSource extends CoreI * Get the path to use when navigating to an item page. * * @param item Item. - * @return Path to use when navigating to the item page. + * @returns Path to use when navigating to the item page. */ abstract getItemPath(item: Item): string; diff --git a/src/core/classes/items-management/routed-items-manager.ts b/src/core/classes/items-management/routed-items-manager.ts index ac1b608ac..2d0ede1f4 100644 --- a/src/core/classes/items-management/routed-items-manager.ts +++ b/src/core/classes/items-management/routed-items-manager.ts @@ -53,7 +53,7 @@ export abstract class CoreRoutedItemsManager< * Get the path of the selected item given the current route. * * @param route Page route. - * @return Path of the selected item in the given route. + * @returns Path of the selected item in the given route. */ protected abstract getSelectedItemPathFromRoute(route: ActivatedRouteSnapshot): string | null; @@ -61,7 +61,7 @@ export abstract class CoreRoutedItemsManager< * Get the path of the selected item. * * @param route Page route, if any. - * @return Path of the selected item. + * @returns Path of the selected item. */ protected getSelectedItemPath(route?: ActivatedRouteSnapshot | null): string | null { if (!route) { diff --git a/src/core/classes/items-management/swipe-navigation-items-manager.ts b/src/core/classes/items-management/swipe-navigation-items-manager.ts index 8988d0809..f0be57a0c 100644 --- a/src/core/classes/items-management/swipe-navigation-items-manager.ts +++ b/src/core/classes/items-management/swipe-navigation-items-manager.ts @@ -51,6 +51,8 @@ export class CoreSwipeNavigationItemsManager< /** * Has a next item. + * + * @returns If has next item. */ async hasNextItem(): Promise { const item = await this.getItemBy(1); @@ -60,6 +62,8 @@ export class CoreSwipeNavigationItemsManager< /** * Has a previous item. + * + * @returns If has previous item. */ async hasPreviousItem(): Promise { const item = await this.getItemBy(-1); @@ -113,6 +117,7 @@ export class CoreSwipeNavigationItemsManager< * Get item by an offset. * * @param delta Index offset. + * @returns The item or null if none. */ protected async getItemBy(delta: number): Promise { const items = this.getSource().getItems(); diff --git a/src/core/classes/items-management/swipe-slides-dynamic-items-manager-source.ts b/src/core/classes/items-management/swipe-slides-dynamic-items-manager-source.ts index cd54848c8..ca8c4d435 100644 --- a/src/core/classes/items-management/swipe-slides-dynamic-items-manager-source.ts +++ b/src/core/classes/items-management/swipe-slides-dynamic-items-manager-source.ts @@ -50,7 +50,7 @@ export abstract class CoreSwipeSlidesDynamicItemsManagerSource { const previousItem = this.getPreviousItem(item); @@ -68,7 +68,7 @@ export abstract class CoreSwipeSlidesDynamicItemsManagerSource { const preloadedItem = await this.performLoadItemData(item, preload); @@ -126,7 +126,7 @@ export abstract class CoreSwipeSlidesDynamicItemsManagerSource { const itemId = this.getItemId(item); @@ -189,7 +189,7 @@ export abstract class CoreSwipeSlidesDynamicItemsManagerSource; @@ -197,7 +197,7 @@ export abstract class CoreSwipeSlidesDynamicItemsManagerSource extends /** * Load items. * - * @return Items list. + * @returns Items list. */ protected abstract loadItems(): Promise; @@ -47,7 +47,7 @@ export abstract class CoreSwipeSlidesItemsManagerSource extends * Get a certain item. * * @param id Item ID. - * @return Item, null if not found. + * @returns Item, null if not found. */ getItem(id: string | number): Item | null { const index = this.getItemIndexById(id); @@ -59,7 +59,7 @@ export abstract class CoreSwipeSlidesItemsManagerSource extends * Get a certain item index. * * @param item Item. - * @return Item index, -1 if not found. + * @returns Item index, -1 if not found. */ getItemIndex(item: Item): number { return this.getItemIndexById(this.getItemId(item)); @@ -69,7 +69,7 @@ export abstract class CoreSwipeSlidesItemsManagerSource extends * Get a certain item index. * * @param id Item ID. - * @return Item index, -1 if not found. + * @returns Item index, -1 if not found. */ getItemIndexById(id: string | number): number { const index = this.items?.findIndex((listItem) => id === this.getItemId(listItem)); @@ -80,7 +80,7 @@ export abstract class CoreSwipeSlidesItemsManagerSource extends /** * Get initial item index. * - * @return Initial item index. + * @returns Initial item index. */ getInitialItemIndex(): number { if (!this.initialItem) { @@ -94,7 +94,7 @@ export abstract class CoreSwipeSlidesItemsManagerSource extends * Get the ID of an item. * * @param item Item. - * @return Item ID. + * @returns Item ID. */ abstract getItemId(item: Item): string | number; diff --git a/src/core/classes/modal-lateral-transition.ts b/src/core/classes/modal-lateral-transition.ts index 12f3327a2..45fafb626 100644 --- a/src/core/classes/modal-lateral-transition.ts +++ b/src/core/classes/modal-lateral-transition.ts @@ -17,7 +17,10 @@ import { Animation } from '@ionic/core'; import { CorePlatform } from '@services/platform'; /** - * Sliding transition for lateral modals. + * Sliding transition for lateral modals on enter. + * + * @param baseEl Base element. + * @returns The animation. */ export function CoreModalLateralTransitionEnter(baseEl: HTMLElement): Animation { const OFF_RIGHT = CorePlatform.isRTL ? '-100%' : '100%'; @@ -50,6 +53,12 @@ export function CoreModalLateralTransitionEnter(baseEl: HTMLElement): Animation .addAnimation(otherAnimations); } +/** + * Sliding transition for lateral modals on leave. + * + * @param baseEl Base element. + * @returns The animation. + */ export function CoreModalLateralTransitionLeave(baseEl: HTMLElement): Animation { const OFF_RIGHT = CorePlatform.isRTL ? '-100%' : '100%'; diff --git a/src/core/classes/page-load-watcher.ts b/src/core/classes/page-load-watcher.ts index 988dca6d1..52bba8de7 100644 --- a/src/core/classes/page-load-watcher.ts +++ b/src/core/classes/page-load-watcher.ts @@ -39,7 +39,7 @@ export class PageLoadWatcher { /** * Whether this load watcher can update data in background. * - * @return Whether this load watcher can update data in background. + * @returns Whether this load watcher can update data in background. */ canUpdateInBackground(): boolean { return this.updateInBackground; @@ -48,7 +48,7 @@ export class PageLoadWatcher { /** * Whether this load watcher had meaningful changes received in background. * - * @return Whether this load watcher had meaningful changes received in background. + * @returns Whether this load watcher had meaningful changes received in background. */ hasMeaningfulChanges(): boolean { return this.hasChanges; @@ -81,7 +81,7 @@ export class PageLoadWatcher { /** * Get the reading strategy to use. * - * @return Reading strategy to use. + * @returns Reading strategy to use. */ getReadingStrategy(): CoreSitesReadingStrategy | undefined { return this.updateInBackground ? CoreSitesReadingStrategy.STALE_WHILE_REVALIDATE : undefined; @@ -94,7 +94,7 @@ export class PageLoadWatcher { * * @param observable Observable of the request. * @param hasMeaningfulChanges Callback to check if there are meaningful changes if data was updated in background. - * @return First value of the observable. + * @returns First value of the observable. */ watchRequest( observable: WSObservable, diff --git a/src/core/classes/page-loads-manager.ts b/src/core/classes/page-loads-manager.ts index c8291cce2..24a28c4a1 100644 --- a/src/core/classes/page-loads-manager.ts +++ b/src/core/classes/page-loads-manager.ts @@ -35,7 +35,7 @@ export class PageLoadsManager { * * @param page Page instance. * @param staleWhileRevalidate Whether to use stale while revalidate strategy. - * @return Load watcher to use. + * @returns Load watcher to use. */ startPageLoad(page: AsyncComponent, staleWhileRevalidate: boolean): PageLoadWatcher { this.initialPath = this.initialPath ?? CoreNavigator.getCurrentPath(); @@ -51,7 +51,7 @@ export class PageLoadsManager { * Start a component load, adding it to currrent load watcher (if it exists) and watching the component. * * @param component Component instance. - * @return Load watcher to use. + * @returns Load watcher to use. */ startComponentLoad(component: AsyncComponent): PageLoadWatcher { // If a component is loading data without the page loading data, probably the component is reloading/refreshing. @@ -103,7 +103,7 @@ export class PageLoadsManager { * Get an ongoing load watcher that supports updating in background and is not the one passed as a parameter. * * @param loadWatcher Load watcher to ignore. - * @return Ongoing load watcher, undefined if none found. + * @returns Ongoing load watcher, undefined if none found. */ protected getAnotherOngoingUpdateInBackgroundWatcher(loadWatcher: PageLoadWatcher): PageLoadWatcher | undefined { for (const ongoingLoadWatcher of this.ongoingLoadWatchers) { diff --git a/src/core/classes/promised-value.ts b/src/core/classes/promised-value.ts index bedefc5cd..43896f16c 100644 --- a/src/core/classes/promised-value.ts +++ b/src/core/classes/promised-value.ts @@ -56,6 +56,7 @@ export class CorePromisedValue extends CorePromise { } /** + * @returns Promise. * @deprecated since app 4.1. The instance can be directly used as a promise. */ get promise(): Promise { @@ -69,7 +70,7 @@ export class CorePromisedValue extends CorePromise { /** * Check whether the promise resolved successfully. * - * @return Whether the promise resolved successfuly. + * @returns Whether the promise resolved successfuly. */ isResolved(): this is { value: T } { return 'resolvedValue' in this; @@ -78,7 +79,7 @@ export class CorePromisedValue extends CorePromise { /** * Check whether the promise was rejected. * - * @return Whether the promise was rejected. + * @returns Whether the promise was rejected. */ isRejected(): boolean { return 'rejectedReason' in this; @@ -112,7 +113,7 @@ export class CorePromisedValue extends CorePromise { /** * Reject the promise. * - * @param value Rejection reason. + * @param reason Rejection reason. */ reject(reason?: Error): void { if (this.isSettled()) { diff --git a/src/core/classes/queue-runner.ts b/src/core/classes/queue-runner.ts index f58066d08..7c09686e6 100644 --- a/src/core/classes/queue-runner.ts +++ b/src/core/classes/queue-runner.ts @@ -66,7 +66,7 @@ export class CoreQueueRunner { * Get unique ID. * * @param id ID. - * @return Unique ID. + * @returns Unique ID. */ protected getUniqueId(id: string): string { let newId = id; @@ -83,7 +83,7 @@ export class CoreQueueRunner { /** * Process next item in the queue. * - * @return Promise resolved when next item has been treated. + * @returns Promise resolved when next item has been treated. */ protected async processNextItem(): Promise { if (!this.orderedQueue.length || this.numberRunning >= this.maxParallel) { @@ -114,7 +114,7 @@ export class CoreQueueRunner { * @param id ID. * @param fn Function to call. * @param options Options. - * @return Promise resolved when the function has been executed. + * @returns Promise resolved when the function has been executed. */ run(id: string, fn: CoreQueueRunnerFunction, options?: CoreQueueRunnerAddOptions): Promise { options = options || {}; diff --git a/src/core/classes/site.ts b/src/core/classes/site.ts index e0a66f603..6b7fa7538 100644 --- a/src/core/classes/site.ts +++ b/src/core/classes/site.ts @@ -82,7 +82,7 @@ const ALLOWED_LOGGEDOUT_WS = [ * To add tables to the site's database, please use registerSiteSchema exported in @services/sites.ts. This will make sure that * the tables are created in all the sites, not just the current one. * - * @todo: Refactor this class to improve "temporary" sites support (not fully authenticated). + * @todo Refactor this class to improve "temporary" sites support (not fully authenticated). */ export class CoreSite { @@ -140,7 +140,7 @@ export class CoreSite { * @param id Site ID. * @param siteUrl Site URL. * @param token Site's WS token. - * @param info Site info. + * @param infos Site info. * @param privateToken Private token. * @param config Site public config. * @param loggedOut Whether user is logged out. @@ -194,7 +194,7 @@ export class CoreSite { /** * Get site ID. * - * @return Site ID. + * @returns Site ID. */ getId(): string { if (this.id === undefined) { @@ -208,7 +208,7 @@ export class CoreSite { /** * Get site URL. * - * @return Site URL. + * @returns Site URL. */ getURL(): string { return this.siteUrl; @@ -217,7 +217,7 @@ export class CoreSite { /** * Get site token. * - * @return Site token. + * @returns Site token. */ getToken(): string { if (this.token === undefined) { @@ -231,7 +231,7 @@ export class CoreSite { /** * Get site info. * - * @return Site info. + * @returns Site info. */ getInfo(): CoreSiteInfo | undefined { return this.infos; @@ -240,7 +240,7 @@ export class CoreSite { /** * Get site private token. * - * @return Site private token. + * @returns Site private token. */ getPrivateToken(): string | undefined { return this.privateToken; @@ -249,7 +249,7 @@ export class CoreSite { /** * Get site DB. * - * @return Site DB. + * @returns Site DB. */ getDb(): SQLiteDB { if (!this.db) { @@ -263,7 +263,7 @@ export class CoreSite { /** * Get site user's ID. * - * @return User's ID. + * @returns User's ID. */ getUserId(): number { if (!this.infos) { @@ -277,7 +277,7 @@ export class CoreSite { /** * Get site Course ID for frontpage course. If not declared it will return 1 as default. * - * @return Site Home ID. + * @returns Site Home ID. */ getSiteHomeId(): number { return this.infos?.siteid || 1; @@ -286,7 +286,7 @@ export class CoreSite { /** * Get site name. * - * @return Site name. + * @returns Site name. */ getSiteName(): string { if (CoreConstants.CONFIG.sitename) { @@ -300,7 +300,7 @@ export class CoreSite { /** * Set site ID. * - * @param New ID. + * @param id New ID. */ setId(id: string): void { this.id = id; @@ -310,7 +310,7 @@ export class CoreSite { /** * Set site token. * - * @param New token. + * @param token New token. */ setToken(token: string): void { this.token = token; @@ -328,7 +328,7 @@ export class CoreSite { /** * Check if user logged out from the site and needs to authenticate again. * - * @return Whether is logged out. + * @returns Whether is logged out. */ isLoggedOut(): boolean { return !!this.loggedOut; @@ -337,7 +337,7 @@ export class CoreSite { /** * Get OAuth ID. * - * @return OAuth ID. + * @returns OAuth ID. */ getOAuthId(): number | undefined { return this.oauthId; @@ -346,7 +346,7 @@ export class CoreSite { /** * Set site info. * - * @param New info. + * @param infos New info. */ setInfo(infos?: CoreSiteInfo): void { this.infos = infos; @@ -383,7 +383,7 @@ export class CoreSite { /** * Set OAuth ID. * - * @param oauth OAuth ID. + * @param oauthId OAuth ID. */ setOAuthId(oauthId: number | undefined): void { this.oauthId = oauthId; @@ -402,7 +402,7 @@ export class CoreSite { /** * Check if the user authenticated in the site using an OAuth method. * - * @return Whether the user authenticated in the site using an OAuth method. + * @returns Whether the user authenticated in the site using an OAuth method. */ isOAuth(): boolean { return this.oauthId != null && this.oauthId !== undefined; @@ -411,7 +411,7 @@ export class CoreSite { /** * Can the user access their private files? * - * @return Whether can access my files. + * @returns Whether can access my files. */ canAccessMyFiles(): boolean { const info = this.getInfo(); @@ -422,7 +422,7 @@ export class CoreSite { /** * Can the user download files? * - * @return Whether can download files. + * @returns Whether can download files. */ canDownloadFiles(): boolean { const info = this.getInfo(); @@ -433,9 +433,9 @@ export class CoreSite { /** * Can the user use an advanced feature? * - * @param feature The name of the feature. + * @param featureName The name of the feature. * @param whenUndefined The value to return when the parameter is undefined. - * @return Whether can use advanced feature. + * @returns Whether can use advanced feature. */ canUseAdvancedFeature(featureName: string, whenUndefined: boolean = true): boolean { const info = this.getInfo(); @@ -456,7 +456,7 @@ export class CoreSite { /** * Can the user upload files? * - * @return Whether can upload files. + * @returns Whether can upload files. */ canUploadFiles(): boolean { const info = this.getInfo(); @@ -467,7 +467,7 @@ export class CoreSite { /** * Fetch site info from the Moodle site. * - * @return A promise to be resolved when the site info is retrieved. + * @returns A promise to be resolved when the site info is retrieved. */ fetchSiteInfo(): Promise { // The get_site_info WS call won't be cached. @@ -489,7 +489,7 @@ export class CoreSite { * @param method WS method to use. * @param data Data to send to the WS. * @param preSets Extra options. - * @return Promise resolved with the response, rejected with CoreWSError if it fails. + * @returns Promise resolved with the response, rejected with CoreWSError if it fails. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any read(method: string, data: any, preSets?: CoreSiteWSPreSets): Promise { @@ -502,7 +502,7 @@ export class CoreSite { * @param method WS method to use. * @param data Data to send to the WS. * @param preSets Extra options. - * @return Observable returning the WS data. + * @returns Observable returning the WS data. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any readObservable(method: string, data: any, preSets?: CoreSiteWSPreSets): WSObservable { @@ -520,7 +520,7 @@ export class CoreSite { * @param method WS method to use. * @param data Data to send to the WS. * @param preSets Extra options. - * @return Promise resolved with the response, rejected with CoreWSError if it fails. + * @returns Promise resolved with the response, rejected with CoreWSError if it fails. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any write(method: string, data: any, preSets?: CoreSiteWSPreSets): Promise { @@ -533,7 +533,7 @@ export class CoreSite { * @param method WS method to use. * @param data Data to send to the WS. * @param preSets Extra options. - * @return Observable returning the WS data. + * @returns Observable returning the WS data. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any writeObservable(method: string, data: any, preSets?: CoreSiteWSPreSets): WSObservable { @@ -551,7 +551,7 @@ export class CoreSite { * @param method The WebService method to be called. * @param data Arguments to pass to the method. * @param preSets Extra options. - * @return Promise resolved with the response, rejected with CoreWSError if it fails. + * @returns Promise resolved with the response, rejected with CoreWSError if it fails. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any async request(method: string, data: any, preSets: CoreSiteWSPreSets): Promise { @@ -564,7 +564,7 @@ export class CoreSite { * @param method The WebService method to be called. * @param data Arguments to pass to the method. * @param preSets Extra options. - * @return Observable returning the WS data. + * @returns Observable returning the WS data. * @description * * Sends a webservice request to the site. This method will automatically add the @@ -659,7 +659,7 @@ export class CoreSite { * * @param cacheId Cache ID. * @param preSets Presets. - * @return Ongoing request if it exists. + * @returns Ongoing request if it exists. */ protected getOngoingRequest(cacheId: string, preSets: CoreSiteWSPreSets): WSObservable | undefined { if (preSets.updateInBackground) { @@ -714,7 +714,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param preSets Extra options related to the site. * @param wsPreSets Extra options related to the WS call. - * @return Observable returning the WS data. + * @returns Observable returning the WS data. */ protected performRequest( method: string, @@ -796,7 +796,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param preSets Extra options related to the site. * @param wsPreSets Extra options related to the WS call. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ protected async getFromWS( method: string, @@ -942,7 +942,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param preSets Extra options related to the site. * @param wsPreSets Extra options related to the WS call. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ protected async callOrEnqueueWS( method: string, @@ -996,7 +996,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param preSets Extra options related to the site. * @param wsPreSets Extra options related to the WS call. - * @return Promise resolved with the response when the WS is called. + * @returns Promise resolved with the response when the WS is called. */ protected callOrEnqueueRequest( method: string, @@ -1034,7 +1034,7 @@ export class CoreSite { * Adds a request to the queue. * * @param request The request to enqueue. - * @return Promise resolved with the response when the WS is called. + * @returns Promise resolved with the response when the WS is called. */ protected enqueueRequest(request: RequestQueueItem): Promise { this.requestQueue.push(request); @@ -1166,7 +1166,7 @@ export class CoreSite { * Check if a WS is available in this site. * * @param method WS name. - * @return Whether the WS is available. + * @returns Whether the WS is available. */ wsAvailable(method: string): boolean { return !!this.infos?.functionsByName?.[method]; @@ -1177,7 +1177,7 @@ export class CoreSite { * * @param method The WebService method. * @param data Arguments to pass to the method. - * @return Cache ID. + * @returns Cache ID. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any protected getCacheId(method: string, data: any): string { @@ -1191,8 +1191,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param preSets Extra options. * @param emergency Whether it's an "emergency" cache call (WS call failed). - * @param originalData Arguments to pass to the method before being converted to strings. - * @return Cached data. + * @returns Cached data. */ protected async getFromCache( method: string, @@ -1279,7 +1278,7 @@ export class CoreSite { * * @param component Component name * @param componentId Optional component id (if not included, returns sum for whole component) - * @return Promise resolved when we have calculated the size + * @returns Promise resolved when we have calculated the size */ async getComponentCacheSize(component: string, componentId?: number): Promise { const params: Array = [component]; @@ -1310,7 +1309,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param response The WS response. * @param preSets Extra options. - * @return Promise resolved when the response is saved. + * @returns Promise resolved when the response is saved. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any protected async saveToCache(method: string, data: any, response: any, preSets: CoreSiteWSPreSets): Promise { @@ -1349,7 +1348,7 @@ export class CoreSite { * @param data Arguments to pass to the method. * @param preSets Extra options. * @param allCacheKey True to delete all entries with the cache key, false to delete only by ID. - * @return Promise resolved when the entries are deleted. + * @returns Promise resolved when the entries are deleted. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any protected async deleteFromCache(method: string, data: any, preSets: CoreSiteWSPreSets, allCacheKey?: boolean): Promise { @@ -1368,7 +1367,7 @@ export class CoreSite { * * @param component Component name. * @param componentId Component id. - * @return Promise resolved when the entries are deleted. + * @returns Promise resolved when the entries are deleted. */ async deleteComponentFromCache(component: string, componentId?: number): Promise { if (!component) { @@ -1390,7 +1389,7 @@ export class CoreSite { * @param filePath File path. * @param options File upload options. * @param onProgress Function to call on progress. - * @return Promise resolved when uploaded. + * @returns Promise resolved when uploaded. */ uploadFile( filePath: string, @@ -1410,7 +1409,7 @@ export class CoreSite { /** * Invalidates all the cache entries. * - * @return Promise resolved when the cache entries are invalidated. + * @returns Promise resolved when the cache entries are invalidated. */ async invalidateWsCache(): Promise { this.logger.debug('Invalidate all the cache for site: ' + this.id); @@ -1426,7 +1425,7 @@ export class CoreSite { * Invalidates all the cache entries with a certain key. * * @param key Key to search. - * @return Promise resolved when the cache entries are invalidated. + * @returns Promise resolved when the cache entries are invalidated. */ async invalidateWsCacheForKey(key: string): Promise { if (!key) { @@ -1442,7 +1441,7 @@ export class CoreSite { * Invalidates all the cache entries in an array of keys. * * @param keys Keys to search. - * @return Promise resolved when the cache entries are invalidated. + * @returns Promise resolved when the cache entries are invalidated. */ async invalidateMultipleWsCacheForKey(keys: string[]): Promise { if (!this.db) { @@ -1460,7 +1459,7 @@ export class CoreSite { * Invalidates all the cache entries whose key starts with a certain value. * * @param key Key to search. - * @return Promise resolved when the cache entries are invalidated. + * @returns Promise resolved when the cache entries are invalidated. */ async invalidateWsCacheForKeyStartingWith(key: string): Promise { if (!key) { @@ -1480,7 +1479,7 @@ export class CoreSite { * Check if tokenpluginfile can be used, and fix the URL afterwards. * * @param url The url to be fixed. - * @return Promise resolved with the fixed URL. + * @returns Promise resolved with the fixed URL. */ checkAndFixPluginfileURL(url: string): Promise { return this.checkTokenPluginFile(url).then(() => this.fixPluginfileURL(url)); @@ -1491,7 +1490,7 @@ export class CoreSite { * Uses CoreUtilsProvider.fixPluginfileURL, passing site's token. * * @param url The url to be fixed. - * @return Fixed URL. + * @returns Fixed URL. */ fixPluginfileURL(url: string): string { const accessKey = this.tokenPluginFileWorks || this.tokenPluginFileWorks === undefined ? @@ -1503,7 +1502,7 @@ export class CoreSite { /** * Deletes site's DB. * - * @return Promise to be resolved when the DB is deleted. + * @returns Promise to be resolved when the DB is deleted. */ async deleteDB(): Promise { await CoreDB.deleteDB('Site-' + this.id); @@ -1512,7 +1511,7 @@ export class CoreSite { /** * Deletes site's folder. * - * @return Promise to be resolved when the DB is deleted. + * @returns Promise to be resolved when the DB is deleted. */ async deleteFolder(): Promise { if (!CoreFile.isAvailable() || !this.id) { @@ -1528,7 +1527,7 @@ export class CoreSite { /** * Get space usage of the site. * - * @return Promise resolved with the site space usage (size). + * @returns Promise resolved with the site space usage (size). */ getSpaceUsage(): Promise { if (CoreFile.isAvailable() && this.id) { @@ -1545,7 +1544,7 @@ export class CoreSite { * * Currently this is just the total length of the data fields in the cache table. * - * @return Promise resolved with the total size of all data in the cache table (bytes) + * @returns Promise resolved with the total size of all data in the cache table (bytes) */ async getCacheUsage(): Promise { return this.cacheTable.reduce({ @@ -1558,7 +1557,7 @@ export class CoreSite { /** * Gets a total of the file and cache usage. * - * @return Promise with the total of getSpaceUsage and getCacheUsage + * @returns Promise with the total of getSpaceUsage and getCacheUsage */ async getTotalUsage(): Promise { const space = await this.getSpaceUsage(); @@ -1571,7 +1570,7 @@ export class CoreSite { * Returns the URL to the documentation of the app, based on Moodle version and current language. * * @param page Docs page to go to. - * @return Promise resolved with the Moodle docs URL. + * @returns Promise resolved with the Moodle docs URL. */ getDocsUrl(page?: string): Promise { const release = this.infos?.release ? this.infos.release : undefined; @@ -1585,7 +1584,7 @@ export class CoreSite { * @param path Path of the url to go to. * @param params Object with the params to add. * @param anchor Anchor text if needed. - * @return URL with params. + * @returns URL with params. */ createSiteUrl(path: string, params?: CoreUrlParams, anchor?: string): string { return CoreUrlUtils.addParamsToUrl(this.siteUrl + path, params, anchor); @@ -1594,7 +1593,7 @@ export class CoreSite { /** * Check if the local_mobile plugin is installed in the Moodle site. * - * @return Promise resolved when the check is done. + * @returns Promise resolved when the check is done. * @deprecated since app 4.0 */ async checkLocalMobilePlugin(): Promise { @@ -1605,7 +1604,7 @@ export class CoreSite { /** * Check if local_mobile has been installed in Moodle. * - * @return Whether the App is able to use local_mobile plugin for this site. + * @returns Whether the App is able to use local_mobile plugin for this site. * @deprecated since app 4.0 */ checkIfAppUsesLocalMobile(): boolean { @@ -1615,7 +1614,7 @@ export class CoreSite { /** * Check if local_mobile has been installed in Moodle but the app is not using it. * - * @return Promise resolved it local_mobile was added, rejected otherwise. + * @returns Promise resolved it local_mobile was added, rejected otherwise. * @deprecated since app 4.0 */ async checkIfLocalMobileInstalledAndNotUsed(): Promise { @@ -1626,7 +1625,7 @@ export class CoreSite { * Check if a URL belongs to this site. * * @param url URL to check. - * @return Whether the URL belongs to this site. + * @returns Whether the URL belongs to this site. */ containsUrl(url?: string): boolean { if (!url) { @@ -1643,7 +1642,7 @@ export class CoreSite { * Get the public config of this site. * * @param options Options. - * @return Promise resolved with public config. Rejected with an object if error, see CoreWSProvider.callAjax. + * @returns Promise resolved with public config. Rejected with an object if error, see CoreWSProvider.callAjax. */ async getPublicConfig(options: { readingStrategy?: CoreSitesReadingStrategy } = {}): Promise { if (!this.db) { @@ -1735,7 +1734,7 @@ export class CoreSite { /** * Get cache key for getPublicConfig WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getPublicConfigCacheKey(): string { return 'tool_mobile_get_public_config'; @@ -1744,7 +1743,7 @@ export class CoreSite { /** * Perform a request to the server to get the public config of this site. * - * @return Promise resolved with public config. + * @returns Promise resolved with public config. */ protected async requestPublicConfig(): Promise { const preSets: CoreWSAjaxPreSets = { @@ -1791,7 +1790,7 @@ export class CoreSite { * @param url The URL to open. * @param alertMessage If defined, an alert will be shown before opening the browser. * @param options Other options. - * @return Promise resolved when done, rejected otherwise. + * @returns Promise resolved when done, rejected otherwise. */ async openInBrowserWithAutoLogin( url: string, @@ -1807,7 +1806,7 @@ export class CoreSite { * @param url The URL to open. * @param alertMessage If defined, an alert will be shown before opening the browser. * @param options Other options. - * @return Promise resolved when done, rejected otherwise. + * @returns Promise resolved when done, rejected otherwise. * @deprecated since 4.1. Use openInBrowserWithAutoLogin instead, now it always checks that URL belongs to same site. */ async openInBrowserWithAutoLoginIfSameSite( @@ -1824,7 +1823,7 @@ export class CoreSite { * @param url The URL to open. * @param options Override default options passed to InAppBrowser. * @param alertMessage If defined, an alert will be shown before opening the inappbrowser. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openInAppWithAutoLogin(url: string, options?: InAppBrowserOptions, alertMessage?: string): Promise { const iabInstance = await this.openWithAutoLogin(true, url, options, alertMessage); @@ -1838,7 +1837,7 @@ export class CoreSite { * @param url The URL to open. * @param options Override default options passed to inappbrowser. * @param alertMessage If defined, an alert will be shown before opening the inappbrowser. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 4.1. Use openInAppWithAutoLogin instead, now it always checks that URL belongs to same site. */ async openInAppWithAutoLoginIfSameSite( @@ -1856,7 +1855,7 @@ export class CoreSite { * @param url The URL to open. * @param options Override default options passed to $cordovaInAppBrowser#open. * @param alertMessage If defined, an alert will be shown before opening the browser/inappbrowser. - * @return Promise resolved when done. Resolve param is returned only if inApp=true. + * @returns Promise resolved when done. Resolve param is returned only if inApp=true. */ async openWithAutoLogin( inApp: boolean, @@ -1897,7 +1896,7 @@ export class CoreSite { * @param url The URL to open. * @param options Override default options passed to inappbrowser. * @param alertMessage If defined, an alert will be shown before opening the browser/inappbrowser. - * @return Promise resolved when done. Resolve param is returned only if inApp=true. + * @returns Promise resolved when done. Resolve param is returned only if inApp=true. * @deprecated since 4.1. Use openWithAutoLogin instead, now it always checks that URL belongs to same site. */ async openWithAutoLoginIfSameSite( @@ -1915,7 +1914,7 @@ export class CoreSite { * * @param name Name of the setting to get. If not set or false, all settings will be returned. * @param ignoreCache True if it should ignore cached data. - * @return Promise resolved with site config. + * @returns Promise resolved with site config. */ getConfig(name?: undefined, ignoreCache?: boolean): Promise; getConfig(name: string, ignoreCache?: boolean): Promise; @@ -1931,7 +1930,7 @@ export class CoreSite { * * @param name Name of the setting to get. If not set or false, all settings will be returned. * @param readingStrategy Reading strategy. - * @return Observable returning site config. + * @returns Observable returning site config. */ getConfigObservable(name?: undefined, readingStrategy?: CoreSitesReadingStrategy): WSObservable; getConfigObservable(name: string, readingStrategy?: CoreSitesReadingStrategy): WSObservable; @@ -1966,7 +1965,7 @@ export class CoreSite { /** * Invalidates config WS call. * - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateConfig(): Promise { await this.invalidateWsCacheForKey(this.getConfigCacheKey()); @@ -1975,7 +1974,7 @@ export class CoreSite { /** * Get cache key for getConfig WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getConfigCacheKey(): string { return 'tool_mobile_get_config'; @@ -1985,7 +1984,7 @@ export class CoreSite { * Get the stored config of this site. * * @param name Name of the setting to get. If not set, all settings will be returned. - * @return Site config or a specific setting. + * @returns Site config or a specific setting. */ getStoredConfig(): CoreSiteConfig | undefined; getStoredConfig(name: string): string | undefined; @@ -2005,7 +2004,7 @@ export class CoreSite { * Check if a certain feature is disabled in the site. * * @param name Name of the feature to check. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isFeatureDisabled(name: string): boolean { const disabledFeatures = this.getStoredConfig('tool_mobile_disabledfeatures'); @@ -2028,7 +2027,7 @@ export class CoreSite { /** * Get whether offline is disabled in the site. * - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isOfflineDisabled(): boolean { return this.offlineDisabled; @@ -2039,7 +2038,7 @@ export class CoreSite { * This function accepts a string or an array of strings. If array, the last version must be the highest. * * @param versions Version or list of versions to check. - * @return Whether it's greater or equal, false otherwise. + * @returns Whether it's greater or equal, false otherwise. * @description * If a string is supplied (e.g. '3.2.1'), it will check if the site version is greater or equal than this version. * @@ -2094,7 +2093,7 @@ export class CoreSite { * * @param url The URL to convert. * @param showModal Whether to show a loading modal. - * @return Promise resolved with the converted URL. + * @returns Promise resolved with the converted URL. */ async getAutoLoginUrl(url: string, showModal: boolean = true): Promise { if (!this.privateToken) { @@ -2154,7 +2153,7 @@ export class CoreSite { * If release version is valid but not found in the list of Moodle releases, it will use the last released major version. * * @param version Release version to convert to version number. - * @return Version number, 0 if invalid. + * @returns Version number, 0 if invalid. */ protected getVersionNumber(version: string): number { const data = this.getMajorAndMinor(version); @@ -2181,7 +2180,7 @@ export class CoreSite { * Given a release version, return the major and minor versions. * * @param version Release version (e.g. '3.1.0'). - * @return Object with major and minor. Returns false if invalid version. + * @returns Object with major and minor. Returns false if invalid version. */ protected getMajorAndMinor(version: string): {major: string; minor: number} | false { const match = version.match(/^(\d+)(\.(\d+)(\.\d+)?)?/); @@ -2200,7 +2199,7 @@ export class CoreSite { * Given a release version, return the next major version number. * * @param version Release version (e.g. '3.1.0'). - * @return Next major version number. + * @returns Next major version number. */ protected getNextMajorVersionNumber(version: string): number { const data = this.getMajorAndMinor(version); @@ -2225,7 +2224,7 @@ export class CoreSite { * Deletes a site setting. * * @param name The config name. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteSiteConfig(name: string): Promise { await this.configTable.deleteByPrimaryKey({ name }); @@ -2236,7 +2235,7 @@ export class CoreSite { * * @param name The config name. * @param defaultValue Default value to use if the entry is not found. - * @return Resolves upon success along with the config data. Reject on failure. + * @returns Resolves upon success along with the config data. Reject on failure. */ async getLocalSiteConfig(name: string, defaultValue?: T): Promise { try { @@ -2257,7 +2256,7 @@ export class CoreSite { * * @param name The config name. * @param value The config value. Can only store number or strings. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setLocalSiteConfig(name: string, value: number | string): Promise { await this.configTable.insert({ name, value }); @@ -2267,7 +2266,7 @@ export class CoreSite { * Get a certain cache expiration delay. * * @param updateFrequency The update frequency of the entry. - * @return Expiration delay. + * @returns Expiration delay. */ getExpirationDelay(updateFrequency?: number): number { updateFrequency = updateFrequency || CoreSite.FREQUENCY_USUALLY; @@ -2285,7 +2284,7 @@ export class CoreSite { * Check if tokenpluginfile script works in the site. * * @param url URL to check. - * @return Promise resolved with boolean: whether it works or not. + * @returns Promise resolved with boolean: whether it works or not. */ checkTokenPluginFile(url: string): Promise { if (!CoreUrlUtils.canUseTokenPluginFile(url, this.siteUrl, this.infos && this.infos.userprivateaccesskey)) { @@ -2317,7 +2316,7 @@ export class CoreSite { * Check if a URL to a file belongs to the site and uses the pluginfileurl or tokenpluginfileurl endpoints. * * @param url File URL to check. - * @return Whether it's a site file URL. + * @returns Whether it's a site file URL. */ isSitePluginFileUrl(url: string): boolean { const isPluginFileUrl = CoreUrlUtils.isPluginFileUrl(url) || CoreUrlUtils.isTokenPluginFileUrl(url); @@ -2332,7 +2331,7 @@ export class CoreSite { * Check if a URL to a file belongs to the site and is a theme image file. * * @param url File URL to check. - * @return Whether it's a site theme image URL. + * @returns Whether it's a site theme image URL. */ isSiteThemeImageUrl(url: string): boolean { if (!CoreUrlUtils.isThemeImageUrl(url)) { @@ -2346,7 +2345,7 @@ export class CoreSite { * Deletes last viewed records based on some conditions. * * @param conditions Conditions. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteLastViewed(conditions?: Partial): Promise { await this.lastViewedTable.delete(conditions); @@ -2357,7 +2356,7 @@ export class CoreSite { * * @param component The component. * @param id ID. - * @return Resolves with last viewed record, undefined if not found. + * @returns Resolves with last viewed record, undefined if not found. */ async getLastViewed(component: string, id: number): Promise { try { @@ -2372,7 +2371,7 @@ export class CoreSite { * * @param component The component. * @param ids IDs. If not provided or empty, return all last viewed for a component. - * @return Resolves with last viewed records, undefined if error. + * @returns Resolves with last viewed records, undefined if error. */ async getComponentLastViewed(component: string, ids: number[] = []): Promise { try { @@ -2402,7 +2401,7 @@ export class CoreSite { * @param id ID. * @param value Last viewed item value. * @param options Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async storeLastViewed( component: string, @@ -2426,7 +2425,7 @@ export class CoreSite { * * @param readingStrategy Reading strategy used for the current request. * @param callback Callback called with the result of current request and the reading strategy to use in next requests. - * @return Operator. + * @returns Operator. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export function chainRequests>( diff --git a/src/core/classes/sqlitedb.ts b/src/core/classes/sqlitedb.ts index 1021c07d9..ba21b4733 100644 --- a/src/core/classes/sqlitedb.ts +++ b/src/core/classes/sqlitedb.ts @@ -144,7 +144,7 @@ export class SQLiteDB { * @param equal True means we want to equate to the constructed expression. * @param onEmptyItems This defines the behavior when the array of items provided is empty. Defaults to false, * meaning return empty. Other values will become part of the returned SQL fragment. - * @return A list containing the constructed sql fragment and an array of parameters. + * @returns A list containing the constructed sql fragment and an array of parameters. */ static getInOrEqual( items: SQLiteDBRecordValue | SQLiteDBRecordValue[], @@ -200,7 +200,7 @@ export class SQLiteDB { * @param column Name of the column to add. * @param type Type of the column to add. * @param constraints Other constraints (e.g. NOT NULL). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async addColumn(table: string, column: string, type: SQLiteDBColumnType, constraints?: string): Promise { constraints = constraints || ''; @@ -226,7 +226,7 @@ export class SQLiteDB { * @param uniqueKeys List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. * @param foreignKeys List of foreign keys. * @param tableCheck Check constraint for the table. - * @return SQL query. + * @returns SQL query. */ buildCreateTableSql( name: string, @@ -318,7 +318,7 @@ export class SQLiteDB { /** * Close the database. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async close(): Promise { await this.ready(); @@ -331,7 +331,7 @@ export class SQLiteDB { * * @param table The table to query. * @param conditions The conditions to build the where clause. Must not contain numeric indexes. - * @return Promise resolved with the count of records returned from the specified criteria. + * @returns Promise resolved with the count of records returned from the specified criteria. */ async countRecords(table: string, conditions?: SQLiteDBRecordValues): Promise { const selectAndParams = this.whereClause(conditions); @@ -346,7 +346,7 @@ export class SQLiteDB { * @param select A fragment of SQL to be used in a where clause in the SQL call. * @param params An array of sql parameters. * @param countItem The count string to be used in the SQL call. Default is COUNT('x'). - * @return Promise resolved with the count of records returned from the specified criteria. + * @returns Promise resolved with the count of records returned from the specified criteria. */ async countRecordsSelect( table: string, @@ -368,7 +368,7 @@ export class SQLiteDB { * * @param sql The SQL string you wish to be executed. * @param params An array of sql parameters. - * @return Promise resolved with the count. + * @returns Promise resolved with the count. */ async countRecordsSql(sql: string, params?: SQLiteDBRecordValue[]): Promise { const count = await this.getFieldSql(sql, params); @@ -388,7 +388,7 @@ export class SQLiteDB { * @param uniqueKeys List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. * @param foreignKeys List of foreign keys. * @param tableCheck Check constraint for the table. - * @return Promise resolved when success. + * @returns Promise resolved when success. */ async createTable( name: string, @@ -407,7 +407,7 @@ export class SQLiteDB { * Create a table if it doesn't exist from a schema. * * @param table Table schema. - * @return Promise resolved when success. + * @returns Promise resolved when success. */ async createTableFromSchema(table: SQLiteDBTableSchema): Promise { await this.createTable(table.name, table.columns, table.primaryKeys, table.uniqueKeys, table.foreignKeys, table.tableCheck); @@ -417,7 +417,7 @@ export class SQLiteDB { * Create several tables if they don't exist from a list of schemas. * * @param tables List of table schema. - * @return Promise resolved when success. + * @returns Promise resolved when success. */ async createTablesFromSchema(tables: SQLiteDBTableSchema[]): Promise { const promises = tables.map(table => this.createTableFromSchema(table)); @@ -431,7 +431,7 @@ export class SQLiteDB { * * @param table The table to delete from. * @param conditions The conditions to build the where clause. Must not contain numeric indexes. - * @return Promise resolved with the number of affected rows. + * @returns Promise resolved with the number of affected rows. */ async deleteRecords(table: string, conditions?: SQLiteDBRecordValues): Promise { if (conditions === null || conditions === undefined) { @@ -452,7 +452,7 @@ export class SQLiteDB { * @param table The table to delete from. * @param field The name of a field. * @param values The values field might take. - * @return Promise resolved with the number of affected rows. + * @returns Promise resolved with the number of affected rows. */ async deleteRecordsList(table: string, field: string, values: SQLiteDBRecordValue[]): Promise { const selectAndParams = this.whereClauseList(field, values); @@ -466,7 +466,7 @@ export class SQLiteDB { * @param table The table to delete from. * @param select A fragment of SQL to be used in a where clause in the SQL call. * @param params Array of sql parameters. - * @return Promise resolved with the number of affected rows. + * @returns Promise resolved with the number of affected rows. */ async deleteRecordsSelect(table: string, select: string = '', params?: SQLiteDBRecordValue[]): Promise { if (select) { @@ -482,7 +482,7 @@ export class SQLiteDB { * Drop a table if it exists. * * @param name The table name. - * @return Promise resolved when success. + * @returns Promise resolved when success. */ async dropTable(name: string): Promise { await this.execute(`DROP TABLE IF EXISTS ${name}`); @@ -495,7 +495,7 @@ export class SQLiteDB { * * @param sql SQL query to execute. * @param params Query parameters. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any async execute(sql: string, params?: SQLiteDBRecordValue[]): Promise { @@ -510,7 +510,7 @@ export class SQLiteDB { * these query will be run in SQLite (Mobile) and Web SQL (desktop), so your query should work in both environments. * * @param sqlStatements SQL statements to execute. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any async executeBatch(sqlStatements: (string | string[] | any)[]): Promise { @@ -541,7 +541,7 @@ export class SQLiteDB { * Format the data to where params. * * @param data Object data. - * @return List of params. + * @returns List of params. */ protected formatDataToSQLParams(data: SQLiteDBRecordValues): SQLiteDBRecordValue[] { return Object.keys(data).map((key) => data[key]!); @@ -551,7 +551,7 @@ export class SQLiteDB { * Get all the records from a table. * * @param table The table to query. - * @return Promise resolved with the records. + * @returns Promise resolved with the records. */ async getAllRecords(table: string): Promise { return this.getRecords(table); @@ -563,7 +563,7 @@ export class SQLiteDB { * @param table The table to query. * @param field The field to return the value of. * @param conditions The conditions to build the where clause. Must not contain numeric indexes. - * @return Promise resolved with the field's value. + * @returns Promise resolved with the field's value. */ async getField(table: string, field: string, conditions?: SQLiteDBRecordValues): Promise { const selectAndParams = this.whereClause(conditions); @@ -578,7 +578,7 @@ export class SQLiteDB { * @param field The field to return the value of. * @param select A fragment of SQL to be used in a where clause returning one row with one column. * @param params Array of sql parameters. - * @return Promise resolved with the field's value. + * @returns Promise resolved with the field's value. */ async getFieldSelect( table: string, @@ -598,7 +598,7 @@ export class SQLiteDB { * * @param sql The SQL query returning one row with one column. * @param params An array of sql parameters. - * @return Promise resolved with the field's value. + * @returns Promise resolved with the field's value. */ async getFieldSql(sql: string, params?: SQLiteDBRecordValue[]): Promise { const record = await this.getRecordSql>(sql, params); @@ -612,7 +612,7 @@ export class SQLiteDB { /** * Get the database name. * - * @return Database name. + * @returns Database name. */ getName(): string { return this.name; @@ -624,7 +624,7 @@ export class SQLiteDB { * @param table The table to query. * @param conditions The conditions to build the where clause. Must not contain numeric indexes. * @param fields A comma separated list of fields to return. - * @return Promise resolved with the record, rejected if not found. + * @returns Promise resolved with the record, rejected if not found. */ getRecord(table: string, conditions?: SQLiteDBRecordValues, fields: string = '*'): Promise { const selectAndParams = this.whereClause(conditions); @@ -639,7 +639,7 @@ export class SQLiteDB { * @param select A fragment of SQL to be used in a where clause in the SQL call. * @param params An array of sql parameters. * @param fields A comma separated list of fields to return. - * @return Promise resolved with the record, rejected if not found. + * @returns Promise resolved with the record, rejected if not found. */ getRecordSelect( table: string, @@ -662,7 +662,7 @@ export class SQLiteDB { * * @param sql The SQL string you wish to be executed, should normally only return one record. * @param params List of sql parameters - * @return Promise resolved with the records. + * @returns Promise resolved with the records. */ async getRecordSql(sql: string, params?: SQLiteDBRecordValue[]): Promise { const result = await this.getRecordsSql(sql, params, 0, 1); @@ -683,7 +683,7 @@ export class SQLiteDB { * @param fields A comma separated list of fields to return. * @param limitFrom Return a subset of records, starting at this point. * @param limitNum Return a subset comprising this many records in total. - * @return Promise resolved with the records. + * @returns Promise resolved with the records. */ getRecords( table: string, @@ -708,7 +708,7 @@ export class SQLiteDB { * @param fields A comma separated list of fields to return. * @param limitFrom Return a subset of records, starting at this point. * @param limitNum Return a subset comprising this many records in total. - * @return Promise resolved with the records. + * @returns Promise resolved with the records. */ getRecordsList( table: string, @@ -734,7 +734,7 @@ export class SQLiteDB { * @param fields A comma separated list of fields to return. * @param limitFrom Return a subset of records, starting at this point. * @param limitNum Return a subset comprising this many records in total. - * @return Promise resolved with the records. + * @returns Promise resolved with the records. */ getRecordsSelect( table: string, @@ -764,7 +764,7 @@ export class SQLiteDB { * @param params List of sql parameters * @param limitFrom Return a subset of records, starting at this point. * @param limitNum Return a subset comprising this many records. - * @return Promise resolved with the records. + * @returns Promise resolved with the records. */ async getRecordsSql( sql: string, @@ -796,7 +796,7 @@ export class SQLiteDB { * * @param table The database table. * @param data A data object with values for one or more fields in the record. - * @return Array with the SQL query and the params. + * @returns Array with the SQL query and the params. */ protected getSqlInsertQuery(table: string, data: SQLiteDBRecordValues): SQLiteDBQueryParams { this.formatDataToInsert(data); @@ -835,7 +835,7 @@ export class SQLiteDB { * * @param table The database table to be inserted into. * @param data A data object with values for one or more fields in the record. - * @return Promise resolved with new rowId. Please notice this rowId is internal from SQLite. + * @returns Promise resolved with new rowId. Please notice this rowId is internal from SQLite. */ async insertRecord(table: string, data: SQLiteDBRecordValues): Promise { const sqlAndParams = this.getSqlInsertQuery(table, data); @@ -849,7 +849,7 @@ export class SQLiteDB { * * @param table The database table to be inserted into. * @param dataObjects List of objects to be inserted. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async insertRecords(table: string, dataObjects: SQLiteDBRecordValues[]): Promise { if (!Array.isArray(dataObjects)) { @@ -870,7 +870,7 @@ export class SQLiteDB { * * @param table The database table to be inserted into. * @param source The database table to get the records from. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async insertRecordsFrom( table: string, @@ -888,7 +888,7 @@ export class SQLiteDB { * @param oldTable Old table name. * @param newTable New table name. * @param mapCallback Mapping callback to migrate each record. - * @return Resolved when done. + * @returns Resolved when done. */ async migrateTable( oldTable: string, @@ -931,7 +931,7 @@ export class SQLiteDB { * * @param limitFrom Where to start results from. * @param limitNum How many results to return. - * @return Normalised limit params in array: [limitFrom, limitNum]. + * @returns Normalised limit params in array: [limitFrom, limitNum]. */ normaliseLimitFromNum(limitFrom?: number, limitNum?: number): number[] { // We explicilty treat these cases as 0. @@ -953,7 +953,7 @@ export class SQLiteDB { /** * Open the database. Only needed if it was closed before, a database is automatically opened when created. * - * @return Promise resolved when open. + * @returns Promise resolved when open. */ async open(): Promise { await this.ready(); @@ -964,7 +964,7 @@ export class SQLiteDB { /** * Wait for the DB to be ready. * - * @return Promise resolved when ready. + * @returns Promise resolved when ready. */ ready(): Promise { return this.promise; @@ -975,7 +975,7 @@ export class SQLiteDB { * * @param table The table to check. * @param conditions The conditions to build the where clause. Must not contain numeric indexes. - * @return Promise resolved if exists, rejected otherwise. + * @returns Promise resolved if exists, rejected otherwise. */ async recordExists(table: string, conditions?: SQLiteDBRecordValues): Promise { const record = await this.getRecord(table, conditions); @@ -990,7 +990,7 @@ export class SQLiteDB { * @param table The table to query. * @param select A fragment of SQL to be used in a where clause in the SQL call. * @param params An array of sql parameters. - * @return Promise resolved if exists, rejected otherwise. + * @returns Promise resolved if exists, rejected otherwise. */ async recordExistsSelect(table: string, select: string = '', params: SQLiteDBRecordValue[] = []): Promise { const record = await this.getRecordSelect(table, select, params); @@ -1004,7 +1004,7 @@ export class SQLiteDB { * * @param sql The SQL query returning one row with one column. * @param params An array of sql parameters. - * @return Promise resolved if exists, rejected otherwise. + * @returns Promise resolved if exists, rejected otherwise. */ async recordExistsSql(sql: string, params?: SQLiteDBRecordValue[]): Promise { const record = await this.getRecordSql(sql, params); @@ -1017,7 +1017,7 @@ export class SQLiteDB { * Test whether a table exists.. * * @param name The table name. - * @return Promise resolved if exists, rejected otherwise. + * @returns Promise resolved if exists, rejected otherwise. */ async tableExists(name: string): Promise { // eslint-disable-next-line @typescript-eslint/naming-convention @@ -1027,10 +1027,10 @@ export class SQLiteDB { /** * Update one or more records in a table. * - * @param string table The database table to update. + * @param table The database table to update. * @param data An object with the fields to update: fieldname=>fieldvalue. * @param conditions The conditions to build the where clause. Must not contain numeric indexes. - * @return Promise resolved with the number of affected rows. + * @returns Promise resolved with the number of affected rows. */ async updateRecords(table: string, data: SQLiteDBRecordValues, conditions?: SQLiteDBRecordValues): Promise { const whereAndParams = this.whereClause(conditions); @@ -1041,11 +1041,11 @@ export class SQLiteDB { /** * Update one or more records in a table. It accepts a WHERE clause as a string. * - * @param string table The database table to update. + * @param table The database table to update. * @param data An object with the fields to update: fieldname=>fieldvalue. * @param where Where clause. Must not include the "WHERE" word. * @param whereParams Params for the where clause. - * @return Promise resolved with the number of affected rows. + * @returns Promise resolved with the number of affected rows. */ async updateRecordsWhere( table: string, @@ -1080,7 +1080,7 @@ export class SQLiteDB { * Returns the SQL WHERE conditions. * * @param conditions The conditions to build the where clause. Must not contain numeric indexes. - * @return An array list containing sql 'where' part and 'params'. + * @returns An array list containing sql 'where' part and 'params'. */ whereClause(conditions: SQLiteDBRecordValues = {}): SQLiteDBQueryParams { if (!conditions || !Object.keys(conditions).length) { @@ -1115,7 +1115,7 @@ export class SQLiteDB { * * @param field The name of a field. * @param values The values field might take. - * @return An array containing sql 'where' part and 'params'. + * @returns An array containing sql 'where' part and 'params'. */ whereClauseList(field: string, values: SQLiteDBRecordValue[]): SQLiteDBQueryParams { if (!values || !values.length) { diff --git a/src/core/classes/tabs.ts b/src/core/classes/tabs.ts index 294d96ca4..5fe244c3a 100644 --- a/src/core/classes/tabs.ts +++ b/src/core/classes/tabs.ts @@ -216,7 +216,7 @@ export class CoreTabsBaseComponent implements OnInit, Aft * Get the tab on a index. * * @param tabId Tab ID. - * @return Selected tab. + * @returns Selected tab. */ protected getTabIndex(tabId: string): number { return this.tabs.findIndex((tab) => tabId == tab.id); @@ -225,7 +225,7 @@ export class CoreTabsBaseComponent implements OnInit, Aft /** * Get the current selected tab. * - * @return Selected tab. + * @returns Selected tab. */ getSelected(): T | undefined { const index = this.selected && this.getTabIndex(this.selected); @@ -314,7 +314,7 @@ export class CoreTabsBaseComponent implements OnInit, Aft /** * Calculate the initial tab to load. * - * @return Initial tab, undefined if no valid tab found. + * @returns Initial tab, undefined if no valid tab found. */ protected calculateInitialTab(): T | undefined { const selectedTab: T | undefined = this.tabs[this.selectedIndex || 0] || undefined; @@ -479,7 +479,7 @@ export class CoreTabsBaseComponent implements OnInit, Aft * * @param tabId Tab ID. * @param e Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async selectTab(tabId: string, e?: Event): Promise { const index = this.tabs.findIndex((tab) => tabId == tab.id); @@ -495,7 +495,7 @@ export class CoreTabsBaseComponent implements OnInit, Aft * * @param index Index to select. * @param e Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async selectByIndex(index: number, e?: Event): Promise { e?.preventDefault(); @@ -557,7 +557,7 @@ export class CoreTabsBaseComponent implements OnInit, Aft * Load the tab. * * @param tabToSelect Tab to load. - * @return Promise resolved with true if tab is successfully loaded. + * @returns Promise resolved with true if tab is successfully loaded. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected async loadTab(tabToSelect: T): Promise { diff --git a/src/core/components/attachments/attachments.ts b/src/core/components/attachments/attachments.ts index df9a9dbfc..1b19d8e31 100644 --- a/src/core/components/attachments/attachments.ts +++ b/src/core/components/attachments/attachments.ts @@ -99,7 +99,7 @@ export class CoreAttachmentsComponent implements OnInit { /** * Get max size of the area. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getMaxSizeOfArea(): Promise { if (this.courseId) { diff --git a/src/core/components/chart/chart.ts b/src/core/components/chart/chart.ts index cd792d859..0b3c86000 100644 --- a/src/core/components/chart/chart.ts +++ b/src/core/components/chart/chart.ts @@ -136,7 +136,7 @@ export class CoreChartComponent implements OnDestroy, OnInit, OnChanges { /** * Format labels if needed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async formatLabels(): Promise { if (!this.contextLevel || !this.contextInstanceId || this.filter === false) { @@ -161,7 +161,7 @@ export class CoreChartComponent implements OnDestroy, OnInit, OnChanges { * Generate random colors if needed. * * @param n Number of colors needed. - * @return Array with the number of background colors requested. + * @returns Array with the number of background colors requested. */ protected getRandomColors(n: number): string[] { while (CoreChartComponent.backgroundColors.length < n) { diff --git a/src/core/components/chrono/chrono.ts b/src/core/components/chrono/chrono.ts index b111a9b0e..8f30406a1 100644 --- a/src/core/components/chrono/chrono.ts +++ b/src/core/components/chrono/chrono.ts @@ -56,7 +56,7 @@ export class CoreChronoComponent implements OnInit, OnChanges, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.time = this.startTime || 0; diff --git a/src/core/components/combobox/combobox.ts b/src/core/components/combobox/combobox.ts index 3a549827b..05d0d7d25 100644 --- a/src/core/components/combobox/combobox.ts +++ b/src/core/components/combobox/combobox.ts @@ -113,7 +113,7 @@ export class CoreComboboxComponent implements ControlValueAccessor { * Shows combobox modal. * * @param event Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openSelect(event?: UIEvent): Promise { this.touch(); diff --git a/src/core/components/context-menu/context-menu-item.ts b/src/core/components/context-menu/context-menu-item.ts index 2c4a209b1..f6b0c8900 100644 --- a/src/core/components/context-menu/context-menu-item.ts +++ b/src/core/components/context-menu/context-menu-item.ts @@ -74,7 +74,7 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Initialize values. diff --git a/src/core/components/context-menu/context-menu-popover.ts b/src/core/components/context-menu/context-menu-popover.ts index 4cb3c4f4c..6eb3f8b10 100644 --- a/src/core/components/context-menu/context-menu-popover.ts +++ b/src/core/components/context-menu/context-menu-popover.ts @@ -52,7 +52,7 @@ export class CoreContextMenuPopoverComponent { * * @param event Click event. * @param item Item clicked. - * @return Return true if success, false if error. + * @returns Return true if success, false if error. */ itemClicked(event: Event, item: CoreContextMenuItemComponent): boolean { if (item.iconAction == 'toggle' && !event.defaultPrevented) { diff --git a/src/core/components/dynamic-component/dynamic-component.ts b/src/core/components/dynamic-component/dynamic-component.ts index edd456772..00e48d8c4 100644 --- a/src/core/components/dynamic-component/dynamic-component.ts +++ b/src/core/components/dynamic-component/dynamic-component.ts @@ -131,7 +131,7 @@ export class CoreDynamicComponent implements OnChanges, DoCheck * * @param method Name of the method to call. * @param params List of params to send to the method. - * @return Result of the call. Undefined if the component instance is not ready. + * @returns Result of the call. Undefined if the component instance is not ready. */ callComponentMethod( method: Method, @@ -147,7 +147,7 @@ export class CoreDynamicComponent implements OnChanges, DoCheck /** * Create a component, add it to a container and set the input data. * - * @return Whether the component was successfully created. + * @returns Whether the component was successfully created. */ protected createComponent(): boolean { this.lastComponent = this.component; diff --git a/src/core/components/file/file.ts b/src/core/components/file/file.ts index cb3306990..12f2d2fb2 100644 --- a/src/core/components/file/file.ts +++ b/src/core/components/file/file.ts @@ -70,7 +70,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.file) { @@ -124,7 +124,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { /** * Convenience function to get the file state and set variables based on it. * - * @return Promise resolved when state has been calculated. + * @returns Promise resolved when state has been calculated. */ protected async calculateState(): Promise { if (!this.siteId) { @@ -147,7 +147,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { * * @param ev Click event (if any). * @param isOpenButton Whether the open button was clicked. - * @return Promise resolved when file is opened. + * @returns Promise resolved when file is opened. */ openFile(ev?: Event, isOpenButton = false): Promise { ev?.preventDefault(); @@ -222,7 +222,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { } // User confirmed, add the file to queue. - // @todo: Is the invalidate really needed? + // @todo Is the invalidate really needed? await CoreUtils.ignoreErrors(CoreFilepool.invalidateFileByUrl(this.siteId, this.fileUrl)); this.isDownloading = true; diff --git a/src/core/components/files/files.ts b/src/core/components/files/files.ts index a17b1587e..3194a45f7 100644 --- a/src/core/components/files/files.ts +++ b/src/core/components/files/files.ts @@ -50,7 +50,7 @@ export class CoreFilesComponent implements OnInit, DoCheck { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (CoreUtils.isTrueOrOne(this.showInline) && this.files) { diff --git a/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts b/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts index 7541826af..e0ea431e0 100644 --- a/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts +++ b/src/core/components/horizontal-scroll-controls/horizontal-scroll-controls.ts @@ -36,6 +36,8 @@ export class CoreHorizontalScrollControlsComponent { /** * Get target element. + * + * @returns The target element or null. */ private get target(): HTMLElement | null { return this.targetId && document.getElementById(this.targetId) || null; diff --git a/src/core/components/icon/icon.ts b/src/core/components/icon/icon.ts index 36dbb05b1..6850c88d6 100644 --- a/src/core/components/icon/icon.ts +++ b/src/core/components/icon/icon.ts @@ -101,7 +101,7 @@ export class CoreIconComponent implements OnChanges { * Check if the value is true or on. * * @param val Value to be checked. - * @return If has a value equivalent to true. + * @returns If has a value equivalent to true. */ isTrueProperty(val: unknown): boolean { if (typeof val === 'string') { diff --git a/src/core/components/iframe/iframe.ts b/src/core/components/iframe/iframe.ts index 943d4d774..1201da20a 100644 --- a/src/core/components/iframe/iframe.ts +++ b/src/core/components/iframe/iframe.ts @@ -142,7 +142,7 @@ export class CoreIframeComponent implements OnChanges, OnDestroy { /** * Check if the element is in a hidden page. * - * @return Whether the element is in a hidden page. + * @returns Whether the element is in a hidden page. */ protected isInHiddenPage(): boolean { // If we can't find the parent ion-page, consider it to be hidden too. @@ -218,7 +218,7 @@ export class CoreIframeComponent implements OnChanges, OnDestroy { * Treat an iframe message event. * * @param event Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async onIframeMessage(event: MessageEvent): Promise { if (event.data == 'enterFullScreen' && this.showFullscreenOnToolbar && !this.fullscreen) { diff --git a/src/core/components/infinite-loading/infinite-loading.ts b/src/core/components/infinite-loading/infinite-loading.ts index 814416cbb..5ba3e3c13 100644 --- a/src/core/components/infinite-loading/infinite-loading.ts +++ b/src/core/components/infinite-loading/infinite-loading.ts @@ -132,7 +132,7 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Get the height of the element. * - * @return Height. + * @returns Height. * @todo erase if not needed: I'm depreacating it because if not needed or getBoundingClientRect has the same result, it should * be erased, also with getElementHeight * @deprecated since 3.9.5 @@ -144,7 +144,7 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Get the infinite scroll element. * - * @return Element or null. + * @returns Element or null. */ get infiniteScrollElement(): HTMLIonInfiniteScrollElement | null { return this.hostElement.querySelector('ion-infinite-scroll'); diff --git a/src/core/components/loading/loading.ts b/src/core/components/loading/loading.ts index 224dfe631..6db45e3c8 100644 --- a/src/core/components/loading/loading.ts +++ b/src/core/components/loading/loading.ts @@ -131,7 +131,7 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit, A * Change loaded state. * * @param loaded True to load, false otherwise. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async changeState(loaded: boolean): Promise { this.element.classList.toggle('core-loading-loaded', loaded); @@ -163,6 +163,8 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit, A /** * Gets current scroll position. + * + * @returns the scroll position or undefined if scroll not found. */ protected async getScrollPosition(): Promise { const content = this.element.closest('ion-content'); diff --git a/src/core/components/local-file/local-file.ts b/src/core/components/local-file/local-file.ts index dec294335..8301fbad3 100644 --- a/src/core/components/local-file/local-file.ts +++ b/src/core/components/local-file/local-file.ts @@ -64,7 +64,7 @@ export class CoreLocalFileComponent implements OnInit { protected defaultIsOpenWithPicker = false; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { this.manage = CoreUtils.isTrueOrOne(this.manage); diff --git a/src/core/components/mark-required/mark-required.ts b/src/core/components/mark-required/mark-required.ts index e443d6d32..a0c5de654 100644 --- a/src/core/components/mark-required/mark-required.ts +++ b/src/core/components/mark-required/mark-required.ts @@ -48,7 +48,7 @@ export class CoreMarkRequiredComponent implements OnInit, AfterViewInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.requiredLabel = Translate.instant('core.required'); diff --git a/src/core/components/navbar-buttons/navbar-buttons.ts b/src/core/components/navbar-buttons/navbar-buttons.ts index 88dd4dcd0..83e18fb47 100644 --- a/src/core/components/navbar-buttons/navbar-buttons.ts +++ b/src/core/components/navbar-buttons/navbar-buttons.ts @@ -181,7 +181,7 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * Create a new and empty context menu to be used as a "parent". * - * @return Created component. + * @returns Created component. */ protected createMainContextMenu(): CoreContextMenuComponent { const factory = this.factoryResolver.resolveComponentFactory(CoreContextMenuComponent); @@ -195,7 +195,7 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * Search the ion-header where the buttons should be added. * - * @return Promise resolved with the header element. + * @returns Promise resolved with the header element. */ protected async searchHeader(): Promise { await CoreDom.waitToBeInDOM(this.element); diff --git a/src/core/components/recaptcha/recaptcha.ts b/src/core/components/recaptcha/recaptcha.ts index d4f8211b0..abca069ea 100644 --- a/src/core/components/recaptcha/recaptcha.ts +++ b/src/core/components/recaptcha/recaptcha.ts @@ -42,7 +42,7 @@ export class CoreRecaptchaComponent implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.siteUrl = this.siteUrl || CoreSites.getCurrentSite()?.getURL(); diff --git a/src/core/components/split-view/split-view.ts b/src/core/components/split-view/split-view.ts index e535f731d..060b6885c 100644 --- a/src/core/components/split-view/split-view.ts +++ b/src/core/components/split-view/split-view.ts @@ -115,7 +115,7 @@ export class CoreSplitViewComponent implements AfterViewInit, OnDestroy { * Get the current mode. Depending on the layout, outlet status, and whether this split view * is nested or not, this method will indicate which parts of the split view should be visible. * - * @return Split view mode. + * @returns Split view mode. */ private getCurrentMode(): CoreSplitViewMode { if (this.mode) { diff --git a/src/core/components/style/style.ts b/src/core/components/style/style.ts index da497ffdd..e831151f5 100644 --- a/src/core/components/style/style.ts +++ b/src/core/components/style/style.ts @@ -53,7 +53,7 @@ export class CoreStyleComponent implements OnChanges { * * @param css CSS code to be prefixed. * @param prefix Prefix css selector. - * @return Prefixed CSS. + * @returns Prefixed CSS. */ protected prefixCSS(css: string, prefix: string): string { if (!css) { diff --git a/src/core/components/swipe-slides/swipe-slides.ts b/src/core/components/swipe-slides/swipe-slides.ts index f7ab8106b..b5405ac46 100644 --- a/src/core/components/swipe-slides/swipe-slides.ts +++ b/src/core/components/swipe-slides/swipe-slides.ts @@ -88,7 +88,7 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe * Check whether the slide with the given index is active. * * @param index Slide index. - * @return Whether the slide is active. + * @returns Whether the slide is active. */ isActive(index: number): boolean { return this.activeSlideIndexes.includes(index); @@ -257,7 +257,7 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe /** * Treat scroll on change. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async applyScrollOnChange(): Promise { if (this.options.scrollOnChange !== 'top') { @@ -276,7 +276,7 @@ export class CoreSwipeSlidesComponent implements OnChanges, OnDe /** * Get current item and index based on current slide. * - * @return Promise resolved with current item data. Null if not found. + * @returns Promise resolved with current item data. Null if not found. */ protected async getCurrentSlideItemData(): Promise | null> { if (!this.slides || !this.manager) { diff --git a/src/core/components/tabs-outlet/tabs-outlet.ts b/src/core/components/tabs-outlet/tabs-outlet.ts index 8e1174086..93d72b195 100644 --- a/src/core/components/tabs-outlet/tabs-outlet.ts +++ b/src/core/components/tabs-outlet/tabs-outlet.ts @@ -43,8 +43,8 @@ import { CoreComponentsRegistry } from '@singletons/components-registry'; * * Tab contents will only be shown if that tab is selected. * - * @todo: Test RTL and tab history. - * @todo: This should behave like the split-view in relation to routing (maybe we could reuse some code from + * @todo Test RTL and tab history. + * @todo This should behave like the split-view in relation to routing (maybe we could reuse some code from * CorePageItemsListManager). */ @Component({ @@ -188,7 +188,7 @@ export class CoreTabsOutletComponent extends CoreTabsBaseComponent { return CoreNavigator.navigate(tabToSelect.page, { diff --git a/src/core/components/tabs/tab.ts b/src/core/components/tabs/tab.ts index c98e10472..3d9e40561 100644 --- a/src/core/components/tabs/tab.ts +++ b/src/core/components/tabs/tab.ts @@ -89,7 +89,7 @@ export class CoreTabComponent implements OnInit, OnDestroy, CoreTabBase { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.element.setAttribute('aria-labelledby', this.id + '-tab'); diff --git a/src/core/components/tabs/tabs.ts b/src/core/components/tabs/tabs.ts index a603c3ef8..9d213583b 100644 --- a/src/core/components/tabs/tabs.ts +++ b/src/core/components/tabs/tabs.ts @@ -104,7 +104,7 @@ export class CoreTabsComponent extends CoreTabsBaseComponent i * Load the tab. * * @param tabToSelect Tab to load. - * @return Promise resolved with true if tab is successfully loaded. + * @returns Promise resolved with true if tab is successfully loaded. */ protected async loadTab(tabToSelect: CoreTabComponent): Promise { const currentTab = this.getSelected(); diff --git a/src/core/components/timer/timer.ts b/src/core/components/timer/timer.ts index 5d310af86..5b19b5557 100644 --- a/src/core/components/timer/timer.ts +++ b/src/core/components/timer/timer.ts @@ -50,7 +50,7 @@ export class CoreTimerComponent implements OnInit, OnDestroy { ) {} /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { const timeLeftClass = this.timeLeftClass || 'core-timer-timeleft-'; diff --git a/src/core/components/user-avatar/user-avatar.ts b/src/core/components/user-avatar/user-avatar.ts index 3c6923e7a..cd0f26495 100644 --- a/src/core/components/user-avatar/user-avatar.ts +++ b/src/core/components/user-avatar/user-avatar.ts @@ -45,7 +45,7 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges, OnDestroy { avatarUrl?: string; // Variable to check if we consider this user online or not. - // @TODO: Use setting when available (see MDL-63972) so we can use site setting. + // @todo Use setting when available (see MDL-63972) so we can use site setting. protected timetoshowusers = 300000; // Miliseconds default. protected currentUserId: number; protected pictureObserver: CoreEventObserver; @@ -65,7 +65,7 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.setFields(); @@ -101,7 +101,7 @@ export class CoreUserAvatarComponent implements OnInit, OnChanges, OnDestroy { /** * Helper function for checking the time meets the 'online' condition. * - * @return boolean + * @returns boolean */ isOnline(): boolean { if (!this.user) { diff --git a/src/core/directives/collapsible-footer.ts b/src/core/directives/collapsible-footer.ts index 00352c09a..e93fab948 100644 --- a/src/core/directives/collapsible-footer.ts +++ b/src/core/directives/collapsible-footer.ts @@ -243,7 +243,7 @@ export class CoreCollapsibleFooterDirective implements OnInit, OnDestroy { /** * Wait until all children inside the page. * - * @return Promise resolved when loadings are done. + * @returns Promise resolved when loadings are done. */ protected async waitLoadingsDone(): Promise { const scrollElement = await this.ionContent.getScrollElement(); diff --git a/src/core/directives/collapsible-header.ts b/src/core/directives/collapsible-header.ts index 6fdba530a..fbd6ff845 100644 --- a/src/core/directives/collapsible-header.ts +++ b/src/core/directives/collapsible-header.ts @@ -442,7 +442,7 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest * Wait until all children inside the element are done rendering. * * @param element Element. - * @return Promise resolved when texts are rendered. + * @returns Promise resolved when texts are rendered. */ protected async waitFormatTextsRendered(element: Element): Promise { await CoreComponentsRegistry.waitComponentsReady(element, 'core-format-text', CoreFormatTextDirective); diff --git a/src/core/directives/collapsible-item.ts b/src/core/directives/collapsible-item.ts index a5c44c5eb..635da33e6 100644 --- a/src/core/directives/collapsible-item.ts +++ b/src/core/directives/collapsible-item.ts @@ -116,7 +116,7 @@ export class CoreCollapsibleItemDirective implements OnInit, OnDestroy { /** * Wait until all children inside the page. * - * @return Promise resolved when loadings are done. + * @returns Promise resolved when loadings are done. */ protected async waitLoadingsDone(): Promise { this.domPromise = CoreDom.waitToBeInDOM(this.element); diff --git a/src/core/directives/download-file.ts b/src/core/directives/download-file.ts index b0d798584..4c67bc45d 100644 --- a/src/core/directives/download-file.ts +++ b/src/core/directives/download-file.ts @@ -37,7 +37,7 @@ export class CoreDownloadFileDirective implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.element.addEventListener('click', async (ev: Event) => { diff --git a/src/core/directives/external-content.ts b/src/core/directives/external-content.ts index c6a464c81..f62115f7b 100644 --- a/src/core/directives/external-content.ts +++ b/src/core/directives/external-content.ts @@ -191,7 +191,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O * @param targetAttr Attribute to modify. * @param url Original URL to treat. * @param siteId Site ID. - * @return Promise resolved if the element is successfully treated. + * @returns Promise resolved if the element is successfully treated. */ protected async handleExternalContent(targetAttr: string, url: string, siteId?: string): Promise { @@ -250,7 +250,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O * Handle inline styles, trying to download referenced files. * * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async handleInlineStyles(siteId?: string): Promise { if (!siteId) { @@ -324,7 +324,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O * @param targetAttr Attribute to modify. * @param url Original URL to treat. * @param site Site. - * @return Promise resolved with the URL. + * @returns Promise resolved with the URL. */ protected async getUrlToUse(targetAttr: string, url: string, site: CoreSite): Promise { const tagName = this.element.tagName; @@ -379,7 +379,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O * @param targetAttr Attribute to modify. * @param url Original URL to treat. * @param site Site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async setListeners(targetAttr: string, url: string, site: CoreSite): Promise { if (this.fileEventObserver) { diff --git a/src/core/directives/format-text.ts b/src/core/directives/format-text.ts index d0f1ee5fc..7fdd4e165 100644 --- a/src/core/directives/format-text.ts +++ b/src/core/directives/format-text.ts @@ -171,7 +171,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo * Apply CoreExternalContentDirective to a certain element. * * @param element Element to add the attributes to. - * @return External content instance or undefined if siteId is not provided. + * @returns External content instance or undefined if siteId is not provided. */ protected addExternalContent(element: Element): CoreExternalContentDirective | undefined { if (!this.siteId) { @@ -400,7 +400,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo /** * Apply formatText and set sub-directives. * - * @return Promise resolved with a div element containing the code. + * @returns Promise resolved with a div element containing the code. */ protected async formatContents(): Promise { // Retrieve the site since it might be needed later. @@ -463,7 +463,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo * * @param div Div element. * @param site Site instance. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected treatHTMLElements(div: HTMLElement, site?: CoreSite): ElementController[] { const images = Array.from(div.querySelectorAll('img')); @@ -666,7 +666,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo /** * Returns the element width in pixels. * - * @return The width of the element in pixels. + * @returns The width of the element in pixels. */ protected async getElementWidth(): Promise { if (!this.domElementPromise) { @@ -911,7 +911,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncCompo * Convert window.open to window.openWindowSafely inside HTML tags. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ protected treatWindowOpen(text: string): string { // Get HTML tags that include window.open. Script tags aren't executed so there's no need to treat them. diff --git a/src/core/directives/link.ts b/src/core/directives/link.ts index cabc76f25..86d2c18ef 100644 --- a/src/core/directives/link.ts +++ b/src/core/directives/link.ts @@ -111,7 +111,7 @@ export class CoreLinkDirective implements OnInit { * * @param href HREF to be opened. * @param openIn Open In App value coming from data-open-in attribute. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async navigate(href: string, openIn?: string | null): Promise { @@ -150,7 +150,7 @@ export class CoreLinkDirective implements OnInit { * Open a local file. * * @param path Path to the file. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async openLocalFile(path: string): Promise { const filename = path.substring(path.lastIndexOf('/') + 1); @@ -175,7 +175,7 @@ export class CoreLinkDirective implements OnInit { * * @param href HREF to be opened. * @param openIn Open In App value coming from data-open-in attribute. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async openExternalLink(href: string, openIn?: string | null): Promise { // Priority order is: core-link inApp attribute > forceOpenLinksIn setting > data-open-in HTML attribute. diff --git a/src/core/directives/swipe-navigation.ts b/src/core/directives/swipe-navigation.ts index 2a2019cc7..e73990304 100644 --- a/src/core/directives/swipe-navigation.ts +++ b/src/core/directives/swipe-navigation.ts @@ -124,6 +124,8 @@ export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy { /** * Check whether there is an item to the right of the current selection. + * + * @returns If has an item to the right. */ protected async hasItemRight(): Promise { if (!this.manager) { @@ -137,6 +139,8 @@ export class CoreSwipeNavigationDirective implements AfterViewInit, OnDestroy { /** * Check whether there is an item to the left of the current selection. + * + * @returns If has an item to the left. */ protected async hasItemLeft(): Promise { if (!this.manager) { diff --git a/src/core/features/block/classes/base-block-component.ts b/src/core/features/block/classes/base-block-component.ts index d31b7cac7..368519223 100644 --- a/src/core/features/block/classes/base-block-component.ts +++ b/src/core/features/block/classes/base-block-component.ts @@ -51,7 +51,7 @@ export abstract class CoreBlockBaseComponent implements OnInit, ICoreBlockCompon } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (this.block.configs && this.block.configs.length > 0) { @@ -69,7 +69,7 @@ export abstract class CoreBlockBaseComponent implements OnInit, ICoreBlockCompon * Perform the refresh content function. * * @param showLoading Whether to show loading. - * @return Resolved when done. + * @returns Resolved when done. */ protected async refreshContent(showLoading?: boolean): Promise { if (showLoading) { @@ -116,7 +116,7 @@ export abstract class CoreBlockBaseComponent implements OnInit, ICoreBlockCompon /** * Download the component contents. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchContent(): Promise { return; @@ -125,7 +125,7 @@ export abstract class CoreBlockBaseComponent implements OnInit, ICoreBlockCompon /** * Reload content without invalidating data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async reloadContent(): Promise { if (!this.loaded) { diff --git a/src/core/features/block/classes/base-block-handler.ts b/src/core/features/block/classes/base-block-handler.ts index 161e7e319..b9f3604c4 100644 --- a/src/core/features/block/classes/base-block-handler.ts +++ b/src/core/features/block/classes/base-block-handler.ts @@ -29,7 +29,7 @@ export class CoreBlockBaseHandler implements CoreBlockHandler { /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -41,7 +41,7 @@ export class CoreBlockBaseHandler implements CoreBlockHandler { * @param block The block to render. * @param contextLevel The context where the block will be used. * @param instanceId The instance ID associated with the context level. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData( block: CoreCourseBlock, // eslint-disable-line @typescript-eslint/no-unused-vars diff --git a/src/core/features/block/components/block/block.ts b/src/core/features/block/components/block/block.ts index 8e12855e3..ae37afab2 100644 --- a/src/core/features/block/components/block/block.ts +++ b/src/core/features/block/components/block/block.ts @@ -109,7 +109,7 @@ export class CoreBlockComponent implements OnChanges, OnDestroy { /** * Invalidate some data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidate(): Promise { if (this.dynamicComponent) { diff --git a/src/core/features/block/components/only-title-block/only-title-block.ts b/src/core/features/block/components/only-title-block/only-title-block.ts index 47169f3c7..4c6f4b8d5 100644 --- a/src/core/features/block/components/only-title-block/only-title-block.ts +++ b/src/core/features/block/components/only-title-block/only-title-block.ts @@ -31,7 +31,7 @@ export class CoreBlockOnlyTitleComponent extends CoreBlockBaseComponent implemen } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { await super.ngOnInit(); diff --git a/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts b/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts index 79e3e7614..ad4889a38 100644 --- a/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts +++ b/src/core/features/block/components/pre-rendered-block/pre-rendered-block.ts @@ -31,7 +31,7 @@ export class CoreBlockPreRenderedComponent extends CoreBlockBaseComponent implem } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { await super.ngOnInit(); diff --git a/src/core/features/block/components/side-blocks/side-blocks.ts b/src/core/features/block/components/side-blocks/side-blocks.ts index 5a7fc3494..2e533d3ff 100644 --- a/src/core/features/block/components/side-blocks/side-blocks.ts +++ b/src/core/features/block/components/side-blocks/side-blocks.ts @@ -53,7 +53,7 @@ export class CoreBlockSideBlocksComponent implements OnInit { /** * Invalidate blocks data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateBlocks(): Promise { const promises: Promise[] = []; @@ -77,7 +77,7 @@ export class CoreBlockSideBlocksComponent implements OnInit { /** * Convenience function to fetch the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadContent(): Promise { try { diff --git a/src/core/features/block/services/block-delegate.ts b/src/core/features/block/services/block-delegate.ts index 5a2aa3d81..8a579bdff 100644 --- a/src/core/features/block/services/block-delegate.ts +++ b/src/core/features/block/services/block-delegate.ts @@ -39,7 +39,7 @@ export interface CoreBlockHandler extends CoreDelegateHandler { * @param block The block to render. * @param contextLevel The context where the block will be used. * @param instanceId The instance ID associated with the context level. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData?( block: CoreCourseBlock, @@ -113,7 +113,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * Check if blocks are disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ areBlocksDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -125,7 +125,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * Check if blocks are disabled in a certain site for courses. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ areBlocksDisabledInCourses(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -137,7 +137,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * Check if blocks are disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async areBlocksDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -151,7 +151,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * @param block The block to render. * @param contextLevel The context where the block will be used. * @param instanceId The instance ID associated with the context level. - * @return Promise resolved with the display data. + * @returns Promise resolved with the display data. */ async getBlockDisplayData( block: CoreCourseBlock, @@ -169,7 +169,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * Check if any of the blocks in a list is supported. * * @param blocks The list of blocks. - * @return Whether any of the blocks is supported. + * @returns Whether any of the blocks is supported. */ hasSupportedBlock(blocks: CoreCourseBlock[]): boolean { blocks = blocks || []; @@ -181,7 +181,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * Check if a block is supported. * * @param name Block "name". E.g. 'activity_modules'. - * @return Whether it's supported. + * @returns Whether it's supported. */ isBlockSupported(name: string): boolean { return this.hasHandler(name, true); @@ -192,7 +192,7 @@ export class CoreBlockDelegateService extends CoreDelegate { * * @param handler Handler to check. * @param site Site to check. - * @return Whether is enabled or disabled in site. + * @returns Whether is enabled or disabled in site. */ protected isFeatureDisabled(handler: CoreBlockHandler, site: CoreSite): boolean { // Allow displaying my overview even if all blocks are disabled, to avoid having an empty My Courses. diff --git a/src/core/features/block/services/block-helper.ts b/src/core/features/block/services/block-helper.ts index 00b33cd23..f1f1288c8 100644 --- a/src/core/features/block/services/block-helper.ts +++ b/src/core/features/block/services/block-helper.ts @@ -26,7 +26,7 @@ export class CoreBlockHelperProvider { /** * Return if it get course blocks options is enabled for the current site. * - * @return true if enabled, false otherwise. + * @returns true if enabled, false otherwise. */ canGetCourseBlocks(): boolean { return CoreCourse.canGetCourseBlocks() && !CoreBlockDelegate.areBlocksDisabledInCourses(); @@ -36,7 +36,7 @@ export class CoreBlockHelperProvider { * Returns the list of blocks for the selected course. * * @param courseId Course ID. - * @return List of supported blocks. + * @returns List of supported blocks. */ async getCourseBlocks(courseId: number): Promise { const canGetBlocks = this.canGetCourseBlocks(); @@ -58,7 +58,7 @@ export class CoreBlockHelperProvider { * Returns if the course has any block. * * @param courseId Course ID. - * @return Wether course has blocks. + * @returns Wether course has blocks. */ async hasCourseBlocks(courseId: number): Promise { try { diff --git a/src/core/features/comments/components/comments/comments.ts b/src/core/features/comments/components/comments/comments.ts index 04c45f389..26fed4370 100644 --- a/src/core/features/comments/components/comments/comments.ts +++ b/src/core/features/comments/components/comments/comments.ts @@ -146,7 +146,7 @@ export class CoreCommentsCommentsComponent implements OnInit, OnChanges, OnDestr /** * Refresh comments. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(): Promise { await this.invalidateComments(); @@ -157,7 +157,7 @@ export class CoreCommentsCommentsComponent implements OnInit, OnChanges, OnDestr /** * Invalidate comments data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateComments(): Promise { await CoreComments.invalidateCommentsData( @@ -208,7 +208,7 @@ export class CoreCommentsCommentsComponent implements OnInit, OnChanges, OnDestr * * @param data Data object. * @param name Name of the property to check. - * @return Whether it's undefined or equal. + * @returns Whether it's undefined or equal. */ protected undefinedOrEqual(data: Record, name: string): boolean { return data[name] === undefined || data[name] == this[name]; diff --git a/src/core/features/comments/pages/viewer/viewer.page.ts b/src/core/features/comments/pages/viewer/viewer.page.ts index 54cf2285f..47f585985 100644 --- a/src/core/features/comments/pages/viewer/viewer.page.ts +++ b/src/core/features/comments/pages/viewer/viewer.page.ts @@ -153,7 +153,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * * @param sync When to resync comments. * @param showErrors When to display errors or not. - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchComments(sync: boolean, showErrors = false): Promise { this.loadMoreError = false; @@ -220,7 +220,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * Function to load more commemts. * * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. - * @return Resolved when done. + * @returns Resolved when done. */ async loadPrevious(infiniteComplete?: () => void): Promise { this.page++; @@ -238,7 +238,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * * @param showErrors Whether to display errors or not. * @param refresher Refresher. - * @return Resolved when done. + * @returns Resolved when done. */ async refreshComments(showErrors: boolean, refresher?: IonRefresher): Promise { this.commentsLoaded = false; @@ -275,7 +275,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * Tries to synchronize comments. * * @param showErrors Whether to display errors or not. - * @return Promise resolved if sync is successful, rejected otherwise. + * @returns Promise resolved if sync is successful, rejected otherwise. */ private async syncComments(showErrors: boolean): Promise { try { @@ -426,7 +426,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { /** * Invalidate comments. * - * @return Resolved when done. + * @returns Resolved when done. */ protected invalidateComments(): Promise { return CoreComments.invalidateCommentsData( @@ -442,7 +442,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * Loads the profile info onto the comment object. * * @param comment Comment object. - * @return Promise resolved with modified comment when done. + * @returns Promise resolved with modified comment when done. */ protected async loadCommentProfile(comment: CoreCommentsDataToDisplay): Promise { // Get the user profile image. @@ -464,7 +464,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * * @param comment Comment object. * @param prevComment Previous comment object. - * @return Whether user data should be shown. + * @returns Whether user data should be shown. */ protected showUserData( comment: CoreCommentsDataToDisplay, @@ -478,7 +478,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * * @param comment Comment object. * @param nextComment Previous comment object. - * @return Whether user data should be shown. + * @returns Whether user data should be shown. */ protected showTail( comment: CoreCommentsDataToDisplay, @@ -492,7 +492,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { * * @param comment Comment object. * @param prevComment Previous comment object. - * @return True if messages are from diferent days, false othetwise. + * @returns True if messages are from diferent days, false othetwise. */ protected showDate( comment: CoreCommentsDataToDisplay, @@ -509,7 +509,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy { /** * Load offline comments. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadOfflineData(): Promise { const promises: Promise[] = []; diff --git a/src/core/features/comments/services/comments-offline.ts b/src/core/features/comments/services/comments-offline.ts index a5bdbc999..997b5f72a 100644 --- a/src/core/features/comments/services/comments-offline.ts +++ b/src/core/features/comments/services/comments-offline.ts @@ -28,7 +28,7 @@ export class CoreCommentsOfflineProvider { * Get all offline comments. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with comments. + * @returns Promise resolved with comments. */ async getAllComments(siteId?: string): Promise<(CoreCommentsDBRecord | CoreCommentsDeletedDBRecord)[]> { const site = await CoreSites.getSite(siteId); @@ -49,7 +49,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the comments. + * @returns Promise resolved with the comments. */ async getComment( contextLevel: string, @@ -83,7 +83,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the comments. + * @returns Promise resolved with the comments. */ async getComments( contextLevel: string, @@ -111,7 +111,7 @@ export class CoreCommentsOfflineProvider { * Get all offline deleted comments. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with comments. + * @returns Promise resolved with comments. */ async getAllDeletedComments(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -128,7 +128,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the comments. + * @returns Promise resolved with the comments. */ async getDeletedComments( contextLevel: string, @@ -162,7 +162,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async removeComment( contextLevel: string, @@ -192,7 +192,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async removeDeletedComments( contextLevel: string, @@ -223,7 +223,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async saveComment( content: string, @@ -261,7 +261,7 @@ export class CoreCommentsOfflineProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteComment( commentId: number, @@ -292,7 +292,7 @@ export class CoreCommentsOfflineProvider { * * @param commentId Comment ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if deleted, rejected if failure. + * @returns Promise resolved if deleted, rejected if failure. */ async undoDeleteComment(commentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/core/features/comments/services/comments-sync.ts b/src/core/features/comments/services/comments-sync.ts index 8efab2e35..78a9d046a 100644 --- a/src/core/features/comments/services/comments-sync.ts +++ b/src/core/features/comments/services/comments-sync.ts @@ -41,7 +41,7 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { return this.syncOnSites('all comments', (siteId) => this.syncAllCommentsFunc(!!force, siteId), siteId); @@ -52,7 +52,7 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { const comments = await CoreCommentsOffline.getAllComments(siteId); @@ -117,7 +117,7 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { const site = await CoreSites.getSite(siteId); @@ -208,8 +208,9 @@ export class CoreCommentsProvider { * * @param comment Comment object to delete. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted (with true if deleted in online, false otherwise), rejected otherwise. Promise resolved - * doesn't mean that comments have been deleted, the resolve param can contain errors for comments not deleted. + * @returns Promise resolved when deleted (with true if deleted in online, false otherwise), rejected otherwise. + * Promise resolved doesn't mean that comments have been deleted,the resolve param can contain errors for comment + * not deleted. */ async deleteComment(comment: CoreCommentsCommentBasicData, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -281,7 +282,7 @@ export class CoreCommentsProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that comments + * @returns Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that comments * have been deleted, the resolve param can contain errors for comments not deleted. */ async deleteCommentsOnline( @@ -310,7 +311,7 @@ export class CoreCommentsProvider { * Returns whether WS to add/delete comments are available in site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if available, resolved with false or rejected otherwise. + * @returns Promise resolved with true if available, resolved with false or rejected otherwise. * @since 3.8 */ async isAddCommentsAvailable(siteId?: string): Promise { @@ -332,7 +333,7 @@ export class CoreCommentsProvider { * @param component Component name. * @param itemId Associated id. * @param area String comment area. Default empty. - * @return Cache key. + * @returns Cache key. */ protected getCommentsCacheKey( contextLevel: string, @@ -349,7 +350,7 @@ export class CoreCommentsProvider { * * @param contextLevel Contextlevel system, course, user... * @param instanceId The Instance id of item associated with the context level. - * @return Cache key. + * @returns Cache key. */ protected getCommentsPrefixCacheKey(contextLevel: string, instanceId: number): string { return ROOT_CACHE_KEY + 'comments:' + contextLevel + ':' + instanceId; @@ -365,7 +366,7 @@ export class CoreCommentsProvider { * @param area String comment area. Default empty. * @param page Page number (0 based). Default 0. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the comments. + * @returns Promise resolved with the comments. */ async getComments( contextLevel: string, @@ -414,7 +415,7 @@ export class CoreCommentsProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Comments count with plus sign if needed. + * @returns Comments count with plus sign if needed. */ async getCommentsCount( contextLevel: string, @@ -479,7 +480,7 @@ export class CoreCommentsProvider { * @param itemId Associated id. * @param area String comment area. Default empty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCommentsData( contextLevel: string, @@ -511,7 +512,7 @@ export class CoreCommentsProvider { * @param contextLevel Contextlevel system, course, user... * @param instanceId The Instance id of item associated with the context level. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCommentsByInstance(contextLevel: string, instanceId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/core/features/comments/services/handlers/sync-cron.ts b/src/core/features/comments/services/handlers/sync-cron.ts index bb45f90d1..2eee1e203 100644 --- a/src/core/features/comments/services/handlers/sync-cron.ts +++ b/src/core/features/comments/services/handlers/sync-cron.ts @@ -30,7 +30,7 @@ export class CoreCommentsSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return CoreCommentsSync.syncAllComments(siteId, force); @@ -39,7 +39,7 @@ export class CoreCommentsSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/core/features/compile/components/compile-html/compile-html.ts b/src/core/features/compile/components/compile-html/compile-html.ts index 12a1eefc5..ecb833a32 100644 --- a/src/core/features/compile/components/compile-html/compile-html.ts +++ b/src/core/features/compile/components/compile-html/compile-html.ts @@ -164,7 +164,7 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { /** * Get a class that defines the dynamic component. * - * @return The component class. + * @returns The component class. */ protected getComponentClass(): Type { // eslint-disable-next-line @typescript-eslint/no-this-alias @@ -284,7 +284,7 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { * @param params List of params to send to the function. * @param callWhenCreated If this param is true and the component hasn't been created yet, call the function * once the component has been created. - * @return Result of the call. Undefined if no component instance or the function doesn't exist. + * @returns Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: unknown[], callWhenCreated: boolean = true): unknown { if (this.componentInstance) { diff --git a/src/core/features/compile/services/compile.ts b/src/core/features/compile/services/compile.ts index ff2d9cb8e..51fdcea13 100644 --- a/src/core/features/compile/services/compile.ts +++ b/src/core/features/compile/services/compile.ts @@ -193,7 +193,7 @@ export class CoreCompileProvider { * @param template The template of the component. * @param componentClass The JS class of the component. * @param extraImports Extra imported modules if needed and not imported by this class. - * @return Promise resolved with the factory to instantiate the component. + * @returns Promise resolved with the factory to instantiate the component. */ async createAndCompileComponent( template: string, @@ -230,7 +230,7 @@ export class CoreCompileProvider { * Eval some javascript using the context of the function. * * @param javascript The javascript to eval. - * @return Result of the eval. + * @returns Result of the eval. */ protected evalInContext(javascript: string): unknown { // eslint-disable-next-line no-eval @@ -242,7 +242,7 @@ export class CoreCompileProvider { * * @param instance Instance to use as the context. In the JS code, "this" will be this instance. * @param javascript The javascript code to eval. - * @return Result of the javascript execution. + * @returns Result of the javascript execution. */ executeJavascript(instance: unknown, javascript: string): unknown { try { @@ -390,7 +390,7 @@ export class CoreCompileProvider { * @param template The template of the component. * @param componentClass The JS class of the component. * @param injector The injector to use. It's recommended to pass it so NavController and similar can be injected. - * @return Promise resolved with the component instance. + * @returns Promise resolved with the component instance. */ async instantiateDynamicComponent( template: string, diff --git a/src/core/features/contentlinks/classes/base-handler.ts b/src/core/features/contentlinks/classes/base-handler.ts index 2e9199796..3b1b4678c 100644 --- a/src/core/features/contentlinks/classes/base-handler.ts +++ b/src/core/features/contentlinks/classes/base-handler.ts @@ -63,7 +63,7 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. * @param data Extra data to handle the URL. - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -84,7 +84,7 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { * Check if a URL is handled by this handler. * * @param url The URL to check. - * @return Whether the URL is handled by this handler + * @returns Whether the URL is handled by this handler */ handles(url: string): boolean { let pattern = this.pattern; @@ -102,7 +102,7 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { * If the URL is handled by this handler, return the site URL. * * @param url The URL to check. - * @return Site URL if it is handled, undefined otherwise. + * @returns Site URL if it is handled, undefined otherwise. */ getSiteUrl(url: string): string | undefined { if (this.pattern) { @@ -121,7 +121,7 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async isEnabled(siteId: string, url: string, params: Record, courseId?: number): Promise { diff --git a/src/core/features/contentlinks/classes/module-grade-handler.ts b/src/core/features/contentlinks/classes/module-grade-handler.ts index cce3bad41..69a498545 100644 --- a/src/core/features/contentlinks/classes/module-grade-handler.ts +++ b/src/core/features/contentlinks/classes/module-grade-handler.ts @@ -58,7 +58,7 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], @@ -104,7 +104,7 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. * @param siteId Site to use. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async goToReview( url: string, // eslint-disable-line @typescript-eslint/no-unused-vars diff --git a/src/core/features/contentlinks/classes/module-index-handler.ts b/src/core/features/contentlinks/classes/module-index-handler.ts index 685970110..5ec69b4e1 100644 --- a/src/core/features/contentlinks/classes/module-index-handler.ts +++ b/src/core/features/contentlinks/classes/module-index-handler.ts @@ -58,7 +58,7 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. - * @return List of params to pass to navigateToModule / navigateToModuleByInstance. + * @returns List of params to pass to navigateToModule / navigateToModuleByInstance. * @deprecated since 4.0 */ // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -73,7 +73,7 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param siteId The site ID. * @param courseId Course ID related to the URL. Optional but recommended. - * @return Navigation options to open the module. + * @returns Navigation options to open the module. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars getModNavOptions(url: string, params: Record, siteId: string, courseId?: number): CoreNavigationOptions { @@ -87,7 +87,7 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], diff --git a/src/core/features/contentlinks/classes/module-list-handler.ts b/src/core/features/contentlinks/classes/module-list-handler.ts index e8fd0a3f0..79747f5ab 100644 --- a/src/core/features/contentlinks/classes/module-list-handler.ts +++ b/src/core/features/contentlinks/classes/module-list-handler.ts @@ -51,7 +51,7 @@ export class CoreContentLinksModuleListHandler extends CoreContentLinksHandlerBa * @param siteIds List of sites the URL belongs to. * @param url The URL to treat. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], diff --git a/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts b/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts index 76f65b273..66297a2a8 100644 --- a/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts +++ b/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts @@ -38,7 +38,7 @@ export class CoreContentLinksChooseSiteModalComponent implements OnInit { protected isRootURL = false; /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.url) { diff --git a/src/core/features/contentlinks/services/contentlinks-delegate.ts b/src/core/features/contentlinks/services/contentlinks-delegate.ts index 7311e1225..cab896e32 100644 --- a/src/core/features/contentlinks/services/contentlinks-delegate.ts +++ b/src/core/features/contentlinks/services/contentlinks-delegate.ts @@ -55,7 +55,7 @@ export interface CoreContentLinksHandler { * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. * @param data Extra data to handle the URL. - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions( siteIds: string[], @@ -69,7 +69,7 @@ export interface CoreContentLinksHandler { * Check if a URL is handled by this handler. * * @param url The URL to check. It's a relative URL, it won't include the site URL. - * @return Whether the URL is handled by this handler + * @returns Whether the URL is handled by this handler */ handles(url: string): boolean; @@ -77,7 +77,7 @@ export interface CoreContentLinksHandler { * If the URL is handled by this handler, return the site URL. * * @param url The URL to check. - * @return Site URL if it is handled, undefined otherwise. + * @returns Site URL if it is handled, undefined otherwise. */ getSiteUrl(url: string): string | undefined; @@ -89,7 +89,7 @@ export interface CoreContentLinksHandler { * @param url The URL to treat. It's a relative URL, it won't include the site URL. * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param courseId Course ID related to the URL. Optional but recommended. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ isEnabled?(siteId: string, url: string, params: Record, courseId?: number): Promise; } @@ -156,7 +156,7 @@ export class CoreContentLinksDelegateService { * @param courseId Course ID related to the URL. Optional but recommended. * @param username Username to use to filter sites. * @param data Extra data to handle the URL. - * @return Promise resolved with the actions. + * @returns Promise resolved with the actions. */ async getActionsFor(url: string, courseId?: number, username?: string, data?: unknown): Promise { if (!url) { @@ -251,7 +251,7 @@ export class CoreContentLinksDelegateService { * Get the site URL if the URL is supported by any handler. * * @param url URL to handle. - * @return Site URL if the URL is supported by any handler, undefined otherwise. + * @returns Site URL if the URL is supported by any handler, undefined otherwise. */ getSiteUrl(url: string): string | void { if (!url) { @@ -277,7 +277,7 @@ export class CoreContentLinksDelegateService { * @param params The params of the URL * @param courseId Course ID the URL belongs to (can be undefined). * @param siteId The site ID to check. - * @return Promise resolved with boolean: whether the handler is enabled. + * @returns Promise resolved with boolean: whether the handler is enabled. */ protected async isHandlerEnabled( handler: CoreContentLinksHandler, @@ -309,7 +309,7 @@ export class CoreContentLinksDelegateService { * Register a handler. * * @param handler The handler to register. - * @return True if registered successfully, false otherwise. + * @returns True if registered successfully, false otherwise. */ registerHandler(handler: CoreContentLinksHandler): boolean { if (this.handlers[handler.name] !== undefined) { @@ -327,7 +327,7 @@ export class CoreContentLinksDelegateService { * Sort actions by priority. * * @param actions Actions to sort. - * @return Sorted actions. + * @returns Sorted actions. */ protected sortActionsByPriority(actions: CoreContentLinksHandlerActions[]): CoreContentLinksAction[] { let sorted: CoreContentLinksAction[] = []; diff --git a/src/core/features/contentlinks/services/contentlinks-helper.ts b/src/core/features/contentlinks/services/contentlinks-helper.ts index a62abffb3..421cb477b 100644 --- a/src/core/features/contentlinks/services/contentlinks-helper.ts +++ b/src/core/features/contentlinks/services/contentlinks-helper.ts @@ -36,7 +36,7 @@ export class CoreContentLinksHelperProvider { * @param courseId Unused param: Course ID related to the URL. * @param username Username to use to filter sites. * @param checkRoot Whether to check if the URL is the root URL of a site. - * @return Promise resolved with a boolean: whether the URL can be handled. + * @returns Promise resolved with a boolean: whether the URL can be handled. */ async canHandleLink(url: string, courseId?: number, username?: string, checkRoot?: boolean): Promise { try { @@ -64,7 +64,7 @@ export class CoreContentLinksHelperProvider { * @param courseId Course ID related to the URL. Optional but recommended. * @param username Username to use to filter sites. * @param data Extra data to handle the URL. - * @return Promise resolved with the first valid action. Returns undefined if no valid action found.. + * @returns Promise resolved with the first valid action. Returns undefined if no valid action found.. */ async getFirstValidActionFor( url: string, @@ -84,7 +84,7 @@ export class CoreContentLinksHelperProvider { * Get the first valid action in a list of possible actions. * * @param actions Actions. - * @return First valid action if any. + * @returns First valid action if any. */ getFirstValidAction(actions: CoreContentLinksAction[]): CoreContentLinksAction | undefined { return actions.find((action) => action && action.sites && action.sites.length); @@ -98,7 +98,7 @@ export class CoreContentLinksHelperProvider { * @param pageName Name of the page to go. * @param pageParams Params to send to the page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 3.9.5. Use CoreNavigator.navigateToSitePath instead. */ async goInSite(navCtrlUnused: unknown, pageName: string, pageParams: Params, siteId?: string): Promise { @@ -129,7 +129,7 @@ export class CoreContentLinksHelperProvider { * the username 'myuser'. Don't use it if you don't want to filter by username. * @param checkRoot Whether to check if the URL is the root URL of a site. * @param openBrowserRoot Whether to open in browser if it's root URL and it belongs to current site. - * @return Promise resolved with a boolean: true if URL was treated, false otherwise. + * @returns Promise resolved with a boolean: true if URL was treated, false otherwise. */ async handleLink( url: string, @@ -199,7 +199,7 @@ export class CoreContentLinksHelperProvider { * @param openBrowserRoot Whether to open in browser if it's root URL and it belongs to current site. * @param checkToken Whether to check that token is the same to verify it's current site. If false or not defined, * only the URL will be checked. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleRootURL(site: CoreSite, openBrowserRoot?: boolean, checkToken?: boolean): Promise { const currentSite = CoreSites.getCurrentSite(); diff --git a/src/core/features/course/classes/activity-prefetch-handler.ts b/src/core/features/course/classes/activity-prefetch-handler.ts index 357efa498..3c433ef97 100644 --- a/src/core/features/course/classes/activity-prefetch-handler.ts +++ b/src/core/features/course/classes/activity-prefetch-handler.ts @@ -39,7 +39,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * @param module The module object returned by WS. * @param courseId Course ID. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when all content is downloaded. + * @returns Promise resolved when all content is downloaded. */ download(module: CoreCourseAnyModuleData, courseId: number, dirPath?: string): Promise { // Same implementation for download and prefetch. @@ -53,7 +53,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean, dirPath?: string): Promise { @@ -69,9 +69,9 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * * @param module Module. * @param courseId Course ID the module belongs to. - * @param downloadFn Function to perform the prefetch. It can return a string to be stored as the package "extra" data. + * @param downloadFunction Function to perform the prefetch. It can return a string to be stored as the package "extra" data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the module has been downloaded. Data returned is not reliable. + * @returns Promise resolved when the module has been downloaded. Data returned is not reliable. */ async prefetchPackage( module: CoreCourseAnyModuleData, @@ -101,9 +101,9 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * * @param module Module. * @param courseId Course ID the module belongs to. - * @param downloadFn Function to perform the prefetch. It can return a string to be stored as the package "extra" data. + * @param downloadFunction Function to perform the prefetch. It can return a string to be stored as the package "extra" data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the module has been downloaded. Data returned is not reliable. + * @returns Promise resolved when the module has been downloaded. Data returned is not reliable. */ protected async changeStatusAndPrefetch( module: CoreCourseAnyModuleData, @@ -145,7 +145,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * @param id Unique identifier per component. * @param siteId Site ID. If not defined, current site. * @param extra Extra data to store. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ setDownloaded(id: number, siteId?: string, extra?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -158,7 +158,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * * @param id Unique identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ setDownloading(id: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -171,7 +171,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * * @param id Unique identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Rejected promise. + * @returns Rejected promise. */ async setPreviousStatus(id: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -185,7 +185,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * @param id Unique identifier per component. * @param error Error to throw. * @param siteId Site ID. If not defined, current site. - * @return Rejected promise. + * @returns Rejected promise. * @deprecated since 3.9.5. Use setPreviousStatus instead. */ async setPreviousStatusAndReject(id: number, error?: Error, siteId?: string): Promise { diff --git a/src/core/features/course/classes/activity-sync.ts b/src/core/features/course/classes/activity-sync.ts index 50a8feccd..faee1f8e6 100644 --- a/src/core/features/course/classes/activity-sync.ts +++ b/src/core/features/course/classes/activity-sync.ts @@ -27,11 +27,12 @@ export class CoreCourseActivitySyncBaseProvider extends CoreSyncBasePr /** * Conveniece function to prefetch data after an update. * + * @param prefetchHandler Prefetch Handler. * @param module Module. * @param courseId Course ID. * @param preventDownloadRegex If regex matches, don't download the data. Defaults to check files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if prefetched, false if no need to prefetch. + * @returns Promise resolved with boolean: true if prefetched, false if no need to prefetch. */ async prefetchAfterUpdate( prefetchHandler: CoreCourseModulePrefetchHandlerBase, diff --git a/src/core/features/course/classes/main-activity-component.ts b/src/core/features/course/classes/main-activity-component.ts index adcd02751..66b9ed4e7 100644 --- a/src/core/features/course/classes/main-activity-component.ts +++ b/src/core/features/course/classes/main-activity-component.ts @@ -48,7 +48,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { await super.ngOnInit(); @@ -68,7 +68,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * Compares sync event data with current data to check if refresh content is needed. * * @param syncEventData Data received on sync observer. - * @return True if refresh is needed, false otherwise. + * @returns True if refresh is needed, false otherwise. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected isRefreshSyncNeeded(syncEventData: unknown): boolean { @@ -92,7 +92,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * * @param sync If the refresh needs syncing. * @param showErrors Wether to show errors to the user or hide them. - * @return Resolved when done. + * @returns Resolved when done. */ protected async refreshContent(sync: boolean = false, showErrors: boolean = false): Promise { if (!this.module) { @@ -113,7 +113,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * * @param sync If the fetch needs syncing. * @param showErrors Wether to show errors to the user or hide them. - * @return Resolved when done. + * @returns Resolved when done. */ protected async showLoadingAndFetch(sync: boolean = false, showErrors: boolean = false): Promise { this.showLoading = true; @@ -127,7 +127,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * * @param sync If the refresh needs syncing. * @param showErrors Wether to show errors to the user or hide them. - * @return Resolved when done. + * @returns Resolved when done. */ protected showLoadingAndRefresh(sync: boolean = false, showErrors: boolean = false): Promise { this.showLoading = true; @@ -142,7 +142,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * @param refresh Whether we're refreshing data. * @param sync If the refresh needs syncing. * @param showErrors Wether to show errors to the user or hide them. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected async fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { @@ -155,7 +155,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * @param refresh Whether we're refreshing data. * @param sync If the refresh needs syncing. * @param showErrors Wether to show errors to the user or hide them. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadContent(refresh?: boolean, sync: boolean = false, showErrors: boolean = false): Promise { if (!this.module) { @@ -186,7 +186,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Performs the sync of the activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async sync(): Promise { return {}; @@ -196,7 +196,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * Checks if sync has succeed from result sync data. * * @param result Data returned on the sync function. - * @return If suceed or not. + * @returns If suceed or not. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected hasSyncSucceed(result: unknown): boolean { @@ -207,7 +207,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR * Tries to synchronize the activity. * * @param showErrors If show errors to the user of hide them. - * @return Promise resolved with true if sync succeed, or false if failed. + * @returns Promise resolved with true if sync succeed, or false if failed. */ protected async syncActivity(showErrors: boolean = false): Promise { try { @@ -228,7 +228,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { super.ngOnDestroy(); diff --git a/src/core/features/course/classes/main-activity-page.ts b/src/core/features/course/classes/main-activity-page.ts index 6d0785f4a..50d2108ae 100644 --- a/src/core/features/course/classes/main-activity-page.ts +++ b/src/core/features/course/classes/main-activity-page.ts @@ -33,7 +33,7 @@ export class CoreCourseModuleMainActivityPage { if (!this.module) { @@ -138,7 +138,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * * @param sync If the refresh needs syncing. * @param showErrors Wether to show errors to the user or hide them. - * @return Resolved when done. + * @returns Resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected async refreshContent(sync: boolean = false, showErrors: boolean = false): Promise { @@ -162,7 +162,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Perform the invalidate content function. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async invalidateContent(): Promise { return; @@ -172,7 +172,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * Download the component contents. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected async fetchContent(refresh?: boolean): Promise { @@ -183,7 +183,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * Loads the component contents and shows the corresponding error. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadContent(refresh?: boolean): Promise { if (!this.module) { @@ -211,7 +211,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * Check if an error is a "module not found" error. * * @param error Error. - * @return Whether the error is a "module not found" error. + * @returns Whether the error is a "module not found" error. */ protected isNotFoundError(error: CoreAnyError): boolean { return CoreTextUtils.getErrorMessageFromError(error) === Translate.instant('core.course.modulenotfound'); @@ -234,6 +234,8 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Check if the module is prefetched or being prefetched. * To make it faster, just use the data calculated by setStatusListener. + * + * @returns If module has been prefetched. */ protected isPrefetched(): boolean { return this.currentStatus != CoreConstants.NOT_DOWNLOADABLE && this.currentStatus != CoreConstants.NOT_DOWNLOADED; @@ -244,6 +246,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * * @param error The specific error. * @param multiLine Whether to put each message in a different paragraph or in a single line. + * @returns Error text message. */ protected getErrorDownloadingSomeFilesMessage(error: string | CoreTextErrorObject, multiLine?: boolean): string { if (multiLine) { @@ -282,7 +285,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * Watch for changes on the status. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async setStatusListener(refresh?: boolean): Promise { if (this.statusObserver === undefined) { @@ -324,7 +327,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, * If module.contents cannot be loaded then the Promise will be rejected. * * @param refresh Whether we're refreshing data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadResourceIfNeeded( refresh?: boolean, @@ -375,7 +378,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * The completion of the modules has changed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async onCompletionChange(): Promise { // Update the module data after a while. @@ -385,7 +388,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Fetch module. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchModule(): Promise { const module = await CoreCourse.getModule(this.module.id, this.courseId); @@ -434,7 +437,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Finish a successful fetch. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async finishSuccessfulFetch(): Promise { if (this.fetchSuccess) { @@ -459,7 +462,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Store module as viewed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async storeModuleViewed(): Promise { await CoreCourse.storeModuleViewed(this.courseId, this.module.id, { sectionId: this.module.section }); @@ -468,7 +471,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Log activity. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async logActivity(): Promise { // To be overridden. @@ -482,7 +485,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.isDestroyed = true; diff --git a/src/core/features/course/classes/module-base-handler.ts b/src/core/features/course/classes/module-base-handler.ts index 1bdceb16e..088def419 100644 --- a/src/core/features/course/classes/module-base-handler.ts +++ b/src/core/features/course/classes/module-base-handler.ts @@ -62,7 +62,7 @@ export class CoreModuleHandlerBase implements Partial { * @param module The module object. * @param courseId The course ID. * @param options Options for the navigation. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openActivityPage(module: CoreCourseModuleData, courseId: number, options?: CoreNavigationOptions): Promise { if (!CoreCourse.moduleHasView(module)) { diff --git a/src/core/features/course/classes/module-prefetch-handler.ts b/src/core/features/course/classes/module-prefetch-handler.ts index 79dfd6bc7..b0a2a01e2 100644 --- a/src/core/features/course/classes/module-prefetch-handler.ts +++ b/src/core/features/course/classes/module-prefetch-handler.ts @@ -58,7 +58,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param id Unique identifier per component. * @param promise Promise to add. * @param siteId Site ID. If not defined, current site. - * @return Promise of the current download. + * @returns Promise of the current download. */ async addOngoingDownload(id: number, promise: Promise, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -84,7 +84,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param module The module object returned by WS. * @param courseId Course ID. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when all content is downloaded. + * @returns Promise resolved when all content is downloaded. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async download(module: CoreCourseAnyModuleData, courseId: number, dirPath?: string): Promise { @@ -96,7 +96,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * Returns a list of content files that can be downloaded. * * @param module The module object returned by WS. - * @return List of files. + * @returns List of files. */ getContentDownloadableFiles(module: CoreCourseAnyModuleData): CoreCourseModuleContentFile[] { if (!module.contents?.length) { @@ -112,7 +112,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param module Module. * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. - * @return Promise resolved with the size. + * @returns Promise resolved with the size. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async getDownloadSize(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise { @@ -130,7 +130,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Size, or promise resolved with the size. + * @returns Size, or promise resolved with the size. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async getDownloadedSize(module: CoreCourseAnyModuleData, courseId: number): Promise { @@ -145,7 +145,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param module Module. * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. - * @return Promise resolved with the list of files. + * @returns Promise resolved with the list of files. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async getFiles(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise { @@ -159,7 +159,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param module The module object returned by WS. * @param courseId Course ID. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved with list of intro files. + * @returns Promise resolved with list of intro files. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async getIntroFiles(module: CoreCourseAnyModuleData, courseId: number, ignoreCache?: boolean): Promise { @@ -171,7 +171,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param module The module object returned by WS. * @param instance The instance to get the intro files (book, assign, ...). If not defined, module will be used. - * @return List of intro files. + * @returns List of intro files. */ getIntroFilesFromInstance(module: CoreCourseAnyModuleData, instance?: ModuleInstance): CoreWSFile[] { if (instance) { @@ -194,7 +194,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param id Unique identifier per component. * @param siteId Site ID. If not defined, current site. - * @return Promise of the current download. + * @returns Promise of the current download. */ async getOngoingDownload(id: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -209,7 +209,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * Create unique identifier using component and id. * * @param id Unique ID inside component. - * @return Unique ID. + * @returns Unique ID. */ getUniqueId(id: number): string { return this.component + '#' + id; @@ -220,7 +220,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param moduleId The module ID. * @param courseId The course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async invalidateContent(moduleId: number, courseId: number): Promise { @@ -234,7 +234,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars invalidateModule(module: CoreCourseAnyModuleData, courseId: number): Promise { @@ -246,7 +246,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can be downloaded. The promise should never be rejected. + * @returns Whether the module can be downloaded. The promise should never be rejected. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async isDownloadable(module: CoreCourseAnyModuleData, courseId: number): Promise { @@ -259,7 +259,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param id Unique identifier per component. * @param siteId Site ID. If not defined, current site. - * @return True if downloading, false otherwise. + * @returns True if downloading, false otherwise. */ isDownloading(id: number, siteId?: string): boolean { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -270,7 +270,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Whether or not the handler is enabled on a site level. * - * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @returns A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ async isEnabled(): Promise { return true; @@ -280,7 +280,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * Check if a file is downloadable. * * @param file File to check. - * @return Whether the file is downloadable. + * @returns Whether the file is downloadable. */ isFileDownloadable(file: CoreCourseModuleContentFile): boolean { return file.type === 'file'; @@ -292,7 +292,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param module Module to load the contents. * @param courseId The course ID. Recommended to speed up the process and minimize data usage. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async loadContents(module: CoreCourseAnyModuleData, courseId: number, ignoreCache?: boolean): Promise { @@ -307,7 +307,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean, dirPath?: string): Promise { @@ -320,7 +320,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars removeFiles(module: CoreCourseAnyModuleData, courseId: number): Promise { diff --git a/src/core/features/course/classes/resource-prefetch-handler.ts b/src/core/features/course/classes/resource-prefetch-handler.ts index a7cde627d..89bcced9a 100644 --- a/src/core/features/course/classes/resource-prefetch-handler.ts +++ b/src/core/features/course/classes/resource-prefetch-handler.ts @@ -39,7 +39,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe * @param module The module object returned by WS. * @param courseId Course ID. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when all content is downloaded. + * @returns Promise resolved when all content is downloaded. */ download(module: CoreCourseModuleData, courseId: number, dirPath?: string): Promise { return this.downloadOrPrefetch(module, courseId, false, dirPath); @@ -54,7 +54,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe * @param dirPath Path of the directory where to store all the content files. This is to keep the files * relative paths and make the package work in an iframe. Undefined to download the files * in the filepool root folder. - * @return Promise resolved when all content is downloaded. + * @returns Promise resolved when all content is downloaded. */ async downloadOrPrefetch(module: CoreCourseModuleData, courseId: number, prefetch?: boolean, dirPath?: string): Promise { if (!CoreNetwork.isOnline()) { @@ -78,11 +78,12 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Download or prefetch the content. * + * @param siteId Site Id. * @param module The module object returned by WS. * @param courseId Course ID. * @param prefetch True to prefetch, false to download right away. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when all content is downloaded. + * @returns Promise resolved when all content is downloaded. */ protected async performDownloadOrPrefetch( siteId: string, @@ -141,7 +142,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe * @param module Module. * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. - * @return Promise resolved with the list of files. + * @returns Promise resolved with the list of files. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async getFiles(module: CoreCourseModuleData, courseId: number, single?: boolean): Promise { @@ -158,7 +159,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe * * @param moduleId The module ID. * @param courseId The course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async invalidateContent(moduleId: number, courseId: number): Promise { @@ -176,7 +177,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe * @param module Module to load the contents. * @param courseId The course ID. Recommended to speed up the process and minimize data usage. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ loadContents(module: CoreCourseAnyModuleData, courseId: number, ignoreCache?: boolean): Promise { return CoreCourse.loadModuleContents(module, courseId, undefined, false, ignoreCache); @@ -189,7 +190,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch(module: CoreCourseModuleData, courseId: number, single?: boolean, dirPath?: string): Promise { return this.downloadOrPrefetch(module, courseId, true, dirPath); diff --git a/src/core/features/course/components/course-format/course-format.ts b/src/core/features/course/components/course-format/course-format.ts index 56b1c916a..c97c3b427 100644 --- a/src/core/features/course/components/course-format/course-format.ts +++ b/src/core/features/course/components/course-format/course-format.ts @@ -239,7 +239,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Load course format component. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCourseFormatComponent(): Promise { this.courseFormatComponent = await CoreCourseFormatDelegate.getCourseFormatComponent(this.course); @@ -248,7 +248,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Load course summary component. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCourseSummaryComponent(): Promise { this.courseSummaryComponent = await CoreCourseFormatDelegate.getCourseSummaryComponent(this.course); @@ -257,7 +257,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Load single section component. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSingleSectionComponent(): Promise { this.singleSectionComponent = await CoreCourseFormatDelegate.getSingleSectionComponent(this.course); @@ -266,7 +266,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Load all sections component. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadAllSectionsComponent(): Promise { this.allSectionsComponent = await CoreCourseFormatDelegate.getAllSectionsComponent(this.course); @@ -276,7 +276,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { * Treat received sections. * * @param sections Sections to treat. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async treatSections(sections: CoreCourseSection[]): Promise { const hasAllSections = sections[0].id == CoreCourseProvider.ALL_SECTIONS_ID; @@ -346,7 +346,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Initialize viewed modules. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initializeViewedModules(): Promise { if (this.viewedModulesInitialized) { @@ -367,7 +367,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { * * @param sections List of sections. * @param viewedModule Viewed module. - * @return Section, undefined if not found. + * @returns Section, undefined if not found. */ protected getViewedModuleSection( sections: CoreCourseSection[], @@ -390,7 +390,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Get selected section ID. If viewing all sections, use current scrolled section. * - * @return Section ID, undefined if not found. + * @returns Section ID, undefined if not found. */ protected async getSelectedSectionId(): Promise { if (this.selectedSection?.id !== this.allSectionsId) { @@ -549,7 +549,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { * * @param section1 First section. * @param section2 Second section. - * @return Whether they're equal. + * @returns Whether they're equal. */ compareSections(section1: CoreCourseSection, section2: CoreCourseSection): boolean { return section1 && section2 ? section1.id === section2.id : section1 === section2; @@ -561,7 +561,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { * @param refresher Refresher. * @param done Function to call when done. * @param afterCompletionChange Whether the refresh is due to a completion change. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void, afterCompletionChange?: boolean): Promise { const promises = this.dynamicComponents?.map(async (component) => { @@ -655,7 +655,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { * Check whether a section can be viewed. * * @param section The section to check. - * @return Whether the section can be viewed. + * @returns Whether the section can be viewed. */ canViewSection(section: CoreCourseSection): boolean { return CoreCourseHelper.canUserViewSection(section) && !CoreCourseHelper.isSectionStealth(section); diff --git a/src/core/features/course/components/module-navigation/module-navigation.ts b/src/core/features/course/components/module-navigation/module-navigation.ts index cf1327ebd..33aca98d5 100644 --- a/src/core/features/course/components/module-navigation/module-navigation.ts +++ b/src/core/features/course/components/module-navigation/module-navigation.ts @@ -88,7 +88,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { * @param readingStrategy Reading strategy. * @param checkNext Check next module. * @param checkPrevious Check previous module. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async setNextAndPreviousModules( readingStrategy: CoreSitesReadingStrategy, @@ -178,7 +178,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { * Module is visible by the user and it has a specific view (e.g. not a label). * * @param module Module to check. - * @return Wether the module is available to the user or not. + * @returns Wether the module is available to the user or not. */ protected async isModuleAvailable(module: CoreCourseModuleData): Promise { return !CoreCourseHelper.isModuleStealth(module) && CoreCourse.instance.moduleHasView(module); @@ -188,7 +188,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { * Section is visible by the user and its not stealth * * @param section Section to check. - * @return Wether the module is available to the user or not. + * @returns Wether the module is available to the user or not. */ protected isSectionAvailable(section: CoreCourseWSSection): boolean { return CoreCourseHelper.canUserViewSection(section) && !CoreCourseHelper.isSectionStealth(section); @@ -197,7 +197,7 @@ export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy { /** * Go to next/previous module. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async goToActivity(next = true): Promise { if (!this.loaded) { diff --git a/src/core/features/course/components/unsupported-module/unsupported-module.ts b/src/core/features/course/components/unsupported-module/unsupported-module.ts index ca124898b..f690a4674 100644 --- a/src/core/features/course/components/unsupported-module/unsupported-module.ts +++ b/src/core/features/course/components/unsupported-module/unsupported-module.ts @@ -33,7 +33,7 @@ export class CoreCourseUnsupportedModuleComponent implements OnInit { isDisabledInSite = false; // It is implicit than if not disabled it will be unsupported. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (!this.module) { diff --git a/src/core/features/course/directives/download-module-main-file.ts b/src/core/features/course/directives/download-module-main-file.ts index e004e3eb5..ef673546d 100644 --- a/src/core/features/course/directives/download-module-main-file.ts +++ b/src/core/features/course/directives/download-module-main-file.ts @@ -46,7 +46,7 @@ export class CoreCourseDownloadModuleMainFileDirective implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.element.addEventListener('click', async (ev: Event) => { diff --git a/src/core/features/course/format/singleactivity/components/singleactivity.ts b/src/core/features/course/format/singleactivity/components/singleactivity.ts index 1cbceaa76..fc31f9ffe 100644 --- a/src/core/features/course/format/singleactivity/components/singleactivity.ts +++ b/src/core/features/course/format/singleactivity/components/singleactivity.ts @@ -78,7 +78,7 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges { * @param refresher Refresher. * @param done Function to call when done. * @param afterCompletionChange Whether the refresh is due to a completion change. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void, afterCompletionChange?: boolean): Promise { if (afterCompletionChange) { diff --git a/src/core/features/course/format/topics/services/handlers/topics-format.ts b/src/core/features/course/format/topics/services/handlers/topics-format.ts index 650b97982..60824fd13 100644 --- a/src/core/features/course/format/topics/services/handlers/topics-format.ts +++ b/src/core/features/course/format/topics/services/handlers/topics-format.ts @@ -29,7 +29,7 @@ export class CoreCourseFormatTopicsHandlerService implements CoreCourseFormatHan /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; diff --git a/src/core/features/course/format/weeks/services/handlers/weeks-format.ts b/src/core/features/course/format/weeks/services/handlers/weeks-format.ts index 2d05d2700..8193a4e12 100644 --- a/src/core/features/course/format/weeks/services/handlers/weeks-format.ts +++ b/src/core/features/course/format/weeks/services/handlers/weeks-format.ts @@ -89,7 +89,7 @@ export class CoreCourseFormatWeeksHandlerService implements CoreCourseFormatHand * * @param section The section to treat. * @param startDate The course start date (in seconds). - * @return An object with the start and end date of the section. + * @returns An object with the start and end date of the section. */ protected getSectionDates(section: CoreCourseWSSection, startDate: number): { start: number; end: number } { // Hack alert. We add 2 hours to avoid possible DST problems. (e.g. we go into daylight savings and the date changes). diff --git a/src/core/features/course/pages/contents/contents.ts b/src/core/features/course/pages/contents/contents.ts index 5ac35bca3..36249b1dc 100644 --- a/src/core/features/course/pages/contents/contents.ts +++ b/src/core/features/course/pages/contents/contents.ts @@ -118,7 +118,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon /** * Init listeners. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initListeners(): Promise { if (this.completionObserver) { @@ -162,7 +162,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon * * @param refresh If it's refreshing content. * @param sync If it should try to sync. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadData(refresh?: boolean, sync?: boolean): Promise { // First of all, get the course because the data might have changed. @@ -201,7 +201,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon * Load course sections. * * @param refresh If it's refreshing content. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSections(refresh?: boolean): Promise { // Get all the sections. @@ -256,7 +256,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon /** * Load course format options if needed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCourseFormatOptions(): Promise { @@ -285,7 +285,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher): Promise { await CoreUtils.ignoreErrors(this.invalidateData()); @@ -307,7 +307,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon * The completion of any of the modules has changed. * * @param completionData Completion data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async onCompletionChange(completionData: CoreCourseModuleCompletionData): Promise { const shouldReload = completionData.valueused === undefined || completionData.valueused; @@ -329,7 +329,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon /** * Invalidate the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async invalidateData(): Promise { const promises: Promise[] = []; @@ -350,7 +350,7 @@ export class CoreCourseContentsPage implements OnInit, OnDestroy, CoreRefreshCon * * @param sync If it should try to sync. * @param invalidateData Whether to invalidate data. Set it to false if data has already been invalidated. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async showLoadingAndRefresh(sync = false, invalidateData = true): Promise { this.updatingData = true; diff --git a/src/core/features/course/pages/course-summary/course-summary.ts b/src/core/features/course/pages/course-summary/course-summary.ts index 1d9da6d56..666d6bd57 100644 --- a/src/core/features/course/pages/course-summary/course-summary.ts +++ b/src/core/features/course/pages/course-summary/course-summary.ts @@ -131,7 +131,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { /** * Check if the user can access as guest. * - * @return Promise resolved if can access as guest, rejected otherwise. Resolve param indicates if + * @returns Promise resolved if can access as guest, rejected otherwise. Resolve param indicates if * password is required for guest access. */ protected async canAccessAsGuest(): Promise { @@ -272,7 +272,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { * Load the course menu handlers. * * @param refresh If it's refreshing content. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadMenuHandlers(refresh?: boolean): Promise { if (!this.course) { @@ -343,7 +343,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { * * @param instanceId The instance ID. * @param password Password to use. - * @return Promise resolved when self enrolled. + * @returns Promise resolved when self enrolled. */ async selfEnrolInCourse(instanceId: number, password = ''): Promise { const modal = await CoreDomUtils.showModalLoading('core.loading', true); @@ -425,7 +425,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { * Wait for the user to be enrolled in the course. * * @param first If it's the first call (true) or it's a recursive call (false). - * @return Promise resolved when enrolled or timeout. + * @returns Promise resolved when enrolled or timeout. */ protected async waitForEnrolled(first?: boolean): Promise { if (first) { diff --git a/src/core/features/course/pages/index/index.ts b/src/core/features/course/pages/index/index.ts index a2f663711..1f451a6e5 100644 --- a/src/core/features/course/pages/index/index.ts +++ b/src/core/features/course/pages/index/index.ts @@ -199,7 +199,7 @@ export class CoreCourseIndexPage implements OnInit, OnDestroy { /** * Load course option handlers. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCourseHandlers(): Promise { if (!this.course) { @@ -239,7 +239,7 @@ export class CoreCourseIndexPage implements OnInit, OnDestroy { /** * Load title for the page. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadBasinInfo(): Promise { if (!this.course) { 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 204abf7f8..e0eb86ae3 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 @@ -58,7 +58,7 @@ export class CoreCourseListModTypePage implements OnInit { /** * Fetches the data. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async fetchData(): Promise { if (!this.courseId) { @@ -114,7 +114,7 @@ export class CoreCourseListModTypePage implements OnInit { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshData(refresher: IonRefresher): Promise { await CoreUtils.ignoreErrors(CoreCourse.invalidateSections(this.courseId || 0)); diff --git a/src/core/features/course/pages/module-preview/module-preview.page.ts b/src/core/features/course/pages/module-preview/module-preview.page.ts index 40320aeef..eb5dbee34 100644 --- a/src/core/features/course/pages/module-preview/module-preview.page.ts +++ b/src/core/features/course/pages/module-preview/module-preview.page.ts @@ -68,7 +68,7 @@ export class CoreCourseModulePreviewPage implements OnInit { /** * Fetch module. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchModule(refresh = false): Promise { if (refresh) { @@ -96,7 +96,7 @@ export class CoreCourseModulePreviewPage implements OnInit { * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher): Promise { @@ -110,7 +110,7 @@ export class CoreCourseModulePreviewPage implements OnInit { /** * The completion of the modules has changed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async onCompletionChange(): Promise { // Update the module data after a while. diff --git a/src/core/features/course/services/course-helper.ts b/src/core/features/course/services/course-helper.ts index 7bae3257d..80bdcf75f 100644 --- a/src/core/features/course/services/course-helper.ts +++ b/src/core/features/course/services/course-helper.ts @@ -152,7 +152,7 @@ export class CoreCourseHelperProvider { * @param completionStatus List of completion status. * @param courseName Not used since 4.0 * @param forCoursePage Whether the data will be used to render the course page. - * @return Whether the sections have content. + * @returns Whether the sections have content. */ async addHandlerDataForModules( sections: CoreCourseWSSection[], @@ -217,7 +217,7 @@ export class CoreCourseHelperProvider { * * @param module Module to check. * @param section Section to check. - * @return Wether the module is stealth. + * @returns Wether the module is stealth. */ isModuleStealth(module: CoreCourseModuleData, section?: CoreCourseWSSection): boolean { // visibleoncoursepage can be 1 for teachers when the section is hidden. @@ -229,7 +229,7 @@ export class CoreCourseHelperProvider { * * @param module Module to check. * @param section Section to check. Omitted if not defined. - * @return Wether the section is visible by the user. + * @returns Wether the section is visible by the user. */ canUserViewModule(module: CoreCourseModuleData, section?: CoreCourseWSSection): boolean { return module.uservisible !== false && (!section || CoreCourseHelper.canUserViewSection(section)); @@ -240,7 +240,7 @@ export class CoreCourseHelperProvider { * This should not be true on Moodle 4.0 onwards. * * @param section Section to check. - * @return Wether section is stealth (accessible but not visible to students). + * @returns Wether section is stealth (accessible but not visible to students). */ isSectionStealth(section: CoreCourseWSSection): boolean { return section.hiddenbynumsections === 1 || section.id === CoreCourseProvider.STEALTH_MODULES_SECTION_ID; @@ -250,7 +250,7 @@ export class CoreCourseHelperProvider { * Section is visible by the user. * * @param section Section to check. - * @return Wether the section is visible by the user. + * @returns Wether the section is visible by the user. */ canUserViewSection(section: CoreCourseWSSection): boolean { return section.uservisible !== false; @@ -279,7 +279,7 @@ export class CoreCourseHelperProvider { * @param courseId Course ID the section belongs to. * @param refresh True if it shouldn't use module status cache (slower). * @param checkUpdates Whether to use the WS to check updates. Defaults to true. - * @return Promise resolved when the status is calculated. + * @returns Promise resolved when the status is calculated. */ async calculateSectionStatus( section: CoreCourseSection, @@ -335,7 +335,7 @@ export class CoreCourseHelperProvider { * @param courseId Course ID the sections belong to. * @param refresh True if it shouldn't use module status cache (slower). * @param checkUpdates Whether to use the WS to check updates. Defaults to true. - * @return Promise resolved when the states are calculated. + * @returns Promise resolved when the states are calculated. */ async calculateSectionsStatus( sections: CoreCourseSection[], @@ -392,7 +392,7 @@ export class CoreCourseHelperProvider { * @param data An object where to store the course icon and title: "prefetchCourseIcon", "title" and "downloadSucceeded". * @param course Course to prefetch. * @param options Other options. - * @return Promise resolved when the download finishes, rejected if an error occurs or the user cancels. + * @returns Promise resolved when the download finishes, rejected if an error occurs or the user cancels. */ async confirmAndPrefetchCourse( data: CorePrefetchStatusInfo, @@ -449,7 +449,7 @@ export class CoreCourseHelperProvider { * * @param courses List of courses to download. * @param options Other options. - * @return Resolved when downloaded, rejected if error or canceled. + * @returns Resolved when downloaded, rejected if error or canceled. */ async confirmAndPrefetchCourses( courses: CoreCourseAnyCourseData[], @@ -521,7 +521,7 @@ export class CoreCourseHelperProvider { * * @param module Module to remove the files. * @param courseId Course ID the module belongs to. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 4.0 */ async confirmAndRemoveFiles(module: CoreCourseModuleData, courseId: number): Promise { @@ -549,7 +549,7 @@ export class CoreCourseHelperProvider { * @param section Section. If not provided, all sections. * @param sections List of sections. Used when downloading all the sections. * @param alwaysConfirm True to show a confirm even if the size isn't high, false otherwise. - * @return Promise resolved if the user confirms or there's no need to confirm. + * @returns Promise resolved if the user confirms or there's no need to confirm. */ async confirmDownloadSizeSection( courseId: number, @@ -602,7 +602,7 @@ export class CoreCourseHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether course is accessed using guest access. + * @returns Promise resolved with boolean: whether course is accessed using guest access. */ async courseUsesGuestAccess(courseId: number, siteId?: string): Promise { try { @@ -649,7 +649,7 @@ export class CoreCourseHelperProvider { /** * Create and return a section for "All sections". * - * @return Created section. + * @returns Created section. */ createAllSectionsSection(): CoreCourseSection { return { @@ -666,7 +666,7 @@ export class CoreCourseHelperProvider { * Determine the status of a list of courses. * * @param courses Courses - * @return Promise resolved with the status. + * @returns Promise resolved with the status. */ async determineCoursesStatus(courses: CoreCourseBasicData[]): Promise { // Get the status of each course. @@ -700,7 +700,7 @@ export class CoreCourseHelperProvider { * @param files List of files of the module. If not provided, use module.contents. * @param siteId The site ID. If not defined, current site. * @param options Options to open the file. - * @return Resolved on success. + * @returns Resolved on success. */ async downloadModuleAndOpenFile( module: CoreCourseModuleData, @@ -790,7 +790,7 @@ export class CoreCourseHelperProvider { * @param componentId An ID to use in conjunction with the component. * @param files List of files of the module. If not provided, use module.contents. * @param options Options to open the file. Only used if not opened in browser. - * @return Resolved on success. + * @returns Resolved on success. */ protected async openModuleFileInBrowser( fileUrl: string, @@ -843,7 +843,7 @@ export class CoreCourseHelperProvider { * @param files List of files of the module. If not provided, use module.contents. * @param siteId The site ID. If not defined, current site. * @param options Options to open the file. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async downloadModuleWithMainFileIfNeeded( module: CoreCourseModuleData, @@ -939,7 +939,7 @@ export class CoreCourseHelperProvider { * @param componentId An ID to use in conjunction with the component. * @param siteId The site ID. If not defined, current site. * @param options Options to open the file. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadModuleWithMainFile( module: CoreCourseModuleData, @@ -1004,7 +1004,7 @@ export class CoreCourseHelperProvider { * @param componentId An ID to use in conjunction with the component. * @param files List of files of the module. If not provided, use module.contents. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async downloadModule( module: CoreCourseModuleData, @@ -1038,7 +1038,7 @@ export class CoreCourseHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the course. + * @returns Promise resolved with the course. */ async getCourse( courseId: number, @@ -1067,7 +1067,7 @@ export class CoreCourseHelperProvider { * @param courseId Course ID. * @param params Other params to pass to the course page. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async getAndOpenCourse(courseId: number, params?: Params, siteId?: string): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -1094,7 +1094,7 @@ export class CoreCourseHelperProvider { * @param courseId Course ID. * @param name Block name to search. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if the block exists or false otherwise. + * @returns Promise resolved with true if the block exists or false otherwise. * @since 3.7 */ async hasABlockNamed(courseId: number, name: string, siteId?: string): Promise { @@ -1112,7 +1112,7 @@ export class CoreCourseHelperProvider { * * @param courses Courses array to get info from. * @param prefetch Prefetch information. - * @return Resolved with the prefetch information updated when done. + * @returns Resolved with the prefetch information updated when done. */ async initPrefetchCoursesIcons( courses: CoreCourseBasicData[], @@ -1144,7 +1144,7 @@ export class CoreCourseHelperProvider { * @param courseId The course to get the completion. * @param sections List of sections of the course. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadOfflineCompletion(courseId: number, sections: CoreCourseWSSection[], siteId?: string): Promise { const offlineCompletions = await CoreCourseOffline.getCourseManualCompletions(courseId, siteId); @@ -1192,7 +1192,7 @@ export class CoreCourseHelperProvider { * @param courseId The course to get the completion. * @param module The module. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadModuleOfflineCompletion(courseId: number, module: CoreCourseModuleData, siteId?: string): Promise { if (!module.completiondata) { @@ -1216,7 +1216,7 @@ export class CoreCourseHelperProvider { * @param courses Courses array to prefetch. * @param prefetch Prefetch information to be updated. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetchCourses( courses: CoreCourseAnyCourseData[], @@ -1251,7 +1251,7 @@ export class CoreCourseHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Download promise, undefined if not found. + * @returns Download promise, undefined if not found. */ getCourseDownloadPromise(courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1264,7 +1264,7 @@ export class CoreCourseHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the icon name and the title key. + * @returns Promise resolved with the icon name and the title key. */ async getCourseStatusIconAndTitle(courseId: number, siteId?: string): Promise { const status = await CoreCourse.getCourseStatus(courseId, siteId); @@ -1276,7 +1276,7 @@ export class CoreCourseHelperProvider { * Get a course status icon and the langkey to use as a title from status. * * @param status Course status. - * @return Prefetch status info. + * @returns Prefetch status info. */ getCoursePrefetchStatusInfo(status: string): CorePrefetchStatusInfo { const prefetchStatus: CorePrefetchStatusInfo = { @@ -1303,7 +1303,7 @@ export class CoreCourseHelperProvider { * Get a courses status icon and the langkey to use as a title from status. * * @param status Courses status. - * @return Prefetch status info. + * @returns Prefetch status info. */ getCoursesPrefetchStatusInfo(status: string): CorePrefetchStatusInfo { const prefetchStatus: CorePrefetchStatusInfo = { @@ -1331,7 +1331,7 @@ export class CoreCourseHelperProvider { * * @param status Status constant. * @param trustDownload True to show download success, false to show an outdated status when downloaded. - * @return Icon name. + * @returns Icon name. */ getPrefetchStatusIcon(status: string, trustDownload: boolean = false): string { if (status == CoreConstants.NOT_DOWNLOADED) { @@ -1357,7 +1357,7 @@ export class CoreCourseHelperProvider { * @param instanceId Instance ID. * @param moduleName Name of the module. E.g. 'glossary'. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the module's course ID. + * @returns Promise resolved with the module's course ID. */ async getModuleCourseIdByInstance(instanceId: number, moduleName: string, siteId?: string): Promise { try { @@ -1382,7 +1382,7 @@ export class CoreCourseHelperProvider { * @param courseId Course ID the section belongs to. * @param invalidateCache Invalidates the cache first. * @param component Component of the module. - * @return Promise resolved with the info. + * @returns Promise resolved with the info. */ async getModulePrefetchInfo( module: CoreCourseModuleData, @@ -1445,7 +1445,7 @@ export class CoreCourseHelperProvider { * * @param module Module to get the info from. * @param component Component of the module. - * @return Promise resolved with the info. + * @returns Promise resolved with the info. */ async getModulePackageLastDownloaded( module: CoreCourseModuleData, @@ -1482,7 +1482,7 @@ export class CoreCourseHelperProvider { * Get the download ID of a section. It's used to interact with CoreCourseModulePrefetchDelegate. * * @param section Section. - * @return Section download ID. + * @returns Section download ID. */ getSectionDownloadId(section: {id: number}): string { return 'Section-' + section.id; @@ -1494,7 +1494,7 @@ export class CoreCourseHelperProvider { * @param instanceId Activity instance ID. * @param modName Module name of the activity. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async navigateToModuleByInstance( instanceId: number, @@ -1528,7 +1528,7 @@ export class CoreCourseHelperProvider { * * @param moduleId Module's ID. * @param options Other options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async navigateToModule( moduleId: number, @@ -1608,7 +1608,7 @@ export class CoreCourseHelperProvider { * @param module The module to open. * @param courseId The course ID of the module. * @param options Other options. - * @return True if module can be opened, false otherwise. + * @returns True if module can be opened, false otherwise. */ async openModule(module: CoreCourseModuleData, courseId: number, options: CoreCourseOpenModuleOptions = {}): Promise { if (!module.handlerData) { @@ -1641,7 +1641,7 @@ export class CoreCourseHelperProvider { * @param courseHandlers List of course options handlers. * @param courseMenuHandlers List of course menu handlers. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the download finishes. + * @returns Promise resolved when the download finishes. */ async prefetchCourse( course: CoreCourseAnyCourseData, @@ -1722,7 +1722,7 @@ export class CoreCourseHelperProvider { * @param size Size to download. * @param courseId Course ID of the module. * @param refresh True if refreshing, false otherwise. - * @return Promise resolved when downloaded. + * @returns Promise resolved when downloaded. */ async prefetchModule( handler: CoreCourseModulePrefetchHandler, @@ -1749,7 +1749,7 @@ export class CoreCourseHelperProvider { * @param section Section. * @param courseId Course ID the section belongs to. * @param sections List of sections. Used when downloading all the sections. - * @return Promise resolved when the prefetch is finished. + * @returns Promise resolved when the prefetch is finished. */ async prefetchSection( section: CoreCourseSectionWithStatus, @@ -1810,7 +1810,7 @@ export class CoreCourseHelperProvider { * * @param section Section to prefetch. * @param courseId Course ID the section belongs to. - * @return Promise resolved when the section is prefetched. + * @returns Promise resolved when the section is prefetched. */ protected async prefetchSingleSectionIfNeeded(section: CoreCourseSectionWithStatus, courseId: number): Promise { if (section.id == CoreCourseProvider.ALL_SECTIONS_ID || section.hiddenbynumsections) { @@ -1843,7 +1843,7 @@ export class CoreCourseHelperProvider { * * @param section Section to prefetch. * @param courseId Course ID the section belongs to. - * @return Promise resolved when the section is prefetched. + * @returns Promise resolved when the section is prefetched. */ protected async syncModulesAndPrefetchSection(section: CoreCourseSectionWithStatus, courseId: number): Promise { // Sync the modules first. @@ -1867,7 +1867,7 @@ export class CoreCourseHelperProvider { * @param section Section to download. * @param result Result of CoreCourseModulePrefetchDelegate.getModulesStatus for this section. * @param courseId Course ID the section belongs to. - * @return Promise resolved when the section has been prefetched. + * @returns Promise resolved when the section has been prefetched. */ protected async prefetchSingleSection( section: CoreCourseSectionWithStatus, @@ -1901,7 +1901,7 @@ export class CoreCourseHelperProvider { * Check if a section has content. * * @param section Section to check. - * @return Whether the section has content. + * @returns Whether the section has content. */ sectionHasContent(section: CoreCourseWSSection): boolean { if (!section.modules) { @@ -1926,7 +1926,7 @@ export class CoreCourseHelperProvider { * * @param course Course to open * @param navOptions Navigation options that includes params to pass to the page. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openCourse( course: CoreCourseAnyCourseData | { id: number }, @@ -1951,7 +1951,7 @@ export class CoreCourseHelperProvider { * Delete course files. * * @param courseId Course id. - * @return Promise to be resolved once the course files are deleted. + * @returns Promise to be resolved once the course files are deleted. */ async deleteCourseFiles(courseId: number): Promise { const sections = await CoreCourse.getSections(courseId); @@ -1969,7 +1969,7 @@ export class CoreCourseHelperProvider { * * @param module Module to remove the files. * @param courseId Course ID the module belongs to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeModuleStoredData(module: CoreCourseModuleData, courseId: number): Promise { const promises: Promise[] = []; @@ -1990,7 +1990,7 @@ export class CoreCourseHelperProvider { * * @param completion The completion. * @param event The click event. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ async changeManualCompletion( completion: CoreCourseModuleCompletionData, diff --git a/src/core/features/course/services/course-offline.ts b/src/core/features/course/services/course-offline.ts index 265d3967e..c3db65db3 100644 --- a/src/core/features/course/services/course-offline.ts +++ b/src/core/features/course/services/course-offline.ts @@ -29,7 +29,7 @@ export class CoreCourseOfflineProvider { * * @param cmId The module ID to remove the completion. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteManualCompletion(cmId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -41,7 +41,7 @@ export class CoreCourseOfflineProvider { * Get all offline manual completions for a certain course. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of completions. + * @returns Promise resolved with the list of completions. */ async getAllManualCompletions(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -54,7 +54,7 @@ export class CoreCourseOfflineProvider { * * @param courseId Course ID the module belongs to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of completions. + * @returns Promise resolved with the list of completions. */ async getCourseManualCompletions(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -67,7 +67,7 @@ export class CoreCourseOfflineProvider { * * @param cmId The module ID to remove the completion. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the completion, rejected if failure or not found. + * @returns Promise resolved with the completion, rejected if failure or not found. */ async getManualCompletion(cmId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -83,7 +83,7 @@ export class CoreCourseOfflineProvider { * @param courseId Course ID the module belongs to. * @param courseName Not used since 4.0. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when completion is successfully stored. + * @returns Promise resolved when completion is successfully stored. */ async markCompletedManually( cmId: number, diff --git a/src/core/features/course/services/course-options-delegate.ts b/src/core/features/course/services/course-options-delegate.ts index a5a4ae720..5a0bc3e25 100644 --- a/src/core/features/course/services/course-options-delegate.ts +++ b/src/core/features/course/services/course-options-delegate.ts @@ -51,7 +51,7 @@ export interface CoreCourseOptionsHandler extends CoreDelegateHandler { * @param accessData Access type and data. Default, guest, ... * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ isEnabledForCourse( courseId: number, @@ -64,7 +64,7 @@ export interface CoreCourseOptionsHandler extends CoreDelegateHandler { * Returns the data needed to render the handler. * * @param course The course. - * @return Data or promise resolved with the data. + * @returns Data or promise resolved with the data. */ getDisplayData?( course: CoreCourseAnyCourseDataWithOptions, @@ -76,7 +76,7 @@ export interface CoreCourseOptionsHandler extends CoreDelegateHandler { * @param courseId The course ID. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ invalidateEnabledForCourse?( courseId: number, @@ -88,7 +88,7 @@ export interface CoreCourseOptionsHandler extends CoreDelegateHandler { * Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline. * * @param course The course. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch?(course: CoreCourseAnyCourseData): Promise; } @@ -101,7 +101,7 @@ export interface CoreCourseOptionsMenuHandler extends CoreCourseOptionsHandler { * Returns the data needed to render the handler. * * @param course The course. - * @return Data or promise resolved with data. + * @returns Data or promise resolved with data. */ getMenuDisplayData( course: CoreCourseAnyCourseDataWithOptions, @@ -176,7 +176,7 @@ export interface CoreCourseOptionsHandlerToDisplay extends CoreDelegateToDisplay * Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline. * * @param course The course. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch?(course: CoreCourseAnyCourseData): Promise; } @@ -204,7 +204,7 @@ export interface CoreCourseOptionsMenuHandlerToDisplay { * Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline. * * @param course The course. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch?(course: CoreCourseAnyCourseData): Promise; } @@ -245,7 +245,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate { const promises: Promise[] = []; @@ -311,7 +311,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate { // Load course options if missing. @@ -494,7 +494,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate { const promises: Promise[] = []; @@ -568,7 +568,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate { if (course.navOptions === undefined || course.admOptions === undefined || refresh) { @@ -612,7 +612,7 @@ export class CoreCourseOptionsDelegateService extends CoreDelegate { const site = await CoreSites.getSite(siteId); @@ -268,7 +268,7 @@ export class CoreCourseProvider { * Check if the current view is a certain course initial page. * * @param courseId Course ID. - * @return Whether the current view is a certain course. + * @returns Whether the current view is a certain course. */ currentViewIsCourse(courseId: number): boolean { const route = CoreNavigator.getCurrentRoute({ routeData: { isCourseIndex: true } }); @@ -289,7 +289,7 @@ export class CoreCourseProvider { * @param forceCache True if it should return cached data. Has priority over ignoreCache. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). * @param includeOffline True if it should load offline data in the completion status. - * @return Promise resolved with the completion statuses: object where the key is module ID. + * @returns Promise resolved with the completion statuses: object where the key is module ID. */ async getActivitiesCompletionStatus( courseId: number, @@ -364,7 +364,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getActivitiesCompletionCacheKey(courseId: number, userId: number): string { return ROOT_CACHE_KEY + 'activitiescompletion:' + courseId + ':' + userId; @@ -375,7 +375,7 @@ export class CoreCourseProvider { * * @param ids Module IDs. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with map of last module viewed data. + * @returns Promise resolved with map of last module viewed data. */ async getCertainModulesViewed(ids: number[] = [], siteId?: string): Promise> { if (!ids.length) { @@ -400,7 +400,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of blocks. + * @returns Promise resolved with the list of blocks. * @since 3.7 */ getCourseBlocks(courseId: number, siteId?: string): Promise { @@ -412,7 +412,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param options Options. - * @return Observable that returns the blocks. + * @returns Observable that returns the blocks. * @since 3.7 */ getCourseBlocksObservable(courseId: number, options: CoreSitesCommonWSOptions = {}): WSObservable { @@ -439,7 +439,7 @@ export class CoreCourseProvider { * Get cache key for course blocks WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getCourseBlocksCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'courseblocks:' + courseId; @@ -450,7 +450,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getCourseStatusData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -467,7 +467,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the status. + * @returns Promise resolved with the status. */ async getCourseStatus(courseId: number, siteId?: string): Promise { try { @@ -483,7 +483,7 @@ export class CoreCourseProvider { * Obtain ids of downloaded courses. * * @param siteId Site id. - * @return Resolves with an array containing downloaded course ids. + * @returns Resolves with an array containing downloaded course ids. */ async getDownloadedCourseIds(siteId?: string): Promise { const downloadedStatuses = [CoreConstants.DOWNLOADED, CoreConstants.DOWNLOADING, CoreConstants.OUTDATED]; @@ -502,7 +502,7 @@ export class CoreCourseProvider { * * @param id Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with last module viewed data, undefined if none. + * @returns Promise resolved with last module viewed data, undefined if none. */ async getLastModuleViewed(id: number, siteId?: string): Promise { const viewedModules = await this.getViewedModules(id, siteId); @@ -521,7 +521,7 @@ export class CoreCourseProvider { * @param siteId Site ID. If not defined, current site. * @param modName If set, the app will retrieve all modules of this type with a single WS call. This reduces the * number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @return Promise resolved with the module. + * @returns Promise resolved with the module. */ async getModule( moduleId: number, @@ -659,7 +659,7 @@ export class CoreCourseProvider { * @param module Module. * @param courseId Course ID of the module. * @param sectionId Section ID of the module. - * @return Module with additional info. + * @returns Module with additional info. */ protected addAdditionalModuleData( module: CoreCourseGetContentsWSModule, @@ -690,7 +690,7 @@ export class CoreCourseProvider { * * @param moduleId Module ID. * @param options Comon site WS options. - * @return Promise resolved with the module's info. + * @returns Promise resolved with the module's info. */ async getModuleBasicInfo(moduleId: number, options: CoreSitesCommonWSOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -716,7 +716,7 @@ export class CoreCourseProvider { * * @param moduleId Module ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the module's grade info. + * @returns Promise resolved with the module's grade info. */ async getModuleBasicGradeInfo(moduleId: number, siteId?: string): Promise { const info = await this.getModuleBasicInfo(moduleId, { siteId }); @@ -744,7 +744,7 @@ export class CoreCourseProvider { * @param instanceId Instance ID. * @param moduleName Name of the module. E.g. 'glossary'. * @param options Comon site WS options. - * @return Promise resolved with the module's info. + * @returns Promise resolved with the module's info. */ async getModuleBasicInfoByInstance( instanceId: number, @@ -781,7 +781,7 @@ export class CoreCourseProvider { * * @param instanceId Instance ID. * @param moduleName Name of the module. E.g. 'glossary'. - * @return Cache key. + * @returns Cache key. */ protected getModuleBasicInfoByInstanceCacheKey(instanceId: number, moduleName: string): string { return ROOT_CACHE_KEY + 'moduleByInstance:' + moduleName + ':' + instanceId; @@ -791,7 +791,7 @@ export class CoreCourseProvider { * Get cache key for module WS calls. * * @param moduleId Module ID. - * @return Cache key. + * @returns Cache key. */ protected getModuleCacheKey(moduleId: number): string { return ROOT_CACHE_KEY + 'module:' + moduleId; @@ -801,7 +801,7 @@ export class CoreCourseProvider { * Get cache key for module by modname WS calls. * * @param modName Name of the module. - * @return Cache key. + * @returns Cache key. */ protected getModuleByModNameCacheKey(modName: string): string { return ROOT_CACHE_KEY + 'module:modName:' + modName; @@ -812,7 +812,7 @@ export class CoreCourseProvider { * * @param moduleName The module name. * @param modicon The mod icon string to use in case we are not using a core activity. - * @return The IMG src. + * @returns The IMG src. */ getModuleIconSrc(moduleName: string, modicon?: string, mimetypeIcon = ''): string { if (mimetypeIcon) { @@ -843,7 +843,7 @@ export class CoreCourseProvider { * @deprecated since 4.0. * @param moduleId The module ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the section ID. + * @returns Promise resolved with the section ID. */ async getModuleSectionId(moduleId: number, siteId?: string): Promise { // Try to get the section using getModuleBasicInfo. @@ -863,7 +863,7 @@ export class CoreCourseProvider { * @param excludeModules Do not return modules, return only the sections structure. * @param excludeContents Do not return module contents (i.e: files inside a resource). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the section. + * @returns Promise resolved with the section. */ async getSection( courseId: number, @@ -896,7 +896,7 @@ export class CoreCourseProvider { * @param preSets Presets to use. * @param siteId Site ID. If not defined, current site. * @param includeStealthModules Whether to include stealth modules. Defaults to true. - * @return The reject contains the error message, else contains the sections. + * @returns The reject contains the error message, else contains the sections. */ getSections( courseId: number, @@ -920,7 +920,7 @@ export class CoreCourseProvider { * * @param courseId The course ID. * @param options Options. - * @return Observable that returns the sections. + * @returns Observable that returns the sections. */ getSectionsObservable( courseId: number, @@ -987,7 +987,7 @@ export class CoreCourseProvider { * Get cache key for section WS call. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getSectionsCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'sections:' + courseId; @@ -997,7 +997,7 @@ export class CoreCourseProvider { * Given a list of sections, returns the list of modules in the sections. * * @param sections Sections. - * @return Modules. + * @returns Modules. */ getSectionsModules(sections: CoreCourseWSSection[]): CoreCourseModuleData[] { if (!sections || !sections.length) { @@ -1012,7 +1012,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of viewed modules. + * @returns Promise resolved with the list of viewed modules. */ async getViewedModules(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1029,7 +1029,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourseBlocks(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1043,7 +1043,7 @@ export class CoreCourseProvider { * @param moduleId Module ID. * @param siteId Site ID. If not defined, current site. * @param modName Module name. E.g. 'label', 'url', ... - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateModule(moduleId: number, siteId?: string, modName?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1062,7 +1062,7 @@ export class CoreCourseProvider { * @param id Instance ID. * @param module Name of the module. E.g. 'glossary'. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateModuleByInstance(id: number, module: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1076,7 +1076,7 @@ export class CoreCourseProvider { * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateSections(courseId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -1103,7 +1103,7 @@ export class CoreCourseProvider { * @param siteId Site ID. If not defined, current site. * @param modName If set, the app will retrieve all modules of this type with a single WS call. This reduces the * number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ async loadModuleContents( module: CoreCourseAnyModuleData, @@ -1141,7 +1141,7 @@ export class CoreCourseProvider { * @param siteId Site ID. If not defined, current site. * @param modName If set, the app will retrieve all modules of this type with a single WS call. This reduces the * number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ async getModuleContents( module: CoreCourseModuleData, @@ -1169,7 +1169,7 @@ export class CoreCourseProvider { * @param sectionNumber Section number. * @param siteId Site ID. If not defined, current site. * @param name Name of the course. - * @return Promise resolved when the WS call is successful. + * @returns Promise resolved when the WS call is successful. */ async logView(courseId: number, sectionNumber?: number, siteId?: string, name?: string): Promise { const params: CoreCourseViewCourseWSParams = { @@ -1203,7 +1203,7 @@ export class CoreCourseProvider { * @param courseId Course ID the module belongs to. * @param courseName Not used since 4.0. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when completion is successfully sent or stored. + * @returns Promise resolved when completion is successfully sent or stored. */ async markCompletedManually( cmId: number, @@ -1253,7 +1253,7 @@ export class CoreCourseProvider { * @param cmId The module ID. * @param completed Whether the module is completed or not. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when completion is successfully sent. + * @returns Promise resolved when completion is successfully sent. */ async markCompletedManuallyOnline( cmId: number, @@ -1286,7 +1286,7 @@ export class CoreCourseProvider { * Check if a module has a view page. E.g. labels don't have a view page. * * @param module The module object. - * @return Whether the module has a view page. + * @returns Whether the module has a view page. */ moduleHasView(module: CoreCourseModuleSummary | CoreCourseModuleData): boolean { if ('modname' in module) { @@ -1312,7 +1312,7 @@ export class CoreCourseProvider { * * @param course Course to open * @param navOptions Navigation options that includes params to pass to the page. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openCourse( course: CoreCourseAnyCourseData | { id: number }, @@ -1396,7 +1396,7 @@ export class CoreCourseProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the status is changed. Resolve param: new status. + * @returns Promise resolved when the status is changed. Resolve param: new status. */ async setCoursePreviousStatus(courseId: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1429,7 +1429,7 @@ export class CoreCourseProvider { * @param courseId Course ID. * @param status New course status. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the status is stored. + * @returns Promise resolved when the status is stored. */ async setCourseStatus(courseId: number, status: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1483,7 +1483,7 @@ export class CoreCourseProvider { * @param courseId Chapter ID. * @param cmId Module ID. * @param options Other options. - * @return Promise resolved with last chapter viewed, undefined if none. + * @returns Promise resolved with last chapter viewed, undefined if none. */ async storeModuleViewed(courseId: number, cmId: number, options: CoreCourseStoreModuleViewedOptions = {}): Promise { const site = await CoreSites.getSite(options.siteId); @@ -1509,7 +1509,7 @@ export class CoreCourseProvider { * Translate a module name to current language. * * @param moduleName The module name. - * @return Translated name. + * @returns Translated name. */ translateModuleName(moduleName: string): string { if (this.CORE_MODULES.indexOf(moduleName) < 0) { diff --git a/src/core/features/course/services/format-delegate.ts b/src/core/features/course/services/format-delegate.ts index 34819b9ba..59b1f5b4a 100644 --- a/src/core/features/course/services/format-delegate.ts +++ b/src/core/features/course/services/format-delegate.ts @@ -37,7 +37,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @param course The course. * @param sections List of sections. - * @return Title. + * @returns Title. */ getCourseTitle?(course: CoreCourseAnyCourseData, sections?: CoreCourseWSSection[]): string; @@ -45,7 +45,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Whether it allows seeing all sections at the same time. Defaults to true. * * @param course The course to check. - * @return Whether it can view all sections. + * @returns Whether it can view all sections. */ canViewAllSections?(course: CoreCourseAnyCourseData): boolean; @@ -53,7 +53,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Whether the option blocks should be displayed. Defaults to true. * * @param course The course to check. - * @return Whether it can display blocks. + * @returns Whether it can display blocks. */ displayBlocks?(course: CoreCourseAnyCourseData): boolean; @@ -62,7 +62,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @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. + * @returns Whether the option to enable section/module download should be displayed. */ displayEnableDownload?(course: CoreCourseAnyCourseData): boolean; @@ -71,7 +71,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @deprecated on 4.0. Please use displayCourseIndex instead. * @param course The course to check. - * @return Whether the default course index should be displayed. + * @returns Whether the default course index should be displayed. */ displaySectionSelector?(course: CoreCourseAnyCourseData): boolean; @@ -79,7 +79,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Whether the default section selector should be displayed. Defaults to true. * * @param course The course to check. - * @return Whether the default section selector should be displayed. + * @returns Whether the default section selector should be displayed. */ displayCourseIndex?(course: CoreCourseAnyCourseData): boolean; @@ -89,7 +89,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @param course The course to check. * @param sections List of course sections. - * @return Whether the refresher should be displayed. + * @returns Whether the refresher should be displayed. */ displayRefresher?(course: CoreCourseAnyCourseData, sections: CoreCourseWSSection[]): boolean; @@ -98,7 +98,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @param course The course to get the title. * @param sections List of sections. - * @return Promise resolved with current section and whether the section should be selected. If only the section is returned, + * @returns Promise resolved with current section and whether the section should be selected. If only the section is returned, * forceSelected will default to false. */ getCurrentSection?( @@ -109,7 +109,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { /** * Returns the name for the highlighted section. * - * @return The name for the highlighted section based on the given course format. + * @returns The name for the highlighted section based on the given course format. */ getSectionHightlightedName?(): string; @@ -121,7 +121,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @param course The course to open. It should contain a "format" attribute. * @param navOptions Navigation options that includes params to pass to the page. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ openCourse?(course: CoreCourseAnyCourseData, navOptions?: CoreNavigationOptions): Promise; @@ -132,7 +132,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param course The course to render. - * @return Promise resolved with component to use, undefined if not found. + * @returns Promise resolved with component to use, undefined if not found. */ getCourseFormatComponent?(course: CoreCourseAnyCourseData): Promise | undefined>; @@ -141,7 +141,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param course The course to render. - * @return Promise resolved with component to use, undefined if not found. + * @returns Promise resolved with component to use, undefined if not found. */ getCourseSummaryComponent?(course: CoreCourseAnyCourseData): Promise | undefined>; @@ -151,7 +151,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param course The course to render. - * @return Promise resolved with component to use, undefined if not found. + * @returns Promise resolved with component to use, undefined if not found. */ getSingleSectionComponent?(course: CoreCourseAnyCourseData): Promise | undefined>; @@ -160,7 +160,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param course The course to render. - * @return Promise resolved with component to use, undefined if not found. + * @returns Promise resolved with component to use, undefined if not found. */ getAllSectionsComponent?(course: CoreCourseAnyCourseData): Promise | undefined>; @@ -169,7 +169,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * * @param course The course to get the title. * @param sections List of sections. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateData?(course: CoreCourseAnyCourseData, sections: CoreCourseWSSection[]): Promise; @@ -178,7 +178,7 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * activity completion then you should return false. * * @param course The course. - * @return Whether course view should be refreshed when an activity completion changes. + * @returns Whether course view should be refreshed when an activity completion changes. */ shouldRefreshWhenCompletionChanges?(course: CoreCourseAnyCourseData): Promise; } @@ -200,7 +200,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate(course.format || '', 'canViewAllSections', [course]); @@ -210,7 +210,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate(course.format || '', 'displayBlocks', [course]); @@ -222,7 +222,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate(course.format || '', 'displayRefresher', [course, sections]); @@ -232,7 +232,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate(course.format || '', 'displayCourseIndex', [course]); @@ -249,7 +249,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate | undefined> { try { @@ -263,7 +263,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate | undefined> { try { @@ -277,7 +277,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate | undefined> { try { @@ -292,7 +292,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate( course: CoreCourseAnyCourseData, @@ -340,7 +340,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate( @@ -354,7 +354,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate | undefined> { try { @@ -369,7 +369,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate { await this.executeFunctionOnEnabled(course.format || '', 'invalidateData', [course, sections]); @@ -380,7 +380,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate { await this.executeFunctionOnEnabled(course.format || '', 'openCourse', [course, navOptions]); @@ -391,7 +391,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate { return this.executeFunctionOnEnabled(course.format || '', 'shouldRefreshWhenCompletionChanges', [course]); diff --git a/src/core/features/course/services/handlers/course-tag-area.ts b/src/core/features/course/services/handlers/course-tag-area.ts index c7d66d6a5..9c52f9b9a 100644 --- a/src/core/features/course/services/handlers/course-tag-area.ts +++ b/src/core/features/course/services/handlers/course-tag-area.ts @@ -31,7 +31,7 @@ export class CoreCourseTagAreaHandlerService implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; @@ -41,7 +41,7 @@ export class CoreCourseTagAreaHandlerService implements CoreTagAreaHandler { * Parses the rendered content of a tag index and returns the items. * * @param content Rendered content. - * @return Area items (or promise resolved with the items). + * @returns Area items (or promise resolved with the items). */ parseContent(content: string): CoreCouseTagItems[] { const items: CoreCouseTagItems[] = []; @@ -67,7 +67,7 @@ export class CoreCourseTagAreaHandlerService implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return CoreCourseTagAreaComponent; diff --git a/src/core/features/course/services/handlers/log-cron.ts b/src/core/features/course/services/handlers/log-cron.ts index cb447acd8..fe87cd189 100644 --- a/src/core/features/course/services/handlers/log-cron.ts +++ b/src/core/features/course/services/handlers/log-cron.ts @@ -33,7 +33,7 @@ export class CoreCourseLogCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async execute(siteId?: string, force?: boolean): Promise { @@ -50,7 +50,7 @@ export class CoreCourseLogCronHandlerService implements CoreCronHandler { /** * Check whether it's a synchronization process or not. * - * @return Whether it's a synchronization process or not. + * @returns Whether it's a synchronization process or not. */ isSync(): boolean { return false; @@ -59,7 +59,7 @@ export class CoreCourseLogCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return 240000; // 4 minutes. By default platform will see the user as online if lastaccess is less than 5 minutes. diff --git a/src/core/features/course/services/handlers/modules-tag-area.ts b/src/core/features/course/services/handlers/modules-tag-area.ts index 75ee702fd..8cbd6ea47 100644 --- a/src/core/features/course/services/handlers/modules-tag-area.ts +++ b/src/core/features/course/services/handlers/modules-tag-area.ts @@ -31,7 +31,7 @@ export class CoreCourseModulesTagAreaHandlerService implements CoreTagAreaHandle /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; @@ -41,7 +41,7 @@ export class CoreCourseModulesTagAreaHandlerService implements CoreTagAreaHandle * Parses the rendered content of a tag index and returns the items. * * @param content Rendered content. - * @return Area items (or promise resolved with the items). + * @returns Area items (or promise resolved with the items). */ parseContent(content: string): CoreTagFeedElement[] | Promise { return CoreTagHelper.parseFeedContent(content); @@ -50,7 +50,7 @@ export class CoreCourseModulesTagAreaHandlerService implements CoreTagAreaHandle /** * Get the component to use to display items. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return CoreTagFeedComponent; diff --git a/src/core/features/course/services/handlers/sync-cron.ts b/src/core/features/course/services/handlers/sync-cron.ts index e5388b3ca..b0aff45fb 100644 --- a/src/core/features/course/services/handlers/sync-cron.ts +++ b/src/core/features/course/services/handlers/sync-cron.ts @@ -32,7 +32,7 @@ export class CoreCourseSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return CoreCourseSync.syncAllCourses(siteId, force); @@ -41,7 +41,7 @@ export class CoreCourseSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return CoreCourseSync.syncInterval; diff --git a/src/core/features/course/services/log-helper.ts b/src/core/features/course/services/log-helper.ts index 72124ffc1..83b2ac5be 100644 --- a/src/core/features/course/services/log-helper.ts +++ b/src/core/features/course/services/log-helper.ts @@ -37,7 +37,7 @@ export class CoreCourseLogHelperProvider { * @param component Component name. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted, rejected if failure. + * @returns Promise resolved when deleted, rejected if failure. */ protected async deleteLogs(component: string, componentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -57,7 +57,7 @@ export class CoreCourseLogHelperProvider { * @param componentId Component ID. * @param ws WS name. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted, rejected if failure. + * @returns Promise resolved when deleted, rejected if failure. */ protected async deleteWSLogsByComponent(component: string, componentId: number, ws: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -77,7 +77,7 @@ export class CoreCourseLogHelperProvider { * @param ws WS name. * @param data Data to send to the WS. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when deleted, rejected if failure. + * @returns Promise resolved when deleted, rejected if failure. */ protected async deleteWSLogs(ws: string, data: Record, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -94,7 +94,7 @@ export class CoreCourseLogHelperProvider { * Get all the offline saved activity logs. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of offline logs. + * @returns Promise resolved with the list of offline logs. */ protected async getAllLogs(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -108,7 +108,7 @@ export class CoreCourseLogHelperProvider { * @param component Component name. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of offline logs. + * @returns Promise resolved with the list of offline logs. */ protected async getLogs(component: string, componentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -129,7 +129,7 @@ export class CoreCourseLogHelperProvider { * @param component Component name. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async log(ws: string, data: Record, component: string, componentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -158,7 +158,7 @@ export class CoreCourseLogHelperProvider { * @param ws WS name. * @param data Data to send to the WS. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when log is successfully submitted. Rejected with object containing + * @returns Promise resolved when log is successfully submitted. Rejected with object containing * the error message (if any) and a boolean indicating if the error was returned by WS. */ protected async logOnline( @@ -200,7 +200,7 @@ export class CoreCourseLogHelperProvider { * @param category Category of the viewed item. * @param eventData Data to pass to the Firebase event. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ logSingle( ws: string, @@ -228,7 +228,7 @@ export class CoreCourseLogHelperProvider { * @param category Category of the viewed item. * @param eventData Data to pass to the Firebase event. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ logList( ws: string, @@ -252,7 +252,7 @@ export class CoreCourseLogHelperProvider { * @param component Component name. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ protected async storeOffline( ws: string, @@ -279,7 +279,7 @@ export class CoreCourseLogHelperProvider { * Sync all the offline saved activity logs. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async syncSite(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -310,7 +310,7 @@ export class CoreCourseLogHelperProvider { * @param component Component name. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 3.9.5. Please use syncActivity instead. */ syncIfNeeded(component: string, componentId: number, siteId?: string): Promise { @@ -323,7 +323,7 @@ export class CoreCourseLogHelperProvider { * @param component Component name. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async syncActivity(component: string, componentId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -352,7 +352,7 @@ export class CoreCourseLogHelperProvider { * * @param logs Array of log objects. * @param siteId Site Id. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async syncLogs(logs: CoreCourseActivityLogDBRecord[], siteId: string): Promise { await Promise.all(logs.map(async (log) => { diff --git a/src/core/features/course/services/module-delegate.ts b/src/core/features/course/services/module-delegate.ts index 76680e2f5..bbd3e5568 100644 --- a/src/core/features/course/services/module-delegate.ts +++ b/src/core/features/course/services/module-delegate.ts @@ -50,7 +50,7 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * @param courseId The course ID. * @param sectionId The section ID. * @param forCoursePage Whether the data will be used to render the course page. - * @return Data to render the module. + * @returns Data to render the module. */ getData( module: CoreCourseModuleData, @@ -66,7 +66,7 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * * @param course The course object. * @param module The module object. - * @return Promise resolved with component to use, undefined if not found. + * @returns Promise resolved with component to use, undefined if not found. */ getMainComponent(course: CoreCourseAnyCourseData, module: CoreCourseModuleData): Promise | undefined>; @@ -74,15 +74,15 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * Whether to display the course refresher in single activity course format. If it returns false, a refresher must be * included in the template that calls the doRefresh method of the component. Defaults to true. * - * @return Whether the refresher should be displayed. + * @returns Whether the refresher should be displayed. */ displayRefresherInSingleActivity?(): boolean; /** * Get the icon src for the module. * - * @param module: Module to get the icon from. - * @return The icon src. + * @param module Module to get the icon from. + * @returns The icon src. */ getIconSrc?(module?: CoreCourseModuleData): Promise | string | undefined; @@ -91,7 +91,7 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * If this function is implemented, the supportedFeatures object will be ignored. * * @param feature The feature to check. - * @return The result of the supports check. + * @returns The result of the supports check. */ supportsFeature?(feature: string): unknown; @@ -100,7 +100,7 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * Returns false by default. * * @param module Module. - * @return Promise resolved with boolean: whether the manual completion should always be displayed. + * @returns Promise resolved with boolean: whether the manual completion should always be displayed. */ manualCompletionAlwaysShown?(module: CoreCourseModuleData): Promise; @@ -110,7 +110,7 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * @param module The module object. * @param courseId The course ID. * @param options Options for the navigation. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ openActivityPage(module: CoreCourseModuleData, courseId: number, options?: CoreNavigationOptions): Promise; } @@ -178,7 +178,7 @@ export interface CoreCourseModuleHandlerData { * @param module The module object. * @param courseId The course ID. * @param options Options for the navigation. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ action?(event: Event, module: CoreCourseModuleData, courseId: number, options?: CoreNavigationOptions): Promise | void; @@ -204,7 +204,7 @@ export interface CoreCourseModuleMainComponent { * * @param refresher Refresher. * @param showErrors If show errors to the user of hide them. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ doRefresh(refresher?: IonRefresher | null, showErrors?: boolean): Promise; } @@ -249,7 +249,7 @@ export interface CoreCourseModuleHandlerButton { * @param module The module object. * @param courseId The course ID. * @param options Options for the navigation. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ action(event: Event, module: CoreCourseModuleData, courseId: number, options?: CoreNavigationOptions): Promise | void; } @@ -272,7 +272,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate | undefined> { try { @@ -290,7 +290,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate { const site = await CoreSites.getSite(siteId); @@ -351,7 +352,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate(modname, 'displayRefresherInSingleActivity'); @@ -386,7 +387,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate { const icon = await this.executeFunctionOnEnabled>(modname, 'getIconSrc', [module]); @@ -400,7 +401,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate(modname: string, feature: string, defaultValue: T): T { const handler = this.enabledHandlers[modname]; @@ -424,7 +425,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate { const result = await this.executeFunctionOnEnabled(module.modname, 'manualCompletionAlwaysShown', [module]); diff --git a/src/core/features/course/services/module-prefetch-delegate.ts b/src/core/features/course/services/module-prefetch-delegate.ts index 2a8b254d9..cb1d2522a 100644 --- a/src/core/features/course/services/module-prefetch-delegate.ts +++ b/src/core/features/course/services/module-prefetch-delegate.ts @@ -80,7 +80,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const handler = this.getPrefetchHandlerFor(module.modname); @@ -122,7 +122,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const result: ToCheckList = { @@ -168,7 +168,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { // Check if the module has a prefetch handler. @@ -219,7 +219,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { @@ -250,7 +250,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { // Get course sections and all their modules. @@ -339,7 +339,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { // Get the status of each module. @@ -378,7 +378,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const handler = this.getPrefetchHandlerFor(module.modname); @@ -416,7 +416,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const handler = this.getPrefetchHandlerFor(module.modname); @@ -479,7 +479,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const site = CoreSites.getCurrentSite(); @@ -500,7 +500,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const site = CoreSites.getCurrentSite(); @@ -885,7 +885,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { @@ -926,7 +926,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const site = await CoreSites.getSite(siteId); @@ -938,7 +938,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { if ('uservisible' in module && !CoreCourseHelper.canUserViewModule(module)) { @@ -992,7 +992,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const handler = this.getPrefetchHandlerFor(module.modname); @@ -1025,7 +1025,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const handler = this.getPrefetchHandlerFor(module.modname); @@ -1043,7 +1043,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { try { @@ -1059,7 +1059,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate(module: CoreCourseAnyModuleData, courseId: number): Promise { const handler = this.getPrefetchHandlerFor(module.modname); @@ -1083,7 +1083,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate { const handler = this.getPrefetchHandlerFor(module.modname); @@ -1236,7 +1236,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate; @@ -1387,7 +1387,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * @param courseId Course ID the module belongs to. * @param single True if we're downloading a single module, false if we're downloading a whole section. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean, dirPath?: string): Promise; @@ -1397,7 +1397,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * @param module The module object returned by WS. * @param courseId Course ID. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when all content is downloaded. + * @returns Promise resolved when all content is downloaded. */ download(module: CoreCourseAnyModuleData, courseId: number, dirPath?: string): Promise; @@ -1406,7 +1406,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param moduleId The module ID. * @param courseId Course ID the module belongs to. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise; @@ -1417,7 +1417,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can use check_updates. The promise should never be rejected. + * @returns Whether the module can use check_updates. The promise should never be rejected. */ canUseCheckUpdates?(module: CoreCourseAnyModuleData, courseId: number): Promise; @@ -1428,7 +1428,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * @param module Module. * @param status The current status. * @param canCheck Whether the site allows checking for updates. This parameter was deprecated since app 4.0. - * @return Status to display. + * @returns Status to display. */ determineStatus?(module: CoreCourseAnyModuleData, status: string, canCheck: true): string; @@ -1437,7 +1437,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Size, or promise resolved with the size. + * @returns Size, or promise resolved with the size. */ getDownloadedSize?(module: CoreCourseAnyModuleData, courseId: number): Promise; @@ -1446,7 +1446,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return List of files, or promise resolved with the files. + * @returns List of files, or promise resolved with the files. */ getFiles?(module: CoreCourseAnyModuleData, courseId: number): Promise<(CoreWSFile | CoreCourseModuleContentFile)[]>; @@ -1456,7 +1456,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * @param module Module. * @param courseId Course ID the module belongs to. * @param moduleUpdates List of updates for the module. - * @return Whether the module has updates. The promise should never be rejected. + * @returns Whether the module has updates. The promise should never be rejected. */ hasUpdates?(module: CoreCourseAnyModuleData, courseId: number, moduleUpdates: false | CheckUpdatesWSInstance): Promise; @@ -1466,7 +1466,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ invalidateModule?(module: CoreCourseAnyModuleData, courseId: number): Promise; @@ -1475,7 +1475,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Whether the module can be downloaded. The promise should never be rejected. + * @returns Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable?(module: CoreCourseAnyModuleData, courseId: number): Promise; @@ -1484,7 +1484,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ loadContents?(module: CoreCourseAnyModuleData, courseId: number): Promise; @@ -1493,7 +1493,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * * @param module Module. * @param courseId Course ID the module belongs to. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ removeFiles?(module: CoreCourseAnyModuleData, courseId: number): Promise; @@ -1503,7 +1503,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * @param module Module. * @param courseId Course ID the module belongs to * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ sync?(module: CoreCourseAnyModuleData, courseId: number, siteId?: string): Promise; } diff --git a/src/core/features/course/services/sync.ts b/src/core/features/course/services/sync.ts index 5ef2145a4..c8ff8fe15 100644 --- a/src/core/features/course/services/sync.ts +++ b/src/core/features/course/services/sync.ts @@ -48,7 +48,7 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { return this.syncOnSites('courses', (siteId) => this.syncAllCoursesFunc(!!force, siteId), siteId); @@ -59,7 +59,7 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { await Promise.all([ @@ -73,7 +73,7 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { const completions = await CoreCourseOffline.getAllManualCompletions(siteId); @@ -109,7 +109,7 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { // Usually we call isSyncNeeded to check if a certain time has passed. @@ -123,7 +123,7 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -145,7 +145,7 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { const result: CoreCourseSyncResult = { diff --git a/src/core/features/courses/components/course-options-menu/course-options-menu.ts b/src/core/features/courses/components/course-options-menu/course-options-menu.ts index cc92a3675..b8bece69c 100644 --- a/src/core/features/courses/components/course-options-menu/course-options-menu.ts +++ b/src/core/features/courses/components/course-options-menu/course-options-menu.ts @@ -33,7 +33,7 @@ export class CoreCoursesCourseOptionsMenuComponent implements OnInit { downloadCourseEnabled = false; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.downloadCourseEnabled = !CoreCourses.isDownloadCourseDisabledInSite(); diff --git a/src/core/features/courses/components/self-enrol-password/self-enrol-password.ts b/src/core/features/courses/components/self-enrol-password/self-enrol-password.ts index 7bcd101e4..12d9db4a6 100644 --- a/src/core/features/courses/components/self-enrol-password/self-enrol-password.ts +++ b/src/core/features/courses/components/self-enrol-password/self-enrol-password.ts @@ -49,7 +49,6 @@ export class CoreCoursesSelfEnrolPasswordComponent { * Submit password. * * @param e Event. - * @param password Password to submit. */ submitPassword(e: Event): void { e.preventDefault(); diff --git a/src/core/features/courses/pages/categories/categories.ts b/src/core/features/courses/pages/categories/categories.ts index 3cce72f0a..903c19012 100644 --- a/src/core/features/courses/pages/categories/categories.ts +++ b/src/core/features/courses/pages/categories/categories.ts @@ -101,7 +101,7 @@ export class CoreCoursesCategoriesPage implements OnInit, OnDestroy { /** * Fetch the categories. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCategories(): Promise { try { diff --git a/src/core/features/courses/pages/dashboard/dashboard.ts b/src/core/features/courses/pages/dashboard/dashboard.ts index 6dff6bbf8..8bca938e0 100644 --- a/src/core/features/courses/pages/dashboard/dashboard.ts +++ b/src/core/features/courses/pages/dashboard/dashboard.ts @@ -71,7 +71,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy { /** * Convenience function to fetch the dashboard data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadContent(): Promise { const available = await CoreCoursesDashboard.isAvailable(); @@ -154,7 +154,7 @@ export class CoreCoursesDashboardPage implements OnInit, OnDestroy { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.updateSiteObserver.off(); diff --git a/src/core/features/courses/pages/list/list.ts b/src/core/features/courses/pages/list/list.ts index 04d855ffb..3ba71b126 100644 --- a/src/core/features/courses/pages/list/list.ts +++ b/src/core/features/courses/pages/list/list.ts @@ -129,7 +129,7 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { /** * Load the course list. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchCourses(): Promise { try { @@ -149,7 +149,7 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { * Fetch the courses. * * @param clearTheList If list needs to be reloaded. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCourses(clearTheList = false): Promise { this.loadMoreError = false; @@ -262,7 +262,7 @@ export class CoreCoursesListPage implements OnInit, OnDestroy { /** * Search courses or load the next page of current search. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async searchCourses(): Promise { this.loadMoreError = false; diff --git a/src/core/features/courses/services/courses-helper.ts b/src/core/features/courses/services/courses-helper.ts index b2cfe3ca8..6b1a75add 100644 --- a/src/core/features/courses/services/courses-helper.ts +++ b/src/core/features/courses/services/courses-helper.ts @@ -43,7 +43,7 @@ export class CoreCoursesHelperProvider { * Get the courses to display the course picker popover. If a courseId is specified, it will also return its categoryId. * * @param courseId Course ID to get the category. - * @return Promise resolved with the list of courses and the category. + * @returns Promise resolved with the list of courses and the category. */ async getCoursesForPopover(courseId?: number): Promise<{courses: Partial[]; categoryId?: number}> { const courses: Partial[] = await CoreCourses.getUserCourses(false); @@ -97,7 +97,7 @@ export class CoreCoursesHelperProvider { * Loads the color of courses or the thumb image. * * @param courses List of courses. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadCoursesColorAndImage(courses: CoreCourseSearchedData[]): Promise { if (!courses.length) { @@ -113,7 +113,7 @@ export class CoreCoursesHelperProvider { * * @param courses List of courses. * @param loadCategoryNames Whether load category names or not. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ loadCoursesExtraInfo( courses: CoreEnrolledCourseDataWithExtraInfo[], @@ -128,7 +128,7 @@ export class CoreCoursesHelperProvider { * * @param courses List of courses. * @param loadCategoryNames Whether load category names or not. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ loadCoursesExtraInfoObservable( courses: CoreEnrolledCourseDataWithExtraInfo[], @@ -161,7 +161,7 @@ export class CoreCoursesHelperProvider { /** * Load course colors from site config. * - * @return course colors RGB. + * @returns course colors RGB. */ protected async loadCourseSiteColors(): Promise<(string | undefined)[]> { const site = CoreSites.getRequiredCurrentSite(); @@ -219,7 +219,7 @@ export class CoreCoursesHelperProvider { * @param filter Filter using some field. * @param loadCategoryNames Whether load category names or not. * @param options Options. - * @return Courses filled with options. + * @returns Courses filled with options. */ getUserCoursesWithOptions( sort: string = 'fullname', @@ -241,7 +241,7 @@ export class CoreCoursesHelperProvider { * Get user courses with admin and nav options. * * @param options Options. - * @return Courses filled with options. + * @returns Courses filled with options. */ getUserCoursesWithOptionsObservable( options: CoreCoursesGetWithOptionsOptions = {}, @@ -279,7 +279,7 @@ export class CoreCoursesHelperProvider { * * @param courses Courses. * @param options Options - * @return Courses filtered and sorted. + * @returns Courses filtered and sorted. */ protected filterAndSortCoursesWithOptions( courses: CoreEnrolledCourseData[], @@ -333,7 +333,7 @@ export class CoreCoursesHelperProvider { * Given a course object, fetch and set its completed status if not present already. * * @param course Course. - * @return Observable. + * @returns Observable. */ protected loadCourseCompletedStatus( course: CoreEnrolledCourseDataWithExtraInfo, @@ -369,7 +369,7 @@ export class CoreCoursesHelperProvider { * * @param course Course Object. * @param gradePeriodAfter Classify past courses as in progress for these many days after the course end date. - * @return Wether the course is past. + * @returns Wether the course is past. */ isPastCourse(course: CoreEnrolledCourseDataWithOptions, gradePeriodAfter = 0): boolean { if (course.completed) { @@ -392,7 +392,7 @@ export class CoreCoursesHelperProvider { * @param course Course Object. * @param gradePeriodAfter Classify past courses as in progress for these many days after the course end date. * @param gradePeriodBefore Classify future courses as in progress for these many days prior to the course start date. - * @return Wether the course is future. + * @returns Wether the course is future. */ isFutureCourse( course: CoreEnrolledCourseDataWithOptions, diff --git a/src/core/features/courses/services/courses.ts b/src/core/features/courses/services/courses.ts index 753605724..4979562c9 100644 --- a/src/core/features/courses/services/courses.ts +++ b/src/core/features/courses/services/courses.ts @@ -71,7 +71,7 @@ export class CoreCoursesProvider { /** * Whether current site supports getting course options. * - * @return Whether current site supports getting course options. + * @returns Whether current site supports getting course options. * @deprecated since app 4.0 */ canGetAdminAndNavOptions(): boolean { @@ -84,7 +84,7 @@ export class CoreCoursesProvider { * @param categoryId Category ID to get. * @param addSubcategories If it should add subcategories to the list. * @param siteId Site to get the courses from. If not defined, use current site. - * @return Promise resolved with the categories. + * @returns Promise resolved with the categories. */ async getCategories( categoryId: number, @@ -118,7 +118,7 @@ export class CoreCoursesProvider { * * @param categoryId Category ID to get. * @param addSubcategories If add subcategories to the list. - * @return Cache key. + * @returns Cache key. */ protected getCategoriesCacheKey(categoryId: number, addSubcategories?: boolean): string { return ROOT_CACHE_KEY + 'categories:' + categoryId + ':' + !!addSubcategories; @@ -129,7 +129,7 @@ export class CoreCoursesProvider { * * @param courseIds Course IDs. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with the list of course IDs. + * @returns Promise resolved with the list of course IDs. */ protected async getCourseIdsForAdminAndNavOptions(courseIds: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -154,9 +154,9 @@ export class CoreCoursesProvider { * Given a course ID, if user is enrolled in the course it will return the IDs of all enrolled courses and site home. * Return only the course ID otherwise. * - * @param courseIds Course IDs. + * @param courseId Course Id. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with the list of course IDs. + * @returns Promise resolved with the list of course IDs. */ async getCourseIdsIfEnrolled(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -197,7 +197,7 @@ export class CoreCoursesProvider { * Check if download a whole course is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isDownloadCourseDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -209,7 +209,7 @@ export class CoreCoursesProvider { * Check if download a whole course is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isDownloadCourseDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -221,7 +221,7 @@ export class CoreCoursesProvider { * Check if download all courses is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isDownloadCoursesDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -233,7 +233,7 @@ export class CoreCoursesProvider { * Check if download all courses is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isDownloadCoursesDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -245,7 +245,7 @@ export class CoreCoursesProvider { * Check if My Courses is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isMyCoursesDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -257,7 +257,7 @@ export class CoreCoursesProvider { * Check if My Courses is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isMyCoursesDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -269,7 +269,7 @@ export class CoreCoursesProvider { * Check if Search Courses is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isSearchCoursesDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -281,7 +281,7 @@ export class CoreCoursesProvider { * Check if Search Courses is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isSearchCoursesDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -294,7 +294,7 @@ export class CoreCoursesProvider { * * @param id ID of the course to get. * @param siteId Site to get the courses from. If not defined, use current site. - * @return Promise resolved with the course. + * @returns Promise resolved with the course. */ async getCourse(id: number, siteId?: string): Promise { const courses = await this.getCourses([id], siteId); @@ -311,7 +311,7 @@ export class CoreCoursesProvider { * * @param id ID of the course. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the methods. + * @returns Promise resolved with the methods. */ async getCourseEnrolmentMethods(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -331,7 +331,7 @@ export class CoreCoursesProvider { * Get cache key for get course enrolment methods WS call. * * @param id Course ID. - * @return Cache key. + * @returns Cache key. */ protected getCourseEnrolmentMethodsCacheKey(id: number): string { return ROOT_CACHE_KEY + 'enrolmentmethods:' + id; @@ -342,7 +342,7 @@ export class CoreCoursesProvider { * * @param instanceId Guest instance ID. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when the info is retrieved. + * @returns Promise resolved when the info is retrieved. */ async getCourseGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -362,7 +362,7 @@ export class CoreCoursesProvider { * Get cache key for get course guest enrolment methods WS call. * * @param instanceId Guest instance ID. - * @return Cache key. + * @returns Cache key. */ protected getCourseGuestEnrolmentInfoCacheKey(instanceId: number): string { return ROOT_CACHE_KEY + 'guestinfo:' + instanceId; @@ -375,7 +375,7 @@ export class CoreCoursesProvider { * * @param ids List of IDs of the courses to get. * @param siteId Site to get the courses from. If not defined, use current site. - * @return Promise resolved with the courses. + * @returns Promise resolved with the courses. */ async getCourses(ids: number[], siteId?: string): Promise { if (!Array.isArray(ids)) { @@ -405,7 +405,7 @@ export class CoreCoursesProvider { * Get cache key for get courses WS call. * * @param ids Courses IDs. - * @return Cache key. + * @returns Cache key. */ protected getCoursesCacheKey(ids: number[]): string { return ROOT_CACHE_KEY + 'course:' + JSON.stringify(ids); @@ -419,7 +419,7 @@ export class CoreCoursesProvider { * @param field The field to search. * @param value The value to match. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the field and value to use. + * @returns Promise resolved with the field and value to use. */ protected async fixCoursesByFieldParams( field: string = '', @@ -460,7 +460,7 @@ export class CoreCoursesProvider { * category: category id the course belongs to. * @param value The value to match. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the first course. + * @returns Promise resolved with the first course. */ async getCourseByField(field?: string, value?: string | number, siteId?: string): Promise { const courses = await this.getCoursesByField(field, value, siteId); @@ -483,7 +483,7 @@ export class CoreCoursesProvider { * category: category id the course belongs to. * @param value The value to match. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the courses. + * @returns Promise resolved with the courses. */ getCoursesByField( field: string = '', @@ -504,7 +504,7 @@ export class CoreCoursesProvider { * category: category id the course belongs to. * @param value The value to match. * @param options Other options. - * @return Observable that returns the courses. + * @returns Observable that returns the courses. */ getCoursesByFieldObservable( field: string = '', @@ -578,7 +578,7 @@ export class CoreCoursesProvider { * * @param field The field to search. * @param value The value to match. - * @return Cache key. + * @returns Cache key. */ protected getCoursesByFieldCacheKey(field: string = '', value: string | number = ''): string { return ROOT_CACHE_KEY + 'coursesbyfield:' + field + ':' + value; @@ -590,7 +590,7 @@ export class CoreCoursesProvider { * @param customFieldName Custom field name. * @param customFieldValue Custom field value. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of courses. + * @returns Promise resolved with the list of courses. * @since 3.8 */ getEnrolledCoursesByCustomField( @@ -610,7 +610,7 @@ export class CoreCoursesProvider { * @param customFieldName Custom field name. * @param customFieldValue Custom field value. * @param options Common options. - * @return Promise resolved with the list of courses. + * @returns Promise resolved with the list of courses. * @since 3.8 */ getEnrolledCoursesByCustomFieldObservable( @@ -641,7 +641,7 @@ export class CoreCoursesProvider { /** * Check if get courses by field WS is available in a certain site. * - * @return Whether get courses by field is available. + * @returns Whether get courses by field is available. * @deprecated since app 4.0 */ isGetCoursesByFieldAvailable(): boolean { @@ -651,7 +651,7 @@ export class CoreCoursesProvider { /** * Check if get courses by field WS is available in a certain site, by site ID. * - * @return Promise resolved with boolean: whether get courses by field is available. + * @returns Promise resolved with boolean: whether get courses by field is available. * @deprecated since app 4.0 */ async isGetCoursesByFieldAvailableInSite(): Promise { @@ -663,7 +663,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the options for each course. + * @returns Promise resolved with the options for each course. */ getCoursesAdminAndNavOptions( courseIds: number[], @@ -680,7 +680,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param options Options. - * @return Observable that returns the options for each course. + * @returns Observable that returns the options for each course. */ getCoursesAdminAndNavOptionsObservable( courseIds: number[], @@ -710,7 +710,7 @@ export class CoreCoursesProvider { * Get cache key for get recent courses WS call. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getRecentCoursesCacheKey(userId: number): string { return `${ROOT_CACHE_KEY}:recentcourses:${userId}`; @@ -720,7 +720,7 @@ export class CoreCoursesProvider { * Get recent courses. * * @param options Options. - * @return Promise resolved with courses. + * @returns Promise resolved with courses. * @since 3.6 */ async getRecentCourses(options: CoreCourseGetRecentCoursesOptions = {}): Promise { @@ -743,7 +743,7 @@ export class CoreCoursesProvider { /** * Get the common part of the cache keys for user administration options WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getUserAdministrationOptionsCommonCacheKey(): string { return ROOT_CACHE_KEY + 'administrationOptions:'; @@ -753,7 +753,7 @@ export class CoreCoursesProvider { * Get cache key for get user administration options WS call. * * @param courseIds IDs of courses to get. - * @return Cache key. + * @returns Cache key. */ protected getUserAdministrationOptionsCacheKey(courseIds: number[]): string { return this.getUserAdministrationOptionsCommonCacheKey() + courseIds.join(','); @@ -764,7 +764,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with administration options for each course. + * @returns Promise resolved with administration options for each course. */ getUserAdministrationOptions(courseIds: number[], siteId?: string): Promise { return firstValueFrom(this.getUserAdministrationOptionsObservable(courseIds, { siteId })); @@ -775,7 +775,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param options Options. - * @return Observable that returns administration options for each course. + * @returns Observable that returns administration options for each course. */ getUserAdministrationOptionsObservable( courseIds: number[], @@ -811,7 +811,7 @@ export class CoreCoursesProvider { /** * Get the common part of the cache keys for user navigation options WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getUserNavigationOptionsCommonCacheKey(): string { return ROOT_CACHE_KEY + 'navigationOptions:'; @@ -820,7 +820,7 @@ export class CoreCoursesProvider { /** * Get cache key for get user navigation options WS call. * - * @return Cache key. + * @returns Cache key. */ protected getUserNavigationOptionsCacheKey(courseIds: number[]): string { return this.getUserNavigationOptionsCommonCacheKey() + courseIds.join(','); @@ -831,7 +831,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with navigation options for each course. + * @returns Promise resolved with navigation options for each course. */ async getUserNavigationOptions(courseIds: number[], siteId?: string): Promise { return firstValueFrom(this.getUserNavigationOptionsObservable(courseIds, { siteId })); @@ -842,7 +842,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param options Options. - * @return Observable that returns navigation options for each course. + * @returns Observable that returns navigation options for each course. */ getUserNavigationOptionsObservable( courseIds: number[], @@ -879,7 +879,7 @@ export class CoreCoursesProvider { * Format user navigation or administration options. * * @param courses Navigation or administration options for each course. - * @return Formatted options. + * @returns Formatted options. */ protected formatUserAdminOrNavOptions(courses: CoreCourseUserAdminOrNavOption[]): CoreCourseUserAdminOrNavOptionCourseIndexed { const result = {}; @@ -906,7 +906,7 @@ export class CoreCoursesProvider { * @param id ID of the course to get. * @param preferCache True if shouldn't call WS if data is cached, false otherwise. * @param siteId Site to get the courses from. If not defined, use current site. - * @return Promise resolved with the course. + * @returns Promise resolved with the course. */ async getUserCourse(id: number, preferCache?: boolean, siteId?: string): Promise { if (!id) { @@ -930,7 +930,7 @@ export class CoreCoursesProvider { * @param preferCache True if shouldn't call WS if data is cached, false otherwise. * @param siteId Site to get the courses from. If not defined, use current site. * @param strategy Reading strategy. - * @return Promise resolved with the courses. + * @returns Promise resolved with the courses. */ getUserCourses( preferCache: boolean = false, @@ -949,7 +949,7 @@ export class CoreCoursesProvider { * Get user courses. * * @param options Options. - * @return Observable that returns the courses. + * @returns Observable that returns the courses. */ getUserCoursesObservable(options: CoreSitesCommonWSOptions = {}): WSObservable { return asyncObservable(async () => { @@ -1040,7 +1040,7 @@ export class CoreCoursesProvider { /** * Get cache key for get user courses WS call. * - * @return Cache key. + * @returns Cache key. */ protected getUserCoursesCacheKey(): string { return ROOT_CACHE_KEY + 'usercourses'; @@ -1052,7 +1052,7 @@ export class CoreCoursesProvider { * @param categoryId Category ID to get. * @param addSubcategories If it should add subcategories to the list. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCategories(categoryId: number, addSubcategories?: boolean, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1065,7 +1065,7 @@ export class CoreCoursesProvider { * * @param id Course ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ invalidateCourse(id: number, siteId?: string): Promise { return this.invalidateCourses([id], siteId); @@ -1076,7 +1076,7 @@ export class CoreCoursesProvider { * * @param id Course ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourseEnrolmentMethods(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1089,7 +1089,7 @@ export class CoreCoursesProvider { * * @param instanceId Guest instance ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourseGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1102,7 +1102,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses to get. * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCoursesAdminAndNavOptions(courseIds: number[], siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -1121,7 +1121,7 @@ export class CoreCoursesProvider { * * @param ids Courses IDs. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourses(ids: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1135,7 +1135,7 @@ export class CoreCoursesProvider { * @param field See getCoursesByField for info. * @param value The value to match. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCoursesByField(field: string = '', value: number | string = '', siteId?: string): Promise { if (typeof value === 'string' && value.length === 0) { @@ -1158,7 +1158,7 @@ export class CoreCoursesProvider { * * @param userId User ID. If not defined, current user. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateRecentCourses(userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1170,7 +1170,7 @@ export class CoreCoursesProvider { * Invalidates all user administration options. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserAdministrationOptions(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1183,7 +1183,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses. * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserAdministrationOptionsForCourses(courseIds: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1195,7 +1195,7 @@ export class CoreCoursesProvider { * Invalidates get user courses WS call. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserCourses(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1207,7 +1207,7 @@ export class CoreCoursesProvider { * Invalidates all user navigation options. * * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserNavigationOptions(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1220,7 +1220,7 @@ export class CoreCoursesProvider { * * @param courseIds IDs of courses. * @param siteId Site ID to invalidate. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserNavigationOptionsForCourses(courseIds: number[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1231,7 +1231,7 @@ export class CoreCoursesProvider { /** * Check if WS to retrieve guest enrolment data is available. * - * @return Whether guest WS is available. + * @returns Whether guest WS is available. * @deprecated since app 3.9.5 */ isGuestWSAvailable(): boolean { @@ -1246,7 +1246,7 @@ export class CoreCoursesProvider { * @param perPage Number of courses per page. Defaults to CoreCoursesProvider.SEARCH_PER_PAGE. * @param limitToEnrolled Limit to enrolled courses. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the courses and the total of matches. + * @returns Promise resolved with the courses and the total of matches. */ async search( text: string, @@ -1279,7 +1279,7 @@ export class CoreCoursesProvider { * @param password Password to use. * @param instanceId Enrol instance ID. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved if the user is enrolled. If the password is invalid, the promise is rejected + * @returns Promise resolved if the user is enrolled. If the password is invalid, the promise is rejected * with an object with errorcode = CoreCoursesProvider.ENROL_INVALID_KEY. */ async selfEnrol(courseId: number, password: string = '', instanceId?: number, siteId?: string): Promise { @@ -1325,7 +1325,7 @@ export class CoreCoursesProvider { * @param courseId Course ID. * @param favourite If favourite or unfavourite. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setFavouriteCourse(courseId: number, favourite: boolean, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -1345,7 +1345,7 @@ export class CoreCoursesProvider { /** * Get download options enabled option. * - * @return True if enabled, false otherwise. + * @returns True if enabled, false otherwise. */ getCourseDownloadOptionsEnabled(): boolean { return this.downloadOptionsEnabled; diff --git a/src/core/features/courses/services/dashboard.ts b/src/core/features/courses/services/dashboard.ts index fb6aea9ca..194d32dc8 100644 --- a/src/core/features/courses/services/dashboard.ts +++ b/src/core/features/courses/services/dashboard.ts @@ -38,7 +38,7 @@ export class CoreCoursesDashboardProvider { * * @param myPage What my page to return blocks of. Default MY_PAGE_DEFAULT. * @param userId User ID. Default, 0 means current user. - * @return Cache key. + * @returns Cache key. */ protected getDashboardBlocksCacheKey(myPage = CoreCoursesDashboardProvider.MY_PAGE_DEFAULT, userId: number = 0): string { return ROOT_CACHE_KEY + 'blocks:' + myPage + ':' + userId; @@ -50,7 +50,7 @@ export class CoreCoursesDashboardProvider { * @param myPage What my page to return blocks of. Default MY_PAGE_DEFAULT. * @param userId User ID. Default, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of blocks. + * @returns Promise resolved with the list of blocks. * @since 3.6 */ getDashboardBlocksFromWS( @@ -69,7 +69,7 @@ export class CoreCoursesDashboardProvider { * Get dashboard blocks from WS. * * @param options Options. - * @return Observable that returns the list of blocks. + * @returns Observable that returns the list of blocks. * @since 3.6 */ getDashboardBlocksFromWSObservable(options: GetDashboardBlocksOptions = {}): WSObservable { @@ -121,7 +121,7 @@ export class CoreCoursesDashboardProvider { * @param userId User ID. Default, current user. * @param siteId Site ID. If not defined, current site. * @param myPage What my page to return blocks of. Default MY_PAGE_DEFAULT. - * @return Promise resolved with the list of blocks. + * @returns Promise resolved with the list of blocks. */ getDashboardBlocks( userId?: number, @@ -139,7 +139,7 @@ export class CoreCoursesDashboardProvider { * Get dashboard blocks. * * @param options Options. - * @return observable that returns the list of blocks. + * @returns observable that returns the list of blocks. */ getDashboardBlocksObservable(options: GetDashboardBlocksOptions = {}): WSObservable { return this.getDashboardBlocksFromWSObservable(options).pipe(map(blocks => { @@ -177,7 +177,7 @@ export class CoreCoursesDashboardProvider { * @param myPage What my page to return blocks of. Default MY_PAGE_DEFAULT. * @param userId User ID. Default, current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateDashboardBlocks( myPage = CoreCoursesDashboardProvider.MY_PAGE_DEFAULT, @@ -193,7 +193,7 @@ export class CoreCoursesDashboardProvider { * Returns whether or not block based Dashboard is available for a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if available, resolved with false or rejected otherwise. + * @returns Promise resolved with true if available, resolved with false or rejected otherwise. * @since 3.6 */ async isAvailable(siteId?: string): Promise { @@ -206,7 +206,7 @@ export class CoreCoursesDashboardProvider { * Check if Site Home is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -218,7 +218,7 @@ export class CoreCoursesDashboardProvider { * Check if Dashboard is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); diff --git a/src/core/features/courses/services/handlers/course-link.ts b/src/core/features/courses/services/handlers/course-link.ts index 748d33cdf..0a5af6e2a 100644 --- a/src/core/features/courses/services/handlers/course-link.ts +++ b/src/core/features/courses/services/handlers/course-link.ts @@ -116,7 +116,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler * @param courseId Course ID. * @param url Treated URL. * @param pageParams Params to send to the new page. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async actionOpen(courseId: number, url: string, pageParams: Params): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -152,7 +152,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler * @param courseId Course ID. * @param url Treated URL. * @param modal Modal, to dismiss when needed. - * @return The course after self enrolling or undefined if the user has access but is not enrolled. + * @returns The course after self enrolling or undefined if the user has access but is not enrolled. */ protected async checkSelfUserCanSelfEnrolOrAccess( courseId: number, @@ -221,7 +221,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler * Check if user can access the course. * * @param courseId Course ID. - * @return Promise resolved with boolean: whether user can access the course. + * @returns Promise resolved with boolean: whether user can access the course. */ protected canAccess(courseId: number): Promise { return CoreUtils.promiseWorks(CoreCourse.getSections(courseId, false, true)); @@ -231,7 +231,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler * Check if a user can be "automatically" self enrolled in a course. * * @param courseId Course ID. - * @return Promise resolved with boolean: whether the user can be enrolled in a course. + * @returns Promise resolved with boolean: whether the user can be enrolled in a course. */ protected async canSelfEnrol(courseId: number): Promise { try { @@ -258,7 +258,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler * * @param courseId Course ID. * @param password Password. - * @return Promise resolved when the user is enrolled, rejected otherwise. + * @returns Promise resolved when the user is enrolled, rejected otherwise. */ protected async selfEnrol(courseId: number, password?: string): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -300,7 +300,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler * * @param courseId The course ID. * @param first If it's the first call (true) or it's a recursive call (false). - * @return Promise resolved when enrolled or timeout. + * @returns Promise resolved when enrolled or timeout. */ protected async waitForEnrolled(courseId: number, first?: boolean): Promise { if (first) { diff --git a/src/core/features/courses/services/handlers/dashboard-home.ts b/src/core/features/courses/services/handlers/dashboard-home.ts index 7eff9f0c8..e97133551 100644 --- a/src/core/features/courses/services/handlers/dashboard-home.ts +++ b/src/core/features/courses/services/handlers/dashboard-home.ts @@ -40,7 +40,7 @@ export class CoreDashboardHomeHandlerService implements CoreMainMenuHomeHandler /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.isEnabledForSite(); @@ -50,7 +50,7 @@ export class CoreDashboardHomeHandlerService implements CoreMainMenuHomeHandler * Check if the handler is enabled on a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabledForSite(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -85,7 +85,7 @@ export class CoreDashboardHomeHandlerService implements CoreMainMenuHomeHandler /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreMainMenuHomeHandlerToDisplay { return { diff --git a/src/core/features/courses/services/handlers/dashboard-link.ts b/src/core/features/courses/services/handlers/dashboard-link.ts index 05ad995a0..b6f6cdee5 100644 --- a/src/core/features/courses/services/handlers/dashboard-link.ts +++ b/src/core/features/courses/services/handlers/dashboard-link.ts @@ -32,7 +32,7 @@ export class CoreCoursesDashboardLinkHandlerService extends CoreContentLinksHand /** * Get the list of actions for a link (url). * - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions(): CoreContentLinksAction[] | Promise { return [{ @@ -53,7 +53,7 @@ export class CoreCoursesDashboardLinkHandlerService extends CoreContentLinksHand * Check if the handler is enabled for a certain site (site + user) and a URL. * * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string): Promise { return CoreDashboardHomeHandler.isEnabledForSite(siteId); diff --git a/src/core/features/courses/services/handlers/enrol-push-click.ts b/src/core/features/courses/services/handlers/enrol-push-click.ts index 63408f432..45ee724b3 100644 --- a/src/core/features/courses/services/handlers/enrol-push-click.ts +++ b/src/core/features/courses/services/handlers/enrol-push-click.ts @@ -35,7 +35,7 @@ export class CoreCoursesEnrolPushClickHandlerService implements CorePushNotifica * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: CorePushNotificationsNotificationBasicData): Promise { return CoreUtils.isTrueOrOne(notification.notif) && notification.moodlecomponent?.indexOf('enrol_') === 0 && @@ -46,7 +46,7 @@ export class CoreCoursesEnrolPushClickHandlerService implements CorePushNotifica * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: CoreCoursesEnrolNotificationData): Promise { const courseId = notification.courseid; @@ -63,7 +63,7 @@ export class CoreCoursesEnrolPushClickHandlerService implements CorePushNotifica if (notification.contexturl?.indexOf('user/index.php') != -1) { // Open the participants tab. - params.selectedTab = 'participants'; // @todo: Set this when participants is done. + params.selectedTab = 'participants'; // @todo Set this when participants is done. } else if (!result.enrolled) { // User not enrolled anymore, open the preview page. page += '/summary'; diff --git a/src/core/features/courses/services/handlers/request-push-click.ts b/src/core/features/courses/services/handlers/request-push-click.ts index c9425ee49..9bd1cd64c 100644 --- a/src/core/features/courses/services/handlers/request-push-click.ts +++ b/src/core/features/courses/services/handlers/request-push-click.ts @@ -38,7 +38,7 @@ export class CoreCoursesRequestPushClickHandlerService implements CorePushNotifi * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler + * @returns Whether the notification click is handled by this handler */ async handles(notification: CorePushNotificationsNotificationBasicData): Promise { // Don't support 'courserequestrejected', that way the app will open the notifications page. @@ -50,7 +50,7 @@ export class CoreCoursesRequestPushClickHandlerService implements CorePushNotifi * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleClick(notification: CoreCoursesRequestNotificationData): Promise { const courseId = notification.courseid; diff --git a/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts b/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts index 14224e13b..e2d28827e 100644 --- a/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts +++ b/src/core/features/editor/components/rich-text-editor/rich-text-editor.ts @@ -59,9 +59,9 @@ import { CorePlatform } from '@services/platform'; export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, OnDestroy { // Based on: https://github.com/judgewest2000/Ionic3RichText/ - // @todo: Anchor button, fullscreen... - // @todo: Textarea height is not being updated when editor is resized. Height is calculated if any css is changed. - // @todo: Implement ControlValueAccessor https://angular.io/api/forms/ControlValueAccessor. + // @todo Anchor button, fullscreen... + // @todo Textarea height is not being updated when editor is resized. Height is calculated if any css is changed. + // @todo Implement ControlValueAccessor https://angular.io/api/forms/ControlValueAccessor. @Input() placeholder = ''; // Placeholder to set in textarea. @Input() control?: FormControl; // Form control. @@ -292,7 +292,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, /** * Wait until all children inside the page. * - * @return Promise resolved when loadings are done. + * @returns Promise resolved when loadings are done. */ protected async waitLoadingsDone(): Promise { this.domPromise = CoreDom.waitToBeInDOM(this.element); @@ -310,7 +310,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, /** * Get the height of the space in blank at the end of the page. * - * @return Blank height in px. Will be negative if no blank space. + * @returns Blank height in px. Will be negative if no blank space. */ protected async getBlankHeightInContent(): Promise { await CoreUtils.nextTicks(5); // Ensure content is completely loaded in the DOM. @@ -401,7 +401,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, * Returns the number of chars from the beggining where is placed the cursor. * * @param parent Parent where to get the position from. - * @return Position in chars. + * @returns Position in chars. */ protected getCurrentCursorPosition(parent: Node): number { const selection = window.getSelection(); @@ -446,7 +446,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, * @param node Node where to start. * @param range Previous calculated range. * @param chars Object with counting of characters (input-output param). - * @return Selection range. + * @returns Selection range. */ const setRange = (node: Node, range: Range, chars: { count: number }): Range => { if (chars.count === 0) { @@ -463,7 +463,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, } } else if ((node.textContent || '').length < chars.count) { // Jump this node. - // @todo: empty nodes will be omitted. + // @todo empty nodes will be omitted. chars.count -= (node.textContent || '').length; } else { // The cursor will be placed in this element. @@ -591,6 +591,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, * Check if text is empty. * * @param value text + * @returns If value is null only a white space. */ protected isNullOrWhiteSpace(value: string | null): boolean { if (value == null || value === undefined) { @@ -918,7 +919,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, /** * Check if should auto save drafts. * - * @return {boolean} Whether it should auto save drafts. + * @returns {boolean} Whether it should auto save drafts. */ protected shouldAutoSaveDrafts(): boolean { return !!CoreSites.getCurrentSite() && @@ -931,7 +932,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, /** * Restore a draft if there is any. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async restoreDraft(): Promise { try { @@ -1057,7 +1058,7 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit, * Scan a QR code and put its text in the editor. * * @param event Event data - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async scanQR(event: Event): Promise { this.stopBubble(event); diff --git a/src/core/features/editor/services/editor-offline.ts b/src/core/features/editor/services/editor-offline.ts index 0025f84e4..a38f507c8 100644 --- a/src/core/features/editor/services/editor-offline.ts +++ b/src/core/features/editor/services/editor-offline.ts @@ -41,7 +41,7 @@ export class CoreEditorOfflineProvider { * @param elementId Element ID. * @param extraParams Object with extra params to identify the draft. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteDraft( contextLevel: string, @@ -68,7 +68,7 @@ export class CoreEditorOfflineProvider { * @param contextInstanceId The instance ID related to the context. * @param elementId Element ID. * @param extraParams Object with extra params to identify the draft. - * @return Object with the fixed primary data. + * @returns Object with the fixed primary data. */ protected fixDraftPrimaryData( contextLevel: string, @@ -93,7 +93,7 @@ export class CoreEditorOfflineProvider { * @param elementId Element ID. * @param extraParams Object with extra params to identify the draft. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the draft data. Undefined if no draft stored. + * @returns Promise resolved with the draft data. Undefined if no draft stored. */ async getDraft( contextLevel: string, @@ -120,7 +120,7 @@ export class CoreEditorOfflineProvider { * @param pageInstance Unique identifier to prevent storing data from several sources at the same time. * @param originalContent Original content of the editor. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the draft data. Undefined if no draft stored. + * @returns Promise resolved with the draft data. Undefined if no draft stored. */ async resumeDraft( contextLevel: string, @@ -180,7 +180,7 @@ export class CoreEditorOfflineProvider { * @param draftText The text to store. * @param originalContent Original content of the editor. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveDraft( contextLevel: string, diff --git a/src/core/features/emulator/classes/sqlitedb.ts b/src/core/features/emulator/classes/sqlitedb.ts index a761c6bd2..9111fd84b 100644 --- a/src/core/features/emulator/classes/sqlitedb.ts +++ b/src/core/features/emulator/classes/sqlitedb.ts @@ -33,7 +33,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Close the database. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any close(): Promise { @@ -44,7 +44,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Drop all the data in the database. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any async emptyDatabase(): Promise { @@ -89,7 +89,7 @@ export class SQLiteDBMock extends SQLiteDB { * * @param sql SQL query to execute. * @param params Query parameters. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any async execute(sql: string, params?: any[]): Promise { @@ -114,7 +114,7 @@ export class SQLiteDBMock extends SQLiteDB { * these query will be run in SQLite (Mobile) and Web SQL (desktop), so your query should work in both environments. * * @param sqlStatements SQL statements to execute. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any async executeBatch(sqlStatements: any[]): Promise { @@ -152,7 +152,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Open the database. Only needed if it was closed before, a database is automatically opened when created. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ open(): Promise { // WebSQL databases can't closed, so the open method isn't needed. diff --git a/src/core/features/emulator/components/capture-media/capture-media.ts b/src/core/features/emulator/components/capture-media/capture-media.ts index 4095878c3..520d28099 100644 --- a/src/core/features/emulator/components/capture-media/capture-media.ts +++ b/src/core/features/emulator/components/capture-media/capture-media.ts @@ -80,7 +80,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy { ) {} /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.initVariables(); @@ -127,7 +127,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy { /** * Init recording with Cordova media plugin. * - * @return Promise resolved when ready. + * @returns Promise resolved when ready. */ protected async initCordovaMediaPlugin(): Promise { @@ -179,7 +179,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy { * Init HTML recorder for browser * . * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initHtmlCapture(): Promise { const constraints = { @@ -457,7 +457,6 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy { /** * Close the modal, returning an error. * - * @param code Error code. Will not be used if it's a Camera capture. * @param message Error message. * @param cameraMessage A specific message to use if it's a Camera capture. If not set, message will be used. */ @@ -552,7 +551,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy { /** * Get path to the file where the media will be stored. * - * @return Path. + * @returns Path. */ protected getFilePath(): string { const fileName = this.type + '_' + CoreTimeUtils.readableTimestamp() + '.' + this.extension; diff --git a/src/core/features/emulator/services/camera.ts b/src/core/features/emulator/services/camera.ts index 319e09eba..a7314a5a8 100644 --- a/src/core/features/emulator/services/camera.ts +++ b/src/core/features/emulator/services/camera.ts @@ -30,7 +30,7 @@ export class CameraMock extends Camera { /** * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any cleanup(): Promise { @@ -42,7 +42,7 @@ export class CameraMock extends Camera { * Take a picture. * * @param options Options that you want to pass to the camera. - * @return Promise resolved when captured. + * @returns Promise resolved when captured. */ getPicture(options: CameraOptions): Promise { return CoreEmulatorCaptureHelper.captureMedia('image', options); diff --git a/src/core/features/emulator/services/capture-helper.ts b/src/core/features/emulator/services/capture-helper.ts index a65ebca93..17432f912 100644 --- a/src/core/features/emulator/services/capture-helper.ts +++ b/src/core/features/emulator/services/capture-helper.ts @@ -45,7 +45,7 @@ export class CoreEmulatorCaptureHelperProvider { * * @param type Type of media: image, audio, video. * @param options Optional options. - * @return Promise resolved when captured, rejected if error. + * @returns Promise resolved when captured, rejected if error. */ captureMedia(type: 'image', options?: MockCameraOptions): Promise; captureMedia(type: 'captureimage', options?: MockCaptureImageOptions): Promise; @@ -123,7 +123,7 @@ export class CoreEmulatorCaptureHelperProvider { * * @param type Type of media: image, audio, video. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return An object with mimetype and extension to use. + * @returns An object with mimetype and extension to use. */ protected getMimeTypeAndExtension(type: string, mimetypes?: string[]): { extension?: string; mimetype?: string } { const result: { extension?: string; mimetype?: string } = {}; @@ -160,7 +160,7 @@ export class CoreEmulatorCaptureHelperProvider { /** * Init the getUserMedia function, using a deprecated function as fallback if the new one doesn't exist. * - * @return Whether the function is supported. + * @returns Whether the function is supported. */ protected initGetUserMedia(): boolean { return !!navigator.mediaDevices.getUserMedia; @@ -189,7 +189,7 @@ export class CoreEmulatorCaptureHelperProvider { /** * Load the Mocks that need it. * - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ load(): Promise { if (window.MediaRecorder !== undefined && this.initGetUserMedia()) { diff --git a/src/core/features/emulator/services/clipboard.ts b/src/core/features/emulator/services/clipboard.ts index 2449a59d1..3a4615fc2 100644 --- a/src/core/features/emulator/services/clipboard.ts +++ b/src/core/features/emulator/services/clipboard.ts @@ -37,7 +37,7 @@ export class ClipboardMock extends Clipboard { * Copy some text to the clipboard. * * @param text The text to copy. - * @return Promise resolved when copied. + * @returns Promise resolved when copied. */ copy(text: string): Promise { return new Promise((resolve, reject): void => { @@ -62,7 +62,7 @@ export class ClipboardMock extends Clipboard { /* * Get the text stored in the clipboard. * - * @return Promise resolved with the text. + * @returns Promise resolved with the text. */ paste(): Promise { return new Promise((resolve, reject): void => { diff --git a/src/core/features/emulator/services/emulator-helper.ts b/src/core/features/emulator/services/emulator-helper.ts index dd9e9da64..42a8f5d94 100644 --- a/src/core/features/emulator/services/emulator-helper.ts +++ b/src/core/features/emulator/services/emulator-helper.ts @@ -35,7 +35,7 @@ export class CoreEmulatorHelperProvider { /** * Load the Mocks that need it. * - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ async load(): Promise { window.FileTransferError = FileTransferErrorMock; diff --git a/src/core/features/emulator/services/file-opener.ts b/src/core/features/emulator/services/file-opener.ts index 5c2c7c0b2..89835c2ab 100644 --- a/src/core/features/emulator/services/file-opener.ts +++ b/src/core/features/emulator/services/file-opener.ts @@ -28,7 +28,7 @@ export class FileOpenerMock extends FileOpener { * Check if an app is already installed. * * @param packageId Package ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ appIsInstalled(packageId: string): Promise { return Promise.reject('appIsInstalled not supported in browser.'); @@ -39,7 +39,7 @@ export class FileOpenerMock extends FileOpener { * * @param filePath File path. * @param fileMIMEType File MIME type. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async open(filePath: string, fileMIMEType: string): Promise { if (!filePath.match(/^filesystem:/)) { @@ -66,7 +66,7 @@ export class FileOpenerMock extends FileOpener { * Uninstalls a package. * * @param packageId Package ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ uninstall(packageId: string): Promise { return Promise.reject('uninstall not supported in browser.'); diff --git a/src/core/features/emulator/services/file-transfer.ts b/src/core/features/emulator/services/file-transfer.ts index 63f8baa8f..d3440304a 100644 --- a/src/core/features/emulator/services/file-transfer.ts +++ b/src/core/features/emulator/services/file-transfer.ts @@ -48,6 +48,8 @@ export class FileTransferMock extends FileTransfer { /** * Creates a new FileTransferObjectMock object. + * + * @returns a new file transfer mock. */ create(): FileTransferObjectMock { return new FileTransferObjectMock(); @@ -85,7 +87,7 @@ export class FileTransferObjectMock extends FileTransferObject { * @param target Filesystem url representing the file on the device. * @param trustAllHosts If set to true, it accepts all security certificates. * @param options Optional parameters, currently only supports headers. - * @return Returns a Promise that resolves to a FileEntry object. + * @returns Returns a Promise that resolves to a FileEntry object. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any }): Promise { @@ -166,7 +168,7 @@ export class FileTransferObjectMock extends FileTransferObject { * This code is extracted from Cordova FileTransfer plugin. * * @param urlString The URL to get the credentials from. - * @return The header with the credentials, null if no credentials. + * @returns The header with the credentials, null if no credentials. */ protected getBasicAuthHeader(urlString: string): {name: string; value: string} | null { let header: {name: string; value: string} | null = null; @@ -189,7 +191,7 @@ export class FileTransferObjectMock extends FileTransferObject { * Given an instance of XMLHttpRequest, get the response headers as an object. * * @param xhr XMLHttpRequest instance. - * @return Object with the headers. + * @returns Object with the headers. */ protected getHeadersAsObject(xhr: XMLHttpRequest): Record { const headersString = xhr.getAllResponseHeaders(); @@ -214,7 +216,7 @@ export class FileTransferObjectMock extends FileTransferObject { * This code is extracted from Cordova FileTransfer plugin. * * @param urlString The URL to get the credentials from. - * @return Retrieved credentials. + * @returns Retrieved credentials. */ protected getUrlCredentials(urlString: string): string | null { const credentialsPattern = /^https?:\/\/(?:(?:(([^:@/]*)(?::([^@/]*))?)?@)?([^:/?#]*)(?::(\d*))?).*$/; @@ -236,7 +238,7 @@ export class FileTransferObjectMock extends FileTransferObject { * Parse a response, converting it into text and the into an object if needed. * * @param response The response to parse. - * @return Promise resolved with the parsed response. + * @returns Promise resolved with the parsed response. */ protected async parseResponse(response: Blob | ArrayBuffer | string | null): Promise { if (!response) { @@ -264,7 +266,7 @@ export class FileTransferObjectMock extends FileTransferObject { * Convert a Blob to text. * * @param blob Blob to convert. - * @return Promise resolved with blob contents. + * @returns Promise resolved with blob contents. */ protected blobToText(blob: Blob): Promise { return new Promise((resolve) => { @@ -282,7 +284,7 @@ export class FileTransferObjectMock extends FileTransferObject { * @param fileUrl Filesystem URL representing the file on the device or a data URI. * @param url URL of the server to receive the file, as encoded by encodeURI(). * @param options Optional parameters. - * @return Promise that resolves to a FileUploadResult and rejects with FileTransferError. + * @returns Promise that resolves to a FileUploadResult and rejects with FileTransferError. */ upload(fileUrl: string, url: string, options?: FileUploadOptions): Promise { return new Promise((resolve, reject): void => { diff --git a/src/core/features/emulator/services/file.ts b/src/core/features/emulator/services/file.ts index a8f1cf58b..b98d70e9b 100644 --- a/src/core/features/emulator/services/file.ts +++ b/src/core/features/emulator/services/file.ts @@ -54,7 +54,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param dir Name of directory to check - * @return Returns a Promise that resolves to true if the directory exists or rejects with an error. + * @returns Returns a Promise that resolves to true if the directory exists or rejects with an error. */ async checkDir(path: string, dir: string): Promise { const fullPath = CorePath.concatenatePaths(path, dir); @@ -69,7 +69,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param file Name of file to check. - * @return Returns a Promise that resolves with a boolean or rejects with an error. + * @returns Returns a Promise that resolves with a boolean or rejects with an error. */ async checkFile(path: string, file: string): Promise { const entry = await this.resolveLocalFilesystemUrl(CorePath.concatenatePaths(path, file)); @@ -90,7 +90,7 @@ export class FileMock extends File { * @param srce The Entry to copy. * @param destDir The directory where to put the copy. * @param newName New name of the file/dir. - * @return Returns a Promise that resolves to the new Entry object or rejects with an error. + * @returns Returns a Promise that resolves to the new Entry object or rejects with an error. */ private copyMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise { return new Promise((resolve, reject): void => { @@ -112,7 +112,7 @@ export class FileMock extends File { * @param dirName Name of directory to copy. * @param newPath Base FileSystem of new location. * @param newDirName New name of directory to copy to (leave blank to remain the same). - * @return Returns a Promise that resolves to the new Entry object or rejects with an error. + * @returns Returns a Promise that resolves to the new Entry object or rejects with an error. */ copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { return this.copyFileOrDir(path, dirName, newPath, newDirName); @@ -125,7 +125,7 @@ export class FileMock extends File { * @param fileName Name of file to copy * @param newPath Base FileSystem of new location * @param newFileName New name of file to copy to (leave blank to remain the same) - * @return Returns a Promise that resolves to an Entry or rejects with an error. + * @returns Returns a Promise that resolves to an Entry or rejects with an error. */ copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { return this.copyFileOrDir(path, fileName, newPath, newFileName || fileName); @@ -138,7 +138,7 @@ export class FileMock extends File { * @param sourceName Name of file/dir to copy * @param destPath Path where to copy. * @param destName New name of file/dir. - * @return Returns a Promise that resolves to the new Entry or rejects with an error. + * @returns Returns a Promise that resolves to the new Entry or rejects with an error. */ async copyFileOrDir(sourcePath: string, sourceName: string, destPath: string, destName: string): Promise { const destFixed = this.fixPathAndName(destPath, destName); @@ -158,7 +158,7 @@ export class FileMock extends File { * @param path Base FileSystem. * @param dirName Name of directory to create * @param replace If true, replaces file with same name. If false returns error - * @return Returns a Promise that resolves with a DirectoryEntry or rejects with an error. + * @returns Returns a Promise that resolves with a DirectoryEntry or rejects with an error. */ async createDir(path: string, dirName: string, replace: boolean): Promise { const options: Flags = { @@ -182,7 +182,7 @@ export class FileMock extends File { * @param path Base FileSystem. * @param fileName Name of file to create. * @param replace If true, replaces file with same name. If false returns error. - * @return Returns a Promise that resolves to a FileEntry or rejects with an error. + * @returns Returns a Promise that resolves to a FileEntry or rejects with an error. */ async createFile(path: string, fileName: string, replace: boolean): Promise { const options: Flags = { @@ -202,7 +202,7 @@ export class FileMock extends File { * Create a file writer for a certain file. * * @param fe File entry object. - * @return Promise resolved with the FileWriter. + * @returns Promise resolved with the FileWriter. */ private createWriterMock(fe: FileEntry): Promise { return new Promise((resolve, reject): void => { @@ -234,6 +234,7 @@ export class FileMock extends File { * @param directoryEntry Directory entry, obtained by resolveDirectoryUrl method * @param directoryName Directory name * @param flags Options + * @returns Promise resolved with the directory entry. */ getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise { return new Promise((resolve, reject): void => { @@ -259,6 +260,7 @@ export class FileMock extends File { * @param directoryEntry Directory entry, obtained by resolveDirectoryUrl method * @param fileName File name * @param flags Options + * @returns Promise resolved with the file entry. */ getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise { return new Promise((resolve, reject): void => { @@ -279,7 +281,7 @@ export class FileMock extends File { /** * Get free disk space. * - * @return Promise resolved with the free space. + * @returns Promise resolved with the free space. */ async getFreeDiskSpace(): Promise { // Request a file system instance with a minimum size until we get an error. @@ -323,7 +325,7 @@ export class FileMock extends File { * * @param path Base FileSystem. Please refer to the iOS and Android filesystems above * @param dirName Name of directory - * @return Returns a Promise that resolves to an array of Entry objects or rejects with an error. + * @returns Returns a Promise that resolves to an array of Entry objects or rejects with an error. */ async listDir(path: string, dirName: string): Promise { const parentDir = await this.resolveDirectoryUrl(path); @@ -336,7 +338,7 @@ export class FileMock extends File { /** * Loads an initialize the API for browser. * - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ load(): Promise { return new Promise((resolve, reject): void => { @@ -369,7 +371,7 @@ export class FileMock extends File { * @param srce The Entry to copy. * @param destDir The directory where to move the file/dir. * @param newName New name of the file/dir. - * @return Returns a Promise that resolves to the new Entry object or rejects with an error. + * @returns Returns a Promise that resolves to the new Entry object or rejects with an error. */ private moveMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise { return new Promise((resolve, reject): void => { @@ -391,7 +393,7 @@ export class FileMock extends File { * @param dirName The source directory name. * @param newPath The destionation path to the directory. * @param newDirName The destination directory name. - * @return Returns a Promise that resolves to the new DirectoryEntry object or rejects with + * @returns Returns a Promise that resolves to the new DirectoryEntry object or rejects with * an error. */ moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { @@ -405,7 +407,7 @@ export class FileMock extends File { * @param fileName Name of file to move * @param newPath Base FileSystem of new location * @param newFileName New name of file to move to (leave blank to remain the same) - * @return Returns a Promise that resolves to the new Entry or rejects with an error. + * @returns Returns a Promise that resolves to the new Entry or rejects with an error. */ moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { return this.moveFileOrDir(path, fileName, newPath, newFileName || fileName); @@ -418,7 +420,7 @@ export class FileMock extends File { * @param sourceName Name of file/dir to copy * @param destPath Path where to copy. * @param destName New name of file/dir. - * @return Returns a Promise that resolves to the new Entry or rejects with an error. + * @returns Returns a Promise that resolves to the new Entry or rejects with an error. */ async moveFileOrDir(sourcePath: string, sourceName: string, destPath: string, destName: string): Promise { const destFixed = this.fixPathAndName(destPath, destName); @@ -435,7 +437,7 @@ export class FileMock extends File { * * @param path Path to fix. * @param name Name to fix. - * @return Fixed values. + * @returns Fixed values. */ protected fixPathAndName(path: string, name: string): {path: string; name: string} { @@ -452,7 +454,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param file Name of file, relative to path. - * @return Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects + * @returns Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects * with an error. */ readAsArrayBuffer(path: string, file: string): Promise { @@ -464,7 +466,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param file Name of file, relative to path. - * @return Returns a Promise that resolves with the contents of the file as string rejects with an error. + * @returns Returns a Promise that resolves with the contents of the file as string rejects with an error. */ readAsBinaryString(path: string, file: string): Promise { return this.readFileMock(path, file, 'BinaryString'); @@ -477,7 +479,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param file Name of file, relative to path. - * @return Returns a Promise that resolves with the contents of the file as data URL or rejects + * @returns Returns a Promise that resolves with the contents of the file as data URL or rejects * with an error. */ readAsDataURL(path: string, file: string): Promise { @@ -489,7 +491,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param file Name of file, relative to path. - * @return Returns a Promise that resolves with the contents of the file as string or rejects with an error. + * @returns Returns a Promise that resolves with the contents of the file as string or rejects with an error. */ readAsText(path: string, file: string): Promise { return this.readFileMock(path, file, 'Text'); @@ -499,7 +501,7 @@ export class FileMock extends File { * Read all the files and directories inside a directory. * * @param directoryReader The directory reader. - * @return Promise resolved with the list of files/dirs. + * @returns Promise resolved with the list of files/dirs. */ private readEntriesMock(directoryReader: DirectoryReader): Promise { return new Promise((resolve, reject): void => { @@ -518,7 +520,7 @@ export class FileMock extends File { * @param path Base FileSystem. * @param file Name of file, relative to path. * @param readAs Format to read as. - * @return Returns a Promise that resolves with the contents of the file or rejects with an error. + * @returns Returns a Promise that resolves with the contents of the file or rejects with an error. */ private async readFileMock( path: string, @@ -554,7 +556,7 @@ export class FileMock extends File { * Delete a file. * * @param entry The file to remove. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ private removeMock(entry: Entry): Promise { return new Promise((resolve, reject): void => { @@ -572,7 +574,7 @@ export class FileMock extends File { * * @param path The path to the directory. * @param dirName The directory name. - * @return Returns a Promise that resolves to a RemoveResult or rejects with an error. + * @returns Returns a Promise that resolves to a RemoveResult or rejects with an error. */ async removeDir(path: string, dirName: string): Promise { const parentDir = await this.resolveDirectoryUrl(path); @@ -587,7 +589,7 @@ export class FileMock extends File { * * @param path Base FileSystem. * @param fileName Name of file to remove. - * @return Returns a Promise that resolves to a RemoveResult or rejects with an error. + * @returns Returns a Promise that resolves to a RemoveResult or rejects with an error. */ async removeFile(path: string, fileName: string): Promise { const parentDir = await this.resolveDirectoryUrl(path); @@ -602,7 +604,7 @@ export class FileMock extends File { * * @param path Base FileSystem. Please refer to the iOS and Android filesystems above * @param dirName Name of directory - * @return Returns a Promise that resolves with a RemoveResult or rejects with an error. + * @returns Returns a Promise that resolves with a RemoveResult or rejects with an error. */ async removeRecursively(path: string, dirName: string): Promise { const parentDir = await this.resolveDirectoryUrl(path); @@ -615,7 +617,8 @@ export class FileMock extends File { /** * Resolves a local directory url. * - * @param directoryUrl directory system url + * @param directoryUrl Directory system url. + * @returns Promise resolved with the file system Entry referred to by local URL */ async resolveDirectoryUrl(directoryUrl: string): Promise { const dirEntry = await this.resolveLocalFilesystemUrl(directoryUrl); @@ -633,7 +636,8 @@ export class FileMock extends File { /** * Resolves a local file system URL. * - * @param fileUrl file system url + * @param fileUrl file system url. + * @returns Promise resolved with the file system Entry referred to by local URL */ resolveLocalFilesystemUrl(fileUrl: string): Promise { return new Promise((resolve, reject): void => { @@ -655,7 +659,7 @@ export class FileMock extends File { * Remove a directory and all its contents. * * @param de Directory to remove. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ private rimrafMock(de: DirectoryEntry): Promise { return new Promise((resolve, reject): void => { @@ -673,7 +677,7 @@ export class FileMock extends File { * * @param writer File writer. * @param data The data to write. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected writeMock(writer: FileWriter, data: string | Blob | ArrayBuffer): Promise { if (data instanceof Blob) { @@ -703,7 +707,7 @@ export class FileMock extends File { * @param path Base FileSystem. * @param fileName path relative to base path. * @param text content or blob to write. - * @return Returns a Promise that resolves or rejects with an error. + * @returns Returns a Promise that resolves or rejects with an error. */ async writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { await this.writeFile(path, fileName, text, { replace: true }); @@ -716,7 +720,7 @@ export class FileMock extends File { * @param fileName path relative to base path * @param text content or blob to write * @param options replace file if set to true. See WriteOptions for more information. - * @return Returns a Promise that resolves to updated file entry or rejects with an error. + * @returns Returns a Promise that resolves to updated file entry or rejects with an error. */ async writeFile( path: string, @@ -739,27 +743,29 @@ export class FileMock extends File { /** * Write content to FileEntry. * - * @param fe File entry object. + * @param fileEntry File entry object. * @param text Content or blob to write. * @param options replace file if set to true. See WriteOptions for more information. - * @return Returns a Promise that resolves to updated file entry or rejects with an error. + * @returns Returns a Promise that resolves to updated file entry or rejects with an error. */ - private writeFileEntryMock( + private async writeFileEntryMock( fileEntry: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions, ): Promise { - return this.createWriterMock(fileEntry).then((writer) => { - if (options.append) { - writer.seek(writer.length); - } + const writer = await this.createWriterMock(fileEntry); - if (options.truncate) { - writer.truncate(options.truncate); - } + if (options.append) { + writer.seek(writer.length); + } - return this.writeMock(writer, text); - }).then(() => fileEntry); + if (options.truncate) { + writer.truncate(options.truncate); + } + + await this.writeMock(writer, text); + + return fileEntry; } /** @@ -767,7 +773,7 @@ export class FileMock extends File { * * @param writer File writer. * @param data Data to write. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ private writeFileInChunksMock(writer: FileWriter, data: Blob): Promise { let writtenSize = 0; diff --git a/src/core/features/emulator/services/inappbrowser.ts b/src/core/features/emulator/services/inappbrowser.ts index bec1a4403..4a5dd709c 100644 --- a/src/core/features/emulator/services/inappbrowser.ts +++ b/src/core/features/emulator/services/inappbrowser.ts @@ -27,7 +27,7 @@ export class InAppBrowserMock extends InAppBrowser { * @param url The URL to load. * @param target The target in which to load the URL, an optional parameter that defaults to _self. * @param options Options for the InAppBrowser. - * @return The new instance. + * @returns The new instance. */ create(url: string, target?: string, options: string = 'location=yes'): InAppBrowserObject { if (options && typeof options !== 'string') { diff --git a/src/core/features/emulator/services/media-capture.ts b/src/core/features/emulator/services/media-capture.ts index 213fa10d4..c9f3e02a0 100644 --- a/src/core/features/emulator/services/media-capture.ts +++ b/src/core/features/emulator/services/media-capture.ts @@ -33,7 +33,7 @@ export class MediaCaptureMock extends MediaCapture { * Start the audio recorder application and return information about captured audio clip files. * * @param options Options. - * @return Promise resolved when captured. + * @returns Promise resolved when captured. */ captureAudio(options: CaptureAudioOptions): Promise { return CoreEmulatorCaptureHelper.captureMedia('audio', options); @@ -43,7 +43,7 @@ export class MediaCaptureMock extends MediaCapture { * Start the camera application and return information about captured image files. * * @param options Options. - * @return Promise resolved when captured. + * @returns Promise resolved when captured. */ captureImage(options: CaptureImageOptions): Promise { return CoreEmulatorCaptureHelper.captureMedia('captureimage', options); @@ -53,7 +53,7 @@ export class MediaCaptureMock extends MediaCapture { * Start the video recorder application and return information about captured video clip files. * * @param options Options. - * @return Promise resolved when captured. + * @returns Promise resolved when captured. */ captureVideo(options: CaptureVideoOptions): Promise { return CoreEmulatorCaptureHelper.captureMedia('video', options); diff --git a/src/core/features/emulator/services/zip.ts b/src/core/features/emulator/services/zip.ts index 742c1377e..a511661f0 100644 --- a/src/core/features/emulator/services/zip.ts +++ b/src/core/features/emulator/services/zip.ts @@ -29,7 +29,7 @@ export class ZipMock extends Zip { * * @param destination Destination parent folder. * @param dirPath Relative path to the folder. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async createDir(destination: string, dirPath: string): Promise { // Create all the folders 1 by 1 in order, otherwise it fails. @@ -51,7 +51,7 @@ export class ZipMock extends Zip { * @param source Path to the source ZIP file. * @param destination Destination folder. * @param onProgress Optional callback to be called on progress update - * @return Promise that resolves with a number. 0 is success, -1 is error. + * @returns Promise that resolves with a number. 0 is success, -1 is error. */ async unzip(source: string, destination: string, onProgress?: (ev: {loaded: number; total: number}) => void): Promise { diff --git a/src/core/features/fileuploader/services/fileuploader-delegate.ts b/src/core/features/fileuploader/services/fileuploader-delegate.ts index c13b6e2be..787559424 100644 --- a/src/core/features/fileuploader/services/fileuploader-delegate.ts +++ b/src/core/features/fileuploader/services/fileuploader-delegate.ts @@ -33,14 +33,14 @@ export interface CoreFileUploaderHandler extends CoreDelegateHandler { * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[]; /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData; } @@ -71,7 +71,7 @@ export interface CoreFileUploaderHandlerData { * @param upload Whether the file should be uploaded. * @param allowOffline True to allow selecting in offline, false to require connection. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved with the result of picking/uploading the file. + * @returns Promise resolved with the result of picking/uploading the file. */ action?( maxSize?: number, @@ -159,7 +159,7 @@ export class CoreFileUploaderDelegateService extends CoreDelegate { name = name || file.name; @@ -194,7 +193,7 @@ export class CoreFileUploaderHelperProvider { * @param shouldDelete True if original file should be deleted (move), false otherwise (copy). * @param maxSize Max size of the file. If not defined or -1, no max size. * @param defaultExt Defaut extension to use if the file doesn't have any. - * @return Promise resolved with the copied file. + * @returns Promise resolved with the copied file. */ protected async copyToTmpFolder( path: string, @@ -235,7 +234,7 @@ export class CoreFileUploaderHelperProvider { * * @param maxSize Max size (bytes). * @param fileName Name of the file. - * @return Message. + * @returns Message. */ protected createMaxBytesError(maxSize: number, fileName: string): CoreError { return new CoreError(Translate.instant('core.fileuploader.maxbytesfile', { @@ -274,7 +273,7 @@ export class CoreFileUploaderHelperProvider { * Given the result of choosing a file, try to get its file name from the path. * * @param result Chosen file data. - * @return File name, undefined if cannot get it. + * @returns File name, undefined if cannot get it. */ protected getChosenFileNameFromPath(result: ChooserResult): string | undefined { const nameAndDir = CoreFile.getFileAndDirectoryFromPath(result.uri); @@ -303,7 +302,7 @@ export class CoreFileUploaderHelperProvider { * @param maxSize Max size of the file to upload. If not defined or -1, no max size. * @param title File picker title. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved when a file is uploaded, rejected if file picker is closed without a file uploaded. + * @returns Promise resolved when a file is uploaded, rejected if file picker is closed without a file uploaded. * The resolve value is the response of the upload request. */ async selectAndUploadFile(maxSize?: number, title?: string, mimetypes?: string[]): Promise { @@ -317,7 +316,7 @@ export class CoreFileUploaderHelperProvider { * @param allowOffline True to allow selecting in offline, false to require connection. * @param title File picker title. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved when a file is selected, rejected if file picker is closed without selecting a file. + * @returns Promise resolved when a file is selected, rejected if file picker is closed without selecting a file. * The resolve value is the FileEntry of a copy of the picked file, so it can be deleted afterwards. */ async selectFile(maxSize?: number, allowOffline?: boolean, title?: string, mimetypes?: string[]): Promise { @@ -332,7 +331,7 @@ export class CoreFileUploaderHelperProvider { * @param title File picker title. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. * @param upload Whether the file should be uploaded. - * @return Promise resolved when a file is selected/uploaded, rejected if file picker is closed. + * @returns Promise resolved when a file is selected/uploaded, rejected if file picker is closed. */ protected async selectFileWithPicker( maxSize?: number, @@ -443,7 +442,7 @@ export class CoreFileUploaderHelperProvider { * @param fileEntry FileEntry of the file to upload. * @param deleteAfterUpload Whether the file should be deleted after upload. * @param siteId Id of the site to upload the file to. If not defined, use current site. - * @return Promise resolved when the file is uploaded. + * @returns Promise resolved when the file is uploaded. */ async showConfirmAndUploadInSite(fileEntry: FileEntry, deleteAfterUpload?: boolean, siteId?: string): Promise { try { @@ -466,9 +465,8 @@ export class CoreFileUploaderHelperProvider { * * @param error Error returned by the Cordova plugin. * @param defaultMessage Key of the default message to show. - * @return Rejected promise. */ - protected treatCaptureError(error: CoreCaptureError, defaultMessage: string): CoreError { + protected treatCaptureError(error: CoreCaptureError, defaultMessage: string): void { // Cancelled or error. If cancelled, error is an object with code = 3. if (error) { if (error.code != 3) { @@ -491,7 +489,7 @@ export class CoreFileUploaderHelperProvider { * Check if a capture error is because there is no app to capture. * * @param error Error. - * @return Whether it's because there is no app. + * @returns Whether it's because there is no app. */ protected isNoAppError(error: CoreCaptureError): boolean { return error && error.code == 20; @@ -502,7 +500,7 @@ export class CoreFileUploaderHelperProvider { * * @param error Error returned by the Cordova plugin. * @param defaultMessage Key of the default message to show. - * @return Rejected promise. If it doesn't have an error message it means it was cancelled. + * @returns Rejected promise. If it doesn't have an error message it means it was cancelled. */ protected treatImageError(error: number | string | CoreError | CoreCaptureError, defaultMessage: string): CoreError { // Cancelled or error. @@ -532,7 +530,7 @@ export class CoreFileUploaderHelperProvider { * @param maxSize Max size of the upload. -1 for no max size. * @param upload True if the file should be uploaded, false to return the picked file. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async uploadAudioOrVideo( isAudio: boolean, @@ -599,7 +597,7 @@ export class CoreFileUploaderHelperProvider { * @param type File type. * @param deleteAfterUpload Whether the file should be deleted after upload. * @param siteId Id of the site to upload the file to. If not defined, use current site. - * @return Promise resolved when the file is uploaded. + * @returns Promise resolved when the file is uploaded. */ uploadGenericFile( uri: string, @@ -620,7 +618,7 @@ export class CoreFileUploaderHelperProvider { * @param maxSize Max size of the upload. -1 for no max size. * @param upload True if the file should be uploaded, false to return the picked file. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async uploadImage( fromAlbum: boolean, @@ -700,7 +698,7 @@ export class CoreFileUploaderHelperProvider { * @param upload True if the file should be uploaded, false to return the picked file. * @param allowOffline True to allow selecting in offline, false to require connection. * @param name Name to use when uploading the file. If not defined, use the file's name. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async uploadFileEntry( fileEntry: FileEntry, @@ -730,7 +728,7 @@ export class CoreFileUploaderHelperProvider { * @param upload True if the file should be uploaded, false to return the picked file. * @param allowOffline True to allow selecting in offline, false to require connection. * @param name Name to use when uploading the file. If not defined, use the file's name. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async uploadFileObject( file: IFile | File, @@ -765,9 +763,9 @@ export class CoreFileUploaderHelperProvider { * @param path Absolute path of the file to upload. * @param maxSize Max size of the upload. -1 for no max size. * @param checkSize True to check size. - * @param Options. + * @param options Options. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if the file is uploaded, rejected otherwise. + * @returns Promise resolved if the file is uploaded, rejected otherwise. */ async uploadFile( path: string, diff --git a/src/core/features/fileuploader/services/fileuploader.ts b/src/core/features/fileuploader/services/fileuploader.ts index ce010dd8e..4949c64ff 100644 --- a/src/core/features/fileuploader/services/fileuploader.ts +++ b/src/core/features/fileuploader/services/fileuploader.ts @@ -68,7 +68,7 @@ export class CoreFileUploaderProvider { * Add a dot to the beginning of an extension. * * @param extension Extension. - * @return Treated extension. + * @returns Treated extension. */ protected addDot(extension: string): string { return '.' + extension; @@ -79,7 +79,7 @@ export class CoreFileUploaderProvider { * * @param a First file list. * @param b Second file list. - * @return Whether both lists are different. + * @returns Whether both lists are different. */ areFileListDifferent(a: CoreFileEntry[], b: CoreFileEntry[]): boolean { a = a || []; @@ -103,7 +103,7 @@ export class CoreFileUploaderProvider { * Check if a certain site allows deleting draft files. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if can delete. + * @returns Promise resolved with true if can delete. * @since 3.10 */ async canDeleteDraftFiles(siteId?: string): Promise { @@ -120,7 +120,7 @@ export class CoreFileUploaderProvider { * Check if a certain site allows deleting draft files. * * @param site Site. If not defined, use current site. - * @return Whether draft files can be deleted. + * @returns Whether draft files can be deleted. * @since 3.10 */ canDeleteDraftFilesInSite(site?: CoreSite): boolean { @@ -133,7 +133,7 @@ export class CoreFileUploaderProvider { * Start the audio recorder application and return information about captured audio clip files. * * @param options Options. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ async captureAudio(options: CaptureAudioOptions): Promise { this.onAudioCapture.next(true); @@ -148,7 +148,7 @@ export class CoreFileUploaderProvider { /** * Record an audio file without using an external app. * - * @return Promise resolved with the file. + * @returns Promise resolved with the file. */ async captureAudioInApp(): Promise { const params = { @@ -177,7 +177,7 @@ export class CoreFileUploaderProvider { * Start the video recorder application and return information about captured video clip files. * * @param options Options. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ async captureVideo(options: CaptureVideoOptions): Promise { this.onVideoCapture.next(true); @@ -213,7 +213,7 @@ export class CoreFileUploaderProvider { * @param draftId Draft ID. * @param files Files to delete. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteDraftFiles(draftId: number, files: { filepath: string; filename: string }[], siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -231,7 +231,7 @@ export class CoreFileUploaderProvider { * * @param uri File URI. * @param isFromAlbum True if the image was taken from album, false if it's a new image taken with camera. - * @return Options. + * @returns Options. */ getCameraUploadOptions(uri: string, isFromAlbum?: boolean): CoreFileUploaderOptions { const extension = CoreMimetypeUtils.guessExtensionFromUrl(uri); @@ -273,7 +273,7 @@ export class CoreFileUploaderProvider { * * @param originalFiles Original files. * @param currentFiles Current files. - * @return List of files to delete. + * @returns List of files to delete. */ getFilesToDelete( originalFiles: CoreWSFile[], @@ -307,7 +307,7 @@ export class CoreFileUploaderProvider { * @param deleteAfterUpload Whether the file should be deleted after upload. * @param fileArea File area to upload the file to. It defaults to 'draft'. * @param itemId Draft ID to upload the file to, 0 to create new. - * @return Options. + * @returns Options. */ getFileUploadOptions( uri: string, @@ -333,7 +333,7 @@ export class CoreFileUploaderProvider { * Get the upload options for a file taken with the media capture Cordova plugin. * * @param mediaFile File object to upload. - * @return Options. + * @returns Options. */ getMediaUploadOptions(mediaFile: MediaFile): CoreFileUploaderOptions { const options: CoreFileUploaderOptions = {}; @@ -363,7 +363,7 @@ export class CoreFileUploaderProvider { * Take a picture or video, or load one from the library. * * @param options Options. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ getPicture(options: CameraOptions): Promise { this.onGetPicture.next(true); @@ -377,7 +377,7 @@ export class CoreFileUploaderProvider { * Get the files stored in a folder, marking them as offline. * * @param folderPath Folder where to get the files. - * @return Promise resolved with the list of files. + * @returns Promise resolved with the list of files. */ async getStoredFiles(folderPath: string): Promise { return await CoreFile.getDirectoryContents(folderPath); @@ -388,7 +388,7 @@ export class CoreFileUploaderProvider { * * @param filesObject The combined offline and online files object. * @param folderPath Folder path to get files from. - * @return Promise resolved with files. + * @returns Promise resolved with files. */ async getStoredFilesFromOfflineFilesObject( filesObject: CoreFileUploaderStoreFilesResult, @@ -418,7 +418,7 @@ export class CoreFileUploaderProvider { * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. * @param path File's path or name. * @param mimetype File's mimetype. - * @return Undefined if file is valid, error message if file is invalid. + * @returns Undefined if file is valid, error message if file is invalid. */ isInvalidMimetype(mimetypes?: string[], path?: string, mimetype?: string): string | undefined { let extension: string | undefined; @@ -452,7 +452,7 @@ export class CoreFileUploaderProvider { * Mark files as offline. * * @param files Files to mark as offline. - * @return Files marked as offline. + * @returns Files marked as offline. * @deprecated since 3.9.5. Now stored files no longer have an offline property. */ markOfflineFiles(files: FileEntry[]): FileEntry[] { @@ -463,7 +463,7 @@ export class CoreFileUploaderProvider { * Parse filetypeList to get the list of allowed mimetypes and the data to render information. * * @param filetypeList Formatted string list where the mimetypes can be checked. - * @return Mimetypes and the filetypes informations. Undefined if all types supported. + * @returns Mimetypes and the filetypes informations. Undefined if all types supported. */ prepareFiletypeList(filetypeList: string): CoreFileUploaderTypeList | undefined { filetypeList = filetypeList?.trim(); @@ -548,7 +548,7 @@ export class CoreFileUploaderProvider { * * @param folderPath Path of the folder where to store the files. * @param files List of files. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ async storeFilesToUpload( folderPath: string, @@ -596,7 +596,7 @@ export class CoreFileUploaderProvider { * @param options Options for the upload. * @param onProgress Function to call on progress. * @param siteId Id of the site to upload the file to. If not defined, use current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async uploadFile( uri: string, @@ -629,7 +629,7 @@ export class CoreFileUploaderProvider { * @param itemId Draft ID. * @param files List of files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the itemId. + * @returns Promise resolved with the itemId. */ async uploadFiles(itemId: number, files: CoreFileEntry[], siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -673,7 +673,7 @@ export class CoreFileUploaderProvider { * @param component The component to set to the downloaded files. * @param componentId An ID to use in conjunction with the component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the itemId. + * @returns Promise resolved with the itemId. */ async uploadOrReuploadFile( file: CoreFileEntry, @@ -733,7 +733,7 @@ export class CoreFileUploaderProvider { * @param component The component to set to the downloaded files. * @param componentId An ID to use in conjunction with the component. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the itemId. + * @returns Promise resolved with the itemId. */ async uploadOrReuploadFiles( files: CoreFileEntry[], diff --git a/src/core/features/fileuploader/services/handlers/album.ts b/src/core/features/fileuploader/services/handlers/album.ts index 86f422444..26eb45fe6 100644 --- a/src/core/features/fileuploader/services/handlers/album.ts +++ b/src/core/features/fileuploader/services/handlers/album.ts @@ -32,7 +32,7 @@ export class CoreFileUploaderAlbumHandlerService implements CoreFileUploaderHand /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return CorePlatform.isMobile(); @@ -42,7 +42,7 @@ export class CoreFileUploaderAlbumHandlerService implements CoreFileUploaderHand * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { // Album allows picking images and videos. @@ -52,7 +52,7 @@ export class CoreFileUploaderAlbumHandlerService implements CoreFileUploaderHand /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/features/fileuploader/services/handlers/audio.ts b/src/core/features/fileuploader/services/handlers/audio.ts index a39a77b85..99c4030ed 100644 --- a/src/core/features/fileuploader/services/handlers/audio.ts +++ b/src/core/features/fileuploader/services/handlers/audio.ts @@ -32,7 +32,7 @@ export class CoreFileUploaderAudioHandlerService implements CoreFileUploaderHand /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return CorePlatform.isMobile() || (CoreApp.canGetUserMedia() && CoreApp.canRecordMedia()); @@ -42,7 +42,7 @@ export class CoreFileUploaderAudioHandlerService implements CoreFileUploaderHand * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { if (CoreApp.isIOS()) { @@ -68,7 +68,7 @@ export class CoreFileUploaderAudioHandlerService implements CoreFileUploaderHand /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/features/fileuploader/services/handlers/camera.ts b/src/core/features/fileuploader/services/handlers/camera.ts index 077487da0..84c9e3ff9 100644 --- a/src/core/features/fileuploader/services/handlers/camera.ts +++ b/src/core/features/fileuploader/services/handlers/camera.ts @@ -33,7 +33,7 @@ export class CoreFileUploaderCameraHandlerService implements CoreFileUploaderHan /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return CorePlatform.isMobile() || CoreApp.canGetUserMedia(); @@ -43,7 +43,7 @@ export class CoreFileUploaderCameraHandlerService implements CoreFileUploaderHan * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { // Camera only supports JPEG and PNG. @@ -53,7 +53,7 @@ export class CoreFileUploaderCameraHandlerService implements CoreFileUploaderHan /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/features/fileuploader/services/handlers/file.ts b/src/core/features/fileuploader/services/handlers/file.ts index a2326bced..54407e387 100644 --- a/src/core/features/fileuploader/services/handlers/file.ts +++ b/src/core/features/fileuploader/services/handlers/file.ts @@ -34,7 +34,7 @@ export class CoreFileUploaderFileHandlerService implements CoreFileUploaderHandl /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -44,7 +44,7 @@ export class CoreFileUploaderFileHandlerService implements CoreFileUploaderHandl * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { return mimetypes; @@ -53,7 +53,7 @@ export class CoreFileUploaderFileHandlerService implements CoreFileUploaderHandl /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData { const handler: CoreFileUploaderHandlerData = { diff --git a/src/core/features/fileuploader/services/handlers/video.ts b/src/core/features/fileuploader/services/handlers/video.ts index 578070cd4..b22f0750f 100644 --- a/src/core/features/fileuploader/services/handlers/video.ts +++ b/src/core/features/fileuploader/services/handlers/video.ts @@ -32,7 +32,7 @@ export class CoreFileUploaderVideoHandlerService implements CoreFileUploaderHand /** * Whether or not the handler is enabled on a site level. * - * @return Promise resolved with true if enabled. + * @returns Promise resolved with true if enabled. */ async isEnabled(): Promise { return CorePlatform.isMobile() || (CoreApp.canGetUserMedia() && CoreApp.canRecordMedia()); @@ -42,7 +42,7 @@ export class CoreFileUploaderVideoHandlerService implements CoreFileUploaderHand * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { if (CoreApp.isIOS()) { @@ -68,7 +68,7 @@ export class CoreFileUploaderVideoHandlerService implements CoreFileUploaderHand /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/features/filter/services/filter-delegate.ts b/src/core/features/filter/services/filter-delegate.ts index 4e4a08936..88eafb41b 100644 --- a/src/core/features/filter/services/filter-delegate.ts +++ b/src/core/features/filter/services/filter-delegate.ts @@ -37,7 +37,7 @@ export interface CoreFilterHandler extends CoreDelegateHandler { * @param filter The filter. * @param options Options passed to the filters. * @param siteId Site ID. If not defined, current site. - * @return Filtered text (or promise resolved with the filtered text). + * @returns Filtered text (or promise resolved with the filtered text). */ filter(text: string, filter: CoreFilterFilter, options: CoreFilterFormatTextOptions, siteId?: string): string | Promise; @@ -52,7 +52,7 @@ export interface CoreFilterHandler extends CoreDelegateHandler { * @param component Component. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return If async, promise resolved when done. + * @returns If async, promise resolved when done. */ handleHtml?( container: HTMLElement, @@ -69,7 +69,7 @@ export interface CoreFilterHandler extends CoreDelegateHandler { * * @param options Options. * @param site Site. - * @return Whether filter should be applied. + * @returns Whether filter should be applied. */ shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean; } @@ -95,7 +95,7 @@ export class CoreFilterDelegateService extends CoreDelegate { * @param options Options passed to the filters. * @param skipFilters Names of filters that shouldn't be applied. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the filtered text. + * @returns Promise resolved with the filtered text. */ async filterText( text: string, @@ -143,7 +143,7 @@ export class CoreFilterDelegateService extends CoreDelegate { * * @param contextLevel Context level of the filters. * @param instanceId Instance ID. - * @return Filters. + * @returns Filters. */ getEnabledFilters(contextLevel: string, instanceId: number): CoreFilterFilter[] { const filters: CoreFilterFilter[] = []; @@ -175,7 +175,7 @@ export class CoreFilterDelegateService extends CoreDelegate { * @param component Component. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async handleHtml( container: HTMLElement, @@ -217,11 +217,11 @@ export class CoreFilterDelegateService extends CoreDelegate { /** * Check if a filter is enabled and should be applied. * - * @param filters Filters to apply. + * @param filter Filter to apply. * @param options Options passed to the filters. * @param site Site. * @param skipFilters Names of filters that shouldn't be applied. - * @return Whether the filter is enabled and should be applied. + * @returns Whether the filter is enabled and should be applied. */ isEnabledAndShouldApply( filter: CoreFilterFilter, @@ -251,10 +251,10 @@ export class CoreFilterDelegateService extends CoreDelegate { /** * Check if at least 1 filter should be applied in a certain site and with certain options. * - * @param filter Filter to check. + * @param filters Filters to check. * @param options Options passed to the filters. * @param site Site. If not defined, current site. - * @return Promise resolved with true: whether the filter should be applied. + * @returns Promise resolved with true: whether the filter should be applied. */ async shouldBeApplied(filters: CoreFilterFilter[], options: CoreFilterFormatTextOptions, site?: CoreSite): Promise { // Wait for filters to be initialized. @@ -275,7 +275,7 @@ export class CoreFilterDelegateService extends CoreDelegate { * @param filter Filter to check. * @param options Options passed to the filters. * @param site Site. If not defined, current site. - * @return Whether the filter should be applied. + * @returns Whether the filter should be applied. */ protected shouldFilterBeApplied(filter: CoreFilterFilter, options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { if (!this.hasHandler(filter.filter, true)) { diff --git a/src/core/features/filter/services/filter-helper.ts b/src/core/features/filter/services/filter-helper.ts index 6a1f980fd..70378e5a0 100644 --- a/src/core/features/filter/services/filter-helper.ts +++ b/src/core/features/filter/services/filter-helper.ts @@ -73,7 +73,7 @@ export class CoreFilterHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the contexts. + * @returns Promise resolved with the contexts. */ async getBlocksContexts(courseId: number, siteId?: string): Promise { // Use stale while revalidate, but always use the first value. If data is updated it will be stored in DB. @@ -99,9 +99,10 @@ export class CoreFilterHelperProvider { * * @param contextLevel The context level. * @param instanceId Instance ID related to the context. + * @param getFilters Function to get filter contexts from. * @param options Options for format text. - * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the filters. + * @param site Site. If not defined, current site. + * @returns Promise resolved with the filters. */ protected async getCacheableFilters( contextLevel: string, @@ -133,7 +134,7 @@ export class CoreFilterHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the contexts. + * @returns Promise resolved with the contexts. */ async getCourseContexts(courseId: number, siteId?: string): Promise { const courseIds = await CoreCourses.getCourseIdsIfEnrolled(courseId, siteId); @@ -155,7 +156,7 @@ export class CoreFilterHelperProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the contexts. + * @returns Promise resolved with the contexts. */ async getCourseModulesContexts(courseId: number, siteId?: string): Promise { // Use stale while revalidate, but always use the first value. If data is updated it will be stored in DB. @@ -192,7 +193,7 @@ export class CoreFilterHelperProvider { * @param instanceId Instance ID related to the context. * @param options Options for format text. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the filters. + * @returns Promise resolved with the filters. */ async getFilters( contextLevel: string, @@ -268,7 +269,7 @@ export class CoreFilterHelperProvider { * @param instanceId Instance ID related to the context. * @param options Options for format text. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the formatted text and the filters. + * @returns Promise resolved with the formatted text and the filters. */ async getFiltersAndFormatText( text: string, @@ -292,7 +293,7 @@ export class CoreFilterHelperProvider { * @param contextLevel Context level. * @param instanceId Instance ID. * @param site Site. - * @return The filters, undefined if not found. + * @returns The filters, undefined if not found. */ protected getFromMemoryCache( courseId: number, @@ -321,7 +322,7 @@ export class CoreFilterHelperProvider { * * @param options Options passed to the filters. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it has filters to treat. + * @returns Promise resolved with boolean: whether it has filters to treat. */ async siteHasFiltersToTreat(options?: CoreFilterFormatTextOptions, siteId?: string): Promise { options = options || {}; @@ -337,7 +338,9 @@ export class CoreFilterHelperProvider { /** * Store filters in the memory cache. * - * @param contexts Filters to store, classified by contextlevel and instanceid + * @param courseId Course the module belongs to. + * @param contextLevel Context level. + * @param contexts Contexts. * @param siteId Site ID. */ protected storeInMemoryCache( diff --git a/src/core/features/filter/services/filter.ts b/src/core/features/filter/services/filter.ts index a1735684f..d9f63cf50 100644 --- a/src/core/features/filter/services/filter.ts +++ b/src/core/features/filter/services/filter.ts @@ -63,7 +63,7 @@ export class CoreFilterProvider { /** * Returns whether or not WS get available in context is available. * - * @return Promise resolved with true if ws is available, false otherwise. + * @returns Promise resolved with true if ws is available, false otherwise. * @deprecated since app 4.0 */ async canGetAvailableInContext(): Promise { @@ -73,7 +73,7 @@ export class CoreFilterProvider { /** * Returns whether or not WS get available in context is available in a certain site. * - * @return Promise resolved with true if ws is available, false otherwise. + * @returns Promise resolved with true if ws is available, false otherwise. * @deprecated since app 4.0 */ canGetAvailableInContextInSite(): boolean { @@ -84,7 +84,7 @@ export class CoreFilterProvider { * Returns whether or not we can get the available filters: the WS is available and the feature isn't disabled. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whethe can get filters. + * @returns Promise resolved with boolean: whethe can get filters. */ async canGetFilters(siteId?: string): Promise { const disabled = await this.checkFiltersDisabled(siteId); @@ -96,7 +96,7 @@ export class CoreFilterProvider { * Returns whether or not we can get the available filters: the WS is available and the feature isn't disabled. * * @param site Site. If not defined, current site. - * @return Promise resolved with boolean: whethe can get filters. + * @returns Promise resolved with boolean: whethe can get filters. */ canGetFiltersInSite(site?: CoreSite): boolean { return this.checkFiltersDisabledInSite(site); @@ -106,7 +106,7 @@ export class CoreFilterProvider { * Returns whether or not checking the available filters is disabled in the site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it's disabled. + * @returns Promise resolved with boolean: whether it's disabled. */ async checkFiltersDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -118,7 +118,7 @@ export class CoreFilterProvider { * Returns whether or not checking the available filters is disabled in the site. * * @param site Site. If not defined, current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ checkFiltersDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -134,7 +134,7 @@ export class CoreFilterProvider { * @param hadSystemContext Whether the list of contexts originally had system context. * @param hadSiteHomeContext Whether the list of contexts originally had site home context. * @param site Site instance. - * @return Classified filters. + * @returns Classified filters. */ protected classifyFilters( contexts: CoreFiltersGetAvailableInContextWSParamContext[], @@ -188,7 +188,7 @@ export class CoreFilterProvider { * @param options Formatting options. * @param filters The filters to apply. Required if filter is set to true. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the formatted text. + * @returns Promise resolved with the formatted text. */ async formatText( text: string, @@ -240,7 +240,7 @@ export class CoreFilterProvider { * Get cache key for available in contexts WS calls. * * @param contexts The contexts to check. - * @return Cache key. + * @returns Cache key. */ protected getAvailableInContextsCacheKey(contexts: CoreFiltersGetAvailableInContextWSParamContext[]): string { return this.getAvailableInContextsPrefixCacheKey() + JSON.stringify(contexts); @@ -249,7 +249,7 @@ export class CoreFilterProvider { /** * Get prefixed cache key for available in contexts WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getAvailableInContextsPrefixCacheKey(): string { return this.ROOT_CACHE_KEY + 'availableInContexts:'; @@ -260,7 +260,7 @@ export class CoreFilterProvider { * * @param contexts The contexts to check. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the filters classified by context. + * @returns Promise resolved with the filters classified by context. */ async getAvailableInContexts( contexts: CoreFiltersGetAvailableInContextWSParamContext[], @@ -314,7 +314,7 @@ export class CoreFilterProvider { * @param contextLevel The context level to check: system, user, coursecat, course, module, block, ... * @param instanceId The instance ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the filters. + * @returns Promise resolved with the filters. */ async getAvailableInContext(contextLevel: string, instanceId: number, siteId?: string): Promise { const result = await this.getAvailableInContexts([{ contextlevel: contextLevel, instanceid: instanceId }], siteId); @@ -327,7 +327,7 @@ export class CoreFilterProvider { * * @param contexts Contexts to get. * @param site Site. - * @return The filters classified by context and instance. + * @returns The filters classified by context and instance. */ protected getFromMemoryCache( contexts: CoreFiltersGetAvailableInContextWSParamContext[], @@ -369,7 +369,7 @@ export class CoreFilterProvider { * Invalidates all available in context WS calls. * * @param siteId Site ID (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllAvailableInContext(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -382,7 +382,7 @@ export class CoreFilterProvider { * * @param contexts The contexts to check. * @param siteId Site ID (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAvailableInContexts( contexts: CoreFiltersGetAvailableInContextWSParamContext[], @@ -399,7 +399,7 @@ export class CoreFilterProvider { * @param contextLevel The context level to check. * @param instanceId The instance ID. * @param siteId Site ID (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAvailableInContext(contextLevel: string, instanceId: number, siteId?: string): Promise { await this.invalidateAvailableInContexts([{ contextlevel: contextLevel, instanceid: instanceId }], siteId); @@ -411,7 +411,7 @@ export class CoreFilterProvider { * * @param contexts The contexts to check. * @param site Site instance. - * @return Whether the filters had system context and whether they had the site home context. + * @returns Whether the filters had system context and whether they had the site home context. */ protected replaceSystemContext( contexts: CoreFiltersGetAvailableInContextWSParamContext[], diff --git a/src/core/features/filter/services/handlers/default-filter.ts b/src/core/features/filter/services/handlers/default-filter.ts index dbee116d2..625b5bd9b 100644 --- a/src/core/features/filter/services/handlers/default-filter.ts +++ b/src/core/features/filter/services/handlers/default-filter.ts @@ -28,13 +28,7 @@ export class CoreFilterDefaultHandler implements CoreFilterHandler { filterName = 'default'; /** - * Filter some text. - * - * @param text The text to filter. - * @param filter The filter. - * @param options Options passed to the filters. - * @param siteId Site ID. If not defined, current site. - * @return Filtered text (or promise resolved with the filtered text). + * @inheritdoc */ filter( text: string, @@ -46,17 +40,7 @@ export class CoreFilterDefaultHandler implements CoreFilterHandler { } /** - * Handle HTML. This function is called after "filter", and it will receive an HTMLElement containing the text that was - * filtered. - * - * @param container The HTML container to handle. - * @param filter The filter. - * @param options Options passed to the filters. - * @param viewContainerRef The ViewContainerRef where the container is. - * @param component Component. - * @param componentId Component ID. - * @param siteId Site ID. If not defined, current site. - * @return If async, promise resolved when done. + * @inheritdoc */ handleHtml( container: HTMLElement, // eslint-disable-line @typescript-eslint/no-unused-vars @@ -71,20 +55,14 @@ export class CoreFilterDefaultHandler implements CoreFilterHandler { } /** - * Whether or not the handler is enabled on a site level. - * - * @return Whether or not the handler is enabled on a site level. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Check if the filter should be applied in a certain site based on some filter options. - * - * @param options Options. - * @param site Site. - * @return Whether filter should be applied. + * @inheritdoc */ // eslint-disable-next-line @typescript-eslint/no-unused-vars shouldBeApplied(options: CoreFilterFormatTextOptions, site?: CoreSite): boolean { diff --git a/src/core/features/grades/services/grades-helper.ts b/src/core/features/grades/services/grades-helper.ts index b782456f0..d75a4e9e0 100644 --- a/src/core/features/grades/services/grades-helper.ts +++ b/src/core/features/grades/services/grades-helper.ts @@ -56,7 +56,7 @@ export class CoreGradesHelperProvider { * Formats a row from the grades table te be rendered in a page. * * @param tableRow JSON object representing row of grades table data. - * @return Formatted row object. + * @returns Formatted row object. * @deprecated since app 4.0 */ protected async formatGradeRow(tableRow: CoreGradesTableRow): Promise { @@ -100,7 +100,7 @@ export class CoreGradesHelperProvider { * * @param tableRow JSON object representing row of grades table data. * @param useLegacyLayout Whether to use the layout before 4.1. - * @return Formatted row object. + * @returns Formatted row object. */ protected formatGradeRowForTable(tableRow: CoreGradesTableRow, useLegacyLayout: boolean): CoreGradesFormattedTableRow { const row: CoreGradesFormattedTableRow = {}; @@ -186,7 +186,7 @@ export class CoreGradesHelperProvider { * Removes suffix formatted to compatibilize data from table and items. * * @param item Grade item to format. - * @return Grade item formatted. + * @returns Grade item formatted. */ protected formatGradeItem(item: CoreGradesGradeItem): CoreGradesFormattedItem { for (const name in item) { @@ -203,7 +203,7 @@ export class CoreGradesHelperProvider { * Formats the response of gradereport_user_get_grades_table to be rendered. * * @param table JSON object representing a table with data. - * @return Formatted HTML table. + * @returns Formatted HTML table. */ formatGradesTable(table: CoreGradesTable): CoreGradesFormattedTable { const maxDepth = table.maxdepth; @@ -288,7 +288,7 @@ export class CoreGradesHelperProvider { * Get course data for grades since they only have courseid. * * @param grades Grades to get the data for. - * @return Promise always resolved. Resolve param is the formatted grades. + * @returns Promise always resolved. Resolve param is the formatted grades. */ async getGradesCourseData(grades: CoreGradesGradeOverview[]): Promise { // Obtain courses from cache to prevent network requests. @@ -323,7 +323,7 @@ export class CoreGradesHelperProvider { * * @param grades Array of grades to populate. * @param courses HashMap of courses to read data from. - * @return Boolean indicating if some courses were not found. + * @returns Boolean indicating if some courses were not found. */ protected addCourseData( grades: CoreGradesGradeOverview[], @@ -352,7 +352,7 @@ export class CoreGradesHelperProvider { * @param userId ID of the user to get the grades from. If not defined use site's current user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the grades are retrieved. + * @returns Promise to be resolved when the grades are retrieved. * @deprecated since app 4.0 */ async getGradeItem( @@ -376,7 +376,7 @@ export class CoreGradesHelperProvider { * * @param grades Array with objects with value and label. * @param selectedGrade Selected grade value. - * @return Selected grade label. + * @returns Selected grade label. */ getGradeLabelFromValue(grades: CoreGradesMenuItem[], selectedGrade?: number): string { selectedGrade = Number(selectedGrade); @@ -399,7 +399,7 @@ export class CoreGradesHelperProvider { * @param groupId ID of the group to get the grades from. Not used for old gradebook table. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the grades are retrieved. + * @returns Promise to be resolved when the grades are retrieved. */ async getGradeModuleItems( courseId: number, @@ -419,7 +419,7 @@ export class CoreGradesHelperProvider { * * @param grades Array with objects with value and label. * @param selectedGrade Selected grade label. - * @return Selected grade value. + * @returns Selected grade value. */ getGradeValueFromLabel(grades: CoreMenuItem[], selectedGrade?: string): number { if (!grades || !selectedGrade) { @@ -437,7 +437,7 @@ export class CoreGradesHelperProvider { * Gets the link to the module for the selected grade. * * @param text HTML where the link is present. - * @return URL linking to the module. + * @returns URL linking to the module. */ protected getModuleLink(text: string): string | false { const el = CoreDomUtils.toDom(text)[0]; @@ -455,7 +455,7 @@ export class CoreGradesHelperProvider { * * @param table JSON object representing a table with data. * @param gradeId Grade Object identifier. - * @return Formatted HTML table. + * @returns Formatted HTML table. * @deprecated since app 4.0 */ async getGradesTableRow(table: CoreGradesTable, gradeId: number): Promise { @@ -481,7 +481,7 @@ export class CoreGradesHelperProvider { * * @param table JSON object representing a table with data. * @param moduleId Grade Object identifier. - * @return Formatted HTML table. + * @returns Formatted HTML table. * @deprecated since app 4.0 */ async getModuleGradesTableRows(table: CoreGradesTable, moduleId: number): Promise { @@ -512,7 +512,7 @@ export class CoreGradesHelperProvider { * * @param courseId Course Id. * @param moduleId Module Id. - * @return Formatted table rows. + * @returns Formatted table rows. */ async getModuleGrades(courseId: number, moduleId: number): Promise { const table = await CoreGrades.getCourseGradesTable(courseId); @@ -546,7 +546,7 @@ export class CoreGradesHelperProvider { * @param userId User to view. If not defined, current user. * @param moduleId Module to view. If not defined, view all course grades. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async goToGrades( courseId: number, @@ -621,7 +621,7 @@ export class CoreGradesHelperProvider { * @param userId ID of the user to invalidate. If not defined use site's current user. * @param groupId ID of the group to invalidate. Not used for old gradebook table. * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the grades are invalidated. + * @returns Promise to be resolved when the grades are invalidated. */ async invalidateGradeModuleItems(courseId: number, userId?: number, groupId?: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -722,7 +722,7 @@ export class CoreGradesHelperProvider { * @param defaultLabel Element that will become default option, if not defined, it won't be added. * @param defaultValue Element that will become default option value. Default ''. * @param scale Scale csv list String. If not provided, it will take it from the module grade info. - * @return Array with objects with value and label to create a propper HTML select. + * @returns Array with objects with value and label to create a propper HTML select. */ async makeGradesMenu( gradingType?: number, @@ -778,7 +778,7 @@ export class CoreGradesHelperProvider { * Type guard to check if the param is a CoreGradesGradeItem. * * @param item Param to check. - * @return Whether the param is a CoreGradesGradeItem. + * @returns Whether the param is a CoreGradesGradeItem. */ isGradeItem(item: CoreGradesGradeItem | CoreGradesFormattedRow): item is CoreGradesGradeItem { return 'outcomeid' in item; diff --git a/src/core/features/grades/services/grades.ts b/src/core/features/grades/services/grades.ts index d6498132d..a59b1eccd 100644 --- a/src/core/features/grades/services/grades.ts +++ b/src/core/features/grades/services/grades.ts @@ -46,7 +46,7 @@ export class CoreGradesProvider { * * @param courseId ID of the course to get the grades from. * @param userId ID of the user to get the grades from. - * @return Cache key. + * @returns Cache key. */ protected getCourseGradesCacheKey(courseId: number, userId: number): string { return this.getCourseGradesPrefixCacheKey(courseId) + userId; @@ -58,7 +58,7 @@ export class CoreGradesProvider { * @param courseId ID of the course to get the grades from. * @param userId ID of the user to get the grades from. * @param groupId ID of the group to get the grades from. Default: 0. - * @return Cache key. + * @returns Cache key. */ protected getCourseGradesItemsCacheKey(courseId: number, userId: number, groupId?: number): string { groupId = groupId ?? 0; @@ -70,7 +70,7 @@ export class CoreGradesProvider { * Get prefix cache key for grade table data WS calls. * * @param courseId ID of the course to get the grades from. - * @return Cache key. + * @returns Cache key. */ protected getCourseGradesPrefixCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'items:' + courseId + ':'; @@ -79,7 +79,7 @@ export class CoreGradesProvider { /** * Get cache key for courses grade WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getCoursesGradesCacheKey(): string { return this.ROOT_CACHE_KEY + 'coursesgrades'; @@ -93,7 +93,7 @@ export class CoreGradesProvider { * @param groupId ID of the group to get the grades from. Not used for old gradebook table. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the grades are retrieved. + * @returns Promise to be resolved when the grades are retrieved. */ async getGradeItems( courseId: number, @@ -119,7 +119,7 @@ export class CoreGradesProvider { * @param groupId ID of the group to get the grades from. Default 0. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the grades table is retrieved. + * @returns Promise to be resolved when the grades table is retrieved. */ async getCourseGradesItems( courseId: number, @@ -169,7 +169,7 @@ export class CoreGradesProvider { * @param userId ID of the user to get the grades from. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise to be resolved when the grades table is retrieved. + * @returns Promise to be resolved when the grades table is retrieved. */ async getCourseGradesTable( courseId: number, @@ -209,7 +209,7 @@ export class CoreGradesProvider { * Get the grades for a certain course. * * @param siteId Site ID. If not defined, current site. - * @return Promise to be resolved when the grades are retrieved. + * @returns Promise to be resolved when the grades are retrieved. */ async getCoursesGrades(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -239,7 +239,7 @@ export class CoreGradesProvider { * * @param courseId ID of the course to get the grades from. * @param siteId Site ID (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllCourseGradesData(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -253,7 +253,7 @@ export class CoreGradesProvider { * @param courseId Course ID. * @param userId User ID. * @param siteId Site id (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourseGradesData(courseId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -266,7 +266,7 @@ export class CoreGradesProvider { * Invalidates courses grade data WS calls. * * @param siteId Site id (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCoursesGradesData(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -281,7 +281,7 @@ export class CoreGradesProvider { * @param userId ID of the user to get the grades from. * @param groupId ID of the group to get the grades from. Default: 0. * @param siteId Site id (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCourseGradesItemsData(courseId: number, userId: number, groupId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -293,7 +293,7 @@ export class CoreGradesProvider { * Returns whether or not the plugin is enabled for a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Resolve with true if plugin is enabled, false otherwise. + * @returns Resolve with true if plugin is enabled, false otherwise. */ async isCourseGradesEnabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -309,7 +309,7 @@ export class CoreGradesProvider { * * @param courseId Course ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ async isPluginEnabledForCourse(courseId?: number, siteId?: string): Promise { if (!courseId) { @@ -324,8 +324,7 @@ export class CoreGradesProvider { /** * Returns whether or not WS Grade Items is available. * - * @param siteId Site ID. If not defined, current site. - * @return True if ws is available, false otherwise. + * @returns True if ws is available, false otherwise. * @deprecated since app 4.0 */ async isGradeItemsAvailable(): Promise { @@ -338,7 +337,7 @@ export class CoreGradesProvider { * @param courseId Course ID. * @param userId User ID. * @param name Course name. If not set, it will be calculated. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async logCourseGradesView(courseId: number, userId: number, name?: string): Promise { userId = userId || CoreSites.getCurrentSiteUserId(); @@ -371,7 +370,7 @@ export class CoreGradesProvider { * Log Courses grades view in Moodle. * * @param courseId Course ID. If not defined, site Home ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async logCoursesGradesView(courseId?: number): Promise { if (!courseId) { diff --git a/src/core/features/grades/services/handlers/overview-link.ts b/src/core/features/grades/services/handlers/overview-link.ts index 2205e29ea..f6f36cd5d 100644 --- a/src/core/features/grades/services/handlers/overview-link.ts +++ b/src/core/features/grades/services/handlers/overview-link.ts @@ -32,7 +32,7 @@ export class CoreGradesOverviewLinkHandlerService extends CoreContentLinksHandle /** * Get the list of actions for a link (url). * - * @return List of (or promise resolved with list of) actions. + * @returns List of (or promise resolved with list of) actions. */ getActions(): CoreContentLinksAction[] | Promise { return [{ @@ -47,7 +47,7 @@ export class CoreGradesOverviewLinkHandlerService extends CoreContentLinksHandle * If not defined, defaults to true. * * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @returns Whether the handler is enabled for the URL and site. */ async isEnabled(siteId: string): Promise { return CoreGrades.isCourseGradesEnabled(siteId); diff --git a/src/core/features/h5p/assets/js/h5p-action-bar.js b/src/core/features/h5p/assets/js/h5p-action-bar.js index 608a848b3..560fbbf86 100644 --- a/src/core/features/h5p/assets/js/h5p-action-bar.js +++ b/src/core/features/h5p/assets/js/h5p-action-bar.js @@ -76,7 +76,7 @@ H5P.ActionBar = (function ($, EventDispatcher) { /** * Returns a reference to the dom element * - * @return {H5P.jQuery} + * @returns {H5P.jQuery} */ self.getDOMElement = function () { return $actions; @@ -85,7 +85,7 @@ H5P.ActionBar = (function ($, EventDispatcher) { /** * Does the actionbar contain actions? * - * @return {Boolean} + * @returns {Boolean} */ self.hasActions = function () { return hasActions; diff --git a/src/core/features/h5p/assets/js/h5p-confirmation-dialog.js b/src/core/features/h5p/assets/js/h5p-confirmation-dialog.js index cd3536e7a..fd0c2f752 100644 --- a/src/core/features/h5p/assets/js/h5p-confirmation-dialog.js +++ b/src/core/features/h5p/assets/js/h5p-confirmation-dialog.js @@ -375,7 +375,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { /** * Retrieve element * - * @return {HTMLElement} + * @returns {HTMLElement} */ this.getElement = function () { return popup; @@ -383,7 +383,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { /** * Get previously focused element - * @return {HTMLElement} + * @returns {HTMLElement} */ this.getPreviouslyFocused = function () { return previouslyFocused; diff --git a/src/core/features/h5p/assets/js/h5p-content-type.js b/src/core/features/h5p/assets/js/h5p-content-type.js index 47c4d21bf..7eff85b2d 100644 --- a/src/core/features/h5p/assets/js/h5p-content-type.js +++ b/src/core/features/h5p/assets/js/h5p-content-type.js @@ -22,7 +22,7 @@ H5P.ContentType = function (isRootLibrary) { * Is library standalone or not? Not beeing standalone, means it is * included in another library * - * @return {Boolean} + * @returns {Boolean} */ ContentType.prototype.isRoot = function () { return isRootLibrary; @@ -31,7 +31,7 @@ H5P.ContentType = function (isRootLibrary) { /** * Returns the file path of a file in the current library * @param {string} filePath The path to the file relative to the library folder - * @return {string} The full path to the file + * @returns {string} The full path to the file */ ContentType.prototype.getLibraryFilePath = function (filePath) { return H5P.getLibraryPath(this.libraryInfo.versionedNameNoSpaces) + '/' + filePath; diff --git a/src/core/features/h5p/assets/js/h5p-x-api-event.js b/src/core/features/h5p/assets/js/h5p-x-api-event.js index a26b58b70..94a92a49f 100644 --- a/src/core/features/h5p/assets/js/h5p-x-api-event.js +++ b/src/core/features/h5p/assets/js/h5p-x-api-event.js @@ -263,7 +263,7 @@ H5P.XAPIEvent.prototype.getContentXAPIId = function (instance) { /** * Check if this event is sent from a child (i.e not from grandchild) * - * @return {Boolean} + * @returns {Boolean} */ H5P.XAPIEvent.prototype.isFromChild = function () { var parentId = this.getVerifiedStatementValue(['context', 'contextActivities', 'parent', 0, 'id']); diff --git a/src/core/features/h5p/assets/js/h5p.js b/src/core/features/h5p/assets/js/h5p.js index bab4edb3f..f013276ad 100644 --- a/src/core/features/h5p/assets/js/h5p.js +++ b/src/core/features/h5p/assets/js/h5p.js @@ -732,7 +732,7 @@ if (isIOS()) { * * @param {string} path * @param {string} parameter - * @return {string} + * @returns {string} */ H5P.addQueryParameter = function (path, parameter) { let newPath, secondSplit; @@ -789,7 +789,7 @@ if (isIOS()) { * * @private * @param {string} path - * @return {string} + * @returns {string} */ var hasProtocol = function (path) { return path.match(/^[a-z0-9]+:\/\//i); @@ -1544,7 +1544,7 @@ H5P.attachToastTo = function (element, message, config) { * @param {boolean} [position.noOverflowBottom=false] True to prevent overflow bottom. * @param {boolean} [position.noOverflowX=false] True to prevent overflow left and right. * @param {boolean} [position.noOverflowY=false] True to prevent overflow top and bottom. - * @return {object} + * @returns {object} */ const getToastCoordinates = function (element, toast, position) { position = position || {}; @@ -2562,7 +2562,7 @@ H5P.createTitle = function (rawTitle, maxLength) { * Function for getting content for a certain ID * * @param {number} contentId - * @return {Object} + * @returns {Object} */ H5P.getContentForInstance = function (contentId) { var key = 'cid-' + contentId; @@ -2643,7 +2643,7 @@ H5P.createTitle = function (rawTitle, maxLength) { /** * Retrieve parsed clipboard data. * - * @return {Object} + * @returns {Object} */ H5P.getClipboard = function () { return parseClipboard(); @@ -2665,7 +2665,7 @@ H5P.createTitle = function (rawTitle, maxLength) { * Get config for a library * * @param string machineName - * @return Object + * @returns Object */ H5P.getLibraryConfig = function (machineName) { var hasConfig = H5PIntegration.libraryConfig && H5PIntegration.libraryConfig[machineName]; @@ -2676,7 +2676,7 @@ H5P.createTitle = function (rawTitle, maxLength) { * Get item from the H5P Clipboard. * * @private - * @return {Object} + * @returns {Object} */ var parseClipboard = function () { var clipboardData = localStorage.getItem('h5pClipboard'); diff --git a/src/core/features/h5p/assets/js/request-queue.js b/src/core/features/h5p/assets/js/request-queue.js index 5b367e147..8688faf07 100644 --- a/src/core/features/h5p/assets/js/request-queue.js +++ b/src/core/features/h5p/assets/js/request-queue.js @@ -85,7 +85,7 @@ H5P.RequestQueue = (function ($, EventDispatcher) { /** * Start processing of requests queue * - * @return {boolean} Returns false if it was not possible to resume processing queue + * @returns {boolean} Returns false if it was not possible to resume processing queue */ RequestQueue.prototype.resumeQueue = function () { // Not supported diff --git a/src/core/features/h5p/classes/content-validator.ts b/src/core/features/h5p/classes/content-validator.ts index b238bfe27..332ee6bab 100644 --- a/src/core/features/h5p/classes/content-validator.ts +++ b/src/core/features/h5p/classes/content-validator.ts @@ -55,7 +55,7 @@ export class CoreH5PContentValidator { * Add Addon library. * * @param library The addon library to add. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async addon(library: CoreH5PLibraryAddonData): Promise { const depKey = 'preloaded-' + library.machineName; @@ -73,7 +73,7 @@ export class CoreH5PContentValidator { /** * Get the flat dependency tree. * - * @return Dependencies. + * @returns Dependencies. */ getDependencies(): {[key: string]: CoreH5PContentDepsTreeDependency} { return this.dependencies; @@ -83,7 +83,7 @@ export class CoreH5PContentValidator { * Validate metadata * * @param metadata Metadata. - * @return Promise resolved with metadata validated & filtered. + * @returns Promise resolved with metadata validated & filtered. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any validateMetadata(metadata: any): Promise { @@ -103,7 +103,7 @@ export class CoreH5PContentValidator { * * @param text Text to validate. * @param semantics Semantics. - * @return Validated text. + * @returns Validated text. */ validateText(text: string, semantics: CoreH5PSemantics): string { if (typeof text != 'string') { @@ -180,7 +180,7 @@ export class CoreH5PContentValidator { * * @param contentPath The path containing content files to validate. * @param isLibrary Whether it's a library. - * @return True if all files are valid. + * @returns True if all files are valid. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars validateContentFiles(contentPath: string, isLibrary: boolean = false): boolean { @@ -193,7 +193,7 @@ export class CoreH5PContentValidator { * * @param value Number to validate. * @param semantics Semantics. - * @return Validated number. + * @returns Validated number. */ validateNumber(value: unknown, semantics: CoreH5PSemantics): number { // Validate that num is indeed a number. @@ -228,7 +228,7 @@ export class CoreH5PContentValidator { * Validate given value against boolean semantics. * * @param bool Boolean to check. - * @return Validated bool. + * @returns Validated bool. */ validateBoolean(bool: unknown): boolean { return !!bool; @@ -239,7 +239,7 @@ export class CoreH5PContentValidator { * * @param select Values to validate. * @param semantics Semantics. - * @return Validated select. + * @returns Validated select. */ validateSelect(select: string | string[], semantics: CoreH5PSemantics): string | string[] { const optional = semantics.optional; @@ -294,7 +294,7 @@ export class CoreH5PContentValidator { * * @param list List to validate. * @param semantics Semantics. - * @return Validated list. + * @returns Validated list. */ async validateList(list: Record | unknown[], semantics: CoreH5PSemantics): Promise { const field = semantics.field!; @@ -347,7 +347,7 @@ export class CoreH5PContentValidator { * @param file File to validate. * @param semantics Semantics. * @param typeValidKeys List of valid keys. - * @return Promise resolved with the validated file. + * @returns Promise resolved with the validated file. */ protected async validateFilelike(file: FileLike, semantics: CoreH5PSemantics, typeValidKeys: string[] = []): Promise { // Do not allow to use files from other content folders. @@ -414,7 +414,7 @@ export class CoreH5PContentValidator { * * @param file File. * @param semantics Semantics. - * @return Promise resolved with the validated file. + * @returns Promise resolved with the validated file. */ validateFile(file: FileLike, semantics: CoreH5PSemantics): Promise { return this.validateFilelike(file, semantics); @@ -425,7 +425,7 @@ export class CoreH5PContentValidator { * * @param image Image. * @param semantics Semantics. - * @return Promise resolved with the validated file. + * @returns Promise resolved with the validated file. */ validateImage(image: FileLike, semantics: CoreH5PSemantics): Promise { return this.validateFilelike(image, semantics, ['width', 'height', 'originalImage']); @@ -436,7 +436,7 @@ export class CoreH5PContentValidator { * * @param video Video. * @param semantics Semantics. - * @return Promise resolved with the validated file. + * @returns Promise resolved with the validated file. */ async validateVideo(video: Record, semantics: CoreH5PSemantics): Promise> { for (const key in video) { @@ -451,7 +451,7 @@ export class CoreH5PContentValidator { * * @param audio Audio. * @param semantics Semantics. - * @return Promise resolved with the validated file. + * @returns Promise resolved with the validated file. */ async validateAudio(audio: Record, semantics: CoreH5PSemantics): Promise> { for (const key in audio) { @@ -468,7 +468,7 @@ export class CoreH5PContentValidator { * @param group Group. * @param semantics Semantics. * @param flatten Whether to flatten. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async validateGroup(group: unknown, semantics: CoreH5PSemantics, flatten: boolean = true): Promise { if (!semantics.fields) { @@ -525,7 +525,7 @@ export class CoreH5PContentValidator { * * @param value Value. * @param semantics Semantics. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async validateLibrary(value: LibraryType, semantics: CoreH5PSemantics): Promise { if (!value.library) { @@ -605,7 +605,7 @@ export class CoreH5PContentValidator { * @param text The string with raw HTML in it. * @param allowedTags An array of allowed tags. * @param allowedStyles Allowed styles. - * @return An XSS safe version of the string. + * @returns An XSS safe version of the string. */ protected filterXss(text: string, allowedTags?: string[], allowedStyles?: RegExp[]): string { if (!text || typeof text != 'string') { @@ -650,7 +650,7 @@ export class CoreH5PContentValidator { * If store is TRUE then the array contains the allowed tags. * If store is FALSE then the array has one element, the HTML tag to process. * @param store Whether to store m. - * @return string If the element isn't allowed, an empty string. Otherwise, the cleaned up version of the HTML element. + * @returns string If the element isn't allowed, an empty string. Otherwise, the cleaned up version of the HTML element. */ protected filterXssSplit(tags: string[], store: boolean = false): string { if (store) { @@ -717,7 +717,7 @@ export class CoreH5PContentValidator { * * @param attr HTML attributes. * @param allowedStyles Allowed styles. - * @return Cleaned up version of the HTML attributes. + * @returns Cleaned up version of the HTML attributes. */ protected filterXssAttributes(attr: string, allowedStyles?: RegExp[]): string[] { const attrArray: string[] = []; @@ -839,7 +839,7 @@ export class CoreH5PContentValidator { * * @param str The string with the attribute value. * @param decode Whether to decode entities in the str. - * @return Cleaned up and HTML-escaped version of str. + * @returns Cleaned up and HTML-escaped version of str. */ filterXssBadProtocol(str: string, decode: boolean = true): string { // Get the plain text representation of the attribute value (i.e. its meaning). @@ -854,7 +854,7 @@ export class CoreH5PContentValidator { * Strips dangerous protocols (e.g. 'javascript:') from a URI. * * @param uri A plain-text URI that might contain dangerous protocols. - * @return A plain-text URI stripped of dangerous protocols. + * @returns A plain-text URI stripped of dangerous protocols. */ protected stripDangerousProtocols(uri: string): string { @@ -892,7 +892,7 @@ export class CoreH5PContentValidator { /** * Get metadata semantics. * - * @return Semantics. + * @returns Semantics. */ getMetadataSemantics(): CoreH5PSemantics[] { @@ -1118,7 +1118,7 @@ export class CoreH5PContentValidator { /** * Get copyright semantics. * - * @return Semantics. + * @returns Semantics. */ getCopyrightSemantics(): CoreH5PSemantics { @@ -1262,7 +1262,7 @@ export class CoreH5PContentValidator { /** * Get CC versions for semantics. * - * @return CC versions. + * @returns CC versions. */ protected getCCVersions(): VersionSemantics[] { return [ diff --git a/src/core/features/h5p/classes/core.ts b/src/core/features/h5p/classes/core.ts index 97e243923..6bdd1de74 100644 --- a/src/core/features/h5p/classes/core.ts +++ b/src/core/features/h5p/classes/core.ts @@ -92,9 +92,9 @@ export class CoreH5PCore { /** * Determine the correct embed type to use. * - * @param Embed type of the content. - * @param Embed type of the main library. - * @return Either 'div' or 'iframe'. + * @param contentEmbedType Type of the content. + * @param libraryEmbedTypes Type of the main library. + * @returns Either 'div' or 'iframe'. */ static determineEmbedType(contentEmbedType: string, libraryEmbedTypes: string): string { // Detect content embed type. @@ -117,7 +117,7 @@ export class CoreH5PCore { * Get the hash of a list of dependencies. * * @param dependencies Dependencies. - * @return Hash. + * @returns Hash. */ static getDependenciesHash(dependencies: {[machineName: string]: CoreH5PContentDependencyData}): string { // Build hash of dependencies. @@ -139,7 +139,7 @@ export class CoreH5PCore { /** * Get core JavaScript files. * - * @return array The array containg urls of the core JavaScript files: + * @returns array The array containg urls of the core JavaScript files: */ static getScripts(): string[] { const libUrl = CoreH5P.h5pCore.h5pFS.getCoreH5PPath(); @@ -158,7 +158,7 @@ export class CoreH5PCore { * Parses library data from a string on the form {machineName} {majorVersion}.{minorVersion}. * * @param libraryString On the form {machineName} {majorVersion}.{minorVersion} - * @return Object with keys machineName, majorVersion and minorVersion. Null if string is not parsable. + * @returns Object with keys machineName, majorVersion and minorVersion. Null if string is not parsable. */ static libraryFromString(libraryString: string): CoreH5PLibraryBasicData | null { @@ -180,7 +180,7 @@ export class CoreH5PCore { * * @param libraryData Library data. * @param folderName Use hyphen instead of space in returned string. - * @return String on the form {machineName} {majorVersion}.{minorVersion}. + * @returns String on the form {machineName} {majorVersion}.{minorVersion}. */ static libraryToString(libraryData: CoreH5PLibraryBasicData | CoreH5PContentMainLibraryData, folderName?: boolean): string { return ('machineName' in libraryData ? libraryData.machineName : libraryData.name) + (folderName ? '-' : ' ') + @@ -191,7 +191,7 @@ export class CoreH5PCore { * Convert strings of text into simple kebab case slugs. Based on H5PCore::slugify. * * @param input The string to slugify. - * @return Slugified text. + * @returns Slugified text. */ static slugify(input: string): string { input = input || ''; @@ -233,7 +233,7 @@ export class CoreH5PCore { * * @param content Content data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the filtered params, resolved with null if error. + * @returns Promise resolved with the filtered params, resolved with null if error. */ async filterParameters(content: CoreH5PContentData, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -323,7 +323,7 @@ export class CoreH5PCore { * @param nextWeight An integer determining the order of the libraries when they are loaded. * @param editor Used internally to force all preloaded sub dependencies of an editor dependency to be editor dependencies. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the next weight. + * @returns Promise resolved with the next weight. */ async findLibraryDependencies( dependencies: {[key: string]: CoreH5PContentDepsTreeDependency}, @@ -393,6 +393,7 @@ export class CoreH5PCore { * * @param displayOptions The display options to validate. * @param id Package ID. + * @returns Display Options. */ fixDisplayOptions(displayOptions: CoreH5PDisplayOptions, id: number): CoreH5PDisplayOptions { displayOptions = displayOptions || {}; @@ -417,8 +418,8 @@ export class CoreH5PCore { /** * Parses library data from a string on the form {machineName} {majorVersion}.{minorVersion}. * - * @param libraryString On the form {machineName} {majorVersion}.{minorVersion} - * @return Object with keys machineName, majorVersion and minorVersion. Null if string is not parsable. + * @param content On the form {machineName} {majorVersion}.{minorVersion} + * @returns Object with keys machineName, majorVersion and minorVersion. Null if string is not parsable. */ generateContentSlug(content: CoreH5PContentData): string { @@ -447,7 +448,7 @@ export class CoreH5PCore { * * @param assets List of assets to get their URLs. * @param assetsFolderPath The path of the folder where the assets are. - * @return List of urls. + * @returns List of urls. */ getAssetsUrls(assets: CoreH5PDependencyAsset[], assetsFolderPath: string = ''): string[] { const urls: string[] = []; @@ -478,7 +479,7 @@ export class CoreH5PCore { * @param folderName Name of the folder of the content. * @param prefix Make paths relative to another dir. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getDependenciesFiles( dependencies: {[machineName: string]: CoreH5PContentDependencyData}, @@ -545,7 +546,7 @@ export class CoreH5PCore { * * @param id The H5P content ID. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with an object containing the path of each content dependency. + * @returns Promise resolved with an object containing the path of each content dependency. */ async getDependencyRoots(id: number, siteId?: string): Promise<{[libString: string]: string}> { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -603,7 +604,7 @@ export class CoreH5PCore { * Convert display options to an object. * * @param disable Display options as a number. - * @return Display options as object. + * @returns Display options as object. */ getDisplayOptionsAsObject(disable: number): CoreH5PDisplayOptions { const displayOptions: CoreH5PDisplayOptions = {}; @@ -624,7 +625,7 @@ export class CoreH5PCore { * * @param disable The display options as a number. * @param id Package ID. - * @return Display options as object. + * @returns Display options as object. */ getDisplayOptionsForView(disable: number, id: number): CoreH5PDisplayOptions { return this.fixDisplayOptions(this.getDisplayOptionsAsObject(disable), id); @@ -633,7 +634,7 @@ export class CoreH5PCore { /** * Provide localization for the Core JS. * - * @return Object with the translations. + * @returns Object with the translations. */ getLocalization(): {[name: string]: string} { return { @@ -713,7 +714,7 @@ export class CoreH5PCore { * @param id Content ID. * @param fileUrl H5P file URL. Required if id is not provided. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the content data. + * @returns Promise resolved with the content data. */ async loadContent(id?: number, fileUrl?: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -753,7 +754,7 @@ export class CoreH5PCore { * * @param id Content ID. * @param type The dependency type. - * @return Content dependencies, indexed by machine name. + * @returns Content dependencies, indexed by machine name. */ loadContentDependencies( id: number, @@ -770,7 +771,7 @@ export class CoreH5PCore { * @param majorVersion The library's major version. * @param minorVersion The library's minor version. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library data. + * @returns Promise resolved with the library data. */ loadLibrary(machineName: string, majorVersion: number, minorVersion: number, siteId?: string): Promise { return this.h5pFramework.loadLibrary(machineName, majorVersion, minorVersion, siteId); @@ -779,7 +780,7 @@ export class CoreH5PCore { /** * Check if the current user has permission to update and install new libraries. * - * @return Whether has permissions. + * @returns Whether has permissions. */ mayUpdateLibraries(): boolean { // In the app the installation only affects current user, so the user always has permissions. @@ -793,7 +794,7 @@ export class CoreH5PCore { * @param folderName The name of the folder that contains the H5P. * @param fileUrl The online URL of the package. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with content ID. + * @returns Promise resolved with content ID. */ async saveContent(content: CoreH5PContentBeingSaved, folderName: string, fileUrl: string, siteId?: string): Promise { content.id = await this.h5pFramework.updateContent(content, folderName, fileUrl, siteId); @@ -811,7 +812,7 @@ export class CoreH5PCore { * @param permission The permission. * @param id The package ID. * @param value Default value. - * @return The value to use. + * @returns The value to use. */ setDisplayOptionOverrides(optionName: string, permission: number, id: number, value: boolean): boolean { const behaviour = this.h5pFramework.getOption(optionName, CoreH5PDisplayOptionBehaviour.ALWAYS_SHOW); @@ -834,7 +835,7 @@ export class CoreH5PCore { * * @param params Parameters. * @param pattern Regular expression to identify pattern. - * @return True if params matches pattern. + * @returns True if params matches pattern. */ protected textAddonMatches(params: unknown, pattern: string): boolean { diff --git a/src/core/features/h5p/classes/file-storage.ts b/src/core/features/h5p/classes/file-storage.ts index 7a58af39d..d44c1f7dc 100644 --- a/src/core/features/h5p/classes/file-storage.ts +++ b/src/core/features/h5p/classes/file-storage.ts @@ -44,7 +44,7 @@ export class CoreH5PFileStorage { * @param key Hashed key for cached asset. * @param folderName Name of the folder of the H5P package. * @param siteId The site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async cacheAssets(files: CoreH5PDependenciesFiles, key: string, folderName: string, siteId: string): Promise { @@ -84,7 +84,7 @@ export class CoreH5PFileStorage { * @param assets A list of files. * @param type The type of files in assets. Either 'scripts' or 'styles'. * @param newFolder The new folder where the concatenated content will be stored. - * @return Promise resolved with all of the files content in one string. + * @returns Promise resolved with all of the files content in one string. */ protected async concatenateFiles(assets: CoreH5PDependencyAsset[], type: string, newFolder: string): Promise { let content = ''; @@ -133,9 +133,9 @@ export class CoreH5PFileStorage { /** * Delete cached assets from file system. * - * @param libraryId Library identifier. + * @param removedEntries Assets to remove. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteCachedAssets(removedEntries: CoreH5PLibraryCachedAssetsDBRecord[], siteId?: string): Promise { @@ -162,7 +162,7 @@ export class CoreH5PFileStorage { * * @param folderName Folder name of the content. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteContentFolder(folderName: string, siteId: string): Promise { await CoreFile.removeDir(this.getContentFolderPath(folderName, siteId)); @@ -173,7 +173,7 @@ export class CoreH5PFileStorage { * * @param folderName Name of the folder of the H5P package. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteContentIndex(folderName: string, siteId: string): Promise { await CoreFile.removeFile(this.getContentIndexPath(folderName, siteId)); @@ -184,7 +184,7 @@ export class CoreH5PFileStorage { * * @param libraryId Library identifier. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteContentIndexesForLibrary(libraryId: number, siteId?: string): Promise { @@ -217,7 +217,7 @@ export class CoreH5PFileStorage { * @param libraryData The library data. * @param siteId Site ID. * @param folderName Folder name. If not provided, it will be calculated. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteLibraryFolder( libraryData: CoreH5PLibraryBasicData | CoreH5PContentMainLibraryData, @@ -231,7 +231,7 @@ export class CoreH5PFileStorage { * Will check if there are cache assets available for content. * * @param key Hashed key for cached asset - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getCachedAssets(key: string): Promise<{scripts?: CoreH5PDependencyAsset[]; styles?: CoreH5PDependencyAsset[]} | null> { @@ -254,7 +254,7 @@ export class CoreH5PFileStorage { * * @param key Key of the cached asset. * @param extension Extension of the file to get. - * @return Promise resolved with the list of assets (only one), undefined if not found. + * @returns Promise resolved with the list of assets (only one), undefined if not found. */ protected async getCachedAsset(key: string, extension: string): Promise { @@ -281,7 +281,7 @@ export class CoreH5PFileStorage { * * @param folderName Name of the folder of the content the assets belong to. * @param siteId Site ID. - * @return Path. + * @returns Path. */ getCachedAssetsFolderPath(folderName: string, siteId: string): string { return CorePath.concatenatePaths( @@ -295,7 +295,7 @@ export class CoreH5PFileStorage { * * @param fileUrl Package URL. * @param siteId Site ID. - * @return Promise resolved with the folder name. + * @returns Promise resolved with the folder name. */ async getContentFolderNameByUrl(fileUrl: string, siteId: string): Promise { const path = await CoreFilepool.getFilePathByUrl(siteId, fileUrl); @@ -310,7 +310,7 @@ export class CoreH5PFileStorage { * * @param folderName Name of the folder of the H5P package. * @param siteId The site ID. - * @return Folder path. + * @returns Folder path. */ getContentFolderPath(folderName: string, siteId: string): string { return CorePath.concatenatePaths( @@ -324,7 +324,7 @@ export class CoreH5PFileStorage { * * @param fileUrl URL of the H5P package. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the file URL if exists, rejected otherwise. + * @returns Promise resolved with the file URL if exists, rejected otherwise. */ async getContentIndexFileUrl(fileUrl: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -341,7 +341,7 @@ export class CoreH5PFileStorage { * * @param folderName Name of the folder of the H5P package. * @param siteId The site ID. - * @return Folder path. + * @returns Folder path. */ getContentIndexPath(folderName: string, siteId: string): string { return CorePath.concatenatePaths(this.getContentFolderPath(folderName, siteId), 'index.html'); @@ -350,7 +350,7 @@ export class CoreH5PFileStorage { /** * Get the path to the folder that contains the H5P core libraries. * - * @return Folder path. + * @returns Folder path. */ getCoreH5PPath(): string { return CorePath.concatenatePaths(CoreFile.getWWWPath(), '/assets/lib/h5p/'); @@ -360,7 +360,7 @@ export class CoreH5PFileStorage { * Get the path to the dependency. * * @param dependency Dependency library. - * @return The path to the dependency library + * @returns The path to the dependency library */ getDependencyPath(dependency: CoreH5PContentDependencyData): string { return 'libraries/' + dependency.machineName + '-' + dependency.majorVersion + '.' + dependency.minorVersion; @@ -370,7 +370,7 @@ export class CoreH5PFileStorage { * Get path to the folder containing H5P files extracted from packages. * * @param siteId The site ID. - * @return Folder path. + * @returns Folder path. */ getExternalH5PFolderPath(siteId: string): string { return CorePath.concatenatePaths(CoreFile.getSiteFolder(siteId), 'h5p'); @@ -380,7 +380,7 @@ export class CoreH5PFileStorage { * Get libraries folder path. * * @param siteId The site ID. - * @return Folder path. + * @returns Folder path. */ getLibrariesFolderPath(siteId: string): string { return CorePath.concatenatePaths(this.getExternalH5PFolderPath(siteId), 'libraries'); @@ -392,7 +392,7 @@ export class CoreH5PFileStorage { * @param libraryData The library data. * @param siteId The site ID. * @param folderName Folder name. If not provided, it will be calculated. - * @return Folder path. + * @returns Folder path. */ getLibraryFolderPath( libraryData: CoreH5PLibraryBasicData | CoreH5PContentMainLibraryData, @@ -412,7 +412,7 @@ export class CoreH5PFileStorage { * @param contentPath Path to the current content folder (tmp). * @param folderName Name to put to the content folder. * @param siteId Site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveContent(contentPath: string, folderName: string, siteId: string): Promise { const folderPath = this.getContentFolderPath(folderName, siteId); @@ -429,7 +429,7 @@ export class CoreH5PFileStorage { * * @param libraryData Library data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveLibrary(libraryData: CoreH5PLibraryBeingSaved, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/core/features/h5p/classes/framework.ts b/src/core/features/h5p/classes/framework.ts index 8b20463dc..b3dfbe603 100644 --- a/src/core/features/h5p/classes/framework.ts +++ b/src/core/features/h5p/classes/framework.ts @@ -56,7 +56,7 @@ export class CoreH5PFramework { * * @param libraryIds Array of library ids. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async clearFilteredParameters(libraryIds: number[], siteId?: string): Promise { if (!libraryIds || !libraryIds.length) { @@ -76,7 +76,7 @@ export class CoreH5PFramework { * * @param libraryId Library identifier. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the removed entries. + * @returns Promise resolved with the removed entries. */ async deleteCachedAssets(libraryId: number, siteId?: string): Promise { @@ -103,7 +103,7 @@ export class CoreH5PFramework { * * @param id Content ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteContentData(id: number, siteId?: string): Promise { @@ -123,7 +123,7 @@ export class CoreH5PFramework { * * @param id Library ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteLibrary(id: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -136,7 +136,7 @@ export class CoreH5PFramework { * * @param libraryId Library ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteLibraryDependencies(libraryId: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -149,7 +149,7 @@ export class CoreH5PFramework { * * @param id Package ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteLibraryUsage(id: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -161,7 +161,7 @@ export class CoreH5PFramework { * Get all conent data from DB. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of content data. + * @returns Promise resolved with the list of content data. */ async getAllContentData(siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -174,7 +174,7 @@ export class CoreH5PFramework { * * @param id Content ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the content data. + * @returns Promise resolved with the content data. */ async getContentData(id: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -187,7 +187,7 @@ export class CoreH5PFramework { * * @param fileUrl H5P file URL. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the content data. + * @returns Promise resolved with the content data. */ async getContentDataByUrl(fileUrl: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -209,7 +209,7 @@ export class CoreH5PFramework { * Get the latest library version. * * @param machineName The library's machine name. - * @return Promise resolved with the latest library version data. + * @returns Promise resolved with the latest library version data. */ async getLatestLibraryVersion(machineName: string, siteId?: string): Promise { @@ -242,7 +242,7 @@ export class CoreH5PFramework { * @param majorVersion Major version number. * @param minorVersion Minor version number. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library data, rejected if not found. + * @returns Promise resolved with the library data, rejected if not found. */ protected async getLibrary( machineName: string, @@ -271,7 +271,7 @@ export class CoreH5PFramework { * * @param libraryData Library data. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library data, rejected if not found. + * @returns Promise resolved with the library data, rejected if not found. */ getLibraryByData(libraryData: CoreH5PLibraryBasicData, siteId?: string): Promise { return this.getLibrary(libraryData.machineName, libraryData.majorVersion, libraryData.minorVersion, siteId); @@ -282,7 +282,7 @@ export class CoreH5PFramework { * * @param id Library ID. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library data, rejected if not found. + * @returns Promise resolved with the library data, rejected if not found. */ async getLibraryById(id: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -299,7 +299,7 @@ export class CoreH5PFramework { * @param majorVersion Major version number. * @param minorVersion Minor version number. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library ID, null if not found. + * @returns Promise resolved with the library ID, null if not found. */ async getLibraryId( machineName: string, @@ -321,7 +321,7 @@ export class CoreH5PFramework { * * @param libraryData Library data. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library ID, null if not found. + * @returns Promise resolved with the library ID, null if not found. */ getLibraryIdByData(libraryData: CoreH5PLibraryBasicData, siteId?: string): Promise { return this.getLibraryId(libraryData.machineName, libraryData.majorVersion, libraryData.minorVersion, siteId); @@ -332,7 +332,7 @@ export class CoreH5PFramework { * * @param name Identifier for the setting. * @param defaultValue Optional default value if settings is not set. - * @return Return the value for this display option. + * @returns Return the value for this display option. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars getOption(name: string, defaultValue: unknown): unknown { @@ -345,7 +345,7 @@ export class CoreH5PFramework { * * @param permission Permission to check. * @param id H5P package id. - * @return Whether the user has permission to execute an action. + * @returns Whether the user has permission to execute an action. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars hasPermission(permission: number, id: number): boolean { @@ -357,7 +357,7 @@ export class CoreH5PFramework { * Determines if content slug is used. * * @param slug The content slug. - * @return Whether the content slug is used + * @returns Whether the content slug is used */ // eslint-disable-next-line @typescript-eslint/no-unused-vars isContentSlugAvailable(slug: string): boolean { @@ -370,7 +370,7 @@ export class CoreH5PFramework { * * @param library Library to check. * @param dbData Installed library. If not supplied it will be calculated. - * @return Promise resolved with boolean: whether it's a patched library. + * @returns Promise resolved with boolean: whether it's a patched library. */ async isPatchedLibrary(library: CoreH5PLibraryBasicDataWithPatch, dbData?: CoreH5PLibraryParsedDBRecord): Promise { if (!dbData) { @@ -386,7 +386,7 @@ export class CoreH5PFramework { * @param libraryData Library data as found in library.json files. * @param key Key that should be found in libraryData. * @param searchParam The library parameter (Default: 'path'). - * @return Library parameter values separated by ', ' + * @returns Library parameter values separated by ', ' */ libraryParameterValuesToCsv(libraryData: CoreH5PLibraryBeingSaved, key: string, searchParam: string = 'path'): string { if (libraryData[key] !== undefined) { @@ -410,7 +410,7 @@ export class CoreH5PFramework { * Load addon libraries. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the addon libraries. + * @returns Promise resolved with the addon libraries. */ async loadAddons(siteId?: string): Promise { @@ -443,7 +443,7 @@ export class CoreH5PFramework { * @param id Content ID. * @param fileUrl H5P file URL. Required if id is not provided. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the content data. + * @returns Promise resolved with the content data. */ async loadContent(id?: number, fileUrl?: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -500,7 +500,7 @@ export class CoreH5PFramework { * * @param id Content ID. * @param type The dependency type. - * @return Content dependencies, indexed by machine name. + * @returns Content dependencies, indexed by machine name. */ async loadContentDependencies( id: number, @@ -549,7 +549,7 @@ export class CoreH5PFramework { * @param majorVersion The library's major version. * @param minorVersion The library's minor version. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the library data. + * @returns Promise resolved with the library data. */ async loadLibrary( machineName: string, @@ -613,7 +613,7 @@ export class CoreH5PFramework { * Parse library addon data. * * @param library Library addon data. - * @return Parsed library. + * @returns Parsed library. */ parseLibAddonData(library: LibraryAddonDBData): CoreH5PLibraryAddonData { const parsedLib = library; @@ -626,7 +626,7 @@ export class CoreH5PFramework { * Parse library DB data. * * @param library Library DB data. - * @return Parsed library. + * @returns Parsed library. */ protected parseLibDBData(library: CoreH5PLibraryDBRecord): CoreH5PLibraryParsedDBRecord { return Object.assign(library, { @@ -641,10 +641,10 @@ export class CoreH5PFramework { * * @param contentId Content ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - async resetContentUserData(conentId: number, siteId?: string): Promise { + async resetContentUserData(contentId: number, siteId?: string): Promise { // Currently, we do not store user data for a content. } @@ -652,11 +652,11 @@ export class CoreH5PFramework { * Stores hash keys for cached assets, aggregated JavaScripts and stylesheets, and connects it to libraries so that we * know which cache file to delete when a library is updated. * - * @param key Hash key for the given libraries. - * @param libraries List of dependencies used to create the key. + * @param hash Hash key for the given libraries. + * @param dependencies List of dependencies used to create the key. * @param folderName The name of the folder that contains the H5P. * @param siteId The site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveCachedAssets( hash: string, @@ -683,7 +683,7 @@ export class CoreH5PFramework { * * @param libraryData Library data to save. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveLibraryData(libraryData: CoreH5PLibraryBeingSaved, siteId?: string): Promise { // Some special properties needs some checking and converting before they can be saved. @@ -746,9 +746,9 @@ export class CoreH5PFramework { * * @param library Library data for the library we're saving dependencies for. * @param dependencies List of dependencies as associative arrays containing machineName, majorVersion, minorVersion. - * @param dependencytype The type of dependency. + * @param dependencyType The type of dependency. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveLibraryDependencies( library: CoreH5PLibraryBeingSaved, @@ -788,7 +788,7 @@ export class CoreH5PFramework { * @param id Id identifying the package. * @param librariesInUse List of libraries the content uses. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveLibraryUsage( id: number, @@ -835,7 +835,7 @@ export class CoreH5PFramework { * @param folderName The name of the folder that contains the H5P. * @param fileUrl The online URL of the package. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with content ID. + * @returns Promise resolved with content ID. */ async updateContent(content: CoreH5PContentBeingSaved, folderName: string, fileUrl: string, siteId?: string): Promise { diff --git a/src/core/features/h5p/classes/helper.ts b/src/core/features/h5p/classes/helper.ts index 94bbf1602..28a8a0fb9 100644 --- a/src/core/features/h5p/classes/helper.ts +++ b/src/core/features/h5p/classes/helper.ts @@ -48,7 +48,7 @@ export class CoreH5PHelper { * Convert the number representation of display options into an object. * * @param displayOptions Number representing display options. - * @return Object with display options. + * @returns Object with display options. */ static decodeDisplayOptions(displayOptions: number): CoreH5PDisplayOptions { const displayOptionsObject = CoreH5P.h5pCore.getDisplayOptionsAsObject(displayOptions); @@ -70,7 +70,7 @@ export class CoreH5PHelper { /** * Get the core H5P assets, including all core H5P JavaScript and CSS. * - * @return Array core H5P assets. + * @returns Array core H5P assets. */ static async getCoreAssets( siteId?: string, @@ -109,7 +109,7 @@ export class CoreH5PHelper { * Get the settings needed by the H5P library. * * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the settings. + * @returns Promise resolved with the settings. */ static async getCoreSettings(siteId?: string): Promise { @@ -167,7 +167,7 @@ export class CoreH5PHelper { * @param file The file entry of the downloaded file. * @param siteId Site ID. If not defined, current site. * @param onProgress Function to call on progress. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ static async saveH5P(fileUrl: string, file: FileEntry, siteId?: string, onProgress?: CoreH5PSaveOnProgress): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -187,7 +187,7 @@ export class CoreH5PHelper { * @param file The file entry of the downloaded file. * @param siteId Site ID. If not defined, current site. * @param onProgress Function to call on progress. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected static async performSave( fileUrl: string, diff --git a/src/core/features/h5p/classes/metadata.ts b/src/core/features/h5p/classes/metadata.ts index b0639e57d..17827135d 100644 --- a/src/core/features/h5p/classes/metadata.ts +++ b/src/core/features/h5p/classes/metadata.ts @@ -24,7 +24,7 @@ export class CoreH5PMetadata { * Here we are converting these to booleans, and also doing JSON encoding. * * @param metadataSettings Settings. - * @return Stringified settings. + * @returns Stringified settings. */ static boolifyAndEncodeSettings(metadataSettings: CoreH5PLibraryMetadataSettings | string): string { if (typeof metadataSettings == 'string') { diff --git a/src/core/features/h5p/classes/player.ts b/src/core/features/h5p/classes/player.ts index bcdd7dad2..6973f1f52 100644 --- a/src/core/features/h5p/classes/player.ts +++ b/src/core/features/h5p/classes/player.ts @@ -40,7 +40,7 @@ export class CoreH5PPlayer { * @param fileUrl File URL. * @param displayOptions Display options. * @param component Component to send xAPI events to. - * @return URL. + * @returns URL. */ calculateOnlinePlayerUrl(siteUrl: string, fileUrl: string, displayOptions?: CoreH5PDisplayOptions, component?: string): string { fileUrl = CoreH5P.treatH5PUrl(fileUrl, siteUrl); @@ -63,7 +63,7 @@ export class CoreH5PPlayer { * @param content Content data. * @param embedType Embed type. The app will always use 'iframe'. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the URL of the index file. + * @returns Promise resolved with the URL of the index file. */ async createContentIndex( id: number, @@ -151,7 +151,7 @@ export class CoreH5PPlayer { /** * Delete all content indexes of all sites from filesystem. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteAllContentIndexes(): Promise { const siteIds = await CoreSites.getSitesIds(); @@ -163,7 +163,7 @@ export class CoreH5PPlayer { * Delete all content indexes for a certain site from filesystem. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteAllContentIndexesForSite(siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -184,7 +184,7 @@ export class CoreH5PPlayer { * * @param fileUrl File URL. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteContentByUrl(fileUrl: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -205,7 +205,7 @@ export class CoreH5PPlayer { * @param content Content data. * @param embedType Embed type. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the assets. + * @returns Promise resolved with the assets. */ protected async getAssets( id: number, @@ -250,7 +250,7 @@ export class CoreH5PPlayer { * Get the identifier for the H5P content. This identifier is different than the ID stored in the DB. * * @param id Package ID. - * @return Content identifier. + * @returns Content identifier. */ protected getContentId(id: number): string { return 'cid-' + id; @@ -264,7 +264,7 @@ export class CoreH5PPlayer { * @param component Component to send xAPI events to. * @param contextId Context ID where the H5P is. Required for tracking. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the file URL if exists, rejected otherwise. + * @returns Promise resolved with the file URL if exists, rejected otherwise. */ async getContentIndexFileUrl( fileUrl: string, @@ -300,7 +300,7 @@ export class CoreH5PPlayer { * @param id Content id. * @param folderName Name of the folder of the content. * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ protected async getDependencyFiles(id: number, folderName: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -319,7 +319,7 @@ export class CoreH5PPlayer { * Get display options from a URL params. * * @param params URL params. - * @return Display options as object. + * @returns Display options as object. */ getDisplayOptionsFromUrlParams(params?: {[name: string]: string}): CoreH5PDisplayOptions { const displayOptions: CoreH5PDisplayOptions = {}; @@ -346,7 +346,7 @@ export class CoreH5PPlayer { * @param siteUrl The site URL. * @param h5pUrl The URL of the .h5p file. * @param embedEnabled Whether the option to embed the H5P content is enabled. - * @return The HTML code to reuse this H5P content in a different place. + * @returns The HTML code to reuse this H5P content in a different place. */ protected getEmbedCode(siteUrl: string, h5pUrl: string, embedEnabled?: boolean): string { if (!embedEnabled) { @@ -361,7 +361,7 @@ export class CoreH5PPlayer { * * @param siteUrl The site URL. * @param h5pUrl The URL of the .h5p file. - * @return The embed URL. + * @returns The embed URL. */ protected getEmbedUrl(siteUrl: string, h5pUrl: string): string { return CorePath.concatenatePaths(siteUrl, '/h5p/embed.php') + '?url=' + h5pUrl; @@ -370,7 +370,7 @@ export class CoreH5PPlayer { /** * Resizing script for settings. * - * @return The HTML code with the resize script. + * @returns The HTML code with the resize script. */ protected getResizeCode(): string { return ''; @@ -379,7 +379,7 @@ export class CoreH5PPlayer { /** * Get the URL to the resizer script. * - * @return URL. + * @returns URL. */ getResizerScriptUrl(): string { return CorePath.concatenatePaths(this.h5pCore.h5pFS.getCoreH5PPath(), 'js/h5p-resizer.js'); @@ -389,7 +389,7 @@ export class CoreH5PPlayer { * Get online player URL params from display options. * * @param options Display options. - * @return Object with URL params. + * @returns Object with URL params. */ getUrlParamsFromDisplayOptions(options?: CoreH5PDisplayOptions): {[name: string]: string} { const params: {[name: string]: string} = {}; diff --git a/src/core/features/h5p/classes/storage.ts b/src/core/features/h5p/classes/storage.ts index 7539e8e80..33a8a471e 100644 --- a/src/core/features/h5p/classes/storage.ts +++ b/src/core/features/h5p/classes/storage.ts @@ -42,7 +42,7 @@ export class CoreH5PStorage { * @param librariesJsonData Data about libraries. * @param folderName Name of the folder of the H5P package. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async saveLibraries(librariesJsonData: CoreH5PLibrariesJsonData, folderName: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -153,11 +153,12 @@ export class CoreH5PStorage { /** * Save content data in DB and clear cache. * - * @param content Content to save. + * @param data Content to save. * @param folderName The name of the folder that contains the H5P. * @param fileUrl The online URL of the package. + * @param skipContent Skip content. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the content data. + * @returns Promise resolved with the content data. */ async savePackage( data: CoreH5PMainJSONFilesData, diff --git a/src/core/features/h5p/classes/validator.ts b/src/core/features/h5p/classes/validator.ts index cc0d2ec5c..cabe33d35 100644 --- a/src/core/features/h5p/classes/validator.ts +++ b/src/core/features/h5p/classes/validator.ts @@ -35,7 +35,7 @@ export class CoreH5PValidator { * * @param libDir Directory where the library files are. * @param libPath Path to the directory where the library files are. - * @return Promise resolved with library data. + * @returns Promise resolved with library data. */ protected async getLibraryData(libDir: DirectoryEntry, libPath: string): Promise { @@ -59,7 +59,7 @@ export class CoreH5PValidator { * Use the dependency declarations to find any missing libraries. * * @param libraries Libraries to check. - * @return Promise resolved with the missing dependencies. + * @returns Promise resolved with the missing dependencies. */ protected getMissingLibraries(libraries: CoreH5PLibrariesJsonData): Record { const missing: Record = {}; @@ -85,7 +85,7 @@ export class CoreH5PValidator { * @param dependencies Dependencies to check. * @param library Library that has these dependencies. * @param libraries Libraries. - * @return Promise resolved with missing dependencies. + * @returns Promise resolved with missing dependencies. */ protected getMissingDependencies( dependencies: CoreH5PLibraryBasicData[], @@ -111,7 +111,7 @@ export class CoreH5PValidator { * * @param packagePath The path to the package folder. * @param entries List of files and directories in the root of the package folder. - * @retun Promise resolved with the libraries data. + * @returns Promise resolved with the libraries data. */ protected async getPackageLibrariesData( packagePath: string, @@ -141,7 +141,7 @@ export class CoreH5PValidator { * Check if the library has an icon file. * * @param libPath Path to the directory where the library files are. - * @return Promise resolved with boolean: whether the library has an icon file. + * @returns Promise resolved with boolean: whether the library has an icon file. */ protected async libraryHasIcon(libPath: string): Promise { const path = CorePath.concatenatePaths(libPath, 'icon.svg'); @@ -164,7 +164,7 @@ export class CoreH5PValidator { * @param packagePath The path to the package folder. * @param entries List of files and directories in the root of the package folder. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async processH5PFiles( packagePath: string, @@ -216,7 +216,7 @@ export class CoreH5PValidator { * Read content.json file and return its parsed contents. * * @param packagePath The path to the package folder. - * @return Promise resolved with the parsed file contents. + * @returns Promise resolved with the parsed file contents. */ protected readH5PContentJsonFile(packagePath: string): Promise { const path = CorePath.concatenatePaths(packagePath, 'content/content.json'); @@ -228,7 +228,7 @@ export class CoreH5PValidator { * Read h5p.json file and return its parsed contents. * * @param packagePath The path to the package folder. - * @return Promise resolved with the parsed file contents. + * @returns Promise resolved with the parsed file contents. */ protected readH5PJsonFile(packagePath: string): Promise { const path = CorePath.concatenatePaths(packagePath, 'h5p.json'); @@ -240,7 +240,7 @@ export class CoreH5PValidator { * Read library.json file and return its parsed contents. * * @param libPath Path to the directory where the library files are. - * @return Promise resolved with the parsed file contents. + * @returns Promise resolved with the parsed file contents. */ protected readLibraryJsonFile(libPath: string): Promise { const path = CorePath.concatenatePaths(libPath, 'library.json'); @@ -252,7 +252,7 @@ export class CoreH5PValidator { * Read all language files and return their contents indexed by language code. * * @param libPath Path to the directory where the library files are. - * @return Promise resolved with the language data. + * @returns Promise resolved with the language data. */ protected async readLibraryLanguageFiles(libPath: string): Promise { try { @@ -289,7 +289,7 @@ export class CoreH5PValidator { * Read semantics.json file and return its parsed contents. * * @param libPath Path to the directory where the library files are. - * @return Promise resolved with the parsed file contents. + * @returns Promise resolved with the parsed file contents. */ protected async readLibrarySemanticsFile(libPath: string): Promise { try { 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 f3e5ea549..0bd61fc6b 100644 --- a/src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts +++ b/src/core/features/h5p/components/h5p-iframe/h5p-iframe.ts @@ -94,7 +94,7 @@ export class CoreH5PIframeComponent implements OnChanges, OnDestroy { /** * Play the H5P. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async play(): Promise { let localUrl: string | undefined; @@ -147,7 +147,7 @@ export class CoreH5PIframeComponent implements OnChanges, OnDestroy { /** * Get the local URL of the package. * - * @return Promise resolved with the local URL. + * @returns Promise resolved with the local URL. */ protected async getLocalUrl(): Promise { try { @@ -198,7 +198,7 @@ export class CoreH5PIframeComponent implements OnChanges, OnDestroy { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.subscription?.unsubscribe(); diff --git a/src/core/features/h5p/components/h5p-player/h5p-player.ts b/src/core/features/h5p/components/h5p-player/h5p-player.ts index 2d727e8af..87b85e40a 100644 --- a/src/core/features/h5p/components/h5p-player/h5p-player.ts +++ b/src/core/features/h5p/components/h5p-player/h5p-player.ts @@ -66,7 +66,7 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.checkCanDownload(); @@ -109,7 +109,7 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy { /** * Download the package. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async download(): Promise { if (!CoreNetwork.isOnline()) { @@ -141,7 +141,7 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy { /** * Download the H5P in background if the size is low. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async attemptDownloadInBg(): Promise { if (!this.urlParams || !this.src || !this.siteCanDownload || !CoreH5P.canGetTrustedH5PFileInSite() || @@ -161,7 +161,7 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy { /** * Check if the package can be downloaded. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async checkCanDownload(): Promise { this.observer && this.observer.off(); @@ -191,7 +191,7 @@ export class CoreH5PPlayerComponent implements OnInit, OnChanges, OnDestroy { /** * Calculate state of the file. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async calculateState(): Promise { this.calculating$.next(true); diff --git a/src/core/features/h5p/services/h5p.ts b/src/core/features/h5p/services/h5p.ts index 023d76988..0d0fe9c74 100644 --- a/src/core/features/h5p/services/h5p.ts +++ b/src/core/features/h5p/services/h5p.ts @@ -59,7 +59,7 @@ export class CoreH5PProvider { * Returns whether or not WS to get trusted H5P file is available. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if ws is available, false otherwise. + * @returns Promise resolved with true if ws is available, false otherwise. * @since 3.8 */ async canGetTrustedH5PFile(siteId?: string): Promise { @@ -72,7 +72,7 @@ export class CoreH5PProvider { * Returns whether or not WS to get trusted H5P file is available in a certain site. * * @param site Site. If not defined, current site. - * @return Promise resolved with true if ws is available, false otherwise. + * @returns Promise resolved with true if ws is available, false otherwise. * @since 3.8 */ canGetTrustedH5PFileInSite(site?: CoreSite): boolean { @@ -88,7 +88,7 @@ export class CoreH5PProvider { * @param options Options. * @param ignoreCache Whether to ignore cache. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the file data. + * @returns Promise resolved with the file data. */ async getTrustedH5PFile( url: string, @@ -135,7 +135,7 @@ export class CoreH5PProvider { * Get cache key for trusted H5P file WS calls. * * @param url The file URL. - * @return Cache key. + * @returns Cache key. */ protected getTrustedH5PFileCacheKey(url: string): string { return this.getTrustedH5PFilePrefixCacheKey() + url; @@ -144,7 +144,7 @@ export class CoreH5PProvider { /** * Get prefixed cache key for trusted H5P file WS calls. * - * @return Cache key. + * @returns Cache key. */ protected getTrustedH5PFilePrefixCacheKey(): string { return this.ROOT_CACHE_KEY + 'trustedH5PFile:'; @@ -154,7 +154,7 @@ export class CoreH5PProvider { * Invalidates all trusted H5P file WS calls. * * @param siteId Site ID (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllGetTrustedH5PFile(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -167,7 +167,7 @@ export class CoreH5PProvider { * * @param url The URL of the file. * @param siteId Site ID (empty for current site). - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateGetTrustedH5PFile(url: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -179,7 +179,7 @@ export class CoreH5PProvider { * Check whether H5P offline is disabled. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether is disabled. + * @returns Promise resolved with boolean: whether is disabled. */ async isOfflineDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -191,7 +191,7 @@ export class CoreH5PProvider { * Check whether H5P offline is disabled. * * @param site Site instance. If not defined, current site. - * @return Whether is disabled. + * @returns Whether is disabled. */ isOfflineDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -204,7 +204,7 @@ export class CoreH5PProvider { * * @param url H5P file URL. * @param siteUrl Site URL. - * @return Treated url. + * @returns Treated url. */ treatH5PUrl(url: string, siteUrl: string): string { if (url.indexOf(CorePath.concatenatePaths(siteUrl, '/webservice/pluginfile.php')) === 0) { diff --git a/src/core/features/h5p/services/handlers/pluginfile.ts b/src/core/features/h5p/services/handlers/pluginfile.ts index 48723ae70..aff8d9095 100644 --- a/src/core/features/h5p/services/handlers/pluginfile.ts +++ b/src/core/features/h5p/services/handlers/pluginfile.ts @@ -41,7 +41,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * @param fileUrl The file URL used to download the file. * @param path The path of the deleted file. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fileDeleted(fileUrl: string, path: string, siteId?: string): Promise { // If an h5p file is deleted, remove the contents folder. @@ -53,7 +53,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * * @param file The file data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the file to use. Rejected if cannot download. + * @returns Promise resolved with the file to use. Rejected if cannot download. */ async getDownloadableFile(file: CoreWSFile, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -73,7 +73,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * CoreFilepoolProvider.extractDownloadableFilesFromHtml. * * @param container Container where to get the URLs from. - * @return List of URLs. + * @returns List of URLs. */ getDownloadableFilesFromHTML(container: HTMLElement): string[] { const iframes = Array.from(container.querySelectorAll('iframe.h5p-iframe')); @@ -95,7 +95,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * * @param file The file data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the size. + * @returns Promise resolved with the size. */ async getFileSize(file: CoreWSFile, siteId?: string): Promise { try { @@ -115,7 +115,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return CoreH5P.canGetTrustedH5PFileInSite(); @@ -126,7 +126,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * * @param file The file data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with a boolean and a reason why it isn't downloadable if needed. + * @returns Promise resolved with a boolean and a reason why it isn't downloadable if needed. */ async isFileDownloadable(file: CoreWSFile, siteId?: string): Promise { const offlineDisabled = await CoreH5P.isOfflineDisabled(siteId); @@ -147,7 +147,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * Check whether the file should be treated by this handler. It is used in functions where the component isn't used. * * @param file The file data. - * @return Whether the file should be treated by this handler. + * @returns Whether the file should be treated by this handler. */ shouldHandleFile(file: CoreWSFile): boolean { return CoreMimetypeUtils.guessExtensionFromUrl(CoreFileHelper.getFileUrl(file)) == 'h5p'; @@ -160,7 +160,7 @@ export class CoreH5PPluginFileHandlerService implements CorePluginFileHandler { * @param file The file entry of the downloaded file. * @param siteId Site ID. If not defined, current site. * @param onProgress Function to call on progress. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ treatDownloadedFile( fileUrl: string, diff --git a/src/core/features/login/components/sites/sites.ts b/src/core/features/login/components/sites/sites.ts index 899b49741..bcd7be96d 100644 --- a/src/core/features/login/components/sites/sites.ts +++ b/src/core/features/login/components/sites/sites.ts @@ -71,7 +71,7 @@ export class CoreLoginSitesComponent implements OnInit { * * @param event Click event. * @param site Site to delete. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteSite(event: Event, site: CoreSiteBasicInfo): Promise { event.stopPropagation(); @@ -101,7 +101,7 @@ export class CoreLoginSitesComponent implements OnInit { * * @param event Click event. * @param siteId The site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async login(event: Event, siteId: string): Promise { await this.close(event, true); diff --git a/src/core/features/login/guards/has-sites.ts b/src/core/features/login/guards/has-sites.ts index 7ca80574e..8a8a6ef20 100644 --- a/src/core/features/login/guards/has-sites.ts +++ b/src/core/features/login/guards/has-sites.ts @@ -40,6 +40,8 @@ export class CoreLoginHasSitesGuard implements CanActivate, CanLoad { /** * Check if the user has any sites stored. + * + * @returns Promise resolved with true if it's not redirected or the redirection route. */ private async guard(): Promise { const sites = await CoreUtils.ignoreErrors(CoreSites.getSites(), []); diff --git a/src/core/features/login/pages/credentials/credentials.ts b/src/core/features/login/pages/credentials/credentials.ts index 3381b199d..c5c69bfc3 100644 --- a/src/core/features/login/pages/credentials/credentials.ts +++ b/src/core/features/login/pages/credentials/credentials.ts @@ -74,7 +74,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy { ) {} /** - * Initialize the component. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -148,7 +148,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy { * * @param siteUrl Site URL to check. * @param onInit Whether the check site is done when initializing the page. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async checkSite(siteUrl: string, onInit = false): Promise { this.pageLoaded = false; @@ -229,7 +229,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy { * Tries to authenticate the user. * * @param e Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async login(e?: Event): Promise { if (e) { @@ -342,7 +342,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy { /** * Show instructions and scan QR code. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async showInstructionsAndScanQR(): Promise { try { diff --git a/src/core/features/login/pages/email-signup/email-signup.ts b/src/core/features/login/pages/email-signup/email-signup.ts index 87d674d55..e4fdd4a6c 100644 --- a/src/core/features/login/pages/email-signup/email-signup.ts +++ b/src/core/features/login/pages/email-signup/email-signup.ts @@ -155,7 +155,7 @@ export class CoreLoginEmailSignupPage implements OnInit { /** * Fetch the required data from the server. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchData(): Promise { try { @@ -192,7 +192,7 @@ export class CoreLoginEmailSignupPage implements OnInit { /** * Get signup settings from server. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getSignupSettings(): Promise { this.settings = await CoreWS.callAjax( @@ -230,7 +230,7 @@ export class CoreLoginEmailSignupPage implements OnInit { /** * Treat the site config, checking if it's valid and extracting the data we're interested in. * - * @return True if success. + * @returns True if success. */ protected treatSiteConfig(): boolean { if (this.siteConfig?.registerauth == 'email' && !CoreLoginHelper.isEmailSignupDisabled(this.siteConfig)) { @@ -259,7 +259,7 @@ export class CoreLoginEmailSignupPage implements OnInit { * Create account. * * @param e Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async create(e: Event): Promise { e.preventDefault(); @@ -355,7 +355,7 @@ export class CoreLoginEmailSignupPage implements OnInit { * Escape mail to avoid special characters to be treated as a RegExp. * * @param text Initial mail. - * @return Escaped mail. + * @returns Escaped mail. */ escapeMail(text: string): string { return CoreTextUtils.escapeForRegex(text); @@ -382,7 +382,7 @@ export class CoreLoginEmailSignupPage implements OnInit { * Verify Age. * * @param e Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async verifyAge(e: Event): Promise { e.preventDefault(); diff --git a/src/core/features/login/pages/reconnect/reconnect.ts b/src/core/features/login/pages/reconnect/reconnect.ts index d5089499b..973eeaee7 100644 --- a/src/core/features/login/pages/reconnect/reconnect.ts +++ b/src/core/features/login/pages/reconnect/reconnect.ts @@ -82,7 +82,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy { } /** - * Initialize the component. + * @inheritdoc */ async ngOnInit(): Promise { try { @@ -335,7 +335,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy { /** * Show instructions and scan QR code. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async showInstructionsAndScanQR(): Promise { try { diff --git a/src/core/features/login/pages/site-policy/site-policy.ts b/src/core/features/login/pages/site-policy/site-policy.ts index 180905155..0d7f20d70 100644 --- a/src/core/features/login/pages/site-policy/site-policy.ts +++ b/src/core/features/login/pages/site-policy/site-policy.ts @@ -70,7 +70,7 @@ export class CoreLoginSitePolicyPage implements OnInit { /** * Fetch the site policy URL. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fetchSitePolicy(): Promise { try { @@ -99,7 +99,7 @@ export class CoreLoginSitePolicyPage implements OnInit { /** * Cancel. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async cancel(): Promise { await CoreUtils.ignoreErrors(CoreSites.logout()); @@ -110,7 +110,7 @@ export class CoreLoginSitePolicyPage implements OnInit { /** * Accept the site policy. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async accept(): Promise { const modal = await CoreDomUtils.showModalLoading('core.sending', true); diff --git a/src/core/features/login/pages/site/site.ts b/src/core/features/login/pages/site/site.ts index 864283665..4388745aa 100644 --- a/src/core/features/login/pages/site/site.ts +++ b/src/core/features/login/pages/site/site.ts @@ -134,7 +134,7 @@ export class CoreLoginSitePage implements OnInit { /** * Initialize the site selector. * - * @return URL of the first site. + * @returns URL of the first site. */ protected initSiteSelector(): string { this.fixedSites = this.extendCoreLoginSiteInfo( CoreLoginHelper.getFixedSites()); @@ -153,7 +153,7 @@ export class CoreLoginSitePage implements OnInit { /** * Initialize and show onboarding if needed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initOnboarding(): Promise { const onboardingDone = await CoreConfig.get(CoreLoginHelperProvider.ONBOARDING_DONE, false); @@ -168,7 +168,7 @@ export class CoreLoginSitePage implements OnInit { * Extend info of Login Site Info to get UI tweaks. * * @param sites Sites list. - * @return Sites list with extended info. + * @returns Sites list with extended info. */ protected extendCoreLoginSiteInfo(sites: CoreLoginSiteInfoExtended[]): CoreLoginSiteInfoExtended[] { return sites.map((site) => { @@ -199,7 +199,7 @@ export class CoreLoginSitePage implements OnInit { /** * Validate Url. * - * @return {ValidatorFn} Validation results. + * @returns {ValidatorFn} Validation results. */ protected moodleUrlValidator(): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => { @@ -244,7 +244,7 @@ export class CoreLoginSitePage implements OnInit { * @param e Event. * @param url The URL to connect to. * @param foundSite The site clicked, if any, from the found sites list. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async connect(e: Event, url: string, foundSite?: CoreLoginSiteInfoExtended): Promise { e.preventDefault(); @@ -316,7 +316,7 @@ export class CoreLoginSitePage implements OnInit { * Authenticate in a demo site. * * @param siteData Site data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loginDemoSite(siteData: CoreSitesDemoSiteData): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -348,7 +348,7 @@ export class CoreLoginSitePage implements OnInit { * @param response Response obtained from the site check request. * @param foundSite The site clicked, if any, from the found sites list. * - * @return Promise resolved after logging in. + * @returns Promise resolved after logging in. */ protected async login(response: CoreSiteCheckResponse, foundSite?: CoreLoginSiteInfoExtended): Promise { try { @@ -435,7 +435,7 @@ export class CoreLoginSitePage implements OnInit { ), ].filter(button => !!button); - // @TODO: Remove CoreSite.MINIMUM_MOODLE_VERSION, not used on translations since 3.9.0. + // @todo Remove CoreSite.MINIMUM_MOODLE_VERSION, not used on translations since 3.9.0. const alertElement = await CoreDomUtils.showAlertWithOptions({ header: errorTitle ?? ( siteExists @@ -501,7 +501,7 @@ export class CoreLoginSitePage implements OnInit { /** * Show instructions and scan QR code. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async showInstructionsAndScanQR(): Promise { try { @@ -516,7 +516,7 @@ export class CoreLoginSitePage implements OnInit { /** * Scan a QR code and put its text in the URL input. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async scanQR(): Promise { // Scan for a QR code. @@ -567,7 +567,7 @@ export class CoreLoginSitePage implements OnInit { * * @param customURL Custom URL handled. * @param error Error data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async treatErrorInAuthenticationCustomURL(customURL: string, error: CoreCustomURLSchemesHandleError): Promise { const siteUrl = error.data?.siteUrl || ''; diff --git a/src/core/features/login/pages/sites/sites.ts b/src/core/features/login/pages/sites/sites.ts index 6184e717e..4a75649b2 100644 --- a/src/core/features/login/pages/sites/sites.ts +++ b/src/core/features/login/pages/sites/sites.ts @@ -69,7 +69,7 @@ export class CoreLoginSitesPage implements OnInit { * * @param event Click event. * @param site Site to delete. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteSite(event: Event, site: CoreSiteBasicInfo): Promise { event.stopPropagation(); @@ -104,7 +104,7 @@ export class CoreLoginSitesPage implements OnInit { * * @param event Click event. * @param siteId The site ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async login(event: Event, siteId: string): Promise { event.preventDefault(); diff --git a/src/core/features/login/services/login-helper.ts b/src/core/features/login/services/login-helper.ts index 1a02f0e80..153bbe1d0 100644 --- a/src/core/features/login/services/login-helper.ts +++ b/src/core/features/login/services/login-helper.ts @@ -78,7 +78,7 @@ export class CoreLoginHelperProvider { * Accept site policy. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success, rejected if failure. + * @returns Promise resolved if success, rejected if failure. */ async acceptSitePolicy(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -109,7 +109,7 @@ export class CoreLoginHelperProvider { * Check if a site allows requesting a password reset through the app. * * @param siteUrl URL of the site. - * @return Promise resolved with boolean: whether can be done through the app. + * @returns Promise resolved with boolean: whether can be done through the app. */ async canRequestPasswordReset(siteUrl: string): Promise { try { @@ -140,12 +140,12 @@ export class CoreLoginHelperProvider { /** * Show a confirm modal if needed and open a browser to perform SSO login. * - * @param siteurl URL of the site where the SSO login will be performed. + * @param siteUrl URL of the site where the SSO login will be performed. * @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. * @param service The service to use. If not defined, core service will be used. * @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used. * @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page. - * @return Promise resolved when done or if user cancelled. + * @returns Promise resolved when done or if user cancelled. */ async confirmAndOpenBrowserForSSOLogin( siteUrl: string, @@ -160,7 +160,7 @@ export class CoreLoginHelperProvider { if (showConfirmation) { try { await CoreDomUtils.showConfirm(Translate.instant('core.login.logininsiterequired')); - } catch (error) { + } catch { // User canceled, stop. return; } @@ -210,7 +210,7 @@ export class CoreLoginHelperProvider { * Format profile fields, filtering the ones that shouldn't be shown on signup and classifying them in categories. * * @param profileFields Profile fields to format. - * @return Categories with the fields to show in each one. + * @returns Categories with the fields to show in each one. */ formatProfileFieldsForSignup(profileFields?: AuthEmailSignupProfileField[]): AuthEmailSignupProfileFieldsCategory[] { if (!profileFields) { @@ -243,7 +243,7 @@ export class CoreLoginHelperProvider { * Get disabled features from a site public config. * * @param config Site public config. - * @return Disabled features. + * @returns Disabled features. */ getDisabledFeatures(config?: CoreSitePublicConfigResponse): string { const disabledFeatures = config?.tool_mobile_disabledfeatures; @@ -266,7 +266,7 @@ export class CoreLoginHelperProvider { * @param maxlengthMsg Code of the string for "too long" error. * @param minMsg Code of the string for min value error. * @param maxMsg Code of the string for max value error. - * @return Object with the errors. + * @returns Object with the errors. */ getErrorMessages( requiredMsg?: string, @@ -312,7 +312,7 @@ export class CoreLoginHelperProvider { * Get logo URL from a site public config. * * @param config Site public config. - * @return Logo URL. + * @returns Logo URL. */ getLogoUrl(config: CoreSitePublicConfigResponse): string | undefined { return !CoreConstants.CONFIG.forceLoginLogo && config ? (config.logourl || config.compactlogourl) : undefined; @@ -322,7 +322,7 @@ export class CoreLoginHelperProvider { * Returns the logout label of a site. * * @param site Site. If not defined, use current site. - * @return The string key. + * @returns The string key. */ getLogoutLabel(site?: CoreSite): string { site = site || CoreSites.getCurrentSite(); @@ -335,7 +335,7 @@ export class CoreLoginHelperProvider { * Get the OAuth ID of some URL params (if it has an OAuth ID). * * @param params Params. - * @return OAuth ID. + * @returns OAuth ID. */ getOAuthIdFromParams(params?: CoreUrlParams): number | undefined { return params && params.oauthsso !== undefined ? Number(params.oauthsso) : undefined; @@ -345,7 +345,7 @@ export class CoreLoginHelperProvider { * Get the site policy. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the site policy. + * @returns Promise resolved with the site policy. */ async getSitePolicy(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -376,7 +376,7 @@ export class CoreLoginHelperProvider { /** * Get fixed site or sites. * - * @return Fixed site or list of fixed sites. + * @returns Fixed site or list of fixed sites. */ getFixedSites(): string | CoreLoginSiteInfo[] { return CoreConstants.CONFIG.siteurl; @@ -387,7 +387,7 @@ export class CoreLoginHelperProvider { * * @param siteConfig Site's public config. * @param disabledFeatures List of disabled features already treated. If not provided it will be calculated. - * @return Valid identity providers. + * @returns Valid identity providers. */ getValidIdentityProviders(siteConfig?: CoreSitePublicConfigResponse, disabledFeatures?: string): CoreSiteIdentityProvider[] { if (!siteConfig) { @@ -422,7 +422,7 @@ export class CoreLoginHelperProvider { * * @param setRoot True to set the new page as root, false to add it to the stack. * @param showKeyboard Whether to show keyboard in the new page. Only if no fixed URL set. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async goToAddSite(setRoot = false, showKeyboard = false): Promise { let path = '/login/sites'; @@ -448,7 +448,7 @@ export class CoreLoginHelperProvider { * Get path and params to visit the route to add site. * * @param showKeyboard Whether to show keyboard in the new page. Only if no fixed URL set. - * @return Path and params. + * @returns Path and params. */ getAddSiteRouteInfo(showKeyboard?: boolean): [string, Params] { if (this.isFixedUrlSet()) { @@ -467,7 +467,7 @@ export class CoreLoginHelperProvider { * * @param page Page to open. * @param params Params of the page. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 3.9.5. Use CoreNavigator.navigateToLoginCredentials instead. */ async goToNoSitePage(page: string, params?: Params): Promise { @@ -482,7 +482,7 @@ export class CoreLoginHelperProvider { * @param params Params to pass to the page. * @param options Navigation options. * @param url URL to open once the main menu is loaded. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 3.9.5. Use CoreNavigator.navigateToSiteHome or CoreNavigator.navigateToSitePath instead. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -505,7 +505,7 @@ export class CoreLoginHelperProvider { * @param token User's token. * @param privateToken User's private token. * @param oauthId OAuth ID. Only if the authentication was using an OAuth method. - * @return Promise resolved when the user is authenticated with the token. + * @returns Promise resolved when the user is authenticated with the token. */ handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string, oauthId?: number): Promise { // Always create a new site to prevent overriding data if another user credentials were introduced. @@ -515,7 +515,7 @@ export class CoreLoginHelperProvider { /** * Check if the app is configured to use several fixed URLs. * - * @return Whether there are several fixed URLs. + * @returns Whether there are several fixed URLs. */ hasSeveralFixedSites(): boolean { return !!(CoreConstants.CONFIG.siteurl && Array.isArray(CoreConstants.CONFIG.siteurl) && @@ -527,7 +527,7 @@ export class CoreLoginHelperProvider { * * @param config Site public config. * @param disabledFeatures List of disabled features already treated. If not provided it will be calculated. - * @return Whether email signup is disabled. + * @returns Whether email signup is disabled. */ isEmailSignupDisabled(config?: CoreSitePublicConfigResponse, disabledFeatures?: string): boolean { return this.isFeatureDisabled('CoreLoginEmailSignup', config, disabledFeatures); @@ -539,7 +539,7 @@ export class CoreLoginHelperProvider { * @param feature Feature to check. * @param config Site public config. * @param disabledFeatures List of disabled features already treated. If not provided it will be calculated. - * @return Whether email signup is disabled. + * @returns Whether email signup is disabled. */ isFeatureDisabled(feature: string, config?: CoreSitePublicConfigResponse, disabledFeatures?: string): boolean { if (disabledFeatures === undefined) { @@ -554,7 +554,7 @@ export class CoreLoginHelperProvider { /** * Check if the app is configured to use a fixed URL (only 1). * - * @return Whether there is 1 fixed URL. + * @returns Whether there is 1 fixed URL. */ isFixedUrlSet(): boolean { if (Array.isArray(CoreConstants.CONFIG.siteurl)) { @@ -569,7 +569,7 @@ export class CoreLoginHelperProvider { * * @param config Site public config. * @param disabledFeatures List of disabled features already treated. If not provided it will be calculated. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isForgottenPasswordDisabled(config?: CoreSitePublicConfigResponse, disabledFeatures?: string): boolean { return this.isFeatureDisabled('NoDelegate_ForgottenPassword', config, disabledFeatures); @@ -579,7 +579,7 @@ export class CoreLoginHelperProvider { * Check if current site is logged out, triggering session expired event if it is. * * @param redirectData Data of the path/url to open once authenticated if logged out. If not defined, site initial page. - * @return True if user is logged out, false otherwise. + * @returns True if user is logged out, false otherwise. */ isSiteLoggedOut(redirectData?: CoreRedirectPayload): boolean { const site = CoreSites.getCurrentSite(); @@ -601,7 +601,7 @@ export class CoreLoginHelperProvider { * * @param siteUrl Site URL to check. * @param checkSiteFinder Whether to check site finder if needed. Defaults to true. - * @return Promise resolved with boolean: whether is one of the fixed sites. + * @returns Promise resolved with boolean: whether is one of the fixed sites. */ async isSiteUrlAllowed(siteUrl: string, checkSiteFinder = true): Promise { if (this.isFixedUrlSet()) { @@ -627,7 +627,7 @@ export class CoreLoginHelperProvider { * Check if SSO login should use an embedded browser. * * @param code Code to check. - * @return True if embedded browser, false othwerise. + * @returns True if embedded browser, false othwerise. */ isSSOEmbeddedBrowser(code: number): boolean { return code == CoreConstants.LOGIN_SSO_INAPP_CODE; @@ -637,7 +637,7 @@ export class CoreLoginHelperProvider { * Check if SSO login is needed based on code returned by the WS. * * @param code Code to check. - * @return True if SSO login is needed, false othwerise. + * @returns True if SSO login is needed, false othwerise. */ isSSOLoginNeeded(code: number): boolean { return code == CoreConstants.LOGIN_SSO_CODE || code == CoreConstants.LOGIN_SSO_INAPP_CODE; @@ -661,7 +661,7 @@ export class CoreLoginHelperProvider { * @param provider The identity provider. * @param launchUrl The URL to open for SSO. If not defined, tool/mobile launch URL will be used. * @param redirectData Data of the path/url to open once authenticated. If not defined, site initial page. - * @return True if success, false if error. + * @returns True if success, false if error. */ openBrowserForOAuthLogin( siteUrl: string, @@ -694,7 +694,7 @@ export class CoreLoginHelperProvider { /** * Open a browser to perform SSO login. * - * @param siteurl URL of the site where the SSO login will be performed. + * @param siteUrl URL of the site where the SSO login will be performed. * @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. * @param service The service to use. If not defined, core service will be used. * @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used. @@ -725,7 +725,7 @@ export class CoreLoginHelperProvider { * * @param siteUrl Site URL to construct change password URL. * @param error Error message. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openChangePassword(siteUrl: string, error: string): Promise { const alert = await CoreDomUtils.showAlert(Translate.instant('core.notice'), error, undefined, 3000); @@ -751,7 +751,7 @@ export class CoreLoginHelperProvider { * @param path The relative path of the URL to open. * @param alertMessage The key of the message to display before opening the in app browser. * @param invalidateCache Whether to invalidate site's cache (e.g. when the user is forced to change password). - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openInAppForEdit(siteId: string, path: string, alertMessage?: string, invalidateCache?: boolean): Promise { if (!siteId || siteId !== CoreSites.getCurrentSiteId()) { @@ -820,10 +820,9 @@ export class CoreLoginHelperProvider { * @param siteUrl URL of the site where the SSO login will be performed. * @param service The service to use. If not defined, core service will be used. * @param launchUrl The URL to open for SSO. If not defined, default tool mobile launch URL will be used. - * @param pageName Name of the page to go once authenticated. If not defined, site initial page. - * @param pageOptions Options of the page to go once authenticated. + * @param redirectData Redirect dataof the page to go once authenticated. If not defined, site initial page. * @param urlParams Other params to add to the URL. - * @return Login Url. + * @returns Login Url. */ prepareForSSOLogin( siteUrl: string, @@ -864,7 +863,7 @@ export class CoreLoginHelperProvider { * @param page Name of the page to load. * @param params Params to pass to the page. * @param siteId Site to load. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. * @deprecated since 3.9.5. Use CoreNavigator.navigateToSitePath instead. */ async redirect(page: string, params?: Params, siteId?: string): Promise { @@ -877,7 +876,7 @@ export class CoreLoginHelperProvider { * @param siteUrl URL of the site. * @param username Username to search. * @param email Email to search. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ requestPasswordReset(siteUrl: string, username?: string, email?: string): Promise { const params: Record = {}; @@ -897,7 +896,7 @@ export class CoreLoginHelperProvider { * Function that should be called when the session expires. Reserved for core use. * * @param data Data received by the SESSION_EXPIRED event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async sessionExpired(data: CoreEventSessionExpiredData & CoreEventSiteData): Promise { const siteId = data?.siteId; @@ -1020,7 +1019,7 @@ export class CoreLoginHelperProvider { * Check if a confirm should be shown to open a SSO authentication. * * @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. - * @return True if confirm modal should be shown, false otherwise. + * @returns True if confirm modal should be shown, false otherwise. */ shouldShowSSOConfirm(typeOfLogin: number): boolean { return !this.isSSOEmbeddedBrowser(typeOfLogin) && @@ -1127,7 +1126,7 @@ export class CoreLoginHelperProvider { * Check if confirmation email an be resent. * * @param siteUrl Site URL to check. - * @return Promise. + * @returns Promise. */ protected async canResendEmail(siteUrl: string): Promise { const modal = await CoreDomUtils.showModalLoading(); @@ -1201,7 +1200,7 @@ export class CoreLoginHelperProvider { * Convenient helper to validate a browser SSO login. * * @param url URL received, to be validated. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ async validateBrowserSSOLogin(url: string): Promise { // Split signature:::token @@ -1255,7 +1254,7 @@ export class CoreLoginHelperProvider { /** * Return whether the app is waiting for browser. * - * @return Whether the app is waiting for browser. + * @returns Whether the app is waiting for browser. */ isWaitingForBrowser(): boolean { return !!this.waitingForBrowser; @@ -1264,7 +1263,7 @@ export class CoreLoginHelperProvider { /** * Start waiting when opening a browser/IAB. * - * @return Promise resolved when the app is resumed. + * @returns Promise resolved when the app is resumed. */ async waitForBrowser(): Promise { if (!this.waitingForBrowser) { @@ -1285,7 +1284,7 @@ export class CoreLoginHelperProvider { /** * Check whether the QR reader should be displayed in site screen. * - * @return Whether the QR reader should be displayed in site screen. + * @returns Whether the QR reader should be displayed in site screen. */ displayQRInSiteScreen(): boolean { return CoreUtils.canScanQR() && (CoreConstants.CONFIG.displayqronsitescreen === undefined || @@ -1296,7 +1295,7 @@ export class CoreLoginHelperProvider { * Check whether the QR reader should be displayed in credentials screen. * * @param qrCodeType QR Code type from public config, assuming enabled if undefined. - * @return Whether the QR reader should be displayed in credentials screen. + * @returns Whether the QR reader should be displayed in credentials screen. */ displayQRInCredentialsScreen(qrCodeType = CoreSiteQRCodeType.QR_CODE_LOGIN): boolean { if (!CoreUtils.canScanQR()) { @@ -1316,7 +1315,7 @@ export class CoreLoginHelperProvider { /** * Show instructions to scan QR code. * - * @return Promise resolved if the user accepts to scan QR. + * @returns Promise resolved if the user accepts to scan QR. */ async showScanQRInstructions(): Promise { await new Promise((resolve, reject) => { @@ -1344,7 +1343,7 @@ export class CoreLoginHelperProvider { /** * Scan a QR code and tries to authenticate the user using custom URL scheme. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async scanQR(): Promise { // Scan for a QR code. @@ -1372,7 +1371,7 @@ export class CoreLoginHelperProvider { * Get the accounts list classified per site. * * @param currentSiteId If loggedin, current Site Id. - * @return Promise resolved with account list. + * @returns Promise resolved with account list. */ async getAccountsList(currentSiteId?: string): Promise { const sites = await CoreUtils.ignoreErrors(CoreSites.getSortedSites(), [] as CoreSiteBasicInfo[]); @@ -1421,7 +1420,7 @@ export class CoreLoginHelperProvider { * * @param accountsList Account list. * @param site Site to be deleted. - * @return Resolved when done. + * @returns Resolved when done. */ async deleteAccountFromList(accountsList: CoreAccountsList, site: CoreSiteBasicInfo): Promise { await CoreSites.deleteSite(site.id); @@ -1502,7 +1501,7 @@ export class CoreLoginHelperProvider { * Find out if a password reset has been requested recently for a given site. * * @param siteUrl Site url. - * @return Whether a password reset has been requested recently. + * @returns Whether a password reset has been requested recently. */ async wasPasswordResetRequestedRecently(siteUrl: string): Promise { const passwordResets = await this.getPasswordResets(); @@ -1538,7 +1537,7 @@ export class CoreLoginHelperProvider { * * @param canContactSupport Whether contacting support is enabled in the site. * @param canRecoverPassword Whether recovering the password is enabled in the site. - * @return HTML message. + * @returns HTML message. */ buildExceededAttemptsHTML(canContactSupport: boolean, canRecoverPassword: boolean): SafeHtml | string | null { const safeHTML = (html: string) => DomSanitizer.sanitize(SecurityContext.HTML, html) ?? ''; diff --git a/src/core/features/mainmenu/classes/deep-link-manager.ts b/src/core/features/mainmenu/classes/deep-link-manager.ts index 4f86078f5..2dc0ceb6e 100644 --- a/src/core/features/mainmenu/classes/deep-link-manager.ts +++ b/src/core/features/mainmenu/classes/deep-link-manager.ts @@ -41,7 +41,7 @@ export class CoreMainMenuDeepLinkManager { /** * Whether there is a deep link to be treated. * - * @return Whether there is a deep link to be treated. + * @returns Whether there is a deep link to be treated. */ hasDeepLinkToTreat(): boolean { return !!this.pendingRedirect?.urlToOpen || !!this.pendingRedirect?.redirectPath; diff --git a/src/core/features/mainmenu/components/user-menu/user-menu.ts b/src/core/features/mainmenu/components/user-menu/user-menu.ts index b94d145aa..b85a2866f 100644 --- a/src/core/features/mainmenu/components/user-menu/user-menu.ts +++ b/src/core/features/mainmenu/components/user-menu/user-menu.ts @@ -110,7 +110,7 @@ export class CoreMainMenuUserMenuComponent implements OnInit, OnDestroy { * Load site logo from current site public config. * * @param currentSite Current site object. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSiteLogo(currentSite: CoreSite): Promise { if (CoreConstants.CONFIG.forceLoginLogo) { diff --git a/src/core/features/mainmenu/guards/auth.ts b/src/core/features/mainmenu/guards/auth.ts index 1497a2a8b..5c3619f33 100644 --- a/src/core/features/mainmenu/guards/auth.ts +++ b/src/core/features/mainmenu/guards/auth.ts @@ -39,6 +39,8 @@ export class CoreMainMenuAuthGuard implements CanLoad, CanActivate { /** * Check if the current user should be redirected to the authentication page. + * + * @returns Promise resolved with true if it's not redirected or the redirection route. */ private async guard(): Promise { if (!CoreSites.isLoggedIn()) { diff --git a/src/core/features/mainmenu/mainmenu-tab-routing.module.ts b/src/core/features/mainmenu/mainmenu-tab-routing.module.ts index ca9c0538c..9c5be32ce 100644 --- a/src/core/features/mainmenu/mainmenu-tab-routing.module.ts +++ b/src/core/features/mainmenu/mainmenu-tab-routing.module.ts @@ -37,6 +37,9 @@ export class CoreMainMenuTabRoutingModule { /** * Use this function to declare routes that will be children of all main menu tabs root routes. + * + * @param routes Routes to be children of main menu tabs. + * @returns Calculated module. */ static forChild(routes: ModuleRoutesConfig): ModuleWithProviders { return { diff --git a/src/core/features/mainmenu/pages/menu/menu.ts b/src/core/features/mainmenu/pages/menu/menu.ts index 090a0ebf8..25b639e1c 100644 --- a/src/core/features/mainmenu/pages/menu/menu.ts +++ b/src/core/features/mainmenu/pages/menu/menu.ts @@ -312,7 +312,7 @@ export class CoreMainMenuPage implements OnInit, OnDestroy { /** * Check if current route is the root of the current main menu tab. * - * @return Promise. + * @returns Promise. */ protected async currentRouteIsMainMenuRoot(): Promise { // Check if the current route is the root of the current main menu tab. diff --git a/src/core/features/mainmenu/services/mainmenu.ts b/src/core/features/mainmenu/services/mainmenu.ts index c0e624f2e..39cd39869 100644 --- a/src/core/features/mainmenu/services/mainmenu.ts +++ b/src/core/features/mainmenu/services/mainmenu.ts @@ -53,7 +53,7 @@ export class CoreMainMenuProvider { /** * Get the current main menu handlers. * - * @return Promise resolved with the current main menu handlers. + * @returns Promise resolved with the current main menu handlers. */ async getCurrentMainMenuHandlers(): Promise { const handlers = await CoreMainMenuDelegate.getHandlersWhenLoaded(); @@ -65,7 +65,7 @@ export class CoreMainMenuProvider { * Get a list of custom menu items. * * @param siteId Site to get custom items from. - * @return List of custom menu items. + * @returns List of custom menu items. */ async getCustomMenuItems(siteId?: string): Promise { const customItems = await Promise.all([ @@ -80,7 +80,7 @@ export class CoreMainMenuProvider { * Get a list of custom menu items for a certain site. * * @param siteId Site ID. If not defined, current site. - * @return List of custom menu items. + * @returns List of custom menu items. */ protected async getCustomMenuItemsFromSite(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -114,7 +114,7 @@ export class CoreMainMenuProvider { const id = url + '#' + type; if (!icon) { // Icon not defined, use default one. - icon = type == 'embedded' ? 'fa-expand' : 'fa-link'; // @todo: Find a better icon for embedded. + icon = type == 'embedded' ? 'fa-expand' : 'fa-link'; // @todo Find a better icon for embedded. } if (!map[id]) { @@ -179,7 +179,7 @@ export class CoreMainMenuProvider { /** * Get a list of custom menu items from config. * - * @return List of custom menu items. + * @returns List of custom menu items. */ protected async getCustomItemsFromConfig(): Promise { const items = CoreConstants.CONFIG.customMainMenuItems; @@ -218,7 +218,7 @@ export class CoreMainMenuProvider { /** * Get the number of items to be shown on the main menu bar. * - * @return Number of items depending on the device width. + * @returns Number of items depending on the device width. */ getNumItems(): number { if (!this.isResponsiveMainMenuItemsDisabledInCurrentSite() && window && window.innerWidth) { @@ -244,7 +244,7 @@ export class CoreMainMenuProvider { /** * Get tabs placement depending on the device size. * - * @return Tabs placement including side value. + * @returns Tabs placement including side value. */ getTabPlacement(): 'bottom' | 'side' { return CoreScreen.isTablet ? 'side' : 'bottom'; @@ -254,7 +254,7 @@ export class CoreMainMenuProvider { * Check if a certain page is the root of a main menu tab. * * @param pageName Name of the page. - * @return Promise resolved with boolean: whether it's the root of a main menu tab. + * @returns Promise resolved with boolean: whether it's the root of a main menu tab. */ async isMainMenuTab(pageName: string): Promise { if (pageName == CoreMainMenuProvider.MORE_PAGE_NAME) { @@ -268,7 +268,7 @@ export class CoreMainMenuProvider { * Check if a certain page is the root of a main menu handler currently displayed. * * @param pageName Name of the page. - * @return Promise resolved with boolean: whether it's the root of a main menu handler. + * @returns Promise resolved with boolean: whether it's the root of a main menu handler. */ async isCurrentMainMenuHandler(pageName: string): Promise { const handlers = await this.getCurrentMainMenuHandlers(); @@ -285,7 +285,7 @@ export class CoreMainMenuProvider { /** * Check if responsive main menu items is disabled in the current site. * - * @return Whether it's disabled. + * @returns Whether it's disabled. */ protected isResponsiveMainMenuItemsDisabledInCurrentSite(): boolean { const site = CoreSites.getCurrentSite(); diff --git a/src/core/features/pushnotifications/services/handlers/register-cron.ts b/src/core/features/pushnotifications/services/handlers/register-cron.ts index b2dcdddc1..1e9a0a726 100644 --- a/src/core/features/pushnotifications/services/handlers/register-cron.ts +++ b/src/core/features/pushnotifications/services/handlers/register-cron.ts @@ -29,7 +29,7 @@ export class CorePushNotificationsRegisterCronHandlerService implements CoreCron /** * Check whether the sync can be executed manually. Call isSync if not defined. * - * @return Whether the sync can be executed manually. + * @returns Whether the sync can be executed manually. */ canManualSync(): boolean { return true; // Execute the handler when the site is manually synchronized. @@ -40,7 +40,7 @@ export class CorePushNotificationsRegisterCronHandlerService implements CoreCron * Receives the ID of the site affected, undefined for all sites. * * @param siteId ID of the site affected, undefined for all sites. - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ async execute(siteId?: string): Promise { if (!siteId || !CorePushNotifications.canRegisterOnMoodle()) { @@ -55,7 +55,7 @@ export class CorePushNotificationsRegisterCronHandlerService implements CoreCron /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return 86400000; // 1 day. We won't do anything with automatic execution, so use a big number. @@ -64,7 +64,7 @@ export class CorePushNotificationsRegisterCronHandlerService implements CoreCron /** * Check whether it's a synchronization process or not. True if not defined. * - * @return Whether it's a synchronization process or not. + * @returns Whether it's a synchronization process or not. */ isSync(): boolean { return false; diff --git a/src/core/features/pushnotifications/services/handlers/unregister-cron.ts b/src/core/features/pushnotifications/services/handlers/unregister-cron.ts index 1edab10d8..3dee39649 100644 --- a/src/core/features/pushnotifications/services/handlers/unregister-cron.ts +++ b/src/core/features/pushnotifications/services/handlers/unregister-cron.ts @@ -31,7 +31,7 @@ export class CorePushNotificationsUnregisterCronHandlerService implements CoreCr * Receives the ID of the site affected, undefined for all sites. * * @param siteId ID of the site affected, undefined for all sites. - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ async execute(siteId?: string): Promise { await CorePushNotifications.retryUnregisters(siteId); @@ -40,7 +40,7 @@ export class CorePushNotificationsUnregisterCronHandlerService implements CoreCr /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return 300000; diff --git a/src/core/features/pushnotifications/services/push-delegate.ts b/src/core/features/pushnotifications/services/push-delegate.ts index b897d0324..5b519744f 100644 --- a/src/core/features/pushnotifications/services/push-delegate.ts +++ b/src/core/features/pushnotifications/services/push-delegate.ts @@ -45,7 +45,7 @@ export interface CorePushNotificationsClickHandler { * Check if a notification click is handled by this handler. * * @param notification The notification to check. - * @return Whether the notification click is handled by this handler. + * @returns Whether the notification click is handled by this handler. */ handles(notification: CorePushNotificationsNotificationBasicData): Promise; @@ -53,7 +53,7 @@ export interface CorePushNotificationsClickHandler { * Handle the notification click. * * @param notification The notification to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ handleClick(notification: CorePushNotificationsNotificationBasicData): Promise; } @@ -78,7 +78,7 @@ export class CorePushNotificationsDelegateService { * Function called when a push notification is clicked. Sends notification to handlers. * * @param notification Notification clicked. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async clicked(notification: CorePushNotificationsNotificationBasicData): Promise { if (!notification) { @@ -116,7 +116,7 @@ export class CorePushNotificationsDelegateService { * * @param handler Handler to check. * @param siteId The site ID to check. - * @return Promise resolved with boolean: whether the handler feature is disabled. + * @returns Promise resolved with boolean: whether the handler feature is disabled. */ protected async isFeatureDisabled(handler: CorePushNotificationsClickHandler, siteId?: string): Promise { if (!siteId) { @@ -147,7 +147,7 @@ export class CorePushNotificationsDelegateService { * observer.unsuscribe(); * * @param eventName Only receive is permitted. - * @return Observer to subscribe. + * @returns Observer to subscribe. */ on(eventName: string): Subject { if (this.observables[eventName] === undefined) { @@ -164,7 +164,7 @@ export class CorePushNotificationsDelegateService { * Register a click handler. * * @param handler The handler to register. - * @return True if registered successfully, false otherwise. + * @returns True if registered successfully, false otherwise. */ registerClickHandler(handler: CorePushNotificationsClickHandler): boolean { if (this.clickHandlers[handler.name] !== undefined) { @@ -198,7 +198,7 @@ export class CorePushNotificationsDelegateService { * Check if a counter handler is present. * * @param name Handler's name. - * @return If handler name is present. + * @returns If handler name is present. */ isCounterHandlerRegistered(name: string): boolean { return this.counterHandlers[name] !== undefined; @@ -207,7 +207,7 @@ export class CorePushNotificationsDelegateService { /** * Get all counter badge handlers. * - * @return with all the handler names. + * @returns with all the handler names. */ getCounterHandlers(): Record { return this.counterHandlers; diff --git a/src/core/features/pushnotifications/services/pushnotifications.ts b/src/core/features/pushnotifications/services/pushnotifications.ts index 31407566f..583f81451 100644 --- a/src/core/features/pushnotifications/services/pushnotifications.ts +++ b/src/core/features/pushnotifications/services/pushnotifications.ts @@ -85,7 +85,7 @@ export class CorePushNotificationsProvider { /** * Initialize the service. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async initialize(): Promise { await Promise.all([ @@ -150,7 +150,7 @@ export class CorePushNotificationsProvider { /** * Initialize the default channel for Android. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initializeDefaultChannel(): Promise { await CorePlatform.ready(); @@ -167,7 +167,7 @@ export class CorePushNotificationsProvider { /** * Initialize database. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async initializeDatabase(): Promise { try { @@ -202,7 +202,7 @@ export class CorePushNotificationsProvider { /** * Check whether the device can be registered in Moodle to receive push notifications. * - * @return Whether the device can be registered in Moodle. + * @returns Whether the device can be registered in Moodle. */ canRegisterOnMoodle(): boolean { return !!this.pushID && CorePlatform.isMobile(); @@ -212,7 +212,7 @@ export class CorePushNotificationsProvider { * Delete all badge records for a given site. * * @param siteId Site ID. - * @return Resolved when done. + * @returns Resolved when done. */ async cleanSiteCounters(siteId: string): Promise { try { @@ -225,7 +225,7 @@ export class CorePushNotificationsProvider { /** * Create the default push channel. It is used to change the name. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async createDefaultChannel(): Promise { if (!CoreApp.isAndroid()) { @@ -247,7 +247,7 @@ export class CorePushNotificationsProvider { * Enable or disable Firebase analytics. * * @param enable Whether to enable or disable. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async enableAnalytics(enable: boolean): Promise { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -269,7 +269,7 @@ export class CorePushNotificationsProvider { /** * Returns options for push notifications based on device. * - * @return Promise with the push options resolved when done. + * @returns Promise with the push options resolved when done. */ protected async getOptions(): Promise { let soundEnabled = true; @@ -298,7 +298,7 @@ export class CorePushNotificationsProvider { /** * Get the pushID for this device. * - * @return Push ID. + * @returns Push ID. */ getPushId(): string | undefined { return this.pushID; @@ -307,7 +307,7 @@ export class CorePushNotificationsProvider { /** * Get data to register the device in Moodle. * - * @return Data. + * @returns Data. */ protected getRegisterData(): CoreUserAddUserDeviceWSParams { if (!this.pushID) { @@ -329,7 +329,7 @@ export class CorePushNotificationsProvider { * Get Sitebadge counter from the database. * * @param siteId Site ID. - * @return Promise resolved with the stored badge counter for the site. + * @returns Promise resolved with the stored badge counter for the site. */ getSiteCounter(siteId: string): Promise { return this.getAddonBadge(siteId); @@ -341,7 +341,7 @@ export class CorePushNotificationsProvider { * @param name Name of the event. * @param data Data of the event. * @param filter Whether to filter the data. This is useful when logging a full notification. - * @return Promise resolved when done. This promise is never rejected. + * @returns Promise resolved when done. This promise is never rejected. */ async logEvent(name: string, data: Record, filter?: boolean): Promise { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -374,7 +374,7 @@ export class CorePushNotificationsProvider { * @param wsName Name of the WS. * @param data Other data to pass to the event. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. This promise is never rejected. + * @returns Promise resolved when done. This promise is never rejected. */ logViewEvent( itemId: number | string | undefined, @@ -411,7 +411,7 @@ export class CorePushNotificationsProvider { * @param wsName Name of the WS. * @param data Other data to pass to the event. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. This promise is never rejected. + * @returns Promise resolved when done. This promise is never rejected. */ logViewListEvent(itemCategory: string, wsName: string, data?: Record, siteId?: string): Promise { data = data || {}; @@ -432,7 +432,7 @@ export class CorePushNotificationsProvider { * Function called when a push notification is clicked. Redirect the user to the right state. * * @param data Notification data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async notificationClicked(data: CorePushNotificationsNotificationBasicData): Promise { await ApplicationInit.donePromise; @@ -446,6 +446,7 @@ export class CorePushNotificationsProvider { * if we are in background this code is executed when we open the app clicking in the notification bar. * * @param notification Notification received. + * @returns Promise resolved when done. */ async onMessageReceived(notification: NotificationEventResponse): Promise { const rawData: CorePushNotificationsNotificationBasicRawData = notification ? notification.additionalData : {}; @@ -520,7 +521,7 @@ export class CorePushNotificationsProvider { * * @param notification Notification. * @param data Notification data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async notifyReceived( notification: NotificationEventResponse, @@ -535,7 +536,7 @@ export class CorePushNotificationsProvider { * Unregisters a device from a certain Moodle site. * * @param site Site to unregister from. - * @return Promise resolved when device is unregistered. + * @returns Promise resolved when device is unregistered. */ async unregisterDeviceOnMoodle(site: CoreSite): Promise { if (!site || !CorePlatform.isMobile()) { @@ -593,7 +594,7 @@ export class CorePushNotificationsProvider { * @param addon Registered addon name to set the badge number. * @param value The number to be stored. * @param siteId Site ID. If not defined, use current site. - * @return Promise resolved with the stored badge counter for the addon on the site. + * @returns Promise resolved with the stored badge counter for the addon on the site. */ async updateAddonCounter(addon: string, value: number, siteId?: string): Promise { if (!CorePushNotificationsDelegate.isCounterHandlerRegistered(addon)) { @@ -611,7 +612,7 @@ export class CorePushNotificationsProvider { /** * Update total badge counter of the app. * - * @return Promise resolved with the stored badge counter for the site. + * @returns Promise resolved with the stored badge counter for the site. */ async updateAppCounter(): Promise { const sitesIds = await CoreSites.getSitesIds(); @@ -633,7 +634,7 @@ export class CorePushNotificationsProvider { * It will return the updated site counter. * * @param siteId Site ID. - * @return Promise resolved with the stored badge counter for the site. + * @returns Promise resolved with the stored badge counter for the site. */ async updateSiteCounter(siteId: string): Promise { const addons = CorePushNotificationsDelegate.getCounterHandlers(); @@ -653,7 +654,7 @@ export class CorePushNotificationsProvider { /** * Register a device in Apple APNS or Google GCM. * - * @return Promise resolved when the device is registered. + * @returns Promise resolved when the device is registered. */ async registerDevice(): Promise { try { @@ -707,7 +708,7 @@ export class CorePushNotificationsProvider { * * @param siteId Site ID. If not defined, current site. * @param forceUnregister Whether to force unregister and register. - * @return Promise resolved when device is registered. + * @returns Promise resolved when device is registered. */ async registerDeviceOnMoodle(siteId?: string, forceUnregister?: boolean): Promise { this.logger.debug('Register device on Moodle.'); @@ -756,7 +757,7 @@ export class CorePushNotificationsProvider { * * @param siteId Site ID. * @param addon Registered addon name. If not defined it will store the site total. - * @return Promise resolved with the stored badge counter for the addon or site or 0 if none. + * @returns Promise resolved with the stored badge counter for the addon or site or 0 if none. */ protected async getAddonBadge(siteId?: string, addon: string = 'site'): Promise { try { @@ -772,7 +773,7 @@ export class CorePushNotificationsProvider { * Retry pending unregisters. * * @param siteId If defined, retry only for that site if needed. Otherwise, retry all pending unregisters. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async retryUnregisters(siteId?: string): Promise { const results = await this.pendingUnregistersTable.getMany(CoreObject.withoutEmpty({ siteid: siteId })); @@ -796,7 +797,7 @@ export class CorePushNotificationsProvider { * @param value The number to be stored. * @param siteId Site ID. If not defined, use current site. * @param addon Registered addon name. If not defined it will store the site total. - * @return Promise resolved with the stored badge counter for the addon or site. + * @returns Promise resolved with the stored badge counter for the addon or site. */ protected async saveAddonBadge(value: number, siteId?: string, addon: string = 'site'): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -815,7 +816,7 @@ export class CorePushNotificationsProvider { * * @param data Data of the device. * @param site Site to use. - * @return Promise resolved with booleans: whether to register/unregister. + * @returns Promise resolved with booleans: whether to register/unregister. */ protected async shouldRegister( data: CoreUserAddUserDeviceWSParams, diff --git a/src/core/features/question/classes/base-behaviour-handler.ts b/src/core/features/question/classes/base-behaviour-handler.ts index a33a83118..df93c2cd8 100644 --- a/src/core/features/question/classes/base-behaviour-handler.ts +++ b/src/core/features/question/classes/base-behaviour-handler.ts @@ -37,7 +37,7 @@ export class CoreQuestionBehaviourBaseHandler implements CoreQuestionBehaviourHa * @param question The question. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return New state (or promise resolved with state). + * @returns New state (or promise resolved with state). */ determineNewState( component: string, @@ -56,19 +56,19 @@ export class CoreQuestionBehaviourBaseHandler implements CoreQuestionBehaviourHa * If the behaviour requires to show some extra data, it should return the components to render it. * * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question + * @returns Components (or promise resolved with components) to render some extra data in the question * (e.g. certainty options). Don't return anything if no extra data is required. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars handleQuestion(question: CoreQuestionQuestionParsed): undefined | Type[] | Promise[]> { // Nothing to do. - return; + return undefined; } /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; diff --git a/src/core/features/question/classes/base-question-component.ts b/src/core/features/question/classes/base-question-component.ts index 86c15df55..b30cf8ac3 100644 --- a/src/core/features/question/classes/base-question-component.ts +++ b/src/core/features/question/classes/base-question-component.ts @@ -55,7 +55,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component of type calculated or calculated simple. * - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initCalculatedComponent(): void | HTMLElement { // Treat the input text first. @@ -81,7 +81,7 @@ export class CoreQuestionBaseComponent { * Treat a calculated question units in case they use radio buttons. * * @param questionEl Question HTML element. - * @return True if question has units using radio buttons. + * @returns True if question has units using radio buttons. */ protected treatCalculatedRadioUnits(questionEl: HTMLElement): boolean { // Check if the question has radio buttons for units. @@ -141,7 +141,7 @@ export class CoreQuestionBaseComponent { * Treat a calculated question units in case they use a select. * * @param questionEl Question HTML element. - * @return True if question has units using a select. + * @returns True if question has units using a select. */ protected treatCalculatedSelectUnits(questionEl: HTMLElement): boolean { // Check if the question has a select for units. @@ -210,7 +210,7 @@ export class CoreQuestionBaseComponent { /** * Initialize the component and the question text. * - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initComponent(): void | HTMLElement { if (!this.question) { @@ -238,7 +238,7 @@ export class CoreQuestionBaseComponent { * Initialize a question component of type essay. * * @param review Whether we're in review mode. - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initEssayComponent(review?: boolean): void | HTMLElement { const questionEl = this.initComponent(); @@ -397,7 +397,7 @@ export class CoreQuestionBaseComponent { * Initialize a question component that uses the original question text with some basic treatment. * * @param contentSelector The selector to find the question content (text). - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initOriginalTextComponent(contentSelector: string): void | HTMLElement { if (!this.question) { @@ -436,7 +436,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component that has an input of type "text". * - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initInputTextComponent(): void | HTMLElement { const questionEl = this.initComponent(); @@ -496,7 +496,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component with a "match" behaviour. * - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initMatchComponent(): void | HTMLElement { const questionEl = this.initComponent(); @@ -588,7 +588,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component with a multiple choice (checkbox) or single choice (radio). * - * @return Element containing the question HTML, void if the data is not valid. + * @returns Element containing the question HTML, void if the data is not valid. */ initMultichoiceComponent(): void | HTMLElement { const questionEl = this.initComponent(); diff --git a/src/core/features/question/classes/base-question-handler.ts b/src/core/features/question/classes/base-question-handler.ts index bd062e645..3edcb5723 100644 --- a/src/core/features/question/classes/base-question-handler.ts +++ b/src/core/features/question/classes/base-question-handler.ts @@ -31,7 +31,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return true; @@ -42,12 +42,12 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * It's recommended to return the class of the component, but you can also return an instance of the component. * * @param question The question to render. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars getComponent(question: CoreQuestionQuestionParsed): undefined | Type | Promise> { // There is no default component for questions. - return; + return undefined; } /** @@ -56,7 +56,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * * @param question The question. * @param behaviour The default behaviour. - * @return The behaviour to use. + * @returns The behaviour to use. */ getBehaviour(question: CoreQuestionQuestionParsed, behaviour: string): string { return behaviour; @@ -67,12 +67,12 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * If a question cannot be submitted it should return a message explaining why (translated or not). * * @param question The question. - * @return Prevent submit message. Undefined or empty if can be submitted. + * @returns Prevent submit message. Undefined or empty if can be submitted. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars getPreventSubmitMessage(question: CoreQuestionQuestionParsed): string | undefined { // Never prevent by default. - return; + return undefined; } /** @@ -93,7 +93,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * @param answers Object with the question answers (without prefix). * @param component The component the question is related to. * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @returns 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse( question: CoreQuestionQuestionParsed, // eslint-disable-line @typescript-eslint/no-unused-vars @@ -112,7 +112,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * @param answers Object with the question answers (without prefix). * @param component The component the question is related to. * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @returns 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse( question: CoreQuestionQuestionParsed, // eslint-disable-line @typescript-eslint/no-unused-vars @@ -129,7 +129,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * @param question Question. * @param prevAnswers Object with the previous question answers. * @param newAnswers Object with the new question answers. - * @return Whether they're the same. + * @returns Whether they're the same. */ isSameResponse( question: CoreQuestionQuestionParsed, // eslint-disable-line @typescript-eslint/no-unused-vars @@ -150,7 +150,6 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Return a promise resolved when done if async, void if sync. */ prepareAnswers( question: CoreQuestionQuestionParsed, // eslint-disable-line @typescript-eslint/no-unused-vars @@ -169,7 +168,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * * @param question The question. * @param offlineSequenceCheck Sequence check stored in offline. - * @return Whether sequencecheck is valid. + * @returns Whether sequencecheck is valid. */ validateSequenceCheck(question: CoreQuestionQuestionParsed, offlineSequenceCheck: string): boolean { return question.sequencecheck == Number(offlineSequenceCheck); diff --git a/src/core/features/question/components/question/question.ts b/src/core/features/question/components/question/question.ts index 7def0c42a..af9c2d08e 100644 --- a/src/core/features/question/components/question/question.ts +++ b/src/core/features/question/components/question/question.ts @@ -74,7 +74,7 @@ export class CoreQuestionComponent implements OnInit, AsyncComponent { } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { this.offlineEnabled = CoreUtils.isTrueOrOne(this.offlineEnabled); diff --git a/src/core/features/question/services/behaviour-delegate.ts b/src/core/features/question/services/behaviour-delegate.ts index e6c421565..51d2bab74 100644 --- a/src/core/features/question/services/behaviour-delegate.ts +++ b/src/core/features/question/services/behaviour-delegate.ts @@ -37,7 +37,7 @@ export interface CoreQuestionBehaviourHandler extends CoreDelegateHandler { * @param question The question. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return State (or promise resolved with state). + * @returns State (or promise resolved with state). */ determineNewState?( component: string, @@ -53,7 +53,7 @@ export interface CoreQuestionBehaviourHandler extends CoreDelegateHandler { * If the behaviour requires to show some extra data, it should return the components to render it. * * @param question The question. - * @return Components (or promise resolved with components) to render some extra data in the question + * @returns Components (or promise resolved with components) to render some extra data in the question * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion?(question: CoreQuestionQuestionParsed): void | Type[] | Promise[]>; @@ -74,12 +74,13 @@ export class CoreQuestionBehaviourDelegateService extends CoreDelegate[] | undefined> { behaviour = CoreQuestionDelegate.getBehaviourForQuestion(question, behaviour); @@ -117,7 +118,7 @@ export class CoreQuestionBehaviourDelegateService extends CoreDelegate | Promise>; @@ -44,7 +44,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * * @param question The question. * @param behaviour The default behaviour. - * @return The behaviour to use. + * @returns The behaviour to use. */ getBehaviour?(question: CoreQuestionQuestionParsed, behaviour: string): string; @@ -53,7 +53,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * If a question cannot be submitted it should return a message explaining why (translated or not). * * @param question The question. - * @return Prevent submit message. Undefined or empty if can be submitted. + * @returns Prevent submit message. Undefined or empty if can be submitted. */ getPreventSubmitMessage?(question: CoreQuestionQuestionParsed): string | undefined; @@ -65,7 +65,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param onlineError Online validation error. * @param component The component the question is related to. * @param componentId Component ID. - * @return Error message if there's a validation error, undefined otherwise. + * @returns Error message if there's a validation error, undefined otherwise. */ getValidationError?( question: CoreQuestionQuestionParsed, @@ -82,7 +82,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param answers Object with the question answers (without prefix). * @param component The component the question is related to. * @param componentId Component ID. - * @return 1 if complete, 0 if not complete, -1 if cannot determine. + * @returns 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse?( question: CoreQuestionQuestionParsed, @@ -99,7 +99,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param answers Object with the question answers (without prefix). * @param component The component the question is related to. * @param componentId Component ID. - * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @returns 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse?( question: CoreQuestionQuestionParsed, @@ -114,7 +114,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param question Question. * @param prevAnswers Object with the previous question answers. * @param newAnswers Object with the new question answers. - * @return Whether they're the same. + * @returns Whether they're the same. */ isSameResponse?( question: CoreQuestionQuestionParsed, @@ -133,7 +133,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Return a promise resolved when done if async, void if sync. + * @returns Return a promise resolved when done if async, void if sync. */ prepareAnswers?( question: CoreQuestionQuestionParsed, @@ -150,7 +150,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * * @param question The question. * @param offlineSequenceCheck Sequence check stored in offline. - * @return Whether sequencecheck is valid. + * @returns Whether sequencecheck is valid. */ validateSequenceCheck?(question: CoreQuestionQuestionParsed, offlineSequenceCheck: string): boolean; @@ -159,7 +159,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * * @param question Question. * @param usageId Usage ID. - * @return List of files or URLs. + * @returns List of files or URLs. */ getAdditionalDownloadableFiles?(question: CoreQuestionQuestionParsed, usageId?: number): CoreWSFile[]; @@ -169,7 +169,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param question Question. * @param component The component the question is related to. * @param componentId Component ID. - * @return If async, promise resolved when done. + * @returns If async, promise resolved when done. */ clearTmpData?(question: CoreQuestionQuestionParsed, component: string, componentId: string | number): void | Promise; @@ -180,7 +180,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return If async, promise resolved when done. + * @returns If async, promise resolved when done. */ deleteOfflineData?( question: CoreQuestionQuestionParsed, @@ -197,7 +197,7 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return If async, promise resolved when done. + * @returns If async, promise resolved when done. */ prepareSyncData?( question: CoreQuestionQuestionParsed, @@ -226,7 +226,7 @@ export class CoreQuestionDelegateService extends CoreDelegate | undefined> { const type = this.getTypeName(question); @@ -252,7 +252,7 @@ export class CoreQuestionDelegateService extends CoreDelegate 'qtype_calculated'. * * @param type Type to treat. - * @return Type full name. + * @returns Type full name. */ protected getFullTypeName(type: string): string { return 'qtype_' + type; @@ -274,7 +274,7 @@ export class CoreQuestionDelegateService extends CoreDelegate { const type = this.getTypeName(question); @@ -438,7 +438,7 @@ export class CoreQuestionDelegateService extends CoreDelegate { questions = questions || []; @@ -80,7 +80,7 @@ export class CoreQuestionHelperProvider { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async deleteStoredQuestionFiles( question: CoreQuestionQuestionParsed, @@ -126,7 +126,7 @@ export class CoreQuestionHelperProvider { * We don't remove them from HTML because the whole im-controls block will be removed afterwards. * * @param question Question to treat. - * @return Wether the certainty is found. + * @returns Wether the certainty is found. */ extractQbehaviourCBM(question: CoreQuestionQuestion): boolean { const element = CoreDomUtils.convertToElement(question.html); @@ -193,7 +193,7 @@ export class CoreQuestionHelperProvider { * If so, add the name and value to a "behaviourSeenInput" property and remove the input. * * @param question Question to treat. - * @return Whether the seen input is found. + * @returns Whether the seen input is found. */ extractQbehaviourSeenInput(question: CoreQuestionQuestion): boolean { const element = CoreDomUtils.convertToElement(question.html); @@ -332,7 +332,7 @@ export class CoreQuestionHelperProvider { * This is in order to make this function compatible with other functions like CoreQuestionProvider.getBasicAnswers. * * @param html HTML code. - * @return Object where the keys are the names. + * @returns Object where the keys are the names. */ getAllInputNamesFromHtml(html: string): Record { const element = CoreDomUtils.convertToElement('
' + html + '
'); @@ -359,7 +359,7 @@ export class CoreQuestionHelperProvider { * We don't use ngModel because it doesn't detect changes done by JavaScript and some questions might do that. * * @param form Form. - * @return Object with the answers. + * @returns Object with the answers. */ getAnswersFromForm(form: HTMLFormElement): CoreQuestionsAnswers { if (!form || !form.elements) { @@ -398,7 +398,7 @@ export class CoreQuestionHelperProvider { * an HTML containing only the attachments anchors. * * @param html HTML code to search in. - * @return Attachments. + * @returns Attachments. */ getQuestionAttachmentsFromHtml(html: string): CoreWSFile[] { const element = CoreDomUtils.convertToElement(html); @@ -430,7 +430,7 @@ export class CoreQuestionHelperProvider { * Get the sequence check from a question HTML. * * @param html Question's HTML. - * @return Object with the sequencecheck name and value. + * @returns Object with the sequencecheck name and value. */ getQuestionSequenceCheckFromHtml(html: string): { name: string; value: string } | undefined { if (!html) { @@ -455,7 +455,7 @@ export class CoreQuestionHelperProvider { * Get the CSS class for a question based on its state. * * @param name Question's state name. - * @return State class. + * @returns State class. */ getQuestionStateClass(name: string): string { const state = CoreQuestion.getState(name); @@ -468,7 +468,7 @@ export class CoreQuestionHelperProvider { * * @param question Question. * @param areaName Name of the area, e.g. 'attachments'. - * @return List of files. + * @returns List of files. */ getResponseFileAreaFiles(question: CoreQuestionQuestion, areaName: string): CoreWSFile[] { if (!question.responsefileareas) { @@ -487,7 +487,7 @@ export class CoreQuestionHelperProvider { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ getStoredQuestionFiles( question: CoreQuestionQuestion, @@ -505,7 +505,7 @@ export class CoreQuestionHelperProvider { * Get the validation error message from a question HTML if it's there. * * @param html Question's HTML. - * @return Validation error message if present. + * @returns Validation error message if present. */ getValidationErrorFromHtml(html: string): string | undefined { const element = CoreDomUtils.convertToElement(html); @@ -517,7 +517,7 @@ export class CoreQuestionHelperProvider { * Check if some HTML contains draft file URLs for the current site. * * @param html Question's HTML. - * @return Whether it contains draft files URLs. + * @returns Whether it contains draft files URLs. */ hasDraftFileUrls(html: string): boolean { let url = CoreSites.getCurrentSite()?.getURL(); @@ -539,7 +539,7 @@ export class CoreQuestionHelperProvider { * @param question Question. * @param component Component. * @param attemptId Attempt ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async loadLocalAnswers(question: CoreQuestionQuestion, component: string, attemptId: number): Promise { const answers = await CoreUtils.ignoreErrors( @@ -624,7 +624,7 @@ export class CoreQuestionHelperProvider { * @param componentId An ID to use in conjunction with the component. If not defined, question ID. * @param siteId Site ID. If not defined, current site. * @param usageId Usage ID. Required in Moodle 3.7+. - * @return Promise resolved when all the files have been downloaded. + * @returns Promise resolved when all the files have been downloaded. */ async prefetchQuestionFiles( question: CoreQuestionQuestion, @@ -677,7 +677,7 @@ export class CoreQuestionHelperProvider { * @param component The component the question is related to. * @param componentId Component ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with answers to send to server. + * @returns Promise resolved with answers to send to server. */ async prepareAnswers( questions: CoreQuestionQuestion[], @@ -731,7 +731,7 @@ export class CoreQuestionHelperProvider { * @param question Question. * @param htmlProperty The name of the property containing the HTML to search. * @param selector The selector to find the button. - * @return Whether the button is found. + * @returns Whether the button is found. */ protected searchBehaviourButton(question: CoreQuestionQuestion, htmlProperty: string, selector: string): boolean { const element = CoreDomUtils.convertToElement(question[htmlProperty]); diff --git a/src/core/features/question/services/question.ts b/src/core/features/question/services/question.ts index 7a873e6c6..de21a3373 100644 --- a/src/core/features/question/services/question.ts +++ b/src/core/features/question/services/question.ts @@ -137,7 +137,7 @@ export class CoreQuestionProvider { * * @param prevAnswers Object with previous answers. * @param newAnswers Object with new answers. - * @return Whether all answers are equal. + * @returns Whether all answers are equal. */ compareAllAnswers(prevAnswers: Record, newAnswers: Record): boolean { // Get all the keys. @@ -163,7 +163,7 @@ export class CoreQuestionProvider { * * @param answers List of answers. * @param removePrefix Whether to remove the prefix in the answer's name. - * @return Object with name -> value. + * @returns Object with name -> value. */ convertAnswersArrayToObject(answers: CoreQuestionAnswerDBRecord[], removePrefix?: boolean): Record { const result: Record = {}; @@ -187,7 +187,7 @@ export class CoreQuestionProvider { * @param attemptId Attempt ID. * @param name Answer's name. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the answer. + * @returns Promise resolved with the answer. */ async getAnswer(component: string, attemptId: number, name: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -201,7 +201,7 @@ export class CoreQuestionProvider { * @param component Component the attempt belongs to. * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the answers. + * @returns Promise resolved with the answers. */ async getAttemptAnswers(component: string, attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -215,7 +215,7 @@ export class CoreQuestionProvider { * @param component Component the attempt belongs to. * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the questions. + * @returns Promise resolved with the questions. */ async getAttemptQuestions(component: string, attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -227,7 +227,7 @@ export class CoreQuestionProvider { * Get all the answers that aren't "extra" (sequencecheck, certainty, ...). * * @param answers Object with all the answers. - * @return Object with the basic answers. + * @returns Object with the basic answers. */ getBasicAnswers(answers: Record): Record { const result: Record = {}; @@ -245,7 +245,7 @@ export class CoreQuestionProvider { * Get all the answers that aren't "extra" (sequencecheck, certainty, ...). * * @param answers List of answers. - * @return List with the basic answers. + * @returns List with the basic answers. */ protected getBasicAnswersFromArray(answers: CoreQuestionAnswerDBRecord[]): CoreQuestionAnswerDBRecord[] { const result: CoreQuestionAnswerDBRecord[] = []; @@ -266,7 +266,7 @@ export class CoreQuestionProvider { * @param attemptId Attempt ID. * @param slot Question slot. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the question. + * @returns Promise resolved with the question. */ async getQuestion(component: string, attemptId: number, slot: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -282,7 +282,7 @@ export class CoreQuestionProvider { * @param slot Question slot. * @param filter Whether it should ignore "extra" answers like sequencecheck or certainty. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the answers. + * @returns Promise resolved with the answers. */ async getQuestionAnswers( component: string, @@ -311,7 +311,7 @@ export class CoreQuestionProvider { * * @param question Question. * @param componentId Component ID. - * @return Question component ID. + * @returns Question component ID. */ getQuestionComponentId(question: CoreQuestionQuestionParsed, componentId: string | number): string { return componentId + '_' + question.number; @@ -324,7 +324,7 @@ export class CoreQuestionProvider { * @param component Component the question is related to. * @param componentId Question component ID, returned by getQuestionComponentId. * @param siteId Site ID. If not defined, current site. - * @return Folder path. + * @returns Folder path. */ getQuestionFolder(type: string, component: string, componentId: string, siteId?: string): string { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -339,7 +339,7 @@ export class CoreQuestionProvider { * Extract the question slot from a question name. * * @param name Question name. - * @return Question slot. + * @returns Question slot. */ getQuestionSlotFromName(name: string): number { if (name) { @@ -356,7 +356,7 @@ export class CoreQuestionProvider { * Get question state based on state name. * * @param name State name. - * @return State. + * @returns State. */ getState(name?: string): CoreQuestionState { return STATES[name || 'cannotdeterminestatus']; @@ -366,7 +366,7 @@ export class CoreQuestionProvider { * Check if an answer is extra data like sequencecheck or certainty. * * @param name Answer name. - * @return Whether it's extra data. + * @returns Whether it's extra data. */ isExtraAnswer(name: string): boolean { // Maybe the name still has the prefix. @@ -379,7 +379,7 @@ export class CoreQuestionProvider { * Parse questions of a WS response. * * @param questions Questions to parse. - * @return Parsed questions. + * @returns Parsed questions. */ parseQuestions(questions: CoreQuestionQuestionWSData[]): CoreQuestionQuestionParsed[] { const parsedQuestions: CoreQuestionQuestionParsed[] = questions; @@ -401,7 +401,7 @@ export class CoreQuestionProvider { * @param component Component the attempt belongs to. * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeAttemptAnswers(component: string, attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -415,7 +415,7 @@ export class CoreQuestionProvider { * @param component Component the attempt belongs to. * @param attemptId Attempt ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeAttemptQuestions(component: string, attemptId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -430,7 +430,7 @@ export class CoreQuestionProvider { * @param attemptId Attempt ID. * @param name Answer's name. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeAnswer(component: string, attemptId: number, name: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -445,7 +445,7 @@ export class CoreQuestionProvider { * @param attemptId Attempt ID. * @param slot Question slot. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeQuestion(component: string, attemptId: number, slot: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -460,7 +460,7 @@ export class CoreQuestionProvider { * @param attemptId Attempt ID. * @param slot Question slot. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeQuestionAnswers(component: string, attemptId: number, slot: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -472,7 +472,7 @@ export class CoreQuestionProvider { * Remove the prefix from a question answer name. * * @param name Question name. - * @return Name without prefix. + * @returns Name without prefix. */ removeQuestionPrefix(name: string): string { if (name) { @@ -492,7 +492,7 @@ export class CoreQuestionProvider { * @param answers Object with the answers to save. * @param timemodified Time modified to set in the answers. If not defined, current time. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveAnswers( component: string, @@ -536,7 +536,7 @@ export class CoreQuestionProvider { * @param question The question to save. * @param state Question's state. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async saveQuestion( component: string, diff --git a/src/core/features/rating/components/aggregate/aggregate.ts b/src/core/features/rating/components/aggregate/aggregate.ts index 3c33cf348..8b8c56594 100644 --- a/src/core/features/rating/components/aggregate/aggregate.ts +++ b/src/core/features/rating/components/aggregate/aggregate.ts @@ -133,7 +133,7 @@ export class CoreRatingAggregateComponent implements OnChanges, OnDestroy { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.aggregateObserver?.off(); diff --git a/src/core/features/rating/components/rate/rate.ts b/src/core/features/rating/components/rate/rate.ts index fd87f9dd0..238c28be5 100644 --- a/src/core/features/rating/components/rate/rate.ts +++ b/src/core/features/rating/components/rate/rate.ts @@ -155,7 +155,7 @@ export class CoreRatingRateComponent implements OnChanges, OnDestroy { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.updateSiteObserver.off(); diff --git a/src/core/features/rating/services/rating-offline.ts b/src/core/features/rating/services/rating-offline.ts index 0867e3294..b4a84aa2f 100644 --- a/src/core/features/rating/services/rating-offline.ts +++ b/src/core/features/rating/services/rating-offline.ts @@ -46,7 +46,7 @@ export class CoreRatingOfflineProvider { * @param ratingArea Rating area. Example: "post". * @param itemId Item id. Example: forum post id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the saved rating, rejected if not found. + * @returns Promise resolved with the saved rating, rejected if not found. */ async getRating( contextLevel: ContextLevel, @@ -84,7 +84,7 @@ export class CoreRatingOfflineProvider { * @param ratedUserId Rated user id. * @param aggregateMethod Aggregate method. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the rating is saved. + * @returns Promise resolved when the rating is saved. */ async addRating( component: string, @@ -125,9 +125,10 @@ export class CoreRatingOfflineProvider { * @param component Component. Example: "mod_forum". * @param ratingArea Rating area. Example: "post". * @param contextLevel Context level: course, module, user, etc. - * @param itemId Item id. Example: forum post id. + * @param instanceId Instance Id. + * @param itemId Item Id. Example: forum post id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the rating is saved. + * @returns Promise resolved when the rating is saved. */ async deleteRating( component: string, @@ -159,7 +160,7 @@ export class CoreRatingOfflineProvider { * @param instanceId Context instance id. * @param itemSetId Item set id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of item set ids. + * @returns Promise resolved with the list of item set ids. */ async getItemSets( component: string, @@ -205,10 +206,10 @@ export class CoreRatingOfflineProvider { * @param component Component. Example: "mod_forum". * @param ratingArea Rating Area. Example: "post". * @param contextLevel Context level: course, module, user, etc. - * @param itemId Item id. Example: forum post id. + * @param instanceId Context instance id. * @param itemSetId Item set id. Example: forum discussion id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of ratings. + * @returns Promise resolved with the list of ratings. */ async getRatings( component: string, @@ -240,7 +241,7 @@ export class CoreRatingOfflineProvider { * @param instanceId Context instance id. * @param itemSetId Item set id. Example: forum discussion id. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with a boolean. + * @returns Promise resolved with a boolean. */ async hasRatings( component: string, diff --git a/src/core/features/rating/services/rating-sync.ts b/src/core/features/rating/services/rating-sync.ts index ad04f754e..2d89041d7 100644 --- a/src/core/features/rating/services/rating-sync.ts +++ b/src/core/features/rating/services/rating-sync.ts @@ -49,7 +49,7 @@ export class CoreRatingSyncProvider extends CoreSyncBaseProvider { const site = await CoreSites.getSite(siteId); @@ -332,7 +332,7 @@ export class CoreRatingProvider { * Convenience function to merge two or more rating infos of the same instance. * * @param ratingInfos Array of rating infos. - * @return Merged rating info or undefined. + * @returns Merged rating info or undefined. */ mergeRatingInfos(ratingInfos: CoreRatingInfo[]): CoreRatingInfo | undefined { let result: CoreRatingInfo | undefined; @@ -372,11 +372,12 @@ export class CoreRatingProvider { * This function should be called from the prefetch handler of activities with ratings. * * @param contextLevel Context level: course, module, user, etc. - * @param instanceId Instance id. - * @param siteId Site id. If not defined, current site. + * @param instanceId Instance Id. + * @param scaleId Scale Id. * @param courseId Course id. Used for prefetching user profiles. * @param ratingInfo Rating info returned by web services. - * @return Promise resolved when done. + * @param siteId Site id. If not defined, current site. + * @returns Promise resolved when done. */ async prefetchRatings( contextLevel: ContextLevel, @@ -419,12 +420,13 @@ export class CoreRatingProvider { * Get cache key for rating items WS calls. * * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Instance Id. * @param component Component. Example: "mod_forum". * @param ratingArea Rating area. Example: "post". * @param itemId Item id. Example: forum post id. - * @param scaleId Scale id. + * @param scaleId Scale Id. * @param sort Sort field. - * @return Cache key. + * @returns Cache key. */ protected getItemRatingsCacheKey( contextLevel: ContextLevel, diff --git a/src/core/features/reminders/components/date/date.ts b/src/core/features/reminders/components/date/date.ts index 137d88d4b..05b182431 100644 --- a/src/core/features/reminders/components/date/date.ts +++ b/src/core/features/reminders/components/date/date.ts @@ -73,7 +73,7 @@ export class CoreRemindersDateComponent implements OnInit { * * @param timestamp Timestamp. * @param relativeTo Base timestamp if timestamp is relative to this one. - * @return Readable time string. + * @returns Readable time string. */ protected getReadableTime(timestamp: number, relativeTo = 0): string { if (!relativeTo) { diff --git a/src/core/features/reminders/components/set-button/set-button.ts b/src/core/features/reminders/components/set-button/set-button.ts index 11710ec32..a443e9d35 100644 --- a/src/core/features/reminders/components/set-button/set-button.ts +++ b/src/core/features/reminders/components/set-button/set-button.ts @@ -90,7 +90,7 @@ export class CoreRemindersSetButtonComponent implements OnInit { * Save reminder. * * @param timebefore Time before the event to fire the notification. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async saveReminder(timebefore: number): Promise { if (this.component === undefined || this.instanceId === undefined || this.type === undefined) { diff --git a/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts b/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts index 070367293..26e55c901 100644 --- a/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts +++ b/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts @@ -134,7 +134,7 @@ export class CoreRemindersSetReminderMenuComponent implements OnInit { * * @param unit Time unit. * @param value Time value. - * @return Wether is a valid time or not. + * @returns Wether is a valid time or not. */ protected isValidTime(unit: number, value: number): boolean { if (!this.eventTime) { diff --git a/src/core/features/reminders/services/reminders.ts b/src/core/features/reminders/services/reminders.ts index a6388eff7..d7afcff2d 100644 --- a/src/core/features/reminders/services/reminders.ts +++ b/src/core/features/reminders/services/reminders.ts @@ -64,7 +64,7 @@ export class CoreRemindersService { /** * Initialize the service. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async initialize(): Promise { if (!this.isEnabled()) { @@ -89,7 +89,7 @@ export class CoreRemindersService { /** * Returns if Reminders are enabled. * - * @return True if reminders are enabled and available, false otherwise. + * @returns True if reminders are enabled and available, false otherwise. */ isEnabled(): boolean { return true; @@ -100,7 +100,7 @@ export class CoreRemindersService { * * @param reminder Reminder to set. * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. Rejected on failure. + * @returns Resolved when done. Rejected on failure. */ async addReminder(reminder: CoreReminderData, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -117,7 +117,7 @@ export class CoreRemindersService { * * @param reminder Fields to update. * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the reminder data is updated. + * @returns Promise resolved when the reminder data is updated. */ async updateReminder( reminder: CoreReminderDBRecord, @@ -137,7 +137,7 @@ export class CoreRemindersService { * @param newFields Fields to update. * @param selector Reminder selector. * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the reminder data is updated. + * @returns Promise resolved when the reminder data is updated. */ async updateReminders( newFields: Partial, @@ -159,7 +159,7 @@ export class CoreRemindersService { * Get all reminders from local Db. * * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the reminder data is retrieved. + * @returns Promise resolved when the reminder data is retrieved. */ async getAllReminders(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -172,7 +172,7 @@ export class CoreRemindersService { * * @param selector Reminder selector. * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the reminder data is retrieved. + * @returns Promise resolved when the reminder data is retrieved. */ async getReminders(selector: CoreReminderSelector, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -184,7 +184,7 @@ export class CoreRemindersService { * Get all reminders of a component with default time. * * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the reminder data is retrieved. + * @returns Promise resolved when the reminder data is retrieved. */ protected async getRemindersWithDefaultTime(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -201,7 +201,7 @@ export class CoreRemindersService { * * @param id Reminder ID. * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the notification is updated. + * @returns Promise resolved when the notification is updated. */ async removeReminder(id: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -220,7 +220,7 @@ export class CoreRemindersService { * * @param selector Reminder selector. * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the notification is updated. + * @returns Promise resolved when the notification is updated. */ async removeReminders(selector: CoreReminderSelector, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -243,7 +243,7 @@ export class CoreRemindersService { * @param reminderId Reminder Id to cancel. * @param component Reminder component. * @param siteId ID of the site the reminder belongs to. If not defined, use current site. - * @returns + * @returns Promise resolved when done. */ async cancelReminder(reminderId: number, component: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -256,7 +256,7 @@ export class CoreRemindersService { * * @param reminder Reminder to schedule. * @param siteId Site ID the reminder belongs to. If not defined, use current site. - * @return Promise resolved when the notification is scheduled. + * @returns Promise resolved when the notification is scheduled. */ async scheduleNotification( reminder: CoreReminderDBRecord, @@ -309,7 +309,7 @@ export class CoreRemindersService { * Get the all saved reminders and schedule the notification. * If local notification plugin is not enabled, resolve the promise. * - * @return Promise resolved when all the notifications have been scheduled. + * @returns Promise resolved when all the notifications have been scheduled. */ async scheduleAllNotifications(): Promise { await CorePlatform.ready(); @@ -336,7 +336,7 @@ export class CoreRemindersService { * @param value Value. * @param unit Unit. * @param addDefaultLabel Whether to add the "Default" text. - * @return Translated label. + * @returns Translated label. */ getUnitValueLabel(value: number, unit: CoreRemindersUnits, addDefaultLabel = false): string { if (value === CoreRemindersService.DISABLED) { @@ -367,7 +367,7 @@ export class CoreRemindersService { * Given a number of seconds, convert it to a unit&value format compatible with reminders. * * @param seconds Number of seconds. - * @return Value and unit. + * @returns Value and unit. */ static convertSecondsToValueAndUnit(seconds?: number): CoreReminderValueAndUnit { if (seconds === undefined || seconds < 0) { @@ -407,7 +407,7 @@ export class CoreRemindersService { * Get the configured default notification time. * * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved with the default time (in seconds). + * @returns Promise resolved with the default time (in seconds). */ async getDefaultNotificationTime(siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -422,7 +422,7 @@ export class CoreRemindersService { * * @param time New default time. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved when stored. + * @returns Promise resolved when stored. */ async setDefaultNotificationTime(time: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/core/features/search/components/search-box/search-box.ts b/src/core/features/search/components/search-box/search-box.ts index 275647525..c013928d3 100644 --- a/src/core/features/search/components/search-box/search-box.ts +++ b/src/core/features/search/components/search-box/search-box.ts @@ -109,7 +109,7 @@ export class CoreSearchBoxComponent implements OnInit { * Saves the search term onto the history. * * @param text Text to save. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async saveSearchToHistory(text: string): Promise { try { @@ -122,7 +122,7 @@ export class CoreSearchBoxComponent implements OnInit { /** * Loads search history. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadHistory(): Promise { this.history = await CoreSearchHistory.getSearchHistory(this.searchArea); diff --git a/src/core/features/search/services/search-history.service.ts b/src/core/features/search/services/search-history.service.ts index 8f85c0d40..b4516897e 100644 --- a/src/core/features/search/services/search-history.service.ts +++ b/src/core/features/search/services/search-history.service.ts @@ -32,7 +32,7 @@ export class CoreSearchHistoryProvider { * * @param searchArea Search Area Name. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the list of items when done. + * @returns Promise resolved with the list of items when done. */ async getSearchHistory(searchArea: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -51,7 +51,7 @@ export class CoreSearchHistoryProvider { * * @param searchArea Search area to control * @param db SQLite DB where to perform the search. - * @return Resolved when done. + * @returns Resolved when done. */ protected async controlSearchLimit(searchArea: string, db: SQLiteDB): Promise { const items = await this.getSearchHistory(searchArea); @@ -74,7 +74,7 @@ export class CoreSearchHistoryProvider { * @param searchArea Area where the search has been performed. * @param text Text of the performed text. * @param db SQLite DB where to perform the search. - * @return True if exists, false otherwise. + * @returns True if exists, false otherwise. */ protected async updateExistingItem(searchArea: string, text: string, db: SQLiteDB): Promise { const searchItem = { @@ -103,7 +103,7 @@ export class CoreSearchHistoryProvider { * @param searchArea Area where the search has been performed. * @param text Text of the performed text. * @param siteId Site ID. If not defined, current site. - * @return Resolved when done. + * @returns Resolved when done. */ async insertOrUpdateSearchText(searchArea: string, text: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/core/features/settings/pages/general/general.ts b/src/core/features/settings/pages/general/general.ts index 04d0db1ce..d24b3cc2c 100644 --- a/src/core/features/settings/pages/general/general.ts +++ b/src/core/features/settings/pages/general/general.ts @@ -112,7 +112,7 @@ export class CoreSettingsGeneralPage { /** * Called when a new language is selected. * - * @param ev: Event + * @param ev Event */ async languageChanged(ev: Event): Promise { ev.stopPropagation(); @@ -183,8 +183,8 @@ export class CoreSettingsGeneralPage { /** * Called when a new zoom level is selected. * - * @param ev: Event - * @param value: New value + * @param ev Event + * @param value New value */ zoomLevelChanged(ev: Event, value: CoreZoomLevel): void { ev.stopPropagation(); @@ -205,7 +205,7 @@ export class CoreSettingsGeneralPage { /** * Called when a new color scheme is selected. * - * @param ev: Event + * @param ev Event */ colorSchemeChanged(ev: Event): void { ev.stopPropagation(); @@ -218,7 +218,7 @@ export class CoreSettingsGeneralPage { /** * Called when the rich text editor is enabled or disabled. * - * @param ev: Event + * @param ev Event */ richTextEditorChanged(ev: Event): void { ev.stopPropagation(); @@ -230,7 +230,7 @@ export class CoreSettingsGeneralPage { /** * Called when the debug display setting is enabled or disabled. * - * @param ev: Event + * @param ev Event */ debugDisplayChanged(ev: Event): void { ev.stopPropagation(); @@ -243,7 +243,7 @@ export class CoreSettingsGeneralPage { /** * Called when the analytics setting is enabled or disabled. * - * @param ev: Event + * @param ev Event */ async analyticsEnabledChanged(ev: Event): Promise { ev.stopPropagation(); @@ -257,7 +257,7 @@ export class CoreSettingsGeneralPage { /** * Open native settings. * - * @param ev: Event + * @param ev Event */ openNativeSettings(ev: Event): void { ev.stopPropagation(); diff --git a/src/core/features/settings/pages/site/site.ts b/src/core/features/settings/pages/site/site.ts index 88de8b221..bfe1dd30a 100644 --- a/src/core/features/settings/pages/site/site.ts +++ b/src/core/features/settings/pages/site/site.ts @@ -129,7 +129,7 @@ export class CoreSitePreferencesPage implements AfterViewInit, OnDestroy { /** * Returns true if site is beeing synchronized. * - * @return True if site is beeing synchronized, false otherwise. + * @returns True if site is beeing synchronized, false otherwise. */ isSynchronizing(): boolean { return !!CoreSettingsHelper.getSiteSyncPromise(this.siteId); diff --git a/src/core/features/settings/pages/space-usage/space-usage.ts b/src/core/features/settings/pages/space-usage/space-usage.ts index be91393f2..d243af347 100644 --- a/src/core/features/settings/pages/space-usage/space-usage.ts +++ b/src/core/features/settings/pages/space-usage/space-usage.ts @@ -87,7 +87,7 @@ export class CoreSettingsSpaceUsagePage implements OnInit, OnDestroy { /** * Convenience function to load site data/usage and calculate the totals. * - * @return Resolved when done. + * @returns Resolved when done. */ protected async loadSiteData(): Promise { // Calculate total usage. @@ -136,7 +136,7 @@ export class CoreSettingsSpaceUsagePage implements OnInit, OnDestroy { * Get site with space usage. * * @param site Site to check. - * @return Site with usage. + * @returns Site with usage. */ protected async getSiteWithUsage(site: CoreSiteBasicInfo): Promise { const siteInfo = await CoreSettingsHelper.getSiteSpaceUsage(site.id); diff --git a/src/core/features/settings/pages/synchronization/synchronization.ts b/src/core/features/settings/pages/synchronization/synchronization.ts index 47e3b6f3f..4886300e2 100644 --- a/src/core/features/settings/pages/synchronization/synchronization.ts +++ b/src/core/features/settings/pages/synchronization/synchronization.ts @@ -157,7 +157,7 @@ export class CoreSettingsSynchronizationPage implements OnInit, OnDestroy { * Returns true if site is beeing synchronized. * * @param siteId Site ID. - * @return True if site is beeing synchronized, false otherwise. + * @returns True if site is beeing synchronized, false otherwise. */ isSynchronizing(siteId: string): boolean { return !!CoreSettingsHelper.getSiteSyncPromise(siteId); diff --git a/src/core/features/settings/services/settings-helper.ts b/src/core/features/settings/services/settings-helper.ts index ef82c822c..3fea5fd3a 100644 --- a/src/core/features/settings/services/settings-helper.ts +++ b/src/core/features/settings/services/settings-helper.ts @@ -111,8 +111,8 @@ export class CoreSettingsHelperProvider { * Deletes files of a site and the tables that can be cleared. * * @param siteName Site Name. - * @param siteId: Site ID. - * @return Resolved with detailed new info when done. + * @param siteId Site ID. + * @returns Resolved with detailed new info when done. */ async deleteSiteStorage(siteName: string, siteId: string): Promise { const siteInfo: CoreSiteSpaceUsage = { @@ -173,7 +173,7 @@ export class CoreSettingsHelperProvider { * Calculates each site's usage, and the total usage. * * @param siteId ID of the site. Current site if undefined. - * @return Resolved with detailed info when done. + * @returns Resolved with detailed info when done. */ async getSiteSpaceUsage(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -194,7 +194,7 @@ export class CoreSettingsHelperProvider { * Calculate the number of rows to be deleted on a site. * * @param site Site object. - * @return If there are rows to delete or not. + * @returns If there are rows to delete or not. */ protected async calcSiteClearRows(site: CoreSite): Promise { const clearTables = CoreSites.getSiteTableSchemasToClear(site); @@ -213,11 +213,10 @@ export class CoreSettingsHelperProvider { * @param processors List of processors. * @param name Name of the processor to get. * @param fallback True to return first processor if not found, false to not return any. Defaults to true. - * @return Processor. * @deprecated since 3.9.5. This function has been moved to AddonNotificationsHelperProvider. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - getProcessor(processors: unknown[], name: string, fallback: boolean = true): undefined { + getProcessor(processors: unknown[], name: string, fallback: boolean = true): void { return; } @@ -226,7 +225,7 @@ export class CoreSettingsHelperProvider { * * @param processorName Name of the processor to filter. * @param components Array of components. - * @return Filtered components. + * @returns Filtered components. * @deprecated since 3.9.5. This function has been moved to AddonNotificationsHelperProvider. */ getProcessorComponents(processorName: string, components: unknown[]): unknown[] { @@ -237,7 +236,7 @@ export class CoreSettingsHelperProvider { * Get the synchronization promise of a site. * * @param siteId ID of the site. - * @return Sync promise or null if site is not being syncrhonized. + * @returns Sync promise or null if site is not being syncrhonized. */ getSiteSyncPromise(siteId: string): Promise | void { if (this.syncPromises[siteId] !== undefined) { @@ -250,7 +249,7 @@ export class CoreSettingsHelperProvider { * * @param syncOnlyOnWifi True to sync only on wifi, false otherwise. * @param siteId ID of the site to synchronize. - * @return Promise resolved when synchronized, rejected if failure. + * @returns Promise resolved when synchronized, rejected if failure. */ async synchronizeSite(syncOnlyOnWifi: boolean, siteId: string): Promise { if (this.syncPromises[siteId] !== undefined) { @@ -328,7 +327,7 @@ export class CoreSettingsHelperProvider { /** * Get saved Zoom Level setting. * - * @return The saved zoom Level option. + * @returns The saved zoom Level option. */ async getZoomLevel(): Promise { return CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreConstants.CONFIG.defaultZoomLevel); @@ -337,7 +336,7 @@ export class CoreSettingsHelperProvider { /** * Get saved zoom level value. * - * @return The saved zoom level value in %. + * @returns The saved zoom level value in %. */ async getZoom(): Promise { const zoomLevel = await this.getZoomLevel(); @@ -373,7 +372,7 @@ export class CoreSettingsHelperProvider { * Check if color scheme is disabled in a site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with whether color scheme is disabled. + * @returns Promise resolved with whether color scheme is disabled. */ async isColorSchemeDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -385,7 +384,7 @@ export class CoreSettingsHelperProvider { * Check if color scheme is disabled in a site. * * @param site Site instance. If not defined, current site. - * @return Whether color scheme is disabled. + * @returns Whether color scheme is disabled. */ isColorSchemeDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -407,7 +406,7 @@ export class CoreSettingsHelperProvider { /** * Get system allowed color schemes. * - * @return Allowed color schemes. + * @returns Allowed color schemes. */ getAllowedColorSchemes(): CoreColorScheme[] { if (this.colorSchemes.length > 0) { @@ -472,7 +471,7 @@ export class CoreSettingsHelperProvider { /** * Returns dark mode change observable. * - * @return Dark mode change observable. + * @returns Dark mode change observable. */ onDarkModeChange(): Observable { return this.darkModeObservable; diff --git a/src/core/features/sharedfiles/components/list-modal/list-modal.ts b/src/core/features/sharedfiles/components/list-modal/list-modal.ts index 9a38a9c75..6f0b206bf 100644 --- a/src/core/features/sharedfiles/components/list-modal/list-modal.ts +++ b/src/core/features/sharedfiles/components/list-modal/list-modal.ts @@ -37,7 +37,7 @@ export class CoreSharedFilesListModalComponent implements OnInit { title?: string; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.calculateTitle(this.path); diff --git a/src/core/features/sharedfiles/components/list/list.ts b/src/core/features/sharedfiles/components/list/list.ts index f336c0890..5e1eff050 100644 --- a/src/core/features/sharedfiles/components/list/list.ts +++ b/src/core/features/sharedfiles/components/list/list.ts @@ -48,7 +48,7 @@ export class CoreSharedFilesListComponent implements OnInit, OnDestroy { protected shareObserver?: CoreEventObserver; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.siteId = this.siteId || CoreSites.getCurrentSiteId(); @@ -70,7 +70,7 @@ export class CoreSharedFilesListComponent implements OnInit, OnDestroy { /** * Load the files. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadFiles(): Promise { this.files = await CoreSharedFiles.getSiteSharedFiles(this.siteId, this.path, this.mimetypes); diff --git a/src/core/features/sharedfiles/pages/choose-site/choose-site.ts b/src/core/features/sharedfiles/pages/choose-site/choose-site.ts index defc4a7bc..3d810aabe 100644 --- a/src/core/features/sharedfiles/pages/choose-site/choose-site.ts +++ b/src/core/features/sharedfiles/pages/choose-site/choose-site.ts @@ -72,7 +72,7 @@ export class CoreSharedFilesChooseSitePage implements OnInit { /** * Load the file data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadFile(): Promise { this.fileEntry = await CoreFile.getExternalFile(this.filePath!); @@ -82,7 +82,7 @@ export class CoreSharedFilesChooseSitePage implements OnInit { /** * Load sites. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadSites(): Promise { this.sites = await CoreSites.getSites(); diff --git a/src/core/features/sharedfiles/services/handlers/settings.ts b/src/core/features/sharedfiles/services/handlers/settings.ts index 66cc467de..a501481b3 100644 --- a/src/core/features/sharedfiles/services/handlers/settings.ts +++ b/src/core/features/sharedfiles/services/handlers/settings.ts @@ -30,7 +30,7 @@ export class CoreSharedFilesSettingsHandlerService implements CoreSettingsHandle /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return CoreApp.isIOS(); @@ -39,7 +39,7 @@ export class CoreSharedFilesSettingsHandlerService implements CoreSettingsHandle /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/core/features/sharedfiles/services/handlers/upload.ts b/src/core/features/sharedfiles/services/handlers/upload.ts index 697ef8a2d..a32da22fd 100644 --- a/src/core/features/sharedfiles/services/handlers/upload.ts +++ b/src/core/features/sharedfiles/services/handlers/upload.ts @@ -34,7 +34,7 @@ export class CoreSharedFilesUploadHandlerService implements CoreFileUploaderHand /** * Whether or not the handler is enabled on a site level. * - * @return True or promise resolved with true if enabled. + * @returns True or promise resolved with true if enabled. */ async isEnabled(): Promise { return CoreApp.isIOS(); @@ -44,7 +44,7 @@ export class CoreSharedFilesUploadHandlerService implements CoreFileUploaderHand * Given a list of mimetypes, return the ones that are supported by the handler. * * @param mimetypes List of mimetypes. - * @return Supported mimetypes. + * @returns Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { return mimetypes; @@ -53,7 +53,7 @@ export class CoreSharedFilesUploadHandlerService implements CoreFileUploaderHand /** * Get the data to display the handler. * - * @return Data. + * @returns Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/features/sharedfiles/services/sharedfiles-helper.ts b/src/core/features/sharedfiles/services/sharedfiles-helper.ts index 43c01ae83..c3ab8d4c3 100644 --- a/src/core/features/sharedfiles/services/sharedfiles-helper.ts +++ b/src/core/features/sharedfiles/services/sharedfiles-helper.ts @@ -85,7 +85,7 @@ export class CoreSharedFilesHelperProvider { * * @param originalName Original name. * @param newName New name. - * @return Promise resolved with the name to use when the user chooses. Rejected if user cancels. + * @returns Promise resolved with the name to use when the user chooses. Rejected if user cancels. */ async askRenameReplace(originalName: string, newName: string): Promise { const alert = await AlertController.create({ @@ -138,7 +138,7 @@ export class CoreSharedFilesHelperProvider { /** * Whether the user is already choosing a site to store a shared file. * - * @return Whether the user is already choosing a site to store a shared file. + * @returns Whether the user is already choosing a site to store a shared file. */ protected isChoosingSite(): boolean { return CoreNavigator.getCurrentRoute({ pageComponent: CoreSharedFilesChooseSitePage }) !== null; @@ -148,7 +148,7 @@ export class CoreSharedFilesHelperProvider { * Open the view to select a shared file. * * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved when a file is picked, rejected if file picker is closed without selecting a file. + * @returns Promise resolved when a file is picked, rejected if file picker is closed without selecting a file. */ async pickSharedFile(mimetypes?: string[]): Promise { const file = await CoreDomUtils.openModal({ @@ -178,7 +178,7 @@ export class CoreSharedFilesHelperProvider { * * @param fileEntry The file entry to delete. * @param isInbox Whether the file is in the Inbox folder. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected removeSharedFile(fileEntry: FileEntry, isInbox?: boolean): Promise { if (isInbox) { @@ -194,7 +194,7 @@ export class CoreSharedFilesHelperProvider { * If more than one file is found, treat only the first one. * * @param path Path to a file received when launching the app. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async searchIOSNewSharedFiles(path?: string): Promise { try { @@ -243,7 +243,7 @@ export class CoreSharedFilesHelperProvider { * @param fileEntry Shared file entry. * @param siteId Site ID. If not defined, current site. * @param isInbox Whether the file is in the Inbox folder. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async storeSharedFileInSite(fileEntry: FileEntry, siteId?: string, isInbox?: boolean): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/core/features/sharedfiles/services/sharedfiles.ts b/src/core/features/sharedfiles/services/sharedfiles.ts index 2cc6bd042..151d4b515 100644 --- a/src/core/features/sharedfiles/services/sharedfiles.ts +++ b/src/core/features/sharedfiles/services/sharedfiles.ts @@ -49,7 +49,7 @@ export class CoreSharedFilesProvider { /** * Initialize database. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async initializeDatabase(): Promise { try { @@ -65,7 +65,7 @@ export class CoreSharedFilesProvider { * Checks if there is a new file received in iOS. If more than one file is found, treat only the first one. * The file returned is marked as "treated" and will be deleted in the next execution. * - * @return Promise resolved with a new file to be treated. If no new files found, resolved with undefined. + * @returns Promise resolved with a new file to be treated. If no new files found, resolved with undefined. */ async checkIOSNewFiles(): Promise { this.logger.debug('Search for new files on iOS'); @@ -118,7 +118,7 @@ export class CoreSharedFilesProvider { * Deletes a file in the Inbox folder (shared with the app). * * @param entry FileEntry. - * @return Promise resolved when done, rejected otherwise. + * @returns Promise resolved when done, rejected otherwise. */ async deleteInboxFile(entry: FileEntry): Promise { this.logger.debug('Delete inbox file: ' + entry.name); @@ -140,7 +140,7 @@ export class CoreSharedFilesProvider { * Get the ID of a file for managing "treated" files. * * @param entry FileEntry. - * @return File ID. + * @returns File ID. */ protected getFileId(entry: FileEntry): string { return Md5.hashAsciiStr(entry.name); @@ -152,7 +152,7 @@ export class CoreSharedFilesProvider { * @param siteId Site ID. If not defined, current site. * @param path Path to search inside the site shared folder. * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ async getSiteSharedFiles(siteId?: string, path?: string, mimetypes?: string[]): Promise<(FileEntry | DirectoryEntry)[]> { let pathToGet = this.getSiteSharedFilesDirPath(siteId); @@ -184,7 +184,7 @@ export class CoreSharedFilesProvider { * Get the path to a site's shared files folder. * * @param siteId Site ID. If not defined, current site. - * @return Path. + * @returns Path. */ getSiteSharedFilesDirPath(siteId?: string): string { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -196,7 +196,7 @@ export class CoreSharedFilesProvider { * Check if a file has been treated already. * * @param fileId File ID. - * @return Resolved if treated, rejected otherwise. + * @returns Resolved if treated, rejected otherwise. */ protected async isFileTreated(fileId: string): Promise { const db = await this.appDB; @@ -208,7 +208,7 @@ export class CoreSharedFilesProvider { * Mark a file as treated. * * @param fileId File ID. - * @return Promise resolved when marked. + * @returns Promise resolved when marked. */ protected async markAsTreated(fileId: string): Promise { try { @@ -228,7 +228,7 @@ export class CoreSharedFilesProvider { * @param entry File entry. * @param newName Name of the new file. If not defined, use original file's name. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async storeFileInSite(entry: FileEntry, newName?: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -256,7 +256,7 @@ export class CoreSharedFilesProvider { * Unmark a file as treated. * * @param fileId File ID. - * @return Resolved when unmarked. + * @returns Resolved when unmarked. */ protected async unmarkAsTreated(fileId: string): Promise { const db = await this.appDB; diff --git a/src/core/features/sitehome/pages/index/index.ts b/src/core/features/sitehome/pages/index/index.ts index dbfc682e8..ec1432416 100644 --- a/src/core/features/sitehome/pages/index/index.ts +++ b/src/core/features/sitehome/pages/index/index.ts @@ -93,7 +93,7 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { /** * Convenience function to fetch the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadContent(): Promise { this.hasContent = false; @@ -214,7 +214,7 @@ export class CoreSiteHomeIndexPage implements OnInit, OnDestroy { } /** - * Component being destroyed. + * @inheritdoc */ ngOnDestroy(): void { this.updateSiteObserver.off(); diff --git a/src/core/features/sitehome/services/handlers/sitehome-home.ts b/src/core/features/sitehome/services/handlers/sitehome-home.ts index 61e86b46b..f77b97adc 100644 --- a/src/core/features/sitehome/services/handlers/sitehome-home.ts +++ b/src/core/features/sitehome/services/handlers/sitehome-home.ts @@ -33,7 +33,7 @@ export class CoreSiteHomeHomeHandlerService implements CoreMainMenuHomeHandler { /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.isEnabledForSite(); @@ -43,7 +43,7 @@ export class CoreSiteHomeHomeHandlerService implements CoreMainMenuHomeHandler { * Check if the handler is enabled on a certain site. * * @param siteId Site ID. If not defined, current site. - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabledForSite(siteId?: string): Promise { return CoreSiteHome.isAvailable(siteId); @@ -52,7 +52,7 @@ export class CoreSiteHomeHomeHandlerService implements CoreMainMenuHomeHandler { /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreMainMenuHomeHandlerToDisplay { const site = CoreSites.getCurrentSite(); diff --git a/src/core/features/sitehome/services/sitehome.ts b/src/core/features/sitehome/services/sitehome.ts index 596d144ef..ab145224e 100644 --- a/src/core/features/sitehome/services/sitehome.ts +++ b/src/core/features/sitehome/services/sitehome.ts @@ -44,7 +44,7 @@ export class CoreSiteHomeProvider { * Get the news forum for the Site Home. * * @param siteHomeId Site Home ID. - * @return Promise resolved with the forum if found, rejected otherwise. + * @returns Promise resolved with the forum if found, rejected otherwise. */ async getNewsForum(siteHomeId?: number): Promise { if (!siteHomeId) { @@ -65,7 +65,7 @@ export class CoreSiteHomeProvider { * Invalidate the WS call to get the news forum for the Site Home. * * @param siteHomeId Site Home ID. - * @return Promise resolved when invalidated. + * @returns Promise resolved when invalidated. */ async invalidateNewsForum(siteHomeId: number): Promise { await AddonModForum.invalidateForumData(siteHomeId); @@ -75,7 +75,7 @@ export class CoreSiteHomeProvider { * Returns whether or not the frontpage is available for the current site. * * @param siteId The site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it's available. + * @returns Promise resolved with boolean: whether it's available. */ async isAvailable(siteId?: string): Promise { try { @@ -125,7 +125,7 @@ export class CoreSiteHomeProvider { * Check if Site Home is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -137,7 +137,7 @@ export class CoreSiteHomeProvider { * Check if Site Home is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isDisabledInSite(site: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -149,7 +149,7 @@ export class CoreSiteHomeProvider { * Get the nams of the valid frontpage items. * * @param frontpageItemIds CSV string with indexes of site home components. - * @return Valid names for each item. + * @returns Valid names for each item. */ async getFrontPageItems(frontpageItemIds?: string): Promise { if (!frontpageItemIds) { diff --git a/src/core/features/siteplugins/classes/call-ws-directive.ts b/src/core/features/siteplugins/classes/call-ws-directive.ts index 53caf6458..d34411964 100644 --- a/src/core/features/siteplugins/classes/call-ws-directive.ts +++ b/src/core/features/siteplugins/classes/call-ws-directive.ts @@ -64,7 +64,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Call a WS. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async callWS(): Promise { try { @@ -89,7 +89,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Get the params for the WS call. * - * @return Params. + * @returns Params. */ protected getParamsForWS(): CoreFormFields { let params = this.params || {}; @@ -109,7 +109,6 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { * Function called when the WS call is successful. * * @param result Result of the WS call. - * @return If async, promise resolved when done. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected wsCallSuccess(result: unknown): void | Promise { @@ -119,7 +118,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Invalidate the WS call. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ invalidate(): Promise { const params = this.getParamsForWS(); diff --git a/src/core/features/siteplugins/classes/handlers/module-handler.ts b/src/core/features/siteplugins/classes/handlers/module-handler.ts index 8eda44cbb..6f5de77c6 100644 --- a/src/core/features/siteplugins/classes/handlers/module-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/module-handler.ts @@ -128,7 +128,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp * * @param module Module. * @param forCoursePage Whether the data will be used to render the course page. - * @return Bool. + * @returns Bool. */ protected shouldOnlyDisplayDescription(module: CoreCourseModuleData, forCoursePage?: boolean): boolean { if (forCoursePage && this.handlerSchema.coursepagemethod) { @@ -150,7 +150,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp /** * Check whether the module supports NO_VIEW_LINK. * - * @return Bool if defined, undefined if not specified. + * @returns Bool if defined, undefined if not specified. */ supportsNoViewLink(): boolean | undefined { return (this.supportsFeature ? @@ -166,7 +166,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp * @param handlerData Handler data. * @param method Method to call. * @param refresh Whether to refresh the data. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async loadCoursePageTemplate( module: CoreCourseModuleData, diff --git a/src/core/features/siteplugins/classes/handlers/module-prefetch-handler.ts b/src/core/features/siteplugins/classes/handlers/module-prefetch-handler.ts index 2781d6901..91dde49ee 100644 --- a/src/core/features/siteplugins/classes/handlers/module-prefetch-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/module-prefetch-handler.ts @@ -71,7 +71,7 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref * @param prefetch True to prefetch, false to download right away. * @param dirPath Path of the directory where to store all the content files. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadPrefetchPlugin( module: CoreCourseAnyModuleData, @@ -114,7 +114,7 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref * @param courseId Course ID. * @param prefetch True to prefetch, false to download right away. * @param dirPath Path of the directory where to store all the content files. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async downloadOrPrefetchFiles( siteId: string, diff --git a/src/core/features/siteplugins/classes/handlers/settings-handler.ts b/src/core/features/siteplugins/classes/handlers/settings-handler.ts index 8ec559901..3328f39c2 100644 --- a/src/core/features/siteplugins/classes/handlers/settings-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/settings-handler.ts @@ -42,7 +42,7 @@ export class CoreSitePluginsSettingsHandler extends CoreSitePluginsBaseHandler i /** * Returns the data needed to render the handler. * - * @return Data. + * @returns Data. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts b/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts index a03d8e083..213f4361a 100644 --- a/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts +++ b/src/core/features/siteplugins/components/assign-feedback/assign-feedback.ts @@ -37,7 +37,7 @@ export class CoreSitePluginsAssignFeedbackComponent extends CoreSitePluginsCompi @Input() edit = false; // Whether the user is editing. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Pass the input and output data to the component. @@ -57,7 +57,7 @@ export class CoreSitePluginsAssignFeedbackComponent extends CoreSitePluginsCompi /** * Invalidate the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(); diff --git a/src/core/features/siteplugins/components/assign-submission/assign-submission.ts b/src/core/features/siteplugins/components/assign-submission/assign-submission.ts index ba2bdeab9..ed7232587 100644 --- a/src/core/features/siteplugins/components/assign-submission/assign-submission.ts +++ b/src/core/features/siteplugins/components/assign-submission/assign-submission.ts @@ -36,7 +36,7 @@ export class CoreSitePluginsAssignSubmissionComponent extends CoreSitePluginsCom @Input() allowOffline = false; // Whether to allow offline. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Pass the input and output data to the component. @@ -55,7 +55,7 @@ export class CoreSitePluginsAssignSubmissionComponent extends CoreSitePluginsCom /** * Invalidate the data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(); diff --git a/src/core/features/siteplugins/components/block/block.ts b/src/core/features/siteplugins/components/block/block.ts index 85a4bbac4..f655cb4b8 100644 --- a/src/core/features/siteplugins/components/block/block.ts +++ b/src/core/features/siteplugins/components/block/block.ts @@ -68,7 +68,7 @@ export class CoreSitePluginsBlockComponent extends CoreBlockBaseComponent implem /** * Invalidate block data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async invalidateContent(): Promise { if (!this.component || !this.method) { diff --git a/src/core/features/siteplugins/components/course-format/course-format.ts b/src/core/features/siteplugins/components/course-format/course-format.ts index 45eaf0266..ee72880e0 100644 --- a/src/core/features/siteplugins/components/course-format/course-format.ts +++ b/src/core/features/siteplugins/components/course-format/course-format.ts @@ -94,7 +94,7 @@ export class CoreSitePluginsCourseFormatComponent implements OnChanges { * @param refresher Refresher. * @param done Function to call when done. * @param afterCompletionChange Whether the refresh is due to a completion change. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher, done?: () => void, afterCompletionChange?: boolean): Promise { await this.content?.refreshContent(afterCompletionChange); diff --git a/src/core/features/siteplugins/components/module-index/module-index.ts b/src/core/features/siteplugins/components/module-index/module-index.ts index a0001552f..78caae070 100644 --- a/src/core/features/siteplugins/components/module-index/module-index.ts +++ b/src/core/features/siteplugins/components/module-index/module-index.ts @@ -94,7 +94,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C displayPrefetch = true; displaySize = true; displayGrades = false; - // @TODO: // Currently display blogs is not an option since it may change soon adding new summary handlers. + // @todo // Currently display blogs is not an option since it may change soon adding new summary handlers. displayBlog = false; ptrEnabled = true; @@ -103,7 +103,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C jsData?: Record; // Data to pass to the component. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (!this.module) { @@ -149,7 +149,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C * Refresh the data. * * @param refresher Refresher. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async doRefresh(refresher?: IonRefresher | null): Promise { try { @@ -274,7 +274,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C * * @param name Name of the function to call. * @param params List of params to send to the function. - * @return Result of the call. Undefined if no component instance or the function doesn't exist. + * @returns Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: unknown[]): unknown | undefined { return this.content?.callComponentFunction(name, params); diff --git a/src/core/features/siteplugins/components/only-title-block/only-title-block.ts b/src/core/features/siteplugins/components/only-title-block/only-title-block.ts index 058ccca47..f01d98432 100644 --- a/src/core/features/siteplugins/components/only-title-block/only-title-block.ts +++ b/src/core/features/siteplugins/components/only-title-block/only-title-block.ts @@ -35,7 +35,7 @@ export class CoreSitePluginsOnlyTitleBlockComponent extends CoreBlockBaseCompone } /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { super.ngOnInit(); diff --git a/src/core/features/siteplugins/components/plugin-content/plugin-content.ts b/src/core/features/siteplugins/components/plugin-content/plugin-content.ts index 32c9da985..2bd56a959 100644 --- a/src/core/features/siteplugins/components/plugin-content/plugin-content.ts +++ b/src/core/features/siteplugins/components/plugin-content/plugin-content.ts @@ -61,7 +61,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.fetchContent(); @@ -86,7 +86,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { * Fetches the content to render. * * @param refresh Whether the user is refreshing. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchContent(refresh?: boolean): Promise { this.onLoadingContent.emit(refresh); @@ -222,7 +222,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { * * @param name Name of the function to call. * @param params List of params to send to the function. - * @return Result of the call. Undefined if no component instance or the function doesn't exist. + * @returns Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: unknown[]): unknown | undefined { return this.compileComponent?.callComponentFunction(name, params); diff --git a/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts b/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts index 0fd8f641a..8a288eaa4 100644 --- a/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts +++ b/src/core/features/siteplugins/components/question-behaviour/question-behaviour.ts @@ -46,7 +46,7 @@ export class CoreSitePluginsQuestionBehaviourComponent extends CoreSitePluginsCo } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Pass the input and output data to the component. diff --git a/src/core/features/siteplugins/components/question/question.ts b/src/core/features/siteplugins/components/question/question.ts index 33132630a..3354ebe11 100644 --- a/src/core/features/siteplugins/components/question/question.ts +++ b/src/core/features/siteplugins/components/question/question.ts @@ -43,7 +43,7 @@ export class CoreSitePluginsQuestionComponent extends CoreSitePluginsCompileInit @Output() onAbort = new EventEmitter(); // Should emit an event if the question should be aborted. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Pass the input and output data to the component. diff --git a/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts b/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts index 3ed0e21b9..7c4c2a502 100644 --- a/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts +++ b/src/core/features/siteplugins/components/quiz-access-rule/quiz-access-rule.ts @@ -37,7 +37,7 @@ export class CoreSitePluginsQuizAccessRuleComponent extends CoreSitePluginsCompi @Input() form?: FormGroup; // Form where to add the form control. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Pass the input and output data to the component. diff --git a/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts b/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts index a181a6001..efd1a04c8 100644 --- a/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts +++ b/src/core/features/siteplugins/components/user-profile-field/user-profile-field.ts @@ -41,7 +41,7 @@ export class CoreSitePluginsUserProfileFieldComponent extends CoreSitePluginsCom @Input() courseId?: number; // Course ID the field belongs to (if any). It can be used to improve performance with filters. /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { // Pass the input data to the component. diff --git a/src/core/features/siteplugins/directives/call-ws-new-content.ts b/src/core/features/siteplugins/directives/call-ws-new-content.ts index f76432877..98424da81 100644 --- a/src/core/features/siteplugins/directives/call-ws-new-content.ts +++ b/src/core/features/siteplugins/directives/call-ws-new-content.ts @@ -76,9 +76,7 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal } /** - * Function called when the WS call is successful. - * - * @param result Result of the WS call. + * @inheritdoc */ protected wsCallSuccess(result: unknown): void { let args = this.args || {}; diff --git a/src/core/features/siteplugins/directives/new-content.ts b/src/core/features/siteplugins/directives/new-content.ts index 6ed25dbad..e7d219bfb 100644 --- a/src/core/features/siteplugins/directives/new-content.ts +++ b/src/core/features/siteplugins/directives/new-content.ts @@ -70,7 +70,7 @@ export class CoreSitePluginsNewContentDirective implements OnInit { } /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.element.addEventListener('click', (ev: Event): void => { diff --git a/src/core/features/siteplugins/pages/course-option/course-option.ts b/src/core/features/siteplugins/pages/course-option/course-option.ts index 363a1fe39..564b3ea57 100644 --- a/src/core/features/siteplugins/pages/course-option/course-option.ts +++ b/src/core/features/siteplugins/pages/course-option/course-option.ts @@ -40,7 +40,7 @@ export class CoreSitePluginsCourseOptionPage implements OnInit { ptrEnabled = true; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.courseId = CoreNavigator.getRouteNumberParam('courseId'); @@ -116,7 +116,7 @@ export class CoreSitePluginsCourseOptionPage implements OnInit { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (!this.content) { diff --git a/src/core/features/siteplugins/pages/module-index/module-index.ts b/src/core/features/siteplugins/pages/module-index/module-index.ts index 653d88a1e..0dccf03fe 100644 --- a/src/core/features/siteplugins/pages/module-index/module-index.ts +++ b/src/core/features/siteplugins/pages/module-index/module-index.ts @@ -93,7 +93,7 @@ export class CoreSitePluginsModuleIndexPage implements OnInit, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (!this.content) { diff --git a/src/core/features/siteplugins/pages/plugin-page/plugin-page.ts b/src/core/features/siteplugins/pages/plugin-page/plugin-page.ts index 0895d5157..8e73791fb 100644 --- a/src/core/features/siteplugins/pages/plugin-page/plugin-page.ts +++ b/src/core/features/siteplugins/pages/plugin-page/plugin-page.ts @@ -105,7 +105,7 @@ export class CoreSitePluginsPluginPage implements OnInit, CanLeave { /** * Check if we can leave the page or not. * - * @return Resolved if we can leave it, rejected if not. + * @returns Resolved if we can leave it, rejected if not. */ async canLeave(): Promise { if (!this.content) { diff --git a/src/core/features/siteplugins/services/siteplugins-helper.ts b/src/core/features/siteplugins/services/siteplugins-helper.ts index ddc7db3a9..afda35bdc 100644 --- a/src/core/features/siteplugins/services/siteplugins-helper.ts +++ b/src/core/features/siteplugins/services/siteplugins-helper.ts @@ -95,7 +95,7 @@ const HANDLER_DISABLED = 'core_site_plugins_helper_handler_disabled'; * * This code is split from CoreSitePluginsProvider to prevent circular dependencies. * - * @todo: Support ViewChild and similar in site plugins. Possible solution: make components and directives inject the instance + * @todo Support ViewChild and similar in site plugins. Possible solution: make components and directives inject the instance * inside the host DOM element? */ @Injectable({ providedIn: 'root' }) @@ -155,7 +155,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param siteId Site ID. If not provided, current site. - * @return Promise resolved with the CSS code. + * @returns Promise resolved with the CSS code. */ async downloadStyles( plugin: CoreSitePluginsPlugin, @@ -224,7 +224,7 @@ export class CoreSitePluginsHelperProvider { * * @param plugin Data of the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved when done. It returns the results of the getContent call and the data returned by + * @returns Promise resolved when done. It returns the results of the getContent call and the data returned by * the init JS (if any). */ protected async executeHandlerInit( @@ -244,7 +244,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param method The method to call. * @param isInit Whether it's the init method. - * @return Promise resolved with the results of the getContent call and the data returned by the JS (if any). + * @returns Promise resolved with the results of the getContent call and the data returned by the JS (if any). */ protected async executeMethodAndJS( plugin: CoreSitePluginsPlugin, @@ -292,7 +292,7 @@ export class CoreSitePluginsHelperProvider { * Fetch site plugins. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. Returns the list of plugins to load. + * @returns Promise resolved when done. Returns the list of plugins to load. * @deprecated since 3.9.5. The function was moved to CoreSitePlugins.getPlugins. */ async fetchSitePlugins(siteId?: string): Promise { @@ -303,7 +303,7 @@ export class CoreSitePluginsHelperProvider { * Given an addon name, return the prefix to add to its string keys. * * @param addon Name of the addon (plugin.addon). - * @return Prefix. + * @returns Prefix. */ protected getPrefixForStrings(addon: string): string { if (addon) { @@ -318,7 +318,7 @@ export class CoreSitePluginsHelperProvider { * * @param addon Name of the addon (plugin.addon). * @param key The key of the string. - * @return Full string key. + * @returns Full string key. */ protected getPrefixedString(addon: string, key: string): string { return this.getPrefixForStrings(addon) + key; @@ -329,7 +329,7 @@ export class CoreSitePluginsHelperProvider { * * @param plugin Data of the plugin. * @param site Site affected. - * @return Whether it's a site plugin and it's enabled. + * @returns Whether it's a site plugin and it's enabled. * @deprecated since 3.9.5. The function was moved to CoreSitePlugins.isSitePluginEnabled. */ isSitePluginEnabled(plugin: CoreSitePluginsPlugin, site: CoreSite): boolean { @@ -357,7 +357,7 @@ export class CoreSitePluginsHelperProvider { * Load a site plugin. * * @param plugin Data of the plugin. - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ async loadSitePlugin(plugin: CoreSitePluginsPlugin): Promise { this.logger.debug('Load site plugin:', plugin); @@ -396,7 +396,7 @@ export class CoreSitePluginsHelperProvider { * Load site plugins. * * @param plugins The plugins to load. - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ async loadSitePlugins(plugins: CoreSitePluginsPlugin[]): Promise { this.courseRestrictHandlers = {}; @@ -464,7 +464,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async registerHandler( plugin: CoreSitePluginsPlugin, @@ -587,7 +587,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return A promise resolved with a string to identify the handler. + * @returns A promise resolved with a string to identify the handler. */ protected async registerComponentInitHandler( plugin: CoreSitePluginsPlugin, @@ -647,7 +647,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerAssignFeedbackHandler( plugin: CoreSitePluginsPlugin, @@ -675,7 +675,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerAssignSubmissionHandler( plugin: CoreSitePluginsPlugin, @@ -704,7 +704,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of init function. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerBlockHandler( plugin: CoreSitePluginsPlugin, @@ -731,7 +731,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerCourseFormatHandler( plugin: CoreSitePluginsPlugin, @@ -757,7 +757,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerCourseOptionHandler( plugin: CoreSitePluginsPlugin, @@ -807,7 +807,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerMainMenuHandler( plugin: CoreSitePluginsPlugin, @@ -842,7 +842,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerMessageOutputHandler( plugin: CoreSitePluginsPlugin, @@ -878,7 +878,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerModuleHandler( plugin: CoreSitePluginsPlugin, @@ -932,7 +932,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerQuestionHandler( plugin: CoreSitePluginsPlugin, @@ -956,7 +956,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerQuestionBehaviourHandler( plugin: CoreSitePluginsPlugin, @@ -983,7 +983,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerQuizAccessRuleHandler( plugin: CoreSitePluginsPlugin, @@ -1008,7 +1008,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerSettingsHandler( plugin: CoreSitePluginsPlugin, @@ -1043,7 +1043,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerUserProfileHandler( plugin: CoreSitePluginsPlugin, @@ -1086,7 +1086,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerUserProfileFieldHandler( plugin: CoreSitePluginsPlugin, @@ -1113,7 +1113,7 @@ export class CoreSitePluginsHelperProvider { * @param plugin Data of the plugin. * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. - * @return Promise resolved with a string to identify the handler. + * @returns Promise resolved with a string to identify the handler. */ protected registerWorkshopAssessmentStrategyHandler( plugin: CoreSitePluginsPlugin, @@ -1136,7 +1136,7 @@ export class CoreSitePluginsHelperProvider { /** * Reload the handlers that are restricted to certain courses. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async reloadCourseRestrictHandlers(): Promise { if (!Object.keys(this.courseRestrictHandlers).length) { @@ -1174,7 +1174,7 @@ export class CoreSitePluginsHelperProvider { * @param handlerName Name of the handler in the plugin. * @param handlerSchema Data about the handler. * @param initResult Result of the init WS call. - * @return A string to identify the handler. + * @returns A string to identify the handler. */ protected registerMainMenuHomeHandler( plugin: CoreSitePluginsPlugin, diff --git a/src/core/features/siteplugins/services/siteplugins.ts b/src/core/features/siteplugins/services/siteplugins.ts index 7cbc8dcdc..6cc006cd4 100644 --- a/src/core/features/siteplugins/services/siteplugins.ts +++ b/src/core/features/siteplugins/services/siteplugins.ts @@ -72,7 +72,7 @@ export class CoreSitePluginsProvider { * * @param args Original params. * @param site Site. If not defined, current site. - * @return Promise resolved with the new params. + * @returns Promise resolved with the new params. */ protected async addDefaultArgs = Record>( args: T, @@ -113,7 +113,7 @@ export class CoreSitePluginsProvider { * @param data Data to send to the WS. * @param preSets Extra options. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ async callWS( method: string, @@ -135,7 +135,7 @@ export class CoreSitePluginsProvider { * * @param initResult Result of the init WS call. * @param contentResult Result of the content WS call (if any). - * @return An object with the data to pass to the JS. + * @returns An object with the data to pass to the JS. */ createDataForJS( initResult?: CoreSitePluginsContent | null, @@ -166,7 +166,7 @@ export class CoreSitePluginsProvider { * * @param method Name of the method. * @param data Data to identify the WS call. - * @return Cache key. + * @returns Cache key. */ getCallWSCacheKey(method: string, data: Record): string { return this.getCallWSCommonCacheKey(method) + ':' + CoreUtils.sortAndStringify(data); @@ -176,7 +176,7 @@ export class CoreSitePluginsProvider { * Get common cache key for a WS call. * * @param method Name of the method. - * @return Cache key. + * @returns Cache key. */ protected getCallWSCommonCacheKey(method: string): string { return ROOT_CACHE_KEY + 'ws:' + method; @@ -190,7 +190,7 @@ export class CoreSitePluginsProvider { * @param args The params for the method. * @param preSets Extra options. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the result. + * @returns Promise resolved with the result. */ async getContent( component: string, @@ -243,7 +243,7 @@ export class CoreSitePluginsProvider { * @param component Component where the class is. E.g. mod_assign. * @param method Method to execute in the class. * @param args The params for the method. - * @return Cache key. + * @returns Cache key. */ protected getContentCacheKey(component: string, method: string, args: Record): string { return ROOT_CACHE_KEY + 'content:' + component + ':' + method + ':' + CoreUtils.sortAndStringify(args); @@ -256,7 +256,7 @@ export class CoreSitePluginsProvider { * @param paramName Name of the param as defined by the handler. * @param courseId Course ID (if prefetching a course). * @param module The module object returned by WS (if prefetching a module). - * @return The value. + * @returns The value. */ protected getDownloadParam( component: string, @@ -283,7 +283,7 @@ export class CoreSitePluginsProvider { * * @param plugin Data of the plugin. * @param handlerName Name of the handler inside the plugin. - * @return Unique name. + * @returns Unique name. */ getHandlerUniqueName(plugin: CoreSitePluginsPlugin, handlerName: string): string { return plugin.addon + '_' + handlerName; @@ -293,7 +293,7 @@ export class CoreSitePluginsProvider { * Get site plugins for site. * * @param siteId Site ID. - * @return Promise resolved with the plugins. + * @returns Promise resolved with the plugins. */ async getPlugins(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -315,7 +315,7 @@ export class CoreSitePluginsProvider { /** * Get cache key for get plugins WS call. * - * @return Cache key. + * @returns Cache key. */ protected getPluginsCacheKey(): string { return ROOT_CACHE_KEY + 'plugins'; @@ -325,7 +325,7 @@ export class CoreSitePluginsProvider { * Get a site plugin handler. * * @param name Unique name of the handler. - * @return Handler. + * @returns Handler. */ getSitePluginHandler(name: string): CoreSitePluginsHandler | undefined { return this.sitePlugins[name]; @@ -334,7 +334,7 @@ export class CoreSitePluginsProvider { /** * Get the current site plugin list. * - * @return Plugin list ws info. + * @returns Plugin list ws info. */ getCurrentSitePluginList(): CoreSitePluginsWSPlugin[] { return CoreUtils.objectToArray(this.sitePlugins).map((plugin) => plugin.plugin); @@ -345,7 +345,7 @@ export class CoreSitePluginsProvider { * * @param method WS method to use. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllCallWSForMethod(method: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -360,7 +360,7 @@ export class CoreSitePluginsProvider { * @param data Data to send to the WS. * @param preSets Extra options. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateCallWS( method: string, @@ -379,10 +379,10 @@ export class CoreSitePluginsProvider { * Invalidate a page content. * * @param component Component where the class is. E.g. mod_assign. - * @param method Method to execute in the class. + * @param callback Method to execute in the class. * @param args The params for the method. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateContent(component: string, callback: string, args?: Record, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -393,6 +393,7 @@ export class CoreSitePluginsProvider { /** * Check if the get content WS is available. * + * @returns If get content WS is available. * @deprecated since app 4.0 */ isGetContentAvailable(): boolean { @@ -405,7 +406,7 @@ export class CoreSitePluginsProvider { * @param courseId Course ID to check. * @param restrictEnrolled If true or undefined, handler is only enabled for courses the user is enrolled in. * @param restrict Users and courses the handler is restricted to. - * @return Whether the handler is enabled. + * @returns Whether the handler is enabled. */ async isHandlerEnabledForCourse( courseId: number, @@ -435,7 +436,7 @@ export class CoreSitePluginsProvider { * @param userId User ID to check. * @param restrictCurrent Whether handler is only enabled for current user. * @param restrict Users and courses the handler is restricted to. - * @return Whether the handler is enabled. + * @returns Whether the handler is enabled. */ isHandlerEnabledForUser(userId: number, restrictCurrent?: boolean, restrict?: CoreSitePluginsContentRestrict): boolean { if (restrictCurrent && userId != CoreSites.getCurrentSite()?.getUserId()) { @@ -456,7 +457,7 @@ export class CoreSitePluginsProvider { * * @param plugin Data of the plugin. * @param site Site affected. - * @return Whether it's a site plugin and it's enabled. + * @returns Whether it's a site plugin and it's enabled. */ isSitePluginEnabled(plugin: CoreSitePluginsPlugin, site: CoreSite): boolean { if (site.isFeatureDisabled('sitePlugin_' + plugin.component + '_' + plugin.addon) || !plugin.handlers) { @@ -484,7 +485,7 @@ export class CoreSitePluginsProvider { * @param args The current args. * @param otherData All the other data. * @param useOtherData Names of the attributes to include. - * @return New args. + * @returns New args. */ loadOtherDataInArgs( args: Record | undefined, @@ -540,7 +541,7 @@ export class CoreSitePluginsProvider { * @param prefetch True to prefetch, false to download right away. * @param dirPath Path of the directory where to store all the content files. * @param site Site. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async prefetchFunctions( component: string, @@ -629,8 +630,8 @@ export class CoreSitePluginsProvider { /** * Store the promise for a plugin that is being initialised. * - * @param component - * @param promise + * @param component Component name. + * @param promise Promise to register. */ registerSitePluginPromise(component: string, promise: Promise): void { this.sitePluginPromises[component] = promise; @@ -653,7 +654,8 @@ export class CoreSitePluginsProvider { /** * Is a plugin being initialised for the specified component? * - * @param component + * @param component Component name. + * @returns If site plugin promise has been set. */ sitePluginPromiseExists(component: string): boolean { return !!this.sitePluginPromises[component]; @@ -662,7 +664,8 @@ export class CoreSitePluginsProvider { /** * Get the promise for a plugin that is being initialised. * - * @param component + * @param component Component name. + * @returns Plugin loaded promise. */ sitePluginLoaded(component: string): Promise | undefined { return this.sitePluginPromises[component]; @@ -671,7 +674,7 @@ export class CoreSitePluginsProvider { /** * Wait for fetch plugins to be done. * - * @return Promise resolved when site plugins have been fetched. + * @returns Promise resolved when site plugins have been fetched. */ async waitFetchPlugins(): Promise { await this.fetchPluginsDeferred; @@ -681,7 +684,7 @@ export class CoreSitePluginsProvider { * Get a module hander instance, if present. * * @param modName Mod name without "mod_". - * @return Handler instance, undefined if not found. + * @returns Handler instance, undefined if not found. */ getModuleHandlerInstance(modName: string): CoreSitePluginsModuleHandler | undefined { return this.moduleHandlerInstances[modName]; diff --git a/src/core/features/styles/services/styles.ts b/src/core/features/styles/services/styles.ts index fd07b1f6c..f966c76bd 100644 --- a/src/core/features/styles/services/styles.ts +++ b/src/core/features/styles/services/styles.ts @@ -43,7 +43,7 @@ export interface CoreStyleHandler { * * @param siteId Site Id. * @param config Site public config for temp sites. - * @return Wether the handler should be enabled for the site. + * @returns Wether the handler should be enabled for the site. */ isEnabled(siteId: string, config?: CoreSitePublicConfigResponse): boolean | Promise; @@ -52,7 +52,7 @@ export interface CoreStyleHandler { * * @param siteId Site Id. * @param config Site public config for temp sites. - * @return CSS to apply. + * @returns CSS to apply. */ getStyle(siteId?: string, config?: CoreSitePublicConfigResponse): string | Promise; } @@ -203,7 +203,7 @@ export class CoreStylesService { * @param handler Style handler. * @param disabled Whether the element should be disabled. * @param config Site public config. - * @return New element. + * @returns New element. */ protected async setStyle( siteId: string, @@ -246,7 +246,7 @@ export class CoreStylesService { * Add a style element for a site and load the styles for that element. The style will be disabled. * * @param siteId Site ID. - * @return Promise resolved when added and loaded. + * @returns Promise resolved when added and loaded. */ protected async addSite(siteId?: string): Promise { if (!siteId || this.stylesEls[siteId]) { @@ -287,7 +287,7 @@ export class CoreStylesService { * * @param siteId Site Id. * @param sourceName Source or handler name. - * @return Element Id. + * @returns Element Id. */ protected getStyleId(siteId: string, sourceName: string): string { return `${sourceName}-${siteId}`; @@ -350,7 +350,7 @@ export class CoreStylesService { * * @param siteId Site ID. If not defined, current site. * @param disabled Whether loaded styles should be disabled. - * @return Promise resolved when styles are loaded. + * @returns Promise resolved when styles are loaded. */ protected async load(siteId?: string, disabled = false): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -380,7 +380,7 @@ export class CoreStylesService { * Load styles for a temporary site, given its public config. These styles aren't prefetched. * * @param config Site public config. - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ protected async loadTmpStyles(config: CoreSitePublicConfigResponse): Promise { // Create the style and add it to the header. @@ -396,7 +396,7 @@ export class CoreStylesService { /** * Preload the styles of the current site (stored in DB). * - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ protected async preloadCurrentSite(): Promise { const siteId = await CoreUtils.ignoreErrors(CoreSites.getStoredCurrentSiteId()); @@ -412,7 +412,7 @@ export class CoreStylesService { /** * Preload the styles of all the stored sites. * - * @return Promise resolved when loaded. + * @returns Promise resolved when loaded. */ protected async preloadSites(): Promise { const ids = await CoreSites.getSitesIds(); @@ -446,7 +446,7 @@ export class CoreStylesService { * Unload styles for a temporary site. */ protected unloadTmpStyles(): void { - return this.removeSite(CoreStylesService.TMP_SITE_ID); + this.removeSite(CoreStylesService.TMP_SITE_ID); } } diff --git a/src/core/features/tag/pages/index-area/index-area.page.ts b/src/core/features/tag/pages/index-area/index-area.page.ts index 58104c6d3..b6d6d382d 100644 --- a/src/core/features/tag/pages/index-area/index-area.page.ts +++ b/src/core/features/tag/pages/index-area/index-area.page.ts @@ -91,7 +91,7 @@ export class CoreTagIndexAreaPage implements OnInit { * Fetch next page of the tag index area. * * @param refresh Whether to refresh the data or fetch a new page. - * @return Resolved when done. + * @returns Resolved when done. */ async fetchData(refresh: boolean = false): Promise { this.loadMoreError = false; @@ -136,7 +136,7 @@ export class CoreTagIndexAreaPage implements OnInit { * Load more items. * * @param infiniteComplete Infinite scroll complete function. - * @return Resolved when done. + * @returns Resolved when done. */ async loadMore(infiniteComplete?: () => void): Promise { try { diff --git a/src/core/features/tag/pages/index/index.page.ts b/src/core/features/tag/pages/index/index.page.ts index 1e72b4866..09a40f97f 100644 --- a/src/core/features/tag/pages/index/index.page.ts +++ b/src/core/features/tag/pages/index/index.page.ts @@ -68,7 +68,7 @@ export class CoreTagIndexPage implements OnInit { /** * Fetch first page of tag index per area. * - * @return Resolved when done. + * @returns Resolved when done. */ async fetchData(): Promise { try { diff --git a/src/core/features/tag/pages/search/search.page.ts b/src/core/features/tag/pages/search/search.page.ts index c0b6d4724..02ad43eb3 100644 --- a/src/core/features/tag/pages/search/search.page.ts +++ b/src/core/features/tag/pages/search/search.page.ts @@ -71,7 +71,7 @@ export class CoreTagSearchPage implements OnInit { /** * Fetch tag collections. * - * @return Resolved when done. + * @returns Resolved when done. */ async fetchCollections(): Promise { const collections = await CoreTag.getTagCollections(); @@ -88,7 +88,7 @@ export class CoreTagSearchPage implements OnInit { /** * Fetch tags. * - * @return Resolved when done. + * @returns Resolved when done. */ async fetchTags(): Promise { this.cloud = await CoreTag.getTagCloud(this.collectionId, undefined, undefined, this.query); @@ -120,7 +120,7 @@ export class CoreTagSearchPage implements OnInit { * Search tags. * * @param query Search query. - * @return Resolved when done. + * @returns Resolved when done. */ searchTags(query: string): Promise { this.searching = true; diff --git a/src/core/features/tag/services/handlers/index-link.ts b/src/core/features/tag/services/handlers/index-link.ts index 6454bbdb9..ffccbd5ff 100644 --- a/src/core/features/tag/services/handlers/index-link.ts +++ b/src/core/features/tag/services/handlers/index-link.ts @@ -30,14 +30,7 @@ export class CoreTagIndexLinkHandlerService extends CoreContentLinksHandlerBase pattern = /\/tag\/index\.php/; /** - * Get the list of actions for a link (url). - * - * @param siteIds List of sites the URL belongs to. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @param data Extra data to handle the URL. - * @return List of (or promise resolved with list of) actions. + * @inheritdoc */ getActions( siteIds: string[], @@ -68,14 +61,7 @@ export class CoreTagIndexLinkHandlerService extends CoreContentLinksHandlerBase } /** - * Check if the handler is enabled for a certain site (site + user) and a URL. - * If not defined, defaults to true. - * - * @param siteId The site ID. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @return Whether the handler is enabled for the URL and site. + * @inheritdoc */ async isEnabled(siteId: string): Promise { return CoreTag.areTagsAvailable(siteId); diff --git a/src/core/features/tag/services/handlers/mainmenu.ts b/src/core/features/tag/services/handlers/mainmenu.ts index 1a1a7cf77..cd88b5740 100644 --- a/src/core/features/tag/services/handlers/mainmenu.ts +++ b/src/core/features/tag/services/handlers/mainmenu.ts @@ -32,7 +32,7 @@ export class CoreTagMainMenuHandlerService implements CoreMainMenuHandler { /** * Check if the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { const available = await CoreTag.areTagsAvailable(); @@ -47,7 +47,7 @@ export class CoreTagMainMenuHandlerService implements CoreMainMenuHandler { /** * Returns the data needed to render the handler. * - * @return Data needed to render the handler. + * @returns Data needed to render the handler. */ getDisplayData(): CoreMainMenuHandlerData { return { diff --git a/src/core/features/tag/services/handlers/search-link.ts b/src/core/features/tag/services/handlers/search-link.ts index 1749af16a..18659e6fb 100644 --- a/src/core/features/tag/services/handlers/search-link.ts +++ b/src/core/features/tag/services/handlers/search-link.ts @@ -30,14 +30,7 @@ export class CoreTagSearchLinkHandlerService extends CoreContentLinksHandlerBase pattern = /\/tag\/search\.php/; /** - * Get the list of actions for a link (url). - * - * @param siteIds List of sites the URL belongs to. - * @param url The URL to treat. - * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param courseId Course ID related to the URL. Optional but recommended. - * @param data Extra data to handle the URL. - * @return List of (or promise resolved with list of) actions. + * @inheritdoc */ getActions( siteIds: string[], @@ -57,11 +50,7 @@ export class CoreTagSearchLinkHandlerService extends CoreContentLinksHandlerBase } /** - * Check if the handler is enabled for a certain site (site + user) and a URL. - * If not defined, defaults to true. - * - * @param siteId The site ID. - * @return Whether the handler is enabled for the URL and site. + * @inheritdoc */ async isEnabled(siteId: string): Promise { return CoreTag.areTagsAvailable(siteId); diff --git a/src/core/features/tag/services/tag-area-delegate.ts b/src/core/features/tag/services/tag-area-delegate.ts index 5b5e7a306..5864ea471 100644 --- a/src/core/features/tag/services/tag-area-delegate.ts +++ b/src/core/features/tag/services/tag-area-delegate.ts @@ -29,14 +29,14 @@ export interface CoreTagAreaHandler extends CoreDelegateHandler { * Parses the rendered content of a tag index and returns the items. * * @param content Rendered content. - * @return Area items (or promise resolved with the items). + * @returns Area items (or promise resolved with the items). */ parseContent(content: string): unknown[] | Promise; /** * Get the component to use to display items. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise>; } @@ -58,7 +58,7 @@ export class CoreTagAreaDelegateService extends CoreDelegate * * @param component Component name. * @param itemType Item type. - * @return String key. + * @returns String key. */ getDisplayNameKey(component: string, itemType: string): string { return (component == 'core' ? 'core.tag' : 'addon.' + component) + '.tagarea_' + itemType; @@ -70,7 +70,7 @@ export class CoreTagAreaDelegateService extends CoreDelegate * @param component Component name. * @param itemType Item type. * @param content Rendered content. - * @return Promise resolved with the area items, or undefined if not found. + * @returns Promise resolved with the area items, or undefined if not found. */ async parseContent(component: string, itemType: string, content: string): Promise { const type = component + '/' + itemType; @@ -83,7 +83,7 @@ export class CoreTagAreaDelegateService extends CoreDelegate * * @param component Component name. * @param itemType Item type. - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ async getComponent(component: string, itemType: string): Promise | undefined> { const type = component + '/' + itemType; diff --git a/src/core/features/tag/services/tag-helper.ts b/src/core/features/tag/services/tag-helper.ts index 40646c719..d618fe490 100644 --- a/src/core/features/tag/services/tag-helper.ts +++ b/src/core/features/tag/services/tag-helper.ts @@ -26,7 +26,7 @@ export class CoreTagHelperProvider { * Parses the rendered content of the "core_tag/tagfeed" web template and returns the items. * * @param content Rendered content. - * @return Area items. + * @returns Area items. */ parseFeedContent(content: string): CoreTagFeedElement[] { const items: CoreTagFeedElement[] = []; diff --git a/src/core/features/tag/services/tag.ts b/src/core/features/tag/services/tag.ts index a4e3f6128..fe86e0b29 100644 --- a/src/core/features/tag/services/tag.ts +++ b/src/core/features/tag/services/tag.ts @@ -33,7 +33,7 @@ export class CoreTagProvider { * Check whether tags are available in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if available, resolved with false otherwise. + * @returns Promise resolved with true if available, resolved with false otherwise. * @since 3.7 */ async areTagsAvailable(siteId?: string): Promise { @@ -46,7 +46,7 @@ export class CoreTagProvider { * Check whether tags are available in a certain site. * * @param site Site. If not defined, use current site. - * @return True if available. + * @returns True if available. * @since 3.7 */ areTagsAvailableInSite(site?: CoreSite): boolean { @@ -70,7 +70,7 @@ export class CoreTagProvider { * @param recursive Retrieve tag instances in the context and its children. * @param limit Maximum number of tags to retrieve. Defaults to SEARCH_LIMIT. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the tag cloud. + * @returns Promise resolved with the tag cloud. * @since 3.7 */ async getTagCloud( @@ -110,7 +110,7 @@ export class CoreTagProvider { * Fetch the tag collections. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the tag collections. + * @returns Promise resolved with the tag collections. * @since 3.7 */ async getTagCollections(siteId?: string): Promise { @@ -141,7 +141,7 @@ export class CoreTagProvider { * @param recursive Search in the context and its children. * @param page Page number. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the tag index per area. + * @returns Promise resolved with the tag index per area. * @since 3.7 */ async getTagIndexPerArea( @@ -203,7 +203,7 @@ export class CoreTagProvider { * @param fromContextId Context ID where this tag cloud is displayed. * @param contextId Only retrieve tag instances in this context. * @param recursive Retrieve tag instances in the context and its children. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateTagCloud( collectionId: number = 0, @@ -224,7 +224,7 @@ export class CoreTagProvider { /** * Invalidate tag collections. * - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateTagCollections(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -243,7 +243,7 @@ export class CoreTagProvider { * @param fromContextId Context ID where the link was displayed. * @param contextId Context ID where to search for items. * @param recursive Search in the context and its children. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateTagIndexPerArea( id: number, @@ -271,7 +271,7 @@ export class CoreTagProvider { * @param fromContextId Context ID where this tag cloud is displayed. * @param contextId Only retrieve tag instances in this context. * @param recursive Retrieve tag instances in the context and it's children. - * @return Cache key. + * @returns Cache key. */ protected getTagCloudKey( collectionId: number, @@ -295,7 +295,7 @@ export class CoreTagProvider { /** * Get cache key for tag collections. * - * @return Cache key. + * @returns Cache key. */ protected getTagCollectionsKey(): string { return ROOT_CACHE_KEY + 'collections'; @@ -311,7 +311,7 @@ export class CoreTagProvider { * @param fromContextId Context ID where the link was displayed. * @param contextId Context ID where to search for items. * @param recursive Search in the context and its children. - * @return Cache key. + * @returns Cache key. */ protected getTagIndexPerAreaKey( id: number, diff --git a/src/core/features/user/classes/base-profilefield-component.ts b/src/core/features/user/classes/base-profilefield-component.ts index c2b5ccb81..d7dbb2907 100644 --- a/src/core/features/user/classes/base-profilefield-component.ts +++ b/src/core/features/user/classes/base-profilefield-component.ts @@ -42,7 +42,7 @@ export abstract class CoreUserProfileFieldBaseComponent implements OnInit { required?: boolean; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { if (!this.field) { @@ -88,7 +88,7 @@ export abstract class CoreUserProfileFieldBaseComponent implements OnInit { /** * Create the Form control. * - * @return Form control. + * @returns Form control. */ protected createFormControl(field: AuthEmailSignupProfileField): FormControl { const formData = { diff --git a/src/core/features/user/classes/support/support-config.ts b/src/core/features/user/classes/support/support-config.ts index 09df13244..fd15ddf12 100644 --- a/src/core/features/user/classes/support/support-config.ts +++ b/src/core/features/user/classes/support/support-config.ts @@ -20,14 +20,14 @@ export abstract class CoreUserSupportConfig { /** * Check whether the user can contact support or not. * - * @return Whether the user can contact support. + * @returns Whether the user can contact support. */ public abstract canContactSupport(): boolean; /** * Get language used in the support page, if any. * - * @return Support page language. + * @returns Support page language. */ public abstract getSupportPageLang(): string | null; @@ -47,7 +47,7 @@ export abstract class CoreUserSupportConfig { /** * Build page url string with the internal information. * - * @return Support page url. + * @returns Support page url. */ protected abstract buildSupportPageUrl(): string; diff --git a/src/core/features/user/components/user-profile-field/user-profile-field.ts b/src/core/features/user/components/user-profile-field/user-profile-field.ts index c63c5dfae..e6e9ce874 100644 --- a/src/core/features/user/components/user-profile-field/user-profile-field.ts +++ b/src/core/features/user/components/user-profile-field/user-profile-field.ts @@ -42,7 +42,7 @@ export class CoreUserProfileFieldComponent implements OnInit { data: CoreUserProfileFieldComponentData = {}; // Data to pass to the component. /** - * Component being initialized. + * @inheritdoc */ async ngOnInit(): Promise { if (!this.field) { diff --git a/src/core/features/user/pages/about/about.page.ts b/src/core/features/user/pages/about/about.page.ts index 4a22aa789..a665e364d 100644 --- a/src/core/features/user/pages/about/about.page.ts +++ b/src/core/features/user/pages/about/about.page.ts @@ -97,7 +97,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy { /** * Fetches the user data. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fetchUser(): Promise { try { @@ -129,7 +129,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy { /** * Check if current user image has changed. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async checkUserImageUpdated(): Promise { if (!this.site || !this.site.getInfo() || !this.user) { @@ -200,7 +200,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy { * Refresh the user data. * * @param event Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshUser(event?: IonRefresher): Promise { await CoreUtils.ignoreErrors(CoreUser.invalidateUserCache(this.userId)); @@ -221,7 +221,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy { /** * Check whether the user avatar is not up to date with site info. * - * @return Whether the user avatar differs from site info cache. + * @returns Whether the user avatar differs from site info cache. */ protected isUserAvatarDirty(): boolean { if (!this.user || !this.site) { @@ -241,7 +241,7 @@ export class CoreUserAboutPage implements OnInit, OnDestroy { * the values returned by this function may not be valid urls, given that they are intended for string comparison. * * @param avatarUrl Avatar url. - * @return Normalized avatar string (may not be a valid url). + * @returns Normalized avatar string (may not be a valid url). */ protected normalizeAvatarUrl(avatarUrl?: string): string { if (!avatarUrl) { diff --git a/src/core/features/user/pages/profile/profile.page.ts b/src/core/features/user/pages/profile/profile.page.ts index d9e7280a9..3cb53f79a 100644 --- a/src/core/features/user/pages/profile/profile.page.ts +++ b/src/core/features/user/pages/profile/profile.page.ts @@ -173,7 +173,7 @@ export class CoreUserProfilePage implements OnInit, OnDestroy { * Refresh the user. * * @param event Event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async refreshUser(event?: IonRefresher): Promise { await CoreUtils.ignoreErrors(Promise.all([ diff --git a/src/core/features/user/services/handlers/sync-cron.ts b/src/core/features/user/services/handlers/sync-cron.ts index 833e97ba6..5ae66b5d1 100644 --- a/src/core/features/user/services/handlers/sync-cron.ts +++ b/src/core/features/user/services/handlers/sync-cron.ts @@ -32,7 +32,7 @@ export class CoreUserSyncCronHandlerService implements CoreCronHandler { * * @param siteId ID of the site affected, undefined for all sites. * @param force Wether the execution is forced (manual sync). - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars execute(siteId?: string, force?: boolean): Promise { @@ -42,7 +42,7 @@ export class CoreUserSyncCronHandlerService implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return Time between consecutive executions (in ms). + * @returns Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/core/features/user/services/handlers/tag-area.ts b/src/core/features/user/services/handlers/tag-area.ts index 4aedb6814..37111a061 100644 --- a/src/core/features/user/services/handlers/tag-area.ts +++ b/src/core/features/user/services/handlers/tag-area.ts @@ -33,7 +33,7 @@ export class CoreUserTagAreaHandlerService implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. * - * @return Whether or not the handler is enabled on a site level. + * @returns Whether or not the handler is enabled on a site level. */ async isEnabled(): Promise { return true; @@ -43,7 +43,7 @@ export class CoreUserTagAreaHandlerService implements CoreTagAreaHandler { * Parses the rendered content of a tag index and returns the items. * * @param content Rendered content. - * @return Area items (or promise resolved with the items). + * @returns Area items (or promise resolved with the items). */ parseContent(content: string): CoreUserTagFeedElement[] { const items: CoreUserTagFeedElement[] = []; @@ -83,7 +83,7 @@ export class CoreUserTagAreaHandlerService implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise> { return CoreUserTagAreaComponent; diff --git a/src/core/features/user/services/user-delegate.ts b/src/core/features/user/services/user-delegate.ts index cbb37dbf3..3c8ea1f71 100644 --- a/src/core/features/user/services/user-delegate.ts +++ b/src/core/features/user/services/user-delegate.ts @@ -66,7 +66,7 @@ export interface CoreUserProfileHandler extends CoreDelegateHandler { * @param contextId Context ID. * @param navOptions Navigation options for the course. * @param admOptions Admin options for the course. - * @return Whether or not the handler is enabled for a user. + * @returns Whether or not the handler is enabled for a user. */ isEnabledForContext?( context: CoreUserDelegateContext, @@ -81,7 +81,7 @@ export interface CoreUserProfileHandler extends CoreDelegateHandler { * @param user User object. * @param context Context. * @param contextId Context ID. - * @return Whether or not the handler is enabled for a user. + * @returns Whether or not the handler is enabled for a user. */ isEnabledForUser?(user: CoreUserProfile, context: CoreUserDelegateContext, contextId: number): Promise; @@ -91,7 +91,7 @@ export interface CoreUserProfileHandler extends CoreDelegateHandler { * @param user User object. * @param context Context. * @param contextId Context ID. - * @return Data to be shown. + * @returns Data to be shown. */ getDisplayData(user: CoreUserProfile, context: CoreUserDelegateContext, contextId: number): CoreUserProfileHandlerData; } @@ -250,7 +250,7 @@ export class CoreUserDelegateService extends CoreDelegate { const site = await CoreSites.getSite(siteId); @@ -41,7 +41,7 @@ export class CoreUserOfflineProvider { * * @param name Name of the preference. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the preference, rejected if not found. + * @returns Promise resolved with the preference, rejected if not found. */ async getPreference(name: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -56,7 +56,7 @@ export class CoreUserOfflineProvider { * @param value Value of the preference. * @param onlineValue Online value of the preference. If undefined, preserve previously stored value. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setPreference(name: string, value: string, onlineValue?: string | null , siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/core/features/user/services/user-profile-field-delegate.ts b/src/core/features/user/services/user-profile-field-delegate.ts index caeac6817..14d7492ed 100644 --- a/src/core/features/user/services/user-profile-field-delegate.ts +++ b/src/core/features/user/services/user-profile-field-delegate.ts @@ -33,7 +33,7 @@ export interface CoreUserProfileFieldHandler extends CoreDelegateHandler { * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @return The component (or promise resolved with component) to use, undefined if not found. + * @returns The component (or promise resolved with component) to use, undefined if not found. */ getComponent(): Type | Promise>; @@ -44,7 +44,7 @@ export interface CoreUserProfileFieldHandler extends CoreDelegateHandler { * @param signup True if user is in signup page. * @param registerAuth Register auth method. E.g. 'email'. * @param formValues Form Values. - * @return Data to send for the field. + * @returns Data to send for the field. */ getData?( field: AuthEmailSignupProfileField | CoreUserProfileField, @@ -87,7 +87,7 @@ export class CoreUserProfileFieldDelegateService extends CoreDelegate { * Try to synchronize user preferences in a certain site or in all sites. * * @param siteId Site ID to sync. If not defined, sync all sites. - * @return Promise resolved with warnings if sync is successful, rejected if sync fails. + * @returns Promise resolved with warnings if sync is successful, rejected if sync fails. */ syncPreferences(siteId?: string): Promise { return this.syncOnSites('all user preferences', (siteId) => this.syncSitePreferences(siteId), siteId); @@ -48,7 +48,7 @@ export class CoreUserSyncProvider extends CoreSyncBaseProvider { * Sync user preferences of a site. * * @param siteId Site ID to sync. - * @param Promise resolved with warnings if sync is successful, rejected if sync fails. + * @returns Promise resolved with warnings if sync is successful, rejected if sync fails. */ async syncSitePreferences(siteId: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -72,7 +72,7 @@ export class CoreUserSyncProvider extends CoreSyncBaseProvider { * Sync user preferences of a site. * * @param siteId Site ID to sync. - * @param Promise resolved if sync is successful, rejected if sync fails. + * @returns Promise resolved if sync is successful, rejected if sync fails. */ protected async performSyncSitePreferences(siteId: string): Promise { const warnings: string[] = []; diff --git a/src/core/features/user/services/user.ts b/src/core/features/user/services/user.ts index d0156e5c1..44a8d0d4a 100644 --- a/src/core/features/user/services/user.ts +++ b/src/core/features/user/services/user.ts @@ -76,7 +76,7 @@ export class CoreUserProvider { * Check if WS to search participants is available in site. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: whether it's available. + * @returns Promise resolved with boolean: whether it's available. * @since 3.8 */ async canSearchParticipants(siteId?: string): Promise { @@ -89,7 +89,7 @@ export class CoreUserProvider { * Check if WS to search participants is available in site. * * @param site Site. If not defined, current site. - * @return Whether it's available. + * @returns Whether it's available. * @since 3.8 */ canSearchParticipantsInSite(site?: CoreSite): boolean { @@ -101,7 +101,7 @@ export class CoreUserProvider { /** * Check if WS to update profile picture is available in site. * - * @return Promise resolved with boolean: whether it's available. + * @returns Promise resolved with boolean: whether it's available. * @deprecated since app 4.0 */ async canUpdatePicture(): Promise { @@ -111,7 +111,7 @@ export class CoreUserProvider { /** * Check if WS to search participants is available in site. * - * @return Whether it's available. + * @returns Whether it's available. * @deprecated since app 4.0 */ canUpdatePictureInSite(): boolean { @@ -124,7 +124,7 @@ export class CoreUserProvider { * @param draftItemId New picture draft item id. * @param userId User ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolve with the new profileimageurl + * @returns Promise resolve with the new profileimageurl */ async changeProfilePicture(draftItemId: number, userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -175,7 +175,7 @@ export class CoreUserProvider { * * @param userId User ID. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolve when the user is deleted. + * @returns Promise resolve when the user is deleted. */ async deleteStoredUser(userId: number, siteId?: string): Promise { if (isNaN(userId)) { @@ -198,7 +198,7 @@ export class CoreUserProvider { * @param limitNumber Number of participants to get. * @param siteId Site Id. If not defined, use current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved when the participants are retrieved. + * @returns Promise resolved when the participants are retrieved. */ async getParticipants( courseId: number, @@ -251,7 +251,7 @@ export class CoreUserProvider { * Get cache key for participant list WS calls. * * @param courseId Course ID. - * @return Cache key. + * @returns Cache key. */ protected getParticipantsListCacheKey(courseId: number): string { return ROOT_CACHE_KEY + 'list:' + courseId; @@ -264,7 +264,7 @@ export class CoreUserProvider { * @param courseId Course ID to get course profile, undefined or 0 to get site profile. * @param forceLocal True to retrieve the user data from local DB, false to retrieve it from WS. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolved with the user data. + * @returns Promise resolved with the user data. */ async getProfile( userId: number, @@ -297,7 +297,7 @@ export class CoreUserProvider { * Get cache key for a user WS call. * * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getUserCacheKey(userId: number): string { return ROOT_CACHE_KEY + 'data:' + userId; @@ -308,7 +308,7 @@ export class CoreUserProvider { * * @param userId User ID. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolve when the user is retrieved. + * @returns Promise resolve when the user is retrieved. */ protected async getUserFromLocalDb(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -322,7 +322,7 @@ export class CoreUserProvider { * @param userId User ID. * @param courseId Course ID. * @param siteId Site ID. - * @return Promise resolved with user name. + * @returns Promise resolved with user name. */ async getUserFullNameWithDefault(userId: number, courseId?: number, siteId?: string): Promise { try { @@ -341,7 +341,7 @@ export class CoreUserProvider { * @param userId User ID. * @param courseId Course ID to get course profile, undefined or 0 to get site profile. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolve when the user is retrieved. + * @returns Promise resolve when the user is retrieved. */ protected async getUserFromWS( userId: number, @@ -400,7 +400,7 @@ export class CoreUserProvider { * * @param name Name of the preference. * @param siteId Site Id. If not defined, use current site. - * @return Preference value or null if preference not set. + * @returns Preference value or null if preference not set. */ async getUserPreference(name: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -432,7 +432,7 @@ export class CoreUserProvider { * Get cache key for a user preference WS call. * * @param name Preference name. - * @return Cache key. + * @returns Cache key. */ protected getUserPreferenceCacheKey(name: string): string { return ROOT_CACHE_KEY + 'preference:' + name; @@ -443,7 +443,7 @@ export class CoreUserProvider { * * @param name Name of the preference. * @param siteId Site Id. If not defined, use current site. - * @return Preference value or null if preference not set. + * @returns Preference value or null if preference not set. */ async getUserPreferenceOnline(name: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -466,7 +466,7 @@ export class CoreUserProvider { * * @param userId User ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserCache(userId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -479,7 +479,7 @@ export class CoreUserProvider { * * @param courseId Course ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the list is invalidated. + * @returns Promise resolved when the list is invalidated. */ async invalidateParticipantsList(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -492,7 +492,7 @@ export class CoreUserProvider { * * @param name Name of the preference. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserPreference(name: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -504,7 +504,7 @@ export class CoreUserProvider { * Check if course participants is disabled in a certain site. * * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if disabled, rejected or resolved with false otherwise. */ async isParticipantsDisabled(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -516,7 +516,7 @@ export class CoreUserProvider { * Check if course participants is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return Whether it's disabled. + * @returns Whether it's disabled. */ isParticipantsDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -529,7 +529,7 @@ export class CoreUserProvider { * * @param courseId Course ID. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @returns Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabledForCourse(courseId: number, siteId?: string): Promise { if (!courseId) { @@ -544,7 +544,7 @@ export class CoreUserProvider { * Check if update profile picture is disabled in a certain site. * * @param site Site. If not defined, use current site. - * @return True if disabled, false otherwise. + * @returns True if disabled, false otherwise. */ isUpdatePictureDisabledInSite(site?: CoreSite): boolean { site = site || CoreSites.getCurrentSite(); @@ -558,7 +558,7 @@ export class CoreUserProvider { * @param userId User ID. * @param courseId Course ID. * @param name Name of the user. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async logView(userId: number, courseId?: number, name?: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -581,7 +581,7 @@ export class CoreUserProvider { * Log Participants list view in Moodle. * * @param courseId Course ID. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async logParticipantsView(courseId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -601,7 +601,7 @@ export class CoreUserProvider { * @param userIds List of user IDs. * @param courseId Course the users belong to. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when prefetched. + * @returns Promise resolved when prefetched. */ async prefetchProfiles(userIds: number[], courseId?: number, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -644,7 +644,7 @@ export class CoreUserProvider { * @param entries List of entries that have the images. * @param propertyName The name of the property that contains the image. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when prefetched. + * @returns Promise resolved when prefetched. */ async prefetchUserAvatars(entries: Record[], propertyName: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -684,7 +684,7 @@ export class CoreUserProvider { * @param page Page to get. * @param perPage Number of participants to get. * @param siteId Site Id. If not defined, use current site. - * @return Promise resolved when the participants are retrieved. + * @returns Promise resolved when the participants are retrieved. * @since 3.8 */ async searchParticipants( @@ -723,7 +723,7 @@ export class CoreUserProvider { * @param fullname User full name. * @param avatar User avatar URL. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolve when the user is stored. + * @returns Promise resolve when the user is stored. */ protected async storeUser(userId: number, fullname: string, avatar?: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -742,7 +742,7 @@ export class CoreUserProvider { * * @param users Users to store. * @param siteId ID of the site. If not defined, use current site. - * @return Promise resolve when the user is stored. + * @returns Promise resolve when the user is stored. */ async storeUsers(users: CoreUserBasicData[], siteId?: string): Promise { @@ -761,7 +761,7 @@ export class CoreUserProvider { * @param name Name of the preference. * @param value Value of the preference. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ async setUserPreference(name: string, value: string, siteId?: string): Promise { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -797,7 +797,7 @@ export class CoreUserProvider { * @param value Preference new value. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ updateUserPreference(name: string, value: string | undefined, userId?: number, siteId?: string): Promise { const preferences = [ @@ -817,7 +817,7 @@ export class CoreUserProvider { * @param disableNotifications Whether to disable all notifications. Undefined to not update this value. * @param userId User ID. If not defined, site's current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if success. + * @returns Promise resolved if success. */ async updateUserPreferences( preferences: { type: string; value: string | undefined }[], diff --git a/src/core/features/usertours/services/user-tours.ts b/src/core/features/usertours/services/user-tours.ts index 7a93297a1..2c3712d31 100644 --- a/src/core/features/usertours/services/user-tours.ts +++ b/src/core/features/usertours/services/user-tours.ts @@ -235,7 +235,7 @@ export class CoreUserToursService { /** * Returns the first visible tour in the stack. * - * @return foreground tour if found or undefined. + * @returns foreground tour if found or undefined. */ protected getForegroundTour(): CoreUserToursUserTourComponent | undefined { return this.tours.find(({ visible }) => visible)?.component; @@ -244,7 +244,7 @@ export class CoreUserToursService { /** * Returns the tour index in the stack. * - * @return Tour index if found or -1 otherwise. + * @returns Tour index if found or -1 otherwise. */ protected getTourIndex(tour: CoreUserToursUserTourComponent): number { return this.tours.findIndex(({ component }) => component === tour); @@ -277,7 +277,7 @@ export class CoreUserToursService { * Is user Tour disabled? * * @param tourId Tour Id or undefined to check all user tours. - * @return Wether a particular or all user tours are disabled. + * @returns Wether a particular or all user tours are disabled. */ isDisabled(tourId?: string): boolean { if (CoreConstants.CONFIG.disableUserTours) { diff --git a/src/core/features/viewer/components/image/image.ts b/src/core/features/viewer/components/image/image.ts index 09fe88b40..23c3a4a1d 100644 --- a/src/core/features/viewer/components/image/image.ts +++ b/src/core/features/viewer/components/image/image.ts @@ -75,7 +75,7 @@ export class CoreViewerImageComponent implements OnInit, AfterViewInit { /** * Zoom In or Out. * - * @param zoomIn: True to zoom in, false to zoom out. + * @param zoomIn True to zoom in, false to zoom out. */ zoom(zoomIn = true): void { const imageElement = this.element.nativeElement.querySelector('img'); diff --git a/src/core/features/xapi/services/offline.ts b/src/core/features/xapi/services/offline.ts index 79e3e4de7..e0f01d503 100644 --- a/src/core/features/xapi/services/offline.ts +++ b/src/core/features/xapi/services/offline.ts @@ -29,7 +29,7 @@ export class CoreXAPIOfflineProvider { * * @param contextId Context ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with boolean: true if has offline statements, false otherwise. + * @returns Promise resolved with boolean: true if has offline statements, false otherwise. */ async contextHasStatements(contextId: number, siteId?: string): Promise { const statementsList = await this.getContextStatements(contextId, siteId); @@ -42,7 +42,7 @@ export class CoreXAPIOfflineProvider { * * @param id ID of the statements. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteStatements(id: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -55,7 +55,7 @@ export class CoreXAPIOfflineProvider { * * @param contextId Context ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved if stored, rejected if failure. + * @returns Promise resolved if stored, rejected if failure. */ async deleteStatementsForContext(contextId: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -67,7 +67,7 @@ export class CoreXAPIOfflineProvider { * Get all offline statements. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with all the data. + * @returns Promise resolved with all the data. */ async getAllStatements(siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -80,7 +80,7 @@ export class CoreXAPIOfflineProvider { * * @param contextId Context ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getContextStatements(contextId: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -93,7 +93,7 @@ export class CoreXAPIOfflineProvider { * * @param id ID of the statements. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getStatements(id: number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -108,7 +108,7 @@ export class CoreXAPIOfflineProvider { * @param component Component to send the statements to. * @param statements Statements (JSON-encoded). * @param options Options. - * @return Promise resolved when statements are successfully saved. + * @returns Promise resolved when statements are successfully saved. */ async saveStatements( contextId: number, diff --git a/src/core/features/xapi/services/xapi.ts b/src/core/features/xapi/services/xapi.ts index 6b7c1b1d1..2723fb753 100644 --- a/src/core/features/xapi/services/xapi.ts +++ b/src/core/features/xapi/services/xapi.ts @@ -32,7 +32,7 @@ export class CoreXAPIProvider { * Returns whether or not WS to post XAPI statement is available. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with true if ws is available, false otherwise. + * @returns Promise resolved with true if ws is available, false otherwise. * @since 3.9 */ async canPostStatements(siteId?: string): Promise { @@ -45,7 +45,7 @@ export class CoreXAPIProvider { * Returns whether or not WS to post XAPI statement is available in a certain site. * * @param site Site. If not defined, current site. - * @return Promise resolved with true if ws is available, false otherwise. + * @returns Promise resolved with true if ws is available, false otherwise. * @since 3.9 */ canPostStatementsInSite(site?: CoreSite): boolean { @@ -60,7 +60,7 @@ export class CoreXAPIProvider { * @param contextId Context ID. * @param type Type (e.g. 'activity'). * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async getUrl(contextId: number, type: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -75,7 +75,7 @@ export class CoreXAPIProvider { * @param component Component. * @param json JSON string to send. * @param options Options. - * @return Promise resolved with boolean: true if response was sent to server, false if stored in device. + * @returns Promise resolved with boolean: true if response was sent to server, false if stored in device. */ async postStatements( contextId: number, @@ -120,7 +120,7 @@ export class CoreXAPIProvider { * @param component Component. * @param json JSON string to send. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async postStatementsOnline(component: string, json: string, siteId?: string): Promise { diff --git a/src/core/guards/can-leave.ts b/src/core/guards/can-leave.ts index 17661660b..4c1afbafe 100644 --- a/src/core/guards/can-leave.ts +++ b/src/core/guards/can-leave.ts @@ -37,7 +37,7 @@ export interface CanLeave { /** * Check whether the user can leave the current route. * - * @return Promise resolved with true if can leave, resolved with false or rejected if cannot leave. + * @returns Promise resolved with true if can leave, resolved with false or rejected if cannot leave. */ canLeave: () => Promise; } diff --git a/src/core/guards/redirect.ts b/src/core/guards/redirect.ts index da7c11a3e..4b3d88154 100644 --- a/src/core/guards/redirect.ts +++ b/src/core/guards/redirect.ts @@ -39,6 +39,8 @@ export class CoreRedirectGuard implements CanLoad, CanActivate { /** * Check if there is a pending redirect and trigger it. + * + * @returns Promise resolved with true if it's not redirected or the redirection route. */ private async guard(): Promise { const redirect = CoreApp.consumeMemoryRedirect(); diff --git a/src/core/pipes/bytes-to-size.ts b/src/core/pipes/bytes-to-size.ts index 36e78f737..19b24b9d7 100644 --- a/src/core/pipes/bytes-to-size.ts +++ b/src/core/pipes/bytes-to-size.ts @@ -35,7 +35,7 @@ export class CoreBytesToSizePipe implements PipeTransform { * Takes a number and turns it to a human readable size. * * @param value The bytes to convert. - * @return Readable bytes. + * @returns Readable bytes. */ transform(value: number | string): string { if (typeof value == 'string') { diff --git a/src/core/pipes/create-links.ts b/src/core/pipes/create-links.ts index 9bcf6ddbb..16be05293 100644 --- a/src/core/pipes/create-links.ts +++ b/src/core/pipes/create-links.ts @@ -28,7 +28,7 @@ export class CoreCreateLinksPipe implements PipeTransform { * Takes some text and adds anchor tags to all links that aren't inside anchors. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ transform(text: string): string { return text.replace(CoreCreateLinksPipe.replacePattern, '$1'); diff --git a/src/core/pipes/date-day-or-time.ts b/src/core/pipes/date-day-or-time.ts index b59784a13..a313c0175 100644 --- a/src/core/pipes/date-day-or-time.ts +++ b/src/core/pipes/date-day-or-time.ts @@ -47,7 +47,7 @@ export class CoreDateDayOrTimePipe implements PipeTransform { * Format a timestamp. * * @param timestamp The UNIX timestamp (without milliseconds). - * @return Formatted time. + * @returns Formatted time. */ transform(timestamp: string | number): string { if (typeof timestamp == 'string') { diff --git a/src/core/pipes/duration.ts b/src/core/pipes/duration.ts index 1e127a89b..8f314f905 100644 --- a/src/core/pipes/duration.ts +++ b/src/core/pipes/duration.ts @@ -34,7 +34,7 @@ export class CoreDurationPipe implements PipeTransform { * Turn a number of seconds to a duration. E.g. 60 -> 1 minute. * * @param seconds The number of seconds. - * @return Formatted duration. + * @returns Formatted duration. */ transform(seconds: string | number): string { if (typeof seconds == 'string') { diff --git a/src/core/pipes/format-date.ts b/src/core/pipes/format-date.ts index 84a0e91d8..3b43442a3 100644 --- a/src/core/pipes/format-date.ts +++ b/src/core/pipes/format-date.ts @@ -37,7 +37,7 @@ export class CoreFormatDatePipe implements PipeTransform { * @param format Format to use. It should be a string code to handle i18n (e.g. core.strftimetime). * Defaults to strftimedaydatetime. * @param convert If true, convert the format from PHP to Moment. Set it to false for Moment formats. - * @return Formatted date. + * @returns Formatted date. */ transform(timestamp: string | number, format?: string, convert?: boolean): string { timestamp = timestamp || Date.now(); diff --git a/src/core/pipes/no-tags.ts b/src/core/pipes/no-tags.ts index 8fb0c83b5..67df130e4 100644 --- a/src/core/pipes/no-tags.ts +++ b/src/core/pipes/no-tags.ts @@ -26,7 +26,7 @@ export class CoreNoTagsPipe implements PipeTransform { * Takes a text and removes HTML tags. * * @param text The text to treat. - * @return Treated text. + * @returns Treated text. */ transform(text: string): string { return text.replace(/(<([^>]+)>)/ig, ''); diff --git a/src/core/pipes/seconds-to-hms.ts b/src/core/pipes/seconds-to-hms.ts index 9b3969cf3..91115ea62 100644 --- a/src/core/pipes/seconds-to-hms.ts +++ b/src/core/pipes/seconds-to-hms.ts @@ -38,7 +38,7 @@ export class CoreSecondsToHMSPipe implements PipeTransform { * Convert a number of seconds to Hours:Minutes:Seconds. * * @param seconds Number of seconds. - * @return Formatted seconds. + * @returns Formatted seconds. */ transform(seconds: string | number): string { if (!seconds || seconds < 0) { diff --git a/src/core/pipes/time-ago.ts b/src/core/pipes/time-ago.ts index 211950459..c47d25ae9 100644 --- a/src/core/pipes/time-ago.ts +++ b/src/core/pipes/time-ago.ts @@ -35,7 +35,7 @@ export class CoreTimeAgoPipe implements PipeTransform { * Turn a UNIX timestamp to "time ago". * * @param timestamp The UNIX timestamp (without milliseconds). - * @return Formatted time. + * @returns Formatted time. */ transform(timestamp: string | number): string { if (typeof timestamp === 'string') { diff --git a/src/core/pipes/to-locale-string.ts b/src/core/pipes/to-locale-string.ts index 908bc84f7..7159f70a4 100644 --- a/src/core/pipes/to-locale-string.ts +++ b/src/core/pipes/to-locale-string.ts @@ -39,7 +39,7 @@ export class CoreToLocaleStringPipe implements PipeTransform { * Format a timestamp to a locale string. * * @param timestamp The timestamp (can be in seconds or milliseconds). - * @return Formatted time. + * @returns Formatted time. */ transform(timestamp: number | string): string { if (typeof timestamp == 'string') { diff --git a/src/core/services/app.ts b/src/core/services/app.ts index 4971fe65b..fa6315372 100644 --- a/src/core/services/app.ts +++ b/src/core/services/app.ts @@ -64,7 +64,7 @@ export class CoreAppProvider { /** * Returns whether the user agent is controlled by automation. I.e. Behat testing. * - * @return True if the user agent is controlled by automation, false otherwise. + * @returns True if the user agent is controlled by automation, false otherwise. */ static isAutomated(): boolean { return !!navigator.webdriver; @@ -73,7 +73,7 @@ export class CoreAppProvider { /** * Returns the forced timezone to use. Timezone is forced for automated tests. * - * @return Timezone. Undefined to use the user's timezone. + * @returns Timezone. Undefined to use the user's timezone. */ static getForcedTimezone(): string | undefined { if (CoreAppProvider.isAutomated()) { @@ -105,7 +105,7 @@ export class CoreAppProvider { /** * Check if the browser supports mediaDevices.getUserMedia. * - * @return Whether the function is supported. + * @returns Whether the function is supported. */ canGetUserMedia(): boolean { return !!(navigator && navigator.mediaDevices && navigator.mediaDevices.getUserMedia); @@ -114,7 +114,7 @@ export class CoreAppProvider { /** * Check if the browser supports MediaRecorder. * - * @return Whether the function is supported. + * @returns Whether the function is supported. */ canRecordMedia(): boolean { return !!window.MediaRecorder; @@ -133,7 +133,7 @@ export class CoreAppProvider { * Install and upgrade a certain schema. * * @param schema The schema to create. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async createTablesFromSchema(schema: CoreAppSchema): Promise { this.logger.debug(`Apply schema to app DB: ${schema.name}`); @@ -173,7 +173,7 @@ export class CoreAppProvider { /** * Get the application global database. * - * @return App's DB. + * @returns App's DB. */ getDB(): SQLiteDB { if (!this.db) { @@ -186,7 +186,7 @@ export class CoreAppProvider { /** * Get an ID for a main menu. * - * @return Main menu ID. + * @returns Main menu ID. * @deprecated since 3.9.5. No longer supported. */ getMainMenuId(): number { @@ -197,7 +197,7 @@ export class CoreAppProvider { * Get app store URL. * * @param storesConfig Config params to send the user to the right place. - * @return Store URL. + * @returns Store URL. */ getAppStoreUrl(storesConfig: CoreStoreConfig): string | undefined { if (this.isIOS() && storesConfig.ios) { @@ -217,6 +217,8 @@ export class CoreAppProvider { /** * Get platform major version number. + * + * @returns The platform major number. */ getPlatformMajorVersion(): number { if (!CorePlatform.isMobile()) { @@ -229,7 +231,7 @@ export class CoreAppProvider { /** * Checks if the app is running in a 64 bits desktop environment (not browser). * - * @return false. + * @returns false. * @deprecated since 3.9.5 Desktop support has been removed. */ is64Bits(): boolean { @@ -239,7 +241,7 @@ export class CoreAppProvider { /** * Checks if the app is running in an Android mobile or tablet device. * - * @return Whether the app is running in an Android mobile or tablet device. + * @returns Whether the app is running in an Android mobile or tablet device. */ isAndroid(): boolean { return CorePlatform.isMobile() && CorePlatform.is('android'); @@ -248,7 +250,7 @@ export class CoreAppProvider { /** * Checks if the app is running in a desktop environment (not browser). * - * @return false. + * @returns false. * @deprecated since 3.9.5 Desktop support has been removed. */ isDesktop(): boolean { @@ -258,7 +260,7 @@ export class CoreAppProvider { /** * Checks if the app is running in an iOS mobile or tablet device. * - * @return Whether the app is running in an iOS mobile or tablet device. + * @returns Whether the app is running in an iOS mobile or tablet device. */ isIOS(): boolean { return CorePlatform.isMobile() && !CorePlatform.is('android'); @@ -267,7 +269,7 @@ export class CoreAppProvider { /** * Check if the keyboard is closing. * - * @return Whether keyboard is closing (animating). + * @returns Whether keyboard is closing (animating). */ isKeyboardClosing(): boolean { return this.keyboardClosing; @@ -276,7 +278,7 @@ export class CoreAppProvider { /** * Check if the keyboard is being opened. * - * @return Whether keyboard is opening (animating). + * @returns Whether keyboard is opening (animating). */ isKeyboardOpening(): boolean { return this.keyboardOpening; @@ -285,7 +287,7 @@ export class CoreAppProvider { /** * Check if the keyboard is visible. * - * @return Whether keyboard is visible. + * @returns Whether keyboard is visible. */ isKeyboardVisible(): boolean { return this.isKeyboardShown; @@ -294,7 +296,7 @@ export class CoreAppProvider { /** * Check if the app is running in a Linux environment. * - * @return false. + * @returns false. * @deprecated since 3.9.5 Desktop support has been removed. */ isLinux(): boolean { @@ -304,7 +306,7 @@ export class CoreAppProvider { /** * Check if the app is running in a Mac OS environment. * - * @return false. + * @returns false. * @deprecated since 3.9.5 Desktop support has been removed. */ isMac(): boolean { @@ -314,7 +316,7 @@ export class CoreAppProvider { /** * Check if the main menu is open. * - * @return Whether the main menu is open. + * @returns Whether the main menu is open. * @deprecated since 3.9.5. No longer supported. */ isMainMenuOpen(): boolean { @@ -324,7 +326,7 @@ export class CoreAppProvider { /** * Checks if the app is running in a mobile or tablet device (Cordova). * - * @return Whether the app is running in a mobile or tablet device. + * @returns Whether the app is running in a mobile or tablet device. * @deprecated since 4.1. use CorePlatform instead. */ isMobile(): boolean { @@ -334,7 +336,7 @@ export class CoreAppProvider { /** * Checks if the current window is wider than a mobile. * - * @return Whether the app the current window is wider than a mobile. + * @returns Whether the app the current window is wider than a mobile. */ isWide(): boolean { return CorePlatform.width() > 768; @@ -343,7 +345,7 @@ export class CoreAppProvider { /** * Returns whether we are online. * - * @return Whether the app is online. + * @returns Whether the app is online. * @deprecated since 4.1.0. Use CoreNetwork instead. */ isOnline(): boolean { @@ -353,7 +355,7 @@ export class CoreAppProvider { /** * Check if device uses a limited connection. * - * @return Whether the device uses a limited connection. + * @returns Whether the device uses a limited connection. * @deprecated since 4.1.0. Use CoreNetwork instead. */ isNetworkAccessLimited(): boolean { @@ -363,7 +365,7 @@ export class CoreAppProvider { /** * Check if device uses a wifi connection. * - * @return Whether the device uses a wifi connection. + * @returns Whether the device uses a wifi connection. * @deprecated since 4.1.0. Use CoreNetwork instead. */ isWifi(): boolean { @@ -373,7 +375,7 @@ export class CoreAppProvider { /** * Check if the app is running in a Windows environment. * - * @return false. + * @returns false. * @deprecated since 3.9.5 Desktop support has been removed. */ isWindows(): boolean { @@ -468,7 +470,7 @@ export class CoreAppProvider { /** * Check if there's an ongoing SSO authentication process. * - * @return Whether there's a SSO authentication ongoing. + * @returns Whether there's a SSO authentication ongoing. */ isSSOAuthenticationOngoing(): boolean { return !!this.ssoAuthenticationDeferred; @@ -477,7 +479,7 @@ export class CoreAppProvider { /** * Returns a promise that will be resolved once SSO authentication finishes. * - * @return Promise resolved once SSO authentication finishes. + * @returns Promise resolved once SSO authentication finishes. */ async waitForSSOAuthentication(): Promise { await this.ssoAuthenticationDeferred; @@ -544,7 +546,7 @@ export class CoreAppProvider { /** * Retrieve and forget redirect data. * - * @return Redirect data if any. + * @returns Redirect data if any. */ consumeMemoryRedirect(): CoreRedirectData | null { const redirect = this.getRedirect(); @@ -572,7 +574,7 @@ export class CoreAppProvider { /** * Retrieve redirect data. * - * @return Redirect data if any. + * @returns Redirect data if any. */ getRedirect(): CoreRedirectData | null { return this.redirect || null; @@ -609,7 +611,7 @@ export class CoreAppProvider { * * @param callback Called when the back button is pressed. * @param priority Priority. - * @return A function that, when called, will unregister the back button action. + * @returns A function that, when called, will unregister the back button action. * @deprecated since 3.9.5 */ // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -746,7 +748,7 @@ export type CoreAppSchema = { * * @param db The affected DB. * @param oldVersion Old version of the schema or 0 if not installed. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ migrate?(db: SQLiteDB, oldVersion: number): Promise; @@ -756,7 +758,7 @@ export type CoreAppSchema = { * Called when installing the schema, after creating the defined tables. * * @param db Site database. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ install?(db: SQLiteDB): Promise | void; }; diff --git a/src/core/services/config.ts b/src/core/services/config.ts index 8522db456..f1872ba32 100644 --- a/src/core/services/config.ts +++ b/src/core/services/config.ts @@ -53,6 +53,8 @@ export class CoreConfigProvider { /** * Wait until configuration is ready for use. + * + * @returns Ready promise. */ ready(): Promise { return this.isReady; @@ -93,7 +95,7 @@ export class CoreConfigProvider { * Deletes an app setting. * * @param name The config name. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async delete(name: string): Promise { await this.table.deleteByPrimaryKey({ name }); @@ -104,7 +106,7 @@ export class CoreConfigProvider { * * @param name The config name. * @param defaultValue Default value to use if the entry is not found. - * @return Resolves upon success along with the config data. Reject on failure. + * @returns Resolves upon success along with the config data. Reject on failure. */ async get(name: string, defaultValue?: T): Promise { try { @@ -124,7 +126,7 @@ export class CoreConfigProvider { * Get an app setting directly from the database, without using any optimizations.. * * @param name The config name. - * @return Resolves upon success along with the config data. Reject on failure. + * @returns Resolves upon success along with the config data. Reject on failure. */ async getFromDB(name: string): Promise { const db = CoreApp.getDB(); @@ -154,7 +156,7 @@ export class CoreConfigProvider { * * @param name The config name. * @param value The config value. Can only store number or strings. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async set(name: string, value: number | string): Promise { await this.table.insert({ name, value }); diff --git a/src/core/services/cron.ts b/src/core/services/cron.ts index 32ec54823..5cb3aff2b 100644 --- a/src/core/services/cron.ts +++ b/src/core/services/cron.ts @@ -76,7 +76,7 @@ export class CoreCronDelegateService { * @param name Name of the handler. * @param force Wether the execution is forced (manual sync). * @param siteId Site ID. If not defined, all sites. - * @return Promise resolved if handler is executed successfully, rejected otherwise. + * @returns Promise resolved if handler is executed successfully, rejected otherwise. */ protected async checkAndExecuteHandler(name: string, force?: boolean, siteId?: string): Promise { if (!this.handlers[name] || !this.handlers[name].execute) { @@ -142,7 +142,7 @@ export class CoreCronDelegateService { * @param name Name of the handler. * @param force Wether the execution is forced (manual sync). * @param siteId Site ID. If not defined, all sites. - * @return Promise resolved when the handler finishes or reaches max time, rejected if it fails. + * @returns Promise resolved when the handler finishes or reaches max time, rejected if it fails. */ protected executeHandler(name: string, force?: boolean, siteId?: string): Promise { return new Promise((resolve, reject): void => { @@ -166,7 +166,7 @@ export class CoreCronDelegateService { * Please notice that some tasks may not be executed depending on the network connection and sync settings. * * @param siteId Site ID. If not defined, all sites. - * @return Promise resolved if all handlers are executed successfully, rejected otherwise. + * @returns Promise resolved if all handlers are executed successfully, rejected otherwise. */ async forceSyncExecution(siteId?: string): Promise { const promises: Promise[] = []; @@ -187,7 +187,7 @@ export class CoreCronDelegateService { * * @param name Name of the handler. * @param siteId Site ID. If not defined, all sites. - * @return Promise resolved if handler has been executed successfully, rejected otherwise. + * @returns Promise resolved if handler has been executed successfully, rejected otherwise. */ forceCronHandlerExecution(name: string, siteId?: string): Promise { const handler = this.handlers[name]; @@ -207,7 +207,7 @@ export class CoreCronDelegateService { * Get a handler's interval. * * @param name Handler's name. - * @return Handler's interval. + * @returns Handler's interval. */ protected getHandlerInterval(name: string): number { if (!this.handlers[name] || !this.handlers[name].getInterval) { @@ -230,7 +230,7 @@ export class CoreCronDelegateService { * Get a handler's last execution ID. * * @param name Handler's name. - * @return Handler's last execution ID. + * @returns Handler's last execution ID. */ protected getHandlerLastExecutionId(name: string): string { return 'last_execution_' + name; @@ -240,7 +240,7 @@ export class CoreCronDelegateService { * Get a handler's last execution time. If not defined, return 0. * * @param name Handler's name. - * @return Promise resolved with the handler's last execution time. + * @returns Promise resolved with the handler's last execution time. */ protected async getHandlerLastExecutionTime(name: string): Promise { const id = this.getHandlerLastExecutionId(name); @@ -260,7 +260,7 @@ export class CoreCronDelegateService { * Check if a handler uses network. Defaults to true. * * @param name Handler's name. - * @return True if handler uses network or not defined, false otherwise. + * @returns True if handler uses network or not defined, false otherwise. */ protected handlerUsesNetwork(name: string): boolean { if (!this.handlers[name] || !this.handlers[name].usesNetwork) { @@ -274,7 +274,7 @@ export class CoreCronDelegateService { /** * Check if there is any manual sync handler registered. * - * @return Whether it has at least 1 manual sync handler. + * @returns Whether it has at least 1 manual sync handler. */ hasManualSyncHandlers(): boolean { for (const name in this.handlers) { @@ -289,7 +289,7 @@ export class CoreCronDelegateService { /** * Check if there is any sync handler registered. * - * @return Whether it has at least 1 sync handler. + * @returns Whether it has at least 1 sync handler. */ hasSyncHandlers(): boolean { for (const name in this.handlers) { @@ -305,7 +305,7 @@ export class CoreCronDelegateService { * Check if a handler can be manually synced. Defaults will use isSync instead. * * @param name Handler's name. - * @return True if handler is a sync process and can be manually executed or not defined, false otherwise. + * @returns True if handler is a sync process and can be manually executed or not defined, false otherwise. */ protected isHandlerManualSync(name: string): boolean { if (!this.handlers[name] || !this.handlers[name].canManualSync) { @@ -320,7 +320,7 @@ export class CoreCronDelegateService { * Check if a handler is a sync process. Defaults to true. * * @param name Handler's name. - * @return True if handler is a sync process or not defined, false otherwise. + * @returns True if handler is a sync process or not defined, false otherwise. */ protected isHandlerSync(name: string): boolean { if (!this.handlers[name] || !this.handlers[name].isSync) { @@ -361,7 +361,7 @@ export class CoreCronDelegateService { * * @param name Name of the handler. * @param timeToNextExecution Time (in milliseconds). If not supplied it will be calculated. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async scheduleNextExecution(name: string, timeToNextExecution?: number): Promise { if (!this.handlers[name]) { @@ -398,7 +398,7 @@ export class CoreCronDelegateService { * * @param name Handler's name. * @param time Time to set. - * @return Promise resolved when the execution time is saved. + * @returns Promise resolved when the execution time is saved. */ protected async setHandlerLastExecutionTime(name: string, time: number): Promise { const id = this.getHandlerLastExecutionId(name); @@ -495,28 +495,28 @@ export interface CoreCronHandler { /** * Returns handler's interval in milliseconds. Defaults to CoreCronDelegateService.DEFAULT_INTERVAL. * - * @return Interval time (in milliseconds). + * @returns Interval time (in milliseconds). */ getInterval?(): number; /** * Check whether the process uses network or not. True if not defined. * - * @return Whether the process uses network or not + * @returns Whether the process uses network or not */ usesNetwork?(): boolean; /** * Check whether it's a synchronization process or not. True if not defined. * - * @return Whether it's a synchronization process or not. + * @returns Whether it's a synchronization process or not. */ isSync?(): boolean; /** * Check whether the sync can be executed manually. Call isSync if not defined. * - * @return Whether the sync can be executed manually. + * @returns Whether the sync can be executed manually. */ canManualSync?(): boolean; @@ -525,7 +525,7 @@ export interface CoreCronHandler { * * @param siteId ID of the site affected. If not defined, all sites. * @param force Determines if it's a forced execution. - * @return Promise resolved when done. If the promise is rejected, this function will be called again often, + * @returns Promise resolved when done. If the promise is rejected, this function will be called again often, * it shouldn't be abused. */ execute?(siteId?: string, force?: boolean): Promise; diff --git a/src/core/services/db.ts b/src/core/services/db.ts index df8ce5bb9..036c8718c 100644 --- a/src/core/services/db.ts +++ b/src/core/services/db.ts @@ -72,7 +72,7 @@ export class CoreDbProvider { * Get the table name from a SQL query. * * @param sql SQL query. - * @return Table name, undefined if not found. + * @returns Table name, undefined if not found. */ protected getTableNameFromSql(sql: string): string | undefined { const matches = sql.match(tableNameRegex); @@ -85,7 +85,7 @@ export class CoreDbProvider { * * @param value Value. * @param filter Filter. - * @return Whether the value matches the filter. + * @returns Whether the value matches the filter. */ protected valueMatchesFilter(value: string, filter?: RegExp | string): boolean { if (typeof filter === 'string') { @@ -101,7 +101,7 @@ export class CoreDbProvider { * Build an object with the summary data for each db, table and statement. * * @param filters Filters to limit the data stored. - * @return Object with the summary data. + * @returns Object with the summary data. */ protected buildStatementsSummary( filters: TablesSummaryFilters = {}, @@ -205,7 +205,7 @@ export class CoreDbProvider { * * @param name DB name. * @param forceNew True if it should always create a new instance. - * @return DB. + * @returns DB. */ getDB(name: string, forceNew?: boolean): SQLiteDB { if (this.dbInstances[name] === undefined || forceNew) { @@ -223,7 +223,7 @@ export class CoreDbProvider { * Delete a DB. * * @param name DB name. - * @return Promise resolved when the DB is deleted. + * @returns Promise resolved when the DB is deleted. */ async deleteDB(name: string): Promise { if (this.dbInstances[name] !== undefined) { diff --git a/src/core/services/file-helper.ts b/src/core/services/file-helper.ts index cc245e3ef..0d6404f01 100644 --- a/src/core/services/file-helper.ts +++ b/src/core/services/file-helper.ts @@ -41,7 +41,7 @@ export class CoreFileHelperProvider { /** * Check if the default behaviour of the app is open file with picker. * - * @return Boolean. + * @returns Boolean. */ defaultIsOpenWithPicker(): boolean { return CoreApp.isIOS() && CoreConstants.CONFIG.iOSDefaultOpenFileAction === OpenFileAction.OPEN_WITH; @@ -57,7 +57,7 @@ export class CoreFileHelperProvider { * @param onProgress Function to call on progress. * @param siteId The site ID. If not defined, current site. * @param options Options to open the file. - * @return Resolved on success. + * @returns Resolved on success. */ async downloadAndOpenFile( file: CoreWSFile, @@ -142,7 +142,7 @@ export class CoreFileHelperProvider { * @param onProgress Function to call on progress. * @param siteId The site ID. If not defined, current site. * @param options Options to open the file. - * @return Resolved with the URL to use on success. + * @returns Resolved with the URL to use on success. */ protected async downloadFileIfNeeded( file: CoreWSFile, @@ -234,7 +234,7 @@ export class CoreFileHelperProvider { * @param onProgress Function to call on progress. * @param file The file to download. * @param siteId The site ID. If not defined, current site. - * @return Resolved with internal URL on success, rejected otherwise. + * @returns Resolved with internal URL on success, rejected otherwise. */ async downloadFile( fileUrl: string, @@ -282,7 +282,7 @@ export class CoreFileHelperProvider { * Get the file's URL. * * @param file The file. - * @return File URL. + * @returns File URL. */ getFileUrl(file: CoreWSFile): string { return 'fileurl' in file ? file.fileurl : file.url; @@ -292,6 +292,7 @@ export class CoreFileHelperProvider { * Get the file's timemodified. * * @param file The file. + * @returns File modified timestamp, 0 if none. */ getFileTimemodified(file: CoreWSFile): number { return file.timemodified || 0; @@ -301,6 +302,7 @@ export class CoreFileHelperProvider { * Check if a state is downloaded or outdated. * * @param state The state to check. + * @returns If file has been downloaded (or outdated). */ isStateDownloaded(state: string): boolean { return state === CoreConstants.DOWNLOADED || state === CoreConstants.OUTDATED; @@ -310,7 +312,7 @@ export class CoreFileHelperProvider { * Whether the file has to be opened in browser. * * @param file The file to check. - * @return Whether the file should be opened in browser. + * @returns Whether the file should be opened in browser. */ shouldOpenInBrowser(file: CoreWSFile): boolean { if (!file.mimetype) { @@ -342,7 +344,7 @@ export class CoreFileHelperProvider { * Calculate the total size of the given files. * * @param files The files to check. - * @return Total files size. + * @returns Total files size. */ async getTotalFilesSize(files: CoreFileEntry[]): Promise { let totalSize = 0; @@ -358,7 +360,7 @@ export class CoreFileHelperProvider { * Calculate the file size. * * @param file The file to check. - * @return File size. + * @returns File size. */ async getFileSize(file: CoreFileEntry): Promise { if ('filesize' in file && (file.filesize || file.filesize === 0)) { @@ -403,7 +405,7 @@ export class CoreFileHelperProvider { * Is the file openable in app. * * @param file The file to check. - * @return bool. + * @returns bool. */ isOpenableInApp(file: {filename?: string; name?: string}): boolean { const regex = /(?:\.([^.]+))?$/; @@ -422,7 +424,7 @@ export class CoreFileHelperProvider { * * @param onlyDownload Whether the user is only downloading the file, not opening it. * @param file The file that will be opened. - * @return Promise resolved if confirmed, rejected otherwise. + * @returns Promise resolved if confirmed, rejected otherwise. */ async showConfirmOpenUnsupportedFile(onlyDownload = false, file: {filename?: string; name?: string}): Promise { file = file || {}; // Just in case some plugin doesn't pass it. This can be removed in the future, @since app 4.1. @@ -462,8 +464,8 @@ export class CoreFileHelperProvider { /** * Is the file type excluded to open in app. * - * @param file The file to check. - * @return bool. + * @param fileType The file to check. + * @returns If the file type is excluded in the app. */ isFileTypeExcludedInApp(fileType: string): boolean { const currentSite = CoreSites.getCurrentSite(); @@ -482,7 +484,7 @@ export class CoreFileHelperProvider { * Extract filename from the path. * * @param file The file. - * @return The file name. + * @returns The file name. */ getFilenameFromPath(file: CoreFileEntry): string | undefined { const path = CoreUtils.isFileEntry(file) ? file.fullPath : file.filepath; diff --git a/src/core/services/file-session.ts b/src/core/services/file-session.ts index 5bdea6efb..9c9343729 100644 --- a/src/core/services/file-session.ts +++ b/src/core/services/file-session.ts @@ -66,7 +66,7 @@ export class CoreFileSessionProvider { * @param component Component Name. * @param id File area identifier. * @param siteId Site ID. If not defined, current site. - * @return Array of files in session. + * @returns Array of files in session. */ getFiles(component: string, id: string | number, siteId?: string): CoreFileEntry[] { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/core/services/file.ts b/src/core/services/file.ts index 98db0183b..f03ac2e65 100644 --- a/src/core/services/file.ts +++ b/src/core/services/file.ts @@ -122,7 +122,7 @@ export class CoreFileProvider { /** * Checks if we're using HTML API. * - * @return True if uses HTML API, false otherwise. + * @returns True if uses HTML API, false otherwise. */ usesHTMLAPI(): boolean { return this.isHTMLAPI; @@ -131,7 +131,7 @@ export class CoreFileProvider { /** * Initialize basePath based on the OS if it's not initialized already. * - * @return Promise to be resolved when the initialization is finished. + * @returns Promise to be resolved when the initialization is finished. */ async init(): Promise { if (this.initialized) { @@ -157,7 +157,7 @@ export class CoreFileProvider { /** * Check if the plugin is available. * - * @return Whether the plugin is available. + * @returns Whether the plugin is available. */ isAvailable(): boolean { return window.resolveLocalFileSystemURL !== undefined; @@ -167,7 +167,7 @@ export class CoreFileProvider { * Get a file. * * @param path Relative path to the file. - * @return Promise resolved when the file is retrieved. + * @returns Promise resolved when the file is retrieved. */ getFile(path: string): Promise { return this.init().then(() => { @@ -181,7 +181,7 @@ export class CoreFileProvider { * Get a directory. * * @param path Relative path to the directory. - * @return Promise resolved when the directory is retrieved. + * @returns Promise resolved when the directory is retrieved. */ getDir(path: string): Promise { return this.init().then(() => { @@ -195,7 +195,7 @@ export class CoreFileProvider { * Get site folder path. * * @param siteId Site ID. - * @return Site folder path. + * @returns Site folder path. */ getSiteFolder(siteId: string): string { return CoreFileProvider.SITESFOLDER + '/' + siteId; @@ -208,7 +208,7 @@ export class CoreFileProvider { * @param path Relative path to the dir/file. * @param failIfExists True if it should fail if the dir/file exists, false otherwise. * @param base Base path to create the dir/file in. If not set, use basePath. - * @return Promise to be resolved when the dir/file is created. + * @returns Promise to be resolved when the dir/file is created. */ protected async create( isDirectory: boolean, @@ -250,7 +250,7 @@ export class CoreFileProvider { * * @param path Relative path to the directory. * @param failIfExists True if it should fail if the directory exists, false otherwise. - * @return Promise to be resolved when the directory is created. + * @returns Promise to be resolved when the directory is created. */ async createDir(path: string, failIfExists?: boolean): Promise { const entry = await this.create(true, path, failIfExists); @@ -263,7 +263,7 @@ export class CoreFileProvider { * * @param path Relative path to the file. * @param failIfExists True if it should fail if the file exists, false otherwise.. - * @return Promise to be resolved when the file is created. + * @returns Promise to be resolved when the file is created. */ async createFile(path: string, failIfExists?: boolean): Promise { const entry = await this.create(false, path, failIfExists); @@ -275,7 +275,7 @@ export class CoreFileProvider { * Removes a directory and all its contents. * * @param path Relative path to the directory. - * @return Promise to be resolved when the directory is deleted. + * @returns Promise to be resolved when the directory is deleted. */ async removeDir(path: string): Promise { await this.init(); @@ -290,7 +290,7 @@ export class CoreFileProvider { * Removes a file and all its contents. * * @param path Relative path to the file. - * @return Promise to be resolved when the file is deleted. + * @returns Promise to be resolved when the file is deleted. */ async removeFile(path: string): Promise { await this.init(); @@ -315,8 +315,8 @@ export class CoreFileProvider { /** * Removes a file given its FileEntry. * - * @param fileEntry File Entry. - * @return Promise resolved when the file is deleted. + * @param entry File Entry. + * @returns Promise resolved when the file is deleted. */ removeFileByFileEntry(entry: Entry): Promise { return new Promise((resolve, reject) => entry.remove(resolve, reject)); @@ -326,7 +326,7 @@ export class CoreFileProvider { * Retrieve the contents of a directory (not subdirectories). * * @param path Relative path to the directory. - * @return Promise to be resolved when the contents are retrieved. + * @returns Promise to be resolved when the contents are retrieved. */ async getDirectoryContents(path: string): Promise<(FileEntry | DirectoryEntry)[]> { await this.init(); @@ -343,7 +343,7 @@ export class CoreFileProvider { * Type guard to check if the param is a DirectoryEntry. * * @param entry Param to check. - * @return Whether the param is a DirectoryEntry. + * @returns Whether the param is a DirectoryEntry. */ protected isDirectoryEntry(entry: FileEntry | DirectoryEntry): entry is DirectoryEntry { return entry.isDirectory === true; @@ -353,7 +353,7 @@ export class CoreFileProvider { * Calculate the size of a directory or a file. * * @param entry Directory or file. - * @return Promise to be resolved when the size is calculated. + * @returns Promise to be resolved when the size is calculated. */ protected getSize(entry: DirectoryEntry | FileEntry): Promise { return new Promise((resolve, reject) => { @@ -396,7 +396,7 @@ export class CoreFileProvider { * Calculate the size of a directory. * * @param path Relative path to the directory. - * @return Promise to be resolved when the size is calculated. + * @returns Promise to be resolved when the size is calculated. */ getDirectorySize(path: string): Promise { path = this.removeBasePath(path); @@ -410,7 +410,7 @@ export class CoreFileProvider { * Calculate the size of a file. * * @param path Relative path to the file. - * @return Promise to be resolved when the size is calculated. + * @returns Promise to be resolved when the size is calculated. */ getFileSize(path: string): Promise { path = this.removeBasePath(path); @@ -423,8 +423,8 @@ export class CoreFileProvider { /** * Get file object from a FileEntry. * - * @param path Relative path to the file. - * @return Promise to be resolved when the file is retrieved. + * @param entry Relative path to the file. + * @returns Promise to be resolved when the file is retrieved. */ getFileObjectFromFileEntry(entry: FileEntry): Promise { return new Promise((resolve, reject): void => { @@ -437,7 +437,7 @@ export class CoreFileProvider { * Calculate the free space in the disk. * Please notice that this function isn't reliable and it's not documented in the Cordova File plugin. * - * @return Promise resolved with the estimated free space in bytes. + * @returns Promise resolved with the estimated free space in bytes. */ calculateFreeSpace(): Promise { return File.getFreeDiskSpace().then((size) => { @@ -455,7 +455,7 @@ export class CoreFileProvider { * Normalize a filename that usually comes URL encoded. * * @param filename The file name. - * @return The file name normalized. + * @returns The file name normalized. */ normalizeFileName(filename: string): string { filename = CoreTextUtils.decodeURIComponent(filename); @@ -469,7 +469,7 @@ export class CoreFileProvider { * @param path Relative path to the file. * @param format Format to read the file. * @param folder Absolute path to the folder where the file is. Use it to read files outside of the app's data folder. - * @return Promise to be resolved when the file is read. + * @returns Promise to be resolved when the file is read. */ readFile( path: string, @@ -518,7 +518,7 @@ export class CoreFileProvider { * * @param fileData File's data. * @param format Format to read the file. - * @return Promise to be resolved when the file is read. + * @returns Promise to be resolved when the file is read. */ readFileData(fileData: IFile, format: CoreFileFormat = CoreFileFormat.FORMATTEXT): Promise { format = format || CoreFileFormat.FORMATTEXT; @@ -582,7 +582,7 @@ export class CoreFileProvider { * @param path Relative path to the file. * @param data Data to write. * @param append Whether to append the data to the end of the file. - * @return Promise to be resolved when the file is written. + * @returns Promise to be resolved when the file is written. */ async writeFile(path: string, data: string | Blob, append?: boolean): Promise { await this.init(); @@ -615,7 +615,7 @@ export class CoreFileProvider { * @param onProgress Function to call on progress. * @param offset Offset where to start reading from. * @param append Whether to append the data to the end of the file. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async writeFileDataInFile( file: Blob, @@ -661,7 +661,7 @@ export class CoreFileProvider { * Gets a file that might be outside the app's folder. * * @param fullPath Absolute path to the file. - * @return Promise to be resolved when the file is retrieved. + * @returns Promise to be resolved when the file is retrieved. */ getExternalFile(fullPath: string): Promise { return File.resolveLocalFilesystemUrl(fullPath).then((entry) => entry); @@ -671,7 +671,7 @@ export class CoreFileProvider { * Calculate the size of a file. * * @param path Absolute path to the file. - * @return Promise to be resolved when the size is calculated. + * @returns Promise to be resolved when the size is calculated. */ async getExternalFileSize(path: string): Promise { const fileEntry = await this.getExternalFile(path); @@ -683,7 +683,7 @@ export class CoreFileProvider { * Removes a file that might be outside the app's folder. * * @param fullPath Absolute path to the file. - * @return Promise to be resolved when the file is removed. + * @returns Promise to be resolved when the file is removed. */ async removeExternalFile(fullPath: string): Promise { const directory = fullPath.substring(0, fullPath.lastIndexOf('/')); @@ -695,7 +695,7 @@ export class CoreFileProvider { /** * Get the base path where the application files are stored. * - * @return Promise to be resolved when the base path is retrieved. + * @returns Promise to be resolved when the base path is retrieved. */ getBasePath(): Promise { return this.init().then(() => { @@ -712,7 +712,7 @@ export class CoreFileProvider { * iOS: Internal URL (cdvfile://). * Others: basePath (file://) * - * @return Promise to be resolved when the base path is retrieved. + * @returns Promise to be resolved when the base path is retrieved. */ async getBasePathToDownload(): Promise { await this.init(); @@ -731,7 +731,7 @@ export class CoreFileProvider { /** * Get the base path where the application files are stored. Returns the value instantly, without waiting for it to be ready. * - * @return Base path. If the service hasn't been initialized it will return an invalid value. + * @returns Base path. If the service hasn't been initialized it will return an invalid value. */ getBasePathInstant(): string { if (!this.basePath) { @@ -750,7 +750,7 @@ export class CoreFileProvider { * @param newPath New path of the dir. * @param destDirExists Set it to true if you know the directory where to put the dir exists. If false, the function will * try to create it (slower). - * @return Promise resolved when the entry is moved. + * @returns Promise resolved when the entry is moved. */ async moveDir(originalPath: string, newPath: string, destDirExists?: boolean): Promise { const entry = await this.copyOrMoveFileOrDir(originalPath, newPath, true, false, destDirExists); @@ -765,7 +765,7 @@ export class CoreFileProvider { * @param newPath New path of the file. * @param destDirExists Set it to true if you know the directory where to put the file exists. If false, the function will * try to create it (slower). - * @return Promise resolved when the entry is moved. + * @returns Promise resolved when the entry is moved. */ async moveFile(originalPath: string, newPath: string, destDirExists?: boolean): Promise { const entry = await this.copyOrMoveFileOrDir(originalPath, newPath, false, false, destDirExists); @@ -780,7 +780,7 @@ export class CoreFileProvider { * @param to New path of the directory. * @param destDirExists Set it to true if you know the directory where to put the dir exists. If false, the function will * try to create it (slower). - * @return Promise resolved when the entry is copied. + * @returns Promise resolved when the entry is copied. */ async copyDir(from: string, to: string, destDirExists?: boolean): Promise { const entry = await this.copyOrMoveFileOrDir(from, to, true, true, destDirExists); @@ -795,7 +795,7 @@ export class CoreFileProvider { * @param to New path of the file. * @param destDirExists Set it to true if you know the directory where to put the file exists. If false, the function will * try to create it (slower). - * @return Promise resolved when the entry is copied. + * @returns Promise resolved when the entry is copied. */ async copyFile(from: string, to: string, destDirExists?: boolean): Promise { const entry = await this.copyOrMoveFileOrDir(from, to, false, true, destDirExists); @@ -812,7 +812,7 @@ export class CoreFileProvider { * @param copy Whether to copy. If false, it will move the file. * @param destDirExists Set it to true if you know the directory where to put the file/dir exists. If false, the function will * try to create it (slower). - * @return Promise resolved when the entry is copied. + * @returns Promise resolved when the entry is copied. */ protected async copyOrMoveFileOrDir( from: string, @@ -866,7 +866,7 @@ export class CoreFileProvider { * Extract the file name and directory from a given path. * * @param path Path to be extracted. - * @return Plain object containing the file name and directory. + * @returns Plain object containing the file name and directory. * @description * file.pdf -> directory: '', name: 'file.pdf' * /file.pdf -> directory: '', name: 'file.pdf' @@ -891,7 +891,7 @@ export class CoreFileProvider { * Please notice that with WKWebView these URLs no longer work in mobile. Use fileEntry.toURL() along with convertFileSrc. * * @param fileEntry File Entry. - * @return Internal URL. + * @returns Internal URL. */ getInternalURL(fileEntry: FileEntry): string { if (!fileEntry.toInternalURL) { @@ -906,7 +906,7 @@ export class CoreFileProvider { * Adds the basePath to a path if it doesn't have it already. * * @param path Path to treat. - * @return Path with basePath added. + * @returns Path with basePath added. */ addBasePathIfNeeded(path: string): string { if (path.indexOf(this.basePath) > -1) { @@ -920,7 +920,7 @@ export class CoreFileProvider { * Remove the base path from a path. * * @param path Path to treat. - * @return Path without basePath. + * @returns Path without basePath. */ removeBasePath(path: string): string { return CoreText.removeStartingSlash(path.replace(this.basePath, '')); @@ -934,7 +934,7 @@ export class CoreFileProvider { * same location and name as the ZIP file (without extension). * @param onProgress Function to call on progress. * @param recreateDir Delete the dest directory before unzipping. Defaults to true. - * @return Promise resolved when the file is unzipped. + * @returns Promise resolved when the file is unzipped. */ async unzipFile( path: string, @@ -969,7 +969,7 @@ export class CoreFileProvider { * @param path Path to the file. * @param search Value to search. * @param newValue New value. - * @return Promise resolved in success. + * @returns Promise resolved in success. */ async replaceInFile(path: string, search: string | RegExp, newValue: string): Promise { let content = await this.readFile(path); @@ -989,7 +989,7 @@ export class CoreFileProvider { * Get a file/dir metadata given the file's entry. * * @param fileEntry FileEntry retrieved from getFile or similar. - * @return Promise resolved with metadata. + * @returns Promise resolved with metadata. */ getMetadata(fileEntry: Entry): Promise { if (!fileEntry || !fileEntry.getMetadata) { @@ -1006,7 +1006,7 @@ export class CoreFileProvider { * * @param path Path to the file/dir. * @param isDir True if directory, false if file. - * @return Promise resolved with metadata. + * @returns Promise resolved with metadata. */ getMetadataFromPath(path: string, isDir?: boolean): Promise { let promise; @@ -1023,7 +1023,7 @@ export class CoreFileProvider { * Remove the starting slash of a path if it's there. E.g. '/sites/filepool' -> 'sites/filepool'. * * @param path Path. - * @return Path without a slash in the first position. + * @returns Path without a slash in the first position. * @deprecated since 4.1. Use CoreText.removeStartingSlash instead. */ removeStartingSlash(path: string): string { @@ -1036,7 +1036,7 @@ export class CoreFileProvider { * @param from Absolute path to the file to copy/move. * @param to Relative new path of the file (inside the app folder). * @param copy True to copy, false to move. - * @return Promise resolved when the entry is copied/moved. + * @returns Promise resolved when the entry is copied/moved. */ protected async copyOrMoveExternalFile(from: string, to: string, copy?: boolean): Promise { // Get the file to copy/move. @@ -1062,7 +1062,7 @@ export class CoreFileProvider { * * @param from Absolute path to the file to copy. * @param to Relative new path of the file (inside the app folder). - * @return Promise resolved when the entry is copied. + * @returns Promise resolved when the entry is copied. */ copyExternalFile(from: string, to: string): Promise { return this.copyOrMoveExternalFile(from, to, true); @@ -1073,7 +1073,7 @@ export class CoreFileProvider { * * @param from Absolute path to the file to move. * @param to Relative new path of the file (inside the app folder). - * @return Promise resolved when the entry is moved. + * @returns Promise resolved when the entry is moved. */ moveExternalFile(from: string, to: string): Promise { return this.copyOrMoveExternalFile(from, to, false); @@ -1085,7 +1085,7 @@ export class CoreFileProvider { * @param dirPath Path to the destination folder. * @param fileName File name that wants to be used. * @param defaultExt Default extension to use if no extension found in the file. - * @return Promise resolved with the unique file name. + * @returns Promise resolved with the unique file name. */ async getUniqueNameInFolder(dirPath: string, fileName: string, defaultExt?: string): Promise { // Get existing files in the folder. @@ -1125,7 +1125,7 @@ export class CoreFileProvider { * * @param usedNames Object with names already used as keys. * @param name Name to check. - * @return Unique name. + * @returns Unique name. */ calculateUniqueName(usedNames: Record, name: string): string { if (usedNames[name.toLowerCase()] === undefined) { @@ -1150,7 +1150,7 @@ export class CoreFileProvider { /** * Remove app temporary folder. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async clearTmpFolder(): Promise { // Ignore errors because the folder might not exist. @@ -1162,7 +1162,7 @@ export class CoreFileProvider { * * @param dirPath Folder path. * @param files List of used files. - * @return Promise resolved when done, rejected if failure. + * @returns Promise resolved when done, rejected if failure. */ async removeUnusedFiles(dirPath: string, files: CoreFileEntry[]): Promise { // Get the directory contents. @@ -1201,7 +1201,7 @@ export class CoreFileProvider { * Check if a file is inside the app's folder. * * @param path The absolute path of the file to check. - * @return Whether the file is in the app's folder. + * @returns Whether the file is in the app's folder. */ isFileInAppFolder(path: string): boolean { return path.indexOf(this.basePath) != -1; @@ -1210,7 +1210,7 @@ export class CoreFileProvider { /** * Get the path to the www folder at runtime based on the WebView URL. * - * @return Path. + * @returns Path. */ getWWWPath(): string { // Use current URL, removing the path. @@ -1230,7 +1230,7 @@ export class CoreFileProvider { /** * Get the full path to the www folder. * - * @return Path. + * @returns Path. */ getWWWAbsolutePath(): string { if (window.cordova && cordova.file && cordova.file.applicationDirectory) { @@ -1246,7 +1246,7 @@ export class CoreFileProvider { * This is needed to make files work with the Ionic WebView plugin. * * @param src Source to convert. - * @return Converted src. + * @returns Converted src. */ convertFileSrc(src: string): string { return CorePlatform.isMobile() ? WebView.convertFileSrc(src) : src; @@ -1256,7 +1256,7 @@ export class CoreFileProvider { * Undo the conversion of convertFileSrc. * * @param src Source to unconvert. - * @return Unconverted src. + * @returns Unconverted src. */ unconvertFileSrc(src: string): string { if (!CorePlatform.isMobile()) { @@ -1274,7 +1274,7 @@ export class CoreFileProvider { * Check if a certain path is in the app's folder (basePath). * * @param path Path to check. - * @return Whether it's in the app folder. + * @returns Whether it's in the app folder. */ protected isPathInAppFolder(path: string): boolean { return !path || !path.match(/^[a-z0-9]+:\/\//i) || path.indexOf(this.basePath) != -1; @@ -1284,7 +1284,7 @@ export class CoreFileProvider { * Get the file's name. * * @param file The file. - * @return The file name. + * @returns The file name. */ getFileName(file: CoreFileEntry): string | undefined { return CoreUtils.isFileEntry(file) ? file.name : file.filename; diff --git a/src/core/services/filepool.ts b/src/core/services/filepool.ts index 5041969e1..34a3627b9 100644 --- a/src/core/services/filepool.ts +++ b/src/core/services/filepool.ts @@ -187,7 +187,7 @@ export class CoreFilepoolProvider { * @param fileId The file ID. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ protected async addFileLink(siteId: string, fileId: string, component: string, componentId?: string | number): Promise { if (!component) { @@ -208,7 +208,7 @@ export class CoreFilepoolProvider { * @param fileUrl The file Url. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved on success. + * @returns Promise resolved on success. * @description * Use this method to create a link between a URL and a component. You usually do not need to call this manually since * downloading a file automatically does this. Note that this method does not check if the file exists in the pool. @@ -226,7 +226,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param fileId The file ID. * @param links Array of objects containing the component and optionally componentId. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ protected async addFileLinks(siteId: string, fileId: string, links: CoreFilepoolComponentLink[]): Promise { const promises = links.map((link) => this.addFileLink(siteId, fileId, link.component, link.componentId)); @@ -241,7 +241,7 @@ export class CoreFilepoolProvider { * @param files Array of files to add. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component (optional). - * @return Resolved on success. + * @returns Resolved on success. */ addFilesToQueue(siteId: string, files: CoreWSFile[], component?: string, componentId?: string | number): Promise { return this.downloadOrPrefetchFiles(siteId, files, true, false, component, componentId); @@ -253,7 +253,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param fileId The file ID. * @param data Additional information to store about the file (timemodified, url, ...). See FILES_TABLE schema. - * @return Promise resolved on success. + * @returns Promise resolved on success. */ protected async addFileToPool(siteId: string, fileId: string, data: Omit): Promise { const record = { @@ -269,7 +269,7 @@ export class CoreFilepoolProvider { * * @param url The URL of the file, already treated (decoded, without revision, etc.). * @param filename The filename. - * @return The filename with the hash. + * @returns The filename with the hash. */ protected addHashToFilename(url: string, filename: string): string { // Check if the file already has a hash. If a file is downloaded and re-uploaded with the app it will have a hash already. @@ -303,7 +303,7 @@ export class CoreFilepoolProvider { * @param onProgress Function to call on progress. * @param options Extra options (isexternalfile, repositorytype). * @param link The link to add for the file. - * @return Promise resolved when the file is downloaded. + * @returns Promise resolved when the file is downloaded. */ protected async addToQueue( siteId: string, @@ -354,7 +354,7 @@ export class CoreFilepoolProvider { * @param options Extra options (isexternalfile, repositorytype). * @param revision File revision. If not defined, it will be calculated using the URL. * @param alreadyFixed Whether the URL has already been fixed. - * @return Resolved on success. + * @returns Resolved on success. */ async addToQueueByUrl( siteId: string, @@ -473,7 +473,7 @@ export class CoreFilepoolProvider { * Ignored if checkSize=false. * @param options Extra options (isexternalfile, repositorytype). * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Promise resolved when the file is downloaded. + * @returns Promise resolved when the file is downloaded. */ protected async addToQueueIfNeeded( siteId: string, @@ -568,7 +568,7 @@ export class CoreFilepoolProvider { * Clear all packages status in a site. * * @param siteId Site ID. - * @return Promise resolved when all status are cleared. + * @returns Promise resolved when all status are cleared. */ async clearAllPackagesStatus(siteId: string): Promise { this.logger.debug('Clear all packages status for site ' + siteId); @@ -592,7 +592,7 @@ export class CoreFilepoolProvider { * Clears the filepool. Use it only when all the files from a site are deleted. * * @param siteId ID of the site to clear. - * @return Promise resolved when the filepool is cleared. + * @returns Promise resolved when the filepool is cleared. */ async clearFilepool(siteId: string): Promise { // Read the data first to be able to notify the deletions. @@ -616,7 +616,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. - * @return Resolved means yes, rejected means no. + * @returns Resolved means yes, rejected means no. */ async componentHasFiles(siteId: string, component: string, componentId?: string | number): Promise { const conditions = { @@ -636,7 +636,7 @@ export class CoreFilepoolProvider { * * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. - * @return Link, null if nothing to link. + * @returns Link, null if nothing to link. */ protected createComponentLink(component?: string, componentId?: string | number): CoreFilepoolComponentLink | undefined { if (component !== undefined && component != null) { @@ -649,7 +649,7 @@ export class CoreFilepoolProvider { * * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. - * @return Links. + * @returns Links. */ protected createComponentLinks(component?: string, componentId?: string | number): CoreFilepoolComponentLink[] { const link = this.createComponentLink(component, componentId); @@ -669,8 +669,8 @@ export class CoreFilepoolProvider { * or CoreConstants.DOWNLOADING, with at least 1 package with CoreConstants.OUTDATED. * * @param current Current status of the list of packages. - * @param packagestatus Status of one of the packages. - * @return New status for the list of packages; + * @param packageStatus Status of one of the packages. + * @returns New status for the list of packages; */ determinePackagesStatus(current: string, packageStatus: string): string { if (!current) { @@ -707,7 +707,7 @@ export class CoreFilepoolProvider { * @param filePath Filepath to download the file to. If defined, no extension will be added. * @param onProgress Function to call on progress. * @param poolFileObject When set, the object will be updated, a new entry will not be created. - * @return Resolved with internal URL on success, rejected otherwise. + * @returns Resolved with internal URL on success, rejected otherwise. */ protected async downloadForPoolByUrl( siteId: string, @@ -786,7 +786,7 @@ export class CoreFilepoolProvider { * @param componentId An ID to use in conjunction with the component. * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store * the files directly inside the filepool folder. - * @return Resolved on success. + * @returns Resolved on success. */ downloadOrPrefetchFiles( siteId: string, @@ -850,7 +850,7 @@ export class CoreFilepoolProvider { * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store * the files directly inside the filepool folder. * @param onProgress Function to call on progress. - * @return Promise resolved when the package is downloaded. + * @returns Promise resolved when the package is downloaded. */ downloadOrPrefetchPackage( siteId: string, @@ -975,7 +975,7 @@ export class CoreFilepoolProvider { * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store * the files directly inside the filepool folder. * @param onProgress Function to call on progress. - * @return Promise resolved when all files are downloaded. + * @returns Promise resolved when all files are downloaded. */ downloadPackage( siteId: string, @@ -998,10 +998,11 @@ export class CoreFilepoolProvider { * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. * @param timemodified The time this file was modified. Can be used to check file state. + * @param onProgress On progress callback function. * @param filePath Filepath to download the file to. If not defined, download to the filepool folder. * @param options Extra options (isexternalfile, repositorytype). * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Resolved with internal URL on success, rejected otherwise. + * @returns Resolved with internal URL on success, rejected otherwise. * @description * Downloads a file on the spot. * @@ -1093,7 +1094,7 @@ export class CoreFilepoolProvider { * Extract the downloadable URLs from an HTML code. * * @param html HTML code. - * @return List of file urls. + * @returns List of file urls. */ extractDownloadableFilesFromHtml(html: string): string[] { let urls: string[] = []; @@ -1128,7 +1129,7 @@ export class CoreFilepoolProvider { * Extract the downloadable URLs from an HTML code and returns them in fake file objects. * * @param html HTML code. - * @return List of fake file objects with file URLs. + * @returns List of fake file objects with file URLs. */ extractDownloadableFilesFromHtmlAsFakeFileObjects(html: string): CoreWSExternalFile[] { const urls = this.extractDownloadableFilesFromHtml(html); @@ -1143,9 +1144,9 @@ export class CoreFilepoolProvider { * Fill Missing Extension In the File Object if needed. * This is to migrate from old versions. * - * @param fileObject File object to be migrated. + * @param entry File object to be migrated. * @param siteId SiteID to get migrated. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async fillExtensionInFile(entry: CoreFilepoolFileEntry, siteId: string): Promise { if (entry.extension !== undefined) { @@ -1185,7 +1186,7 @@ export class CoreFilepoolProvider { * Fix a component ID to always be a Number if possible. * * @param componentId The component ID. - * @return The normalised component ID. -1 when undefined was passed. + * @returns The normalised component ID. -1 when undefined was passed. */ protected fixComponentId(componentId?: string | number): string | number { if (typeof componentId == 'number') { @@ -1212,7 +1213,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param fileUrl The file URL. * @param timemodified The timemodified of the file. - * @return Promise resolved with the file data to use. + * @returns Promise resolved with the file data to use. */ protected async fixPluginfileURL(siteId: string, fileUrl: string, timemodified: number = 0): Promise { const file = await CorePluginFileDelegate.getDownloadableFile({ fileurl: fileUrl, timemodified }); @@ -1230,10 +1231,10 @@ export class CoreFilepoolProvider { /** * Convenience function to get component files. * - * @param db Site's DB. + * @param siteId Site Id. * @param component The component to get. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the files. + * @returns Promise resolved with the files. */ protected async getComponentFiles( siteId: string | undefined, @@ -1260,7 +1261,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The file URL. - * @return Resolved with the URL. Rejected otherwise. + * @returns Resolved with the URL. Rejected otherwise. */ async getDirectoryUrlByUrl(siteId: string, fileUrl: string): Promise { if (!CoreFile.isAvailable()) { @@ -1280,7 +1281,7 @@ export class CoreFilepoolProvider { * * @param fileUrl The file URL. * @param filePath The file destination path. - * @return File download ID. + * @returns File download ID. */ protected getFileDownloadId(fileUrl: string, filePath: string): string { return Md5.hashAsciiStr(fileUrl + '###' + filePath); @@ -1291,7 +1292,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return Event name. + * @returns Event name. */ protected getFileEventName(siteId: string, fileId: string): string { return 'CoreFilepoolFile:' + siteId + ':' + fileId; @@ -1302,7 +1303,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The absolute URL to the file. - * @return Promise resolved with event name. + * @returns Promise resolved with event name. */ getFileEventNameByUrl(siteId: string, fileUrl: string): Promise { return this.fixPluginfileURL(siteId, fileUrl).then((file) => { @@ -1319,7 +1320,7 @@ export class CoreFilepoolProvider { * pointing to the same pluginfile URL even if the token or extra attributes have changed. * * @param fileUrl The absolute URL to the file. - * @return The file ID. + * @returns The file ID. */ protected getFileIdByUrl(fileUrl: string): string { let url = fileUrl; @@ -1356,7 +1357,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return Promise resolved with the links. + * @returns Promise resolved with the links. */ protected async getFileLinks(siteId: string, fileId: string): Promise { const items = await this.linksTables[siteId].getMany({ fileId }); @@ -1374,7 +1375,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param fileId The file ID. * @param extension Previously calculated extension. Empty to not add any. Undefined to calculate it. - * @return The path to the file relative to storage root. + * @returns The path to the file relative to storage root. */ protected async getFilePath(siteId: string, fileId: string, extension?: string): Promise { let path = this.getFilepoolFolderPath(siteId) + '/' + fileId; @@ -1402,7 +1403,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The file URL. - * @return Promise resolved with the path to the file relative to storage root. + * @returns Promise resolved with the path to the file relative to storage root. */ async getFilePathByUrl(siteId: string, fileUrl: string): Promise { const file = await this.fixPluginfileURL(siteId, fileUrl); @@ -1428,7 +1429,7 @@ export class CoreFilepoolProvider { * Get site Filepool Folder Path * * @param siteId The site ID. - * @return The root path to the filepool of the site. + * @returns The root path to the filepool of the site. */ getFilepoolFolderPath(siteId: string): string { return CoreFile.getSiteFolder(siteId) + '/' + CoreFilepoolProvider.FOLDER; @@ -1440,7 +1441,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param component The component to get. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the files on success. + * @returns Promise resolved with the files on success. */ async getFilesByComponent(siteId: string, component: string, componentId?: string | number): Promise { const items = await this.getComponentFiles(siteId, component, componentId); @@ -1469,7 +1470,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param component The component to get. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the size on success. + * @returns Promise resolved with the size on success. */ async getFilesSizeByComponent(siteId: string, component: string, componentId?: string | number): Promise { const files = await this.getFilesByComponent(siteId, component, componentId); @@ -1497,7 +1498,7 @@ export class CoreFilepoolProvider { * @param timemodified The time this file was modified. * @param filePath Filepath to download the file to. If defined, no extension will be added. * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Promise resolved with the file state. + * @returns Promise resolved with the file state. */ async getFileStateByUrl( siteId: string, @@ -1555,16 +1556,16 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The absolute URL to the file. - * @param mode The type of URL to return. Accepts 'url' or 'src'. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. + * @param mode The type of URL to return. Accepts 'url' or 'src'. * @param timemodified The time this file was modified. * @param checkSize True if we shouldn't download files if their size is big, false otherwise. * @param downloadUnknown True to download file in WiFi if their size is unknown, false otherwise. * Ignored if checkSize=false. * @param options Extra options (isexternalfile, repositorytype). * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Resolved with the URL to use. + * @returns Resolved with the URL to use. * @description * This will return a URL pointing to the content of the requested URL. * @@ -1650,7 +1651,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return Resolved with the internal URL. Rejected otherwise. + * @returns Resolved with the internal URL. Rejected otherwise. */ protected async getInternalSrcById(siteId: string, fileId: string): Promise { if (!CoreFile.isAvailable()) { @@ -1668,7 +1669,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return Resolved with the URL. Rejected otherwise. + * @returns Resolved with the URL. Rejected otherwise. */ protected async getInternalUrlById(siteId: string, fileId: string): Promise { if (!CoreFile.isAvailable()) { @@ -1686,7 +1687,7 @@ export class CoreFilepoolProvider { * Returns the local URL of a file. * * @param filePath The file path. - * @return Resolved with the URL. + * @returns Resolved with the URL. */ protected async getInternalUrlByPath(filePath: string): Promise { if (!CoreFile.isAvailable()) { @@ -1703,7 +1704,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The file URL. - * @return Resolved with the URL. Rejected otherwise. + * @returns Resolved with the URL. Rejected otherwise. */ async getInternalUrlByUrl(siteId: string, fileUrl: string): Promise { if (!CoreFile.isAvailable()) { @@ -1722,7 +1723,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ async getPackageData(siteId: string, component: string, componentId?: string | number): Promise { componentId = this.fixComponentId(componentId); @@ -1736,7 +1737,7 @@ export class CoreFilepoolProvider { * Creates the name for a package directory (hash). * * @param url An URL to identify the package. - * @return The directory name. + * @returns The directory name. */ protected getPackageDirNameByUrl(url: string): string { let extension = ''; @@ -1764,7 +1765,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param url An URL to identify the package. - * @return Promise resolved with the path of the package. + * @returns Promise resolved with the path of the package. */ getPackageDirPathByUrl(siteId: string, url: string): Promise { return this.fixPluginfileURL(siteId, url).then((file) => { @@ -1779,7 +1780,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param url An URL to identify the package. - * @return Resolved with the URL. + * @returns Resolved with the URL. */ async getPackageDirUrlByUrl(siteId: string, url: string): Promise { if (!CoreFile.isAvailable()) { @@ -1800,7 +1801,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component The component of the package. * @param componentId An ID to use in conjunction with the component. - * @return Download promise or undefined. + * @returns Download promise or undefined. */ getPackageDownloadPromise(siteId: string, component: string, componentId?: string | number): Promise | undefined { const packageId = this.getPackageId(component, componentId); @@ -1815,7 +1816,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the extra data. + * @returns Promise resolved with the extra data. */ getPackageExtra(siteId: string, component: string, componentId?: string | number): Promise { return this.getPackageData(siteId, component, componentId).then((entry) => entry.extra); @@ -1826,7 +1827,7 @@ export class CoreFilepoolProvider { * * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Package ID. + * @returns Package ID. */ getPackageId(component: string, componentId?: string | number): string { return Md5.hashAsciiStr(component + '#' + this.fixComponentId(componentId)); @@ -1838,7 +1839,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the status. + * @returns Promise resolved with the status. */ async getPackagePreviousStatus(siteId: string, component: string, componentId?: string | number): Promise { try { @@ -1856,7 +1857,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved with the status. + * @returns Promise resolved with the status. */ async getPackageStatus(siteId: string, component: string, componentId?: string | number): Promise { try { @@ -1872,7 +1873,7 @@ export class CoreFilepoolProvider { * Return the array of arguments of the pluginfile url. * * @param url URL to get the args. - * @return The args found, undefined if not a pluginfile. + * @returns The args found, undefined if not a pluginfile. */ protected getPluginFileArgs(url: string): string[] | undefined { if (!CoreUrlUtils.isPluginFileUrl(url)) { @@ -1898,7 +1899,7 @@ export class CoreFilepoolProvider { * @param fileId The file ID. * @param create True if it should create a new deferred if it doesn't exist. * @param onProgress Function to call on progress. - * @return Deferred. + * @returns Deferred. */ protected getQueueDeferred( siteId: string, @@ -1931,7 +1932,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return On progress function, undefined if not found. + * @returns On progress function, undefined if not found. */ protected getQueueOnProgress(siteId: string, fileId: string): CoreFilepoolOnProgressCallback | undefined { const deferred = this.getQueueDeferred(siteId, fileId, false); @@ -1946,7 +1947,7 @@ export class CoreFilepoolProvider { * @param fileId The file ID. * @param create True if it should create a new promise if it doesn't exist. * @param onProgress Function to call on progress. - * @return Promise. + * @returns Promise. */ protected getQueuePromise( siteId: string, @@ -1961,7 +1962,7 @@ export class CoreFilepoolProvider { * Get a revision number from a list of files (highest revision). * * @param files Package files. - * @return Highest revision. + * @returns Highest revision. */ getRevisionFromFileList(files: CoreWSFile[]): number { let revision = 0; @@ -1984,7 +1985,7 @@ export class CoreFilepoolProvider { * Get the revision number from a file URL. * * @param url URL to get the revision number. - * @return Revision number. + * @returns Revision number. */ protected getRevisionFromUrl(url: string): number { const args = this.getPluginFileArgs(url); @@ -2011,7 +2012,6 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The absolute URL to the file. - * @param mode The type of URL to return. Accepts 'url' or 'src'. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. * @param timemodified The time this file was modified. @@ -2020,7 +2020,7 @@ export class CoreFilepoolProvider { * Ignored if checkSize=false. * @param options Extra options (isexternalfile, repositorytype). * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Resolved with the URL to use. + * @returns Resolved with the URL to use. * @description * This will return a URL pointing to the content of the requested URL. * The URL returned is compatible to use with IMG tags. @@ -2054,7 +2054,7 @@ export class CoreFilepoolProvider { * Get time modified from a list of files. * * @param files List of files. - * @return Time modified. + * @returns Time modified. */ getTimemodifiedFromFileList(files: CoreWSFile[]): number { let timemodified = 0; @@ -2073,7 +2073,6 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The absolute URL to the file. - * @param mode The type of URL to return. Accepts 'url' or 'src'. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. * @param timemodified The time this file was modified. @@ -2082,7 +2081,7 @@ export class CoreFilepoolProvider { * Ignored if checkSize=false. * @param options Extra options (isexternalfile, repositorytype). * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Resolved with the URL to use. + * @returns Resolved with the URL to use. * @description * This will return a URL pointing to the content of the requested URL. * The URL returned is compatible to use with a local browser. @@ -2116,7 +2115,7 @@ export class CoreFilepoolProvider { * Guess the filename of a file from its URL. This is very weak and unreliable. * * @param fileUrl The file URL. - * @return The filename treated so it doesn't have any special character. + * @returns The filename treated so it doesn't have any special character. */ protected guessFilenameFromUrl(fileUrl: string): string { let filename = ''; @@ -2174,8 +2173,8 @@ export class CoreFilepoolProvider { * Check if the file is already in the pool. This does not check if the file is on the disk. * * @param siteId The site ID. - * @param fileUrl The file URL. - * @return Resolved with file object from DB on success, rejected otherwise. + * @param fileId The file Id. + * @returns Resolved with file object from DB on success, rejected otherwise. */ protected async hasFileInPool(siteId: string, fileId: string): Promise { return this.filesTables[siteId].getOneByPrimaryKey({ fileId }); @@ -2185,8 +2184,8 @@ export class CoreFilepoolProvider { * Check if the file is in the queue. * * @param siteId The site ID. - * @param fileUrl The file URL. - * @return Resolved with file object from DB on success, rejected otherwise. + * @param fileId The file Id. + * @returns Resolved with file object from DB on success, rejected otherwise. */ protected async hasFileInQueue(siteId: string, fileId: string): Promise { const entry = await this.queueTable.getOneByPrimaryKey({ siteId, fileId }); @@ -2207,7 +2206,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param onlyUnknown True to only invalidate files from external repos or without revision/timemodified. * It is advised to set it to true to reduce the performance and data usage of the app. - * @return Resolved on success. + * @returns Resolved on success. */ async invalidateAllFiles(siteId: string, onlyUnknown: boolean = true): Promise { onlyUnknown @@ -2226,7 +2225,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The file URL. - * @return Resolved on success. + * @returns Resolved on success. * @description * Invalidates a file by marking it stale. It will not be added to the queue automatically, but the next time this file * is requested it will be added to the queue. @@ -2248,7 +2247,7 @@ export class CoreFilepoolProvider { * @param componentId An ID to use in conjunction with the component. * @param onlyUnknown True to only invalidate files from external repos or without revision/timemodified. * It is advised to set it to true to reduce the performance and data usage of the app. - * @return Resolved when done. + * @returns Resolved when done. */ async invalidateFilesByComponent( siteId: string | undefined, @@ -2291,7 +2290,7 @@ export class CoreFilepoolProvider { * Whether a file action indicates a file was downloaded or deleted. * * @param data Event data. - * @return Whether downloaded or deleted. + * @returns Whether downloaded or deleted. */ isFileEventDownloadedOrDeleted(data: CoreFilepoolFileEventData): boolean { return (data.action == CoreFilepoolFileActions.DOWNLOAD && data.success == true) || @@ -2306,7 +2305,7 @@ export class CoreFilepoolProvider { * @param timemodified The time this file was modified. * @param filePath Filepath to download the file to. If defined, no extension will be added. * @param revision File revision. If not defined, it will be calculated using the URL. - * @return Promise resolved with a boolean: whether a file is downloadable. + * @returns Promise resolved with a boolean: whether a file is downloadable. */ async isFileDownloadable( siteId: string, @@ -2325,7 +2324,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl File URL. - * @param Promise resolved with boolean: whether the file is downloading. + * @returns Promise resolved with boolean: whether the file is downloading. */ async isFileDownloadingByUrl(siteId: string, fileUrl: string): Promise { const file = await this.fixPluginfileURL(siteId, fileUrl); @@ -2346,7 +2345,7 @@ export class CoreFilepoolProvider { * @param entry Filepool entry. * @param revision File revision number. * @param timemodified The time this file was modified. - * @param Whether the file is outdated. + * @returns Whether the file is outdated. */ protected isFileOutdated(entry: CoreFilepoolFileEntry, revision = 0, timemodified = 0): boolean { // Don't allow undefined values, convert them to 0. @@ -2360,7 +2359,7 @@ export class CoreFilepoolProvider { * Check if cannot determine if a file has been updated. * * @param entry Filepool entry. - * @return Whether it cannot determine updates. + * @returns Whether it cannot determine updates. */ protected isFileUpdateUnknown(entry: CoreFilepoolFileEntry): boolean { return !!entry.isexternalfile || (!entry.revision && !entry.timemodified); @@ -2486,7 +2485,7 @@ export class CoreFilepoolProvider { * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store * the files directly inside the filepool folder. * @param onProgress Function to call on progress. - * @return Promise resolved when all files are downloaded. + * @returns Promise resolved when all files are downloaded. */ prefetchPackage( siteId: string, @@ -2539,7 +2538,7 @@ export class CoreFilepoolProvider { /** * Process the most important queue item. * - * @return Resolved on success. Rejected on failure. + * @returns Resolved on success. Rejected on failure. */ protected async processImportantQueueItem(): Promise { try { @@ -2567,7 +2566,7 @@ export class CoreFilepoolProvider { * Process a queue item. * * @param item The object from the queue store. - * @return Resolved on success. Rejected on failure. + * @returns Resolved on success. Rejected on failure. */ protected async processQueueItem(item: CoreFilepoolQueueEntry): Promise { // Cast optional fields to undefined instead of null. @@ -2682,7 +2681,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return Resolved on success. Rejected on failure. It is advised to silently ignore failures. + * @returns Resolved on success. Rejected on failure. It is advised to silently ignore failures. */ protected async removeFromQueue(siteId: string, fileId: string): Promise { await this.queueTable.deleteByPrimaryKey({ siteId, fileId }); @@ -2693,7 +2692,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileId The file ID. - * @return Resolved on success. + * @returns Resolved on success. */ protected async removeFileById(siteId: string, fileId: string): Promise { // Get the path to the file first since it relies on the file object stored in the pool. @@ -2752,7 +2751,7 @@ export class CoreFilepoolProvider { * @param siteId The site ID. * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. - * @return Resolved on success. + * @returns Resolved on success. */ async removeFilesByComponent(siteId: string, component: string, componentId?: string | number): Promise { const items = await this.getComponentFiles(siteId, component, componentId); @@ -2765,7 +2764,7 @@ export class CoreFilepoolProvider { * * @param siteId The site ID. * @param fileUrl The file URL. - * @return Resolved on success, rejected on failure. + * @returns Resolved on success, rejected on failure. */ async removeFileByUrl(siteId: string, fileUrl: string): Promise { const file = await this.fixPluginfileURL(siteId, fileUrl); @@ -2778,7 +2777,7 @@ export class CoreFilepoolProvider { * Removes the revision number from a file URL. * * @param url URL to remove the revision number. - * @return URL without revision number. + * @returns URL without revision number. * @description * The revision is used to know if a file has changed. We remove it from the URL to prevent storing a file per revision. */ @@ -2798,7 +2797,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved when the status is changed. Resolve param: new status. + * @returns Promise resolved when the status is changed. Resolve param: new status. */ async setPackagePreviousStatus(siteId: string, component: string, componentId?: string | number): Promise { componentId = this.fixComponentId(componentId); @@ -2828,7 +2827,7 @@ export class CoreFilepoolProvider { * Check if a file should be downloaded based on its size. * * @param size File size. - * @return Whether file should be downloaded. + * @returns Whether file should be downloaded. */ shouldDownload(size: number): boolean { return size <= CoreFilepoolProvider.DOWNLOAD_THRESHOLD || @@ -2840,8 +2839,8 @@ export class CoreFilepoolProvider { * * @param url File online URL. * @param size File size. - * @return Promise resolved if should download before open, rejected otherwise. - * @ddeprecated since 3.9.5. Please use shouldDownloadFileBeforeOpen instead. + * @returns Promise resolved if should download before open, rejected otherwise. + * @deprecated since 3.9.5. Please use shouldDownloadFileBeforeOpen instead. */ async shouldDownloadBeforeOpen(url: string, size: number): Promise { if (size >= 0 && size <= CoreFilepoolProvider.DOWNLOAD_THRESHOLD) { @@ -2862,7 +2861,7 @@ export class CoreFilepoolProvider { * @param url File online URL. * @param size File size. * @param options Options. - * @return Promise resolved with boolean: whether file should be downloaded before opening it. + * @returns Promise resolved with boolean: whether file should be downloaded before opening it. * @description * Convenience function to check if a file should be downloaded before opening it. * @@ -2896,7 +2895,7 @@ export class CoreFilepoolProvider { * @param component Package's component. * @param componentId An ID to use in conjunction with the component. * @param extra Extra data to store for the package. If you want to store more than 1 value, use JSON.stringify. - * @return Promise resolved when status is stored. + * @returns Promise resolved when status is stored. */ async storePackageStatus( siteId: string, @@ -2968,7 +2967,7 @@ export class CoreFilepoolProvider { * @param component The component to link the file to. * @param componentId An ID to use in conjunction with the component. * @param revision Revision to use in all files. If not defined, it will be calculated using the URL of each file. - * @return Promise resolved with the CSS code. + * @returns Promise resolved with the CSS code. */ async treatCSSCode( siteId: string, @@ -3082,7 +3081,7 @@ export class CoreFilepoolProvider { * @param siteId Site ID. * @param component Package's component. * @param componentId An ID to use in conjunction with the component. - * @return Promise resolved when status is stored. + * @returns Promise resolved when status is stored. */ async updatePackageDownloadTime(siteId: string, component: string, componentId?: string | number): Promise { componentId = this.fixComponentId(componentId); diff --git a/src/core/services/geolocation.ts b/src/core/services/geolocation.ts index 79758c0be..bea6a4df5 100644 --- a/src/core/services/geolocation.ts +++ b/src/core/services/geolocation.ts @@ -30,6 +30,7 @@ export class CoreGeolocationProvider { * Get current user coordinates. * * @throws {CoreGeolocationError} + * @returns Promise resolved with the geolocation coordinates. */ async getCoordinates(): Promise { try { @@ -118,6 +119,7 @@ export class CoreGeolocationProvider { * Check whether an error was caused by a PERMISSION_DENIED from the cordova plugin. * * @param error Error. + * @returns If error is a permission denied error. */ protected isCordovaPermissionDeniedError(error?: CoreAnyError | GeolocationPositionError): boolean { return !!error && @@ -130,7 +132,7 @@ export class CoreGeolocationProvider { /** * Prechecks if it can request location services. * - * @return If location can be requested. + * @returns If location can be requested. */ async canRequest(): Promise { return CoreUtils.promiseWorks(Diagnostic.getLocationAuthorizationStatus()); diff --git a/src/core/services/groups.ts b/src/core/services/groups.ts index bdf537564..e537c5012 100644 --- a/src/core/services/groups.ts +++ b/src/core/services/groups.ts @@ -40,7 +40,7 @@ export class CoreGroupsProvider { * @param cmId Course module ID. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved with true if the activity has groups, resolved with false otherwise. + * @returns Promise resolved with true if the activity has groups, resolved with false otherwise. */ async activityHasGroups(cmId: number, siteId?: string, ignoreCache?: boolean): Promise { try { @@ -59,7 +59,7 @@ export class CoreGroupsProvider { * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved when the groups are retrieved. + * @returns Promise resolved when the groups are retrieved. */ async getActivityAllowedGroups( cmId: number, @@ -100,7 +100,7 @@ export class CoreGroupsProvider { * * @param cmId Course module ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getActivityAllowedGroupsCacheKey(cmId: number, userId: number): string { return ROOT_CACHE_KEY + 'allowedgroups:' + cmId + ':' + userId; @@ -113,7 +113,7 @@ export class CoreGroupsProvider { * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved when the groups are retrieved. If not allowed, empty array will be returned. + * @returns Promise resolved when the groups are retrieved. If not allowed, empty array will be returned. */ async getActivityAllowedGroupsIfEnabled(cmId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise { @@ -139,7 +139,7 @@ export class CoreGroupsProvider { * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved with the group info. + * @returns Promise resolved with the group info. */ async getActivityGroupInfo( cmId: number, @@ -192,7 +192,7 @@ export class CoreGroupsProvider { * @param cmId Course module ID. * @param siteId Site ID. If not defined, current site. * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @return Promise resolved when the group mode is retrieved. + * @returns Promise resolved when the group mode is retrieved. */ async getActivityGroupMode(cmId: number, siteId?: string, ignoreCache?: boolean): Promise { const site = await CoreSites.getSite(siteId); @@ -223,7 +223,7 @@ export class CoreGroupsProvider { * Get cache key for group mode WS calls. * * @param cmId Course module ID. - * @return Cache key. + * @returns Cache key. */ protected getActivityGroupModeCacheKey(cmId: number): string { return ROOT_CACHE_KEY + 'groupmode:' + cmId; @@ -233,7 +233,7 @@ export class CoreGroupsProvider { * Get user groups in all the user enrolled courses. * * @param siteId Site to get the groups from. If not defined, use current site. - * @return Promise resolved when the groups are retrieved. + * @returns Promise resolved when the groups are retrieved. */ async getAllUserGroups(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -256,7 +256,7 @@ export class CoreGroupsProvider { * @param courses List of courses or course ids to get the groups from. * @param siteId Site to get the groups from. If not defined, use current site. * @param userId ID of the user. If not defined, use the userId related to siteId. - * @return Promise resolved when the groups are retrieved. + * @returns Promise resolved when the groups are retrieved. */ async getUserGroups(courses: CoreCourseBase[] | number[], siteId?: string, userId?: number): Promise { // Get all courses one by one. @@ -273,7 +273,7 @@ export class CoreGroupsProvider { * @param courseId ID of the course. 0 to get all enrolled courses groups (Moodle version > 3.6). * @param siteId Site to get the groups from. If not defined, use current site. * @param userId ID of the user. If not defined, use ID related to siteid. - * @return Promise resolved when the groups are retrieved. + * @returns Promise resolved when the groups are retrieved. */ async getUserGroupsInCourse(courseId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -300,7 +300,7 @@ export class CoreGroupsProvider { /** * Get prefix cache key for user groups in course WS calls. * - * @return Prefix Cache key. + * @returns Prefix Cache key. */ protected getUserGroupsInCoursePrefixCacheKey(): string { return ROOT_CACHE_KEY + 'courseGroups:'; @@ -311,7 +311,7 @@ export class CoreGroupsProvider { * * @param courseId Course ID. * @param userId User ID. - * @return Cache key. + * @returns Cache key. */ protected getUserGroupsInCourseCacheKey(courseId: number, userId: number): string { return this.getUserGroupsInCoursePrefixCacheKey() + courseId + ':' + userId; @@ -323,7 +323,7 @@ export class CoreGroupsProvider { * @param cmId Course module ID. * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateActivityAllowedGroups(cmId: number, userId?: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -337,7 +337,7 @@ export class CoreGroupsProvider { * * @param cmId Course module ID. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateActivityGroupMode(cmId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -351,7 +351,7 @@ export class CoreGroupsProvider { * @param cmId Course module ID. * @param userId User ID. If not defined, use current user. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateActivityGroupInfo(cmId: number, userId?: number, siteId?: string): Promise { const promises = []>[]; @@ -365,7 +365,7 @@ export class CoreGroupsProvider { * Invalidates user groups in all user enrolled courses. * * @param siteId Site ID. If not defined, current site. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateAllUserGroups(siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -383,7 +383,7 @@ export class CoreGroupsProvider { * @param courses List of courses or course ids. * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, use current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserGroups(courses: CoreCourseBase[] | number[], siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -400,7 +400,7 @@ export class CoreGroupsProvider { * @param courseId ID of the course. 0 to get all enrolled courses groups (Moodle version > 3.6). * @param siteId Site ID. If not defined, current site. * @param userId User ID. If not defined, use current user. - * @return Promise resolved when the data is invalidated. + * @returns Promise resolved when the data is invalidated. */ async invalidateUserGroupsInCourse(courseId: number, siteId?: string, userId?: number): Promise { const site = await CoreSites.getSite(siteId); @@ -414,7 +414,7 @@ export class CoreGroupsProvider { * * @param groupId Group ID to validate. * @param groupInfo Group info. - * @return Group ID to use. + * @returns Group ID to use. */ validateGroupId(groupId = 0, groupInfo: CoreGroupInfo): number { if (groupId > 0 && groupInfo && groupInfo.groups && groupInfo.groups.length > 0) { diff --git a/src/core/services/handlers/site-info-cron.ts b/src/core/services/handlers/site-info-cron.ts index 9e55a85a6..e751a61c0 100644 --- a/src/core/services/handlers/site-info-cron.ts +++ b/src/core/services/handlers/site-info-cron.ts @@ -30,7 +30,7 @@ export class CoreSiteInfoCronHandlerService implements CoreCronHandler { * Receives the ID of the site affected, undefined for all sites. * * @param siteId ID of the site affected, undefined for all sites. - * @return Promise resolved when done, rejected on failure. + * @returns Promise resolved when done, rejected on failure. */ async execute(siteId?: string): Promise { if (!siteId) { @@ -45,7 +45,7 @@ export class CoreSiteInfoCronHandlerService implements CoreCronHandler { /** * Returns handler's interval in milliseconds. Defaults to CoreCronDelegateService.DEFAULT_INTERVAL. * - * @return Interval time (in milliseconds). + * @returns Interval time (in milliseconds). */ getInterval(): number { return 10800000; // 3 hours. @@ -54,7 +54,7 @@ export class CoreSiteInfoCronHandlerService implements CoreCronHandler { /** * Check whether it's a synchronization process or not. True if not defined. * - * @return Whether it's a synchronization process or not. + * @returns Whether it's a synchronization process or not. */ isSync(): boolean { return false; diff --git a/src/core/services/lang.ts b/src/core/services/lang.ts index 15c2730b3..c6763637c 100644 --- a/src/core/services/lang.ts +++ b/src/core/services/lang.ts @@ -113,7 +113,7 @@ export class CoreLangProvider { * We cannot use a function from text utils because it would cause a circular dependency. * * @param value String to capitalize. - * @return Capitalized string. + * @returns Capitalized string. */ protected capitalize(value: string): string { return value.charAt(0).toUpperCase() + value.slice(1); @@ -163,7 +163,7 @@ export class CoreLangProvider { * Change current language. * * @param language New language to use. - * @return Promise resolved when the change is finished. + * @returns Promise resolved when the change is finished. */ async changeCurrentLanguage(language: string): Promise { const promises: Promise[] = []; @@ -230,7 +230,7 @@ export class CoreLangProvider { /** * Get all current custom strings. * - * @return Custom strings. + * @returns Custom strings. */ getAllCustomStrings(): CoreLanguageObject { return this.customStrings; @@ -239,7 +239,7 @@ export class CoreLangProvider { /** * Get all current site plugins strings. * - * @return Site plugins strings. + * @returns Site plugins strings. */ getAllSitePluginsStrings(): CoreLanguageObject { return this.sitePluginsStrings; @@ -248,7 +248,7 @@ export class CoreLangProvider { /** * Get current language. * - * @return Promise resolved with the current language. + * @returns Promise resolved with the current language. */ async getCurrentLanguage(): Promise { if (this.currentLanguage !== undefined) { @@ -263,7 +263,7 @@ export class CoreLangProvider { /** * Get the current language from settings, or detect the browser one. * - * @return Promise resolved with the selected language. + * @returns Promise resolved with the selected language. */ protected async detectLanguage(): Promise { // Get current language from config (user might have changed it). @@ -299,7 +299,7 @@ export class CoreLangProvider { /** * Get the default language. * - * @return Default language. + * @returns Default language. */ getDefaultLanguage(): string { return this.defaultLanguage; @@ -308,7 +308,7 @@ export class CoreLangProvider { /** * Get the fallback language. * - * @return Fallback language. + * @returns Fallback language. */ getFallbackLanguage(): string { return this.fallbackLanguage; @@ -317,7 +317,7 @@ export class CoreLangProvider { /** * Get translated month names. * - * @return Translated month names. + * @returns Translated month names. */ getMonthNames(): string[] { return moment.months().map(month => this.capitalize(month)); @@ -326,7 +326,7 @@ export class CoreLangProvider { /** * Get translated month short names. * - * @return Translated month short names. + * @returns Translated month short names. */ getMonthShortNames(): string[] { return moment.monthsShort().map(month => this.capitalize(month)); @@ -335,7 +335,7 @@ export class CoreLangProvider { /** * Get translated day names. * - * @return Translated day names. + * @returns Translated day names. */ getDayNames(): string[] { return moment.weekdays().map(weekDay => this.capitalize(weekDay)); @@ -344,7 +344,7 @@ export class CoreLangProvider { /** * Get translated day short names. * - * @return Translated day short names. + * @returns Translated day short names. */ getDayShortNames(): string[] { return moment.weekdaysShort().map(weekDay => this.capitalize(weekDay)); @@ -354,7 +354,7 @@ export class CoreLangProvider { * Get the full list of translations for a certain language. * * @param lang The language to check. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ getTranslationTable(lang: string): Promise> { // Create a promise to convert the observable into a promise. @@ -445,7 +445,7 @@ export class CoreLangProvider { * * @param langObject The object with the strings to load. * @param lang Language to load. - * @return Whether the translation table was modified. + * @returns Whether the translation table was modified. */ loadLangStrings(langObject: CoreLanguageObject, lang: string): boolean { let langApplied = false; @@ -506,7 +506,7 @@ export class CoreLangProvider { * Read a language file. * * @param lang Language code. - * @return Promise resolved with the file contents. + * @returns Promise resolved with the file contents. */ async readLangFile(lang: CoreLangLanguage): Promise> { const observable = Http.get(`assets/lang/${lang}.json`, { diff --git a/src/core/services/local-notifications.ts b/src/core/services/local-notifications.ts index b1e7d84e0..7b9bc100a 100644 --- a/src/core/services/local-notifications.ts +++ b/src/core/services/local-notifications.ts @@ -136,7 +136,7 @@ export class CoreLocalNotificationsProvider { * @param id Notification id. * @param component Component of the notification. * @param siteId Site ID. - * @return Promise resolved when the notification is cancelled. + * @returns Promise resolved when the notification is cancelled. */ async cancel(id: number, component: string, siteId: string): Promise { const uniqueId = await this.getUniqueNotificationId(id, component, siteId); @@ -152,7 +152,7 @@ export class CoreLocalNotificationsProvider { * Cancel all the scheduled notifications belonging to a certain site. * * @param siteId Site ID. - * @return Promise resolved when the notifications are cancelled. + * @returns Promise resolved when the notifications are cancelled. */ async cancelSiteNotifications(siteId: string): Promise { if (!this.isAvailable()) { @@ -182,7 +182,7 @@ export class CoreLocalNotificationsProvider { /** * Check whether sound can be disabled for notifications. * - * @return Whether sound can be disabled for notifications. + * @returns Whether sound can be disabled for notifications. */ canDisableSound(): boolean { // Only allow disabling sound in Android 7 or lower. In iOS and Android 8+ it can easily be done with system settings. @@ -192,7 +192,7 @@ export class CoreLocalNotificationsProvider { /** * Create the default channel. It is used to change the name. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async createDefaultChannel(): Promise { if (!CoreApp.isAndroid()) { @@ -211,7 +211,7 @@ export class CoreLocalNotificationsProvider { /** * Get all scheduled notifications. * - * @return Promise resolved with the notifications. + * @returns Promise resolved with the notifications. */ protected getAllScheduled(): Promise { return this.queueRunner.run('allScheduled', () => LocalNotifications.getAllScheduled()); @@ -222,7 +222,7 @@ export class CoreLocalNotificationsProvider { * * @param table Table to search in local DB. * @param id ID of the element to get its code. - * @return Promise resolved when the code is retrieved. + * @returns Promise resolved when the code is retrieved. */ protected async getCode(table: string, id: string): Promise { const key = table + '#' + id; @@ -262,7 +262,7 @@ export class CoreLocalNotificationsProvider { * If it's the first time this component is used to send notifications, create a new code for it. * * @param component Component name. - * @return Promise resolved when the component code is retrieved. + * @returns Promise resolved when the component code is retrieved. */ protected getComponentCode(component: string): Promise { return this.requestCode(COMPONENTS_TABLE_NAME, component); @@ -273,7 +273,7 @@ export class CoreLocalNotificationsProvider { * If it's the first time this site is used to send notifications, create a new code for it. * * @param siteId Site ID. - * @return Promise resolved when the site code is retrieved. + * @returns Promise resolved when the site code is retrieved. */ protected getSiteCode(siteId: string): Promise { return this.requestCode(SITES_TABLE_NAME, siteId); @@ -290,7 +290,7 @@ export class CoreLocalNotificationsProvider { * @param notificationId Notification ID. * @param component Component triggering the notification. * @param siteId Site ID. - * @return Promise resolved when the notification ID is generated. + * @returns Promise resolved when the notification ID is generated. */ protected async getUniqueNotificationId(notificationId: number, component: string, siteId: string): Promise { if (!siteId || !component) { @@ -321,7 +321,7 @@ export class CoreLocalNotificationsProvider { /** * Returns whether local notifications are available. * - * @return Whether local notifications are available. + * @returns Whether local notifications are available. * @deprecated since 4.1. It will always return true. */ isAvailable(): boolean { @@ -331,7 +331,7 @@ export class CoreLocalNotificationsProvider { /** * Returns whether local notifications plugin is available. * - * @return Whether local notifications plugin is available. + * @returns Whether local notifications plugin is available. */ isPluginAvailable(): boolean { const win = window; // eslint-disable-line @typescript-eslint/no-explicit-any @@ -346,7 +346,7 @@ export class CoreLocalNotificationsProvider { * * @param notification Notification to check. * @param useQueue Whether to add the call to the queue. - * @return Promise resolved with a boolean indicating if promise is triggered (true) or not. + * @returns Promise resolved with a boolean indicating if promise is triggered (true) or not. */ async isTriggered(notification: ILocalNotification, useQueue: boolean = true): Promise { const db = await this.appDB; @@ -408,7 +408,7 @@ export class CoreLocalNotificationsProvider { * Parse some notification data. * * @param data Notification data. - * @return Parsed data. + * @returns Parsed data. */ protected parseNotificationData(data: unknown): unknown { if (!data) { @@ -461,7 +461,7 @@ export class CoreLocalNotificationsProvider { * * @param component Component to listen notifications for. * @param callback Function to call with the data received by the notification. - * @return Object with an "off" property to stop listening for clicks. + * @returns Object with an "off" property to stop listening for clicks. */ registerClick(component: string, callback: CoreLocalNotificationsClickCallback): CoreEventObserver { return this.registerObserver('click', component, callback); @@ -473,7 +473,7 @@ export class CoreLocalNotificationsProvider { * @param eventName Name of the event to listen to. * @param component Component to listen notifications for. * @param callback Function to call with the data received by the notification. - * @return Object with an "off" property to stop listening for events. + * @returns Object with an "off" property to stop listening for events. */ registerObserver( eventName: string, @@ -504,7 +504,7 @@ export class CoreLocalNotificationsProvider { * Remove a notification from triggered store. * * @param id Notification ID. - * @return Promise resolved when it is removed. + * @returns Promise resolved when it is removed. */ async removeTriggered(id: number): Promise { const db = await this.appDB; @@ -517,7 +517,7 @@ export class CoreLocalNotificationsProvider { * * @param table Table to search in local DB. * @param id ID of the element to get its code. - * @return Promise resolved when the code is retrieved. + * @returns Promise resolved when the code is retrieved. */ protected requestCode(table: string, id: string): Promise { const deferred = new CorePromisedValue(); @@ -546,7 +546,7 @@ export class CoreLocalNotificationsProvider { /** * Reschedule all notifications that are already scheduled. * - * @return Promise resolved when all notifications have been rescheduled. + * @returns Promise resolved when all notifications have been rescheduled. */ async rescheduleAll(): Promise { // Get all the scheduled notifications. @@ -572,7 +572,7 @@ export class CoreLocalNotificationsProvider { * @param component Component triggering the notification. It is used to generate unique IDs. * @param siteId Site ID. * @param alreadyUnique Whether the ID is already unique. - * @return Promise resolved when the notification is scheduled. + * @returns Promise resolved when the notification is scheduled. */ async schedule(notification: ILocalNotification, component: string, siteId: string, alreadyUnique?: boolean): Promise { if (!alreadyUnique) { @@ -624,7 +624,7 @@ export class CoreLocalNotificationsProvider { * Helper function to schedule a notification object if it hasn't been triggered already. * * @param notification Notification to schedule. - * @return Promise resolved when scheduled. + * @returns Promise resolved when scheduled. */ protected async scheduleNotification(notification: ILocalNotification): Promise { // Check if the notification has been triggered already. @@ -662,7 +662,7 @@ export class CoreLocalNotificationsProvider { * time is changed. * * @param notification Triggered notification. - * @return Promise resolved when stored, rejected otherwise. + * @returns Promise resolved when stored, rejected otherwise. */ async trigger(notification: ILocalNotification): Promise { const db = await this.appDB; @@ -689,7 +689,7 @@ export class CoreLocalNotificationsProvider { * * @param oldName The old name. * @param newName The new name. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async updateComponentName(oldName: string, newName: string): Promise { const db = await this.appDB; diff --git a/src/core/services/navigator.ts b/src/core/services/navigator.ts index 130852f54..a0f33b6f4 100644 --- a/src/core/services/navigator.ts +++ b/src/core/services/navigator.ts @@ -81,7 +81,7 @@ export class CoreNavigatorService { * Check whether the active route is using the given path. * * @param path Path, can be a glob pattern. - * @return Whether the active route is using the given path. + * @returns Whether the active route is using the given path. */ isCurrent(path: string): boolean { return CoreTextUtils.matchesGlob(this.getCurrentPath(), path); @@ -90,7 +90,7 @@ export class CoreNavigatorService { /** * Get current main menu tab. * - * @return Current main menu tab or null if the current route is not using the main menu. + * @returns Current main menu tab or null if the current route is not using the main menu. */ getCurrentMainMenuTab(): string | null { return this.getMainMenuTabFromPath(this.getCurrentPath()); @@ -100,7 +100,7 @@ export class CoreNavigatorService { * Get main menu tab from a path. * * @param path The path to check. - * @return Path's main menu tab or null if the path is not using the main menu. + * @returns Path's main menu tab or null if the path is not using the main menu. */ getMainMenuTabFromPath(path: string): string | null { const matches = /^\/main\/([^/]+).*$/.exec(path); @@ -112,7 +112,7 @@ export class CoreNavigatorService { * Returns if a section is loaded on the split view (tablet mode). * * @param path Path, can be a glob pattern. - * @return Whether the active route is using the given path. + * @returns Whether the active route is using the given path. */ isCurrentPathInTablet(path: string): boolean { if (CoreScreen.isMobile) { @@ -128,7 +128,7 @@ export class CoreNavigatorService { * * @param path Path to navigate to. * @param options Navigation options. - * @return Whether navigation suceeded. + * @returns Whether navigation suceeded. */ async navigate(path: string, options: CoreNavigationOptions = {}): Promise { const url: string[] = [/^[./]/.test(path) ? path : `./${path}`]; @@ -163,7 +163,7 @@ export class CoreNavigatorService { * Navigate to the login credentials route. * * @param params Page params. - * @return Whether navigation suceeded. + * @returns Whether navigation suceeded. */ async navigateToLoginCredentials(params: Params = {}): Promise { // If necessary, open the previous path to keep the navigation history. @@ -181,7 +181,7 @@ export class CoreNavigatorService { * Navigate to the home route of the current site. * * @param options Navigation options. - * @return Whether navigation suceeded. + * @returns Whether navigation suceeded. */ async navigateToSiteHome(options: Omit & { siteId?: string } = {}): Promise { const siteId = options.siteId ?? CoreSites.getCurrentSiteId(); @@ -200,7 +200,7 @@ export class CoreNavigatorService { * * @param path Site path to visit. * @param options Navigation and site options. - * @return Whether navigation suceeded. + * @returns Whether navigation suceeded. */ async navigateToSitePath( path: string, @@ -258,7 +258,7 @@ export class CoreNavigatorService { /** * Get the active route path. * - * @return Current path. + * @returns Current path. */ getCurrentPath(): string { return CoreUrlUtils.removeUrlParams(Router.url); @@ -269,7 +269,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param route Current route. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ protected getRouteSnapshotParam(name: string, route?: ActivatedRoute): T | undefined { if (!route) { @@ -294,7 +294,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param routeOptions Optional routeOptions to get the params or route value from. If missing, it will autodetect. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ getRouteParam(name: string, routeOptions: CoreNavigatorCurrentRouteOptions = {}): T | undefined { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -337,7 +337,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param routeOptions Optional routeOptions to get the params or route value from. If missing, it will autodetect. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ getRouteNumberParam(name: string, routeOptions: CoreNavigatorCurrentRouteOptions = {}): number | undefined { const value = this.getRouteParam(name, routeOptions); @@ -351,7 +351,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param routeOptions Optional routeOptions to get the params or route value from. If missing, it will autodetect. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ getRouteBooleanParam(name: string, routeOptions: CoreNavigatorCurrentRouteOptions = {}): boolean | undefined { const value = this.getRouteParam(name, routeOptions); @@ -380,7 +380,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param routeOptions Optional routeOptions to get the params or route value from. If missing, it will autodetect. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ getRequiredRouteParam(name: string, routeOptions: CoreNavigatorCurrentRouteOptions = {}): T { const value = this.getRouteParam(name, routeOptions); @@ -400,7 +400,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param routeOptions Optional routeOptions to get the params or route value from. If missing, it will autodetect. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ getRequiredRouteNumberParam(name: string, routeOptions: CoreNavigatorCurrentRouteOptions = {}): number { const value = this.getRouteNumberParam(name, routeOptions); @@ -420,7 +420,7 @@ export class CoreNavigatorService { * * @param name Name of the parameter. * @param routeOptions Optional routeOptions to get the params or route value from. If missing, it will autodetect. - * @return Value of the parameter, undefined if not found. + * @returns Value of the parameter, undefined if not found. */ getRequiredRouteBooleanParam(name: string, routeOptions: CoreNavigatorCurrentRouteOptions = {}): boolean { const value = this.getRouteBooleanParam(name, routeOptions); @@ -435,7 +435,7 @@ export class CoreNavigatorService { /** * Navigate back. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ back(): Promise { return NavController.pop(); @@ -448,7 +448,7 @@ export class CoreNavigatorService { * - route: Parent route, if this isn't provided the current active route will be used. * - pageComponent: Page component of the route to find, if this isn't provided the deepest route in the hierarchy * will be returned. - * @return Current activated route. + * @returns Current activated route. */ getCurrentRoute(): ActivatedRoute; getCurrentRoute(options: CoreNavigatorCurrentRouteOptions): ActivatedRoute | null; @@ -474,7 +474,7 @@ export class CoreNavigatorService { * Check whether a route is active within the current stack. * * @param route Route to check. - * @return Whether the route is active or not. + * @returns Whether the route is active or not. */ isRouteActive(route: ActivatedRoute): boolean { const routePath = this.getRouteFullPath(route.snapshot); @@ -517,7 +517,7 @@ export class CoreNavigatorService { * Get the number of times a route is repeated on the navigation stack. * * @param path Absolute route path. - * @return Route depth. + * @returns Route depth. */ getRouteDepth(path: string): number { return this.routesDepth[path] ?? 0; @@ -530,7 +530,7 @@ export class CoreNavigatorService { * * @param path Main menu path. * @param options Navigation options. - * @return Whether navigation suceeded. + * @returns Whether navigation suceeded. */ protected async navigateToMainMenuPath(path: string, options: CoreNavigationOptions = {}): Promise { options = { @@ -584,7 +584,7 @@ export class CoreNavigatorService { /** * Get the first page path using priority. * - * @return Landing page path. + * @returns Landing page path. */ protected getLandingTabPage(): string { if (!CoreMainMenuDelegate.areHandlersLoaded()) { @@ -622,6 +622,8 @@ export class CoreNavigatorService { /** * Get an ID for a new parameter. + * + * @returns New param Id. */ protected getNewParamId(): string { return 'param-' + (++this.lastParamId); @@ -646,7 +648,7 @@ export class CoreNavigatorService { * Get the full path of a certain route, including parent routes paths. * * @param route Route snapshot. - * @return Path. + * @returns Path. */ getRouteFullPath(route: ActivatedRouteSnapshot | null): string { if (!route) { @@ -670,7 +672,7 @@ export class CoreNavigatorService { /** * Check if the current route page can block leaving the route. * - * @return Whether the current route page can block leaving the route. + * @returns Whether the current route page can block leaving the route. */ currentRouteCanBlockLeave(): boolean { return !!this.getCurrentRoute().snapshot.routeConfig?.canDeactivate?.length; @@ -679,7 +681,7 @@ export class CoreNavigatorService { /** * Wait for a main menu tab route to be loaded. * - * @return Promise resolved when the route is loaded. + * @returns Promise resolved when the route is loaded. */ protected waitForMainMenuTab(): Promise { if (this.getCurrentMainMenuTab()) { @@ -705,7 +707,7 @@ export class CoreNavigatorService { * E.g. if parent path is '/foo' and current path is '/foo/bar/baz' it will return '../../'. * * @param parentPath Parent path. - * @return Relative path to the parent, empty if same path or parent path not found. + * @returns Relative path to the parent, empty if same path or parent path not found. * @todo If messaging is refactored to use list managers, this function might not be needed anymore. */ getRelativePathToParent(parentPath: string): string { diff --git a/src/core/services/network.ts b/src/core/services/network.ts index d9084bc4a..aeb49a4ae 100644 --- a/src/core/services/network.ts +++ b/src/core/services/network.ts @@ -106,7 +106,7 @@ export class CoreNetworkService extends Network { /** * Returns whether we are online. * - * @return Whether the app is online. + * @returns Whether the app is online. */ isOnline(): boolean { return this.online; @@ -114,8 +114,6 @@ export class CoreNetworkService extends Network { /** * Returns whether we are online. - * - * @return Whether the app is online. */ checkOnline(): void { if (this.forceConnectionMode === CoreNetworkConnection.NONE) { @@ -139,7 +137,7 @@ export class CoreNetworkService extends Network { /** * Returns an observable to watch connection changes. * - * @return Observable. + * @returns Observable. */ onChange(): Observable<'connected' | 'disconnected'> { return merge(this.connectObservable, this.disconnectObservable); @@ -149,7 +147,7 @@ export class CoreNetworkService extends Network { * Returns an observable to notify when the app is connected. * It will also be fired when connection type changes. * - * @return Observable. + * @returns Observable. */ onConnect(): Observable<'connected'> { return this.connectObservable; @@ -158,7 +156,7 @@ export class CoreNetworkService extends Network { /** * Returns an observable to notify when the app is disconnected. * - * @return Observable. + * @returns Observable. */ onDisconnect(): Observable<'disconnected'> { return this.disconnectObservable; @@ -180,7 +178,7 @@ export class CoreNetworkService extends Network { /** * Check if device uses a limited connection. * - * @return Whether the device uses a limited connection. + * @returns Whether the device uses a limited connection. */ isNetworkAccessLimited(): boolean { const limited: CoreNetworkConnection[] = [ @@ -198,7 +196,7 @@ export class CoreNetworkService extends Network { /** * Check if device uses a wifi connection. * - * @return Whether the device uses a wifi connection. + * @returns Whether the device uses a wifi connection. */ isWifi(): boolean { return this.isOnline() && !this.isNetworkAccessLimited(); diff --git a/src/core/services/platform.ts b/src/core/services/platform.ts index e53152943..bb157d9f6 100644 --- a/src/core/services/platform.ts +++ b/src/core/services/platform.ts @@ -25,7 +25,7 @@ export class CorePlatformService extends Platform { /** * Checks if the app is running in a mobile or tablet device (Cordova). * - * @return Whether the app is running in a mobile or tablet device. + * @returns Whether the app is running in a mobile or tablet device. */ isMobile(): boolean { return this.is('cordova'); diff --git a/src/core/services/plugin-file-delegate.ts b/src/core/services/plugin-file-delegate.ts index 4839be2fb..67038bc81 100644 --- a/src/core/services/plugin-file-delegate.ts +++ b/src/core/services/plugin-file-delegate.ts @@ -39,7 +39,7 @@ export class CorePluginFileDelegateService extends CoreDelegate { const handler = this.getHandlerForFile({ fileurl: fileUrl }); @@ -54,7 +54,7 @@ export class CorePluginFileDelegateService extends CoreDelegate { const handler = this.getHandlerForFile(file); @@ -68,7 +68,7 @@ export class CorePluginFileDelegateService extends CoreDelegate[]; @@ -131,7 +131,7 @@ export class CorePluginFileDelegateService extends CoreDelegate { siteId = siteId || CoreSites.getCurrentSiteId(); @@ -154,7 +154,7 @@ export class CorePluginFileDelegateService extends CoreDelegate { const result = { @@ -181,7 +181,7 @@ export class CorePluginFileDelegateService extends CoreDelegate { const isDownloadable = await this.isFileDownloadable(file, siteId); @@ -213,7 +213,7 @@ export class CorePluginFileDelegateService extends CoreDelegate { const handler = this.getHandlerForFile(file); @@ -248,7 +248,7 @@ export class CorePluginFileDelegateService extends CoreDelegate; @@ -332,7 +332,7 @@ export interface CorePluginFileHandler extends CoreDelegateHandler { * * @param file The file data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the file to use. Rejected if cannot download. + * @returns Promise resolved with the file to use. Rejected if cannot download. */ getDownloadableFile?(file: CoreWSFile, siteId?: string): Promise; @@ -341,7 +341,7 @@ export interface CorePluginFileHandler extends CoreDelegateHandler { * CoreFilepoolProvider.extractDownloadableFilesFromHtml. * * @param container Container where to get the URLs from. - * @return List of URLs. + * @returns List of URLs. */ getDownloadableFilesFromHTML?(container: HTMLElement): string[]; @@ -350,7 +350,7 @@ export interface CorePluginFileHandler extends CoreDelegateHandler { * * @param file The file data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with the size. + * @returns Promise resolved with the size. */ getFileSize?(file: CoreWSFile, siteId?: string): Promise; @@ -359,7 +359,7 @@ export interface CorePluginFileHandler extends CoreDelegateHandler { * * @param file The file data. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with a boolean and a reason why it isn't downloadable if needed. + * @returns Promise resolved with a boolean and a reason why it isn't downloadable if needed. */ isFileDownloadable?(file: CoreWSFile, siteId?: string): Promise; @@ -367,7 +367,7 @@ export interface CorePluginFileHandler extends CoreDelegateHandler { * Check whether the file should be treated by this handler. It is used in functions where the component isn't used. * * @param file The file data. - * @return Whether the file should be treated by this handler. + * @returns Whether the file should be treated by this handler. */ shouldHandleFile?(file: CoreWSFile): boolean; @@ -378,7 +378,7 @@ export interface CorePluginFileHandler extends CoreDelegateHandler { * @param file The file entry of the downloaded file. * @param siteId Site ID. If not defined, current site. * @param onProgress Function to call on progress. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ treatDownloadedFile?( fileUrl: string, diff --git a/src/core/services/screen.ts b/src/core/services/screen.ts index f23b0b4f9..55e9cbdd6 100644 --- a/src/core/services/screen.ts +++ b/src/core/services/screen.ts @@ -163,7 +163,7 @@ export class CoreScreenService { * Calculate the layout given the current breakpoints. * * @param breakpoints Breakpoints visibility. - * @return Active layout. + * @returns Active layout. */ protected calculateLayout(breakpoints: Record): CoreScreenLayout { if (breakpoints[Breakpoint.MEDIUM]) { diff --git a/src/core/services/sites-factory.ts b/src/core/services/sites-factory.ts index 395494ea8..da22e6d91 100644 --- a/src/core/services/sites-factory.ts +++ b/src/core/services/sites-factory.ts @@ -33,7 +33,7 @@ export class CoreSitesFactoryService { * @param privateToken Private token. * @param config Site public config. * @param loggedOut Whether user is logged out. - * @return Site instance. + * @returns Site instance. */ makeSite( id: string | undefined, diff --git a/src/core/services/sites.ts b/src/core/services/sites.ts index 87e01c427..3550b6277 100644 --- a/src/core/services/sites.ts +++ b/src/core/services/sites.ts @@ -193,7 +193,7 @@ export class CoreSitesProvider { * Get the demo data for a certain "name" if it is a demo site. * * @param name Name of the site to check. - * @return Site data if it's a demo site, undefined otherwise. + * @returns Site data if it's a demo site, undefined otherwise. */ getDemoSiteData(name: string): CoreSitesDemoSiteData | undefined { const demoSites = CoreConstants.CONFIG.demo_sites; @@ -210,7 +210,7 @@ export class CoreSitesProvider { * * @param siteUrl URL of the site to check. * @param protocol Protocol to use first. - * @return A promise resolved when the site is checked. + * @returns A promise resolved when the site is checked. */ async checkSite(siteUrl: string, protocol: string = 'https://'): Promise { // The formatURL function adds the protocol if is missing. @@ -259,7 +259,7 @@ export class CoreSitesProvider { * * @param siteUrl URL of the site to check. * @param protocol Protocol to use. - * @return A promise resolved when the site is checked. + * @returns A promise resolved when the site is checked. */ async checkSiteWithProtocol(siteUrl: string, protocol: string): Promise { // Now, replace the siteUrl with the protocol. @@ -336,8 +336,9 @@ export class CoreSitesProvider { /** * Create an error to be thrown when it isn't possible to login to a site. * + * @param siteUrl Site Url. * @param options Error options. - * @return Cannot connect error. + * @returns Cannot connect error. */ protected createCannotConnectLoginError(siteUrl: string | null, options?: Partial): CoreLoginError { return new CoreLoginError({ @@ -353,7 +354,7 @@ export class CoreSitesProvider { * * @param siteUrl Site URL. * @param error Error returned. - * @return Promise resolved with the treated error. + * @returns Promise resolved with the treated error. */ protected async treatGetPublicConfigError( siteUrl: string, @@ -407,7 +408,7 @@ export class CoreSitesProvider { * Check if a site exists. * * @param siteUrl URL of the site to check. - * @return A promise to be resolved if the site exists. + * @returns A promise to be resolved if the site exists. * @deprecated since app 4.0. Now the app calls uses tool_mobile_get_public_config to check if site exists. */ async siteExists(siteUrl: string): Promise { @@ -465,7 +466,7 @@ export class CoreSitesProvider { * @param password Password. * @param service Service to use. If not defined, it will be searched in memory. * @param retry Whether we are retrying with a prefixed URL. - * @return A promise resolved when the token is retrieved. + * @returns A promise resolved when the token is retrieved. */ async getUserToken( siteUrl: string, @@ -548,7 +549,7 @@ export class CoreSitesProvider { * @param privateToken User's private token. * @param login Whether to login the user in the site. Defaults to true. * @param oauthId OAuth ID. Only if the authentication was using an OAuth method. - * @return A promise resolved with siteId when the site is added and the user is authenticated. + * @returns A promise resolved with siteId when the site is added and the user is authenticated. */ async newSite( siteUrl: string, @@ -646,7 +647,7 @@ export class CoreSitesProvider { * * @param result Result returned by isValidMoodleVersion function. * @param siteId If site is already added, it will invalidate the token. - * @return A promise rejected with the error info. + * @returns A promise rejected with the error info. */ protected async treatInvalidAppVersion(result: number, siteId?: string): Promise { let errorCode: string | undefined; @@ -684,7 +685,7 @@ export class CoreSitesProvider { * * @param siteUrl The site url. * @param username Username. - * @return Site ID. + * @returns Site ID. */ createSiteID(siteUrl: string, username: string): string { return Md5.hashAsciiStr(siteUrl + username); @@ -693,7 +694,7 @@ export class CoreSitesProvider { /** * Function for determine which service we should use (default or extended plugin). * - * @return The service shortname. + * @returns The service shortname. * @deprecated since app 4.0 */ determineService(): string { @@ -704,7 +705,7 @@ export class CoreSitesProvider { * Check for the minimum required version. * * @param info Site info. - * @return Either VALID_VERSION, WORKPLACE_APP, MOODLE_APP or INVALID_VERSION. + * @returns Either VALID_VERSION, WORKPLACE_APP, MOODLE_APP or INVALID_VERSION. */ protected isValidMoodleVersion(info: CoreSiteInfoResponse): number { if (!info) { @@ -737,7 +738,7 @@ export class CoreSitesProvider { * Check if needs to be redirected to specific Workplace App or general Moodle App. * * @param info Site info. - * @return Either VALID_VERSION, WORKPLACE_APP or MOODLE_APP. + * @returns Either VALID_VERSION, WORKPLACE_APP or MOODLE_APP. */ protected validateWorkplaceVersion(info: CoreSiteInfoResponse): number { const isWorkplace = !!info.functions && info.functions.some((func) => func.name == 'tool_program_get_user_programs'); @@ -758,7 +759,7 @@ export class CoreSitesProvider { /** * Check if the app is workplace enabled. * - * @return If the app is workplace enabled. + * @returns If the app is workplace enabled. */ protected isWorkplaceEnabled(): boolean { return false; @@ -768,7 +769,7 @@ export class CoreSitesProvider { * Returns the release number from site release info. * * @param rawRelease Raw release info text. - * @return Release number or empty. + * @returns Release number or empty. */ getReleaseNumber(rawRelease: string): string { const matches = rawRelease.match(/^\d+(\.\d+(\.\d+)?)?/); @@ -783,7 +784,7 @@ export class CoreSitesProvider { * Returns the major release number from site release info. * * @param rawRelease Raw release info text. - * @return Major release number or empty. + * @returns Major release number or empty. */ getMajorReleaseNumber(rawRelease: string): string { const matches = rawRelease.match(/^\d+(\.\d+)?/); @@ -804,7 +805,7 @@ export class CoreSitesProvider { * @param privateToken User's private token. * @param config Site config (from tool_mobile_get_config). * @param oauthId OAuth ID. Only if the authentication was using an OAuth method. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async addSite( id: string, @@ -840,7 +841,7 @@ export class CoreSitesProvider { * Check the required minimum version of the app for a site and shows a download dialog. * * @param config Config object of the site. - * @return Resolved with if meets the requirements, rejected otherwise. + * @returns Resolved with if meets the requirements, rejected otherwise. */ protected async checkRequiredMinimumVersion(config?: CoreSitePublicConfigResponse): Promise { if (!config || !config.tool_mobile_minimumversion) { @@ -896,7 +897,7 @@ export class CoreSitesProvider { * Convert version name to numbers. * * @param name Version name (dot separated). - * @return Version translated to a comparable number. + * @returns Version translated to a comparable number. */ protected convertVersionName(name: string): number { let version = 0; @@ -918,7 +919,7 @@ export class CoreSitesProvider { * * @param siteId ID of the site to load. * @param redirectData Data of the path/url to open once authenticated if logged out. If not defined, site initial page. - * @return Promise resolved with true if site is loaded, resolved with false if cannot login. + * @returns Promise resolved with true if site is loaded, resolved with false if cannot login. */ async loadSite(siteId: string, redirectData?: CoreRedirectPayload): Promise { this.logger.debug(`Load site ${siteId}`); @@ -951,7 +952,7 @@ export class CoreSitesProvider { * Get site public config and check if app can access the site. * * @param site Site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async getPublicConfigAndCheckApplication(site: CoreSite): Promise { try { @@ -968,7 +969,7 @@ export class CoreSitesProvider { /** * Get current site or undefined if none. * - * @return Current site or undefined if none. + * @returns Current site or undefined if none. */ getCurrentSite(): CoreSite | undefined { return this.currentSite; @@ -977,7 +978,7 @@ export class CoreSitesProvider { /** * Get current site or fail if none. * - * @return Current site. + * @returns Current site. */ getRequiredCurrentSite(): CoreSite { if (!this.currentSite) { @@ -990,7 +991,7 @@ export class CoreSitesProvider { /** * Get the site home ID of the current site. * - * @return Current site home ID. + * @returns Current site home ID. */ getCurrentSiteHomeId(): number { if (this.currentSite) { @@ -1003,7 +1004,7 @@ export class CoreSitesProvider { /** * Get current site ID. * - * @return Current site ID. + * @returns Current site ID. */ getCurrentSiteId(): string { if (this.currentSite) { @@ -1016,7 +1017,7 @@ export class CoreSitesProvider { /** * Get current site User ID. * - * @return Current site User ID. + * @returns Current site User ID. */ getCurrentSiteUserId(): number { return this.currentSite?.getUserId() || 0; @@ -1025,7 +1026,7 @@ export class CoreSitesProvider { /** * Check if the user is logged in a site. * - * @return Whether the user is logged in a site. + * @returns Whether the user is logged in a site. */ isLoggedIn(): boolean { return this.currentSite !== undefined && this.currentSite.token !== undefined && @@ -1036,7 +1037,7 @@ export class CoreSitesProvider { * Delete a site from the sites list. * * @param siteId ID of the site to delete. - * @return Promise to be resolved when the site is deleted. + * @returns Promise to be resolved when the site is deleted. */ async deleteSite(siteId: string): Promise { this.logger.debug(`Delete site ${siteId}`); @@ -1067,7 +1068,7 @@ export class CoreSitesProvider { /** * Check if there are sites stored. * - * @return Promise resolved with true if there are sites and false if there aren't. + * @returns Promise resolved with true if there are sites and false if there aren't. */ async hasSites(): Promise { const isEmpty = await this.sitesTable.isEmpty(); @@ -1079,7 +1080,7 @@ export class CoreSitesProvider { * Returns a site object. * * @param siteId The site ID. If not defined, current site (if available). - * @return Promise resolved with the site. + * @returns Promise resolved with the site. */ async getSite(siteId?: string): Promise { if (!siteId) { @@ -1117,7 +1118,7 @@ export class CoreSitesProvider { * Get a site directly from the database, without using any optimizations. * * @param siteId Site id. - * @return Site. + * @returns Site. */ async getSiteFromDB(siteId: string): Promise { const db = CoreApp.getDB(); @@ -1135,7 +1136,7 @@ export class CoreSitesProvider { * Finds a site with a certain URL. It will return the first site found. * * @param siteUrl The site URL. - * @return Promise resolved with the site. + * @returns Promise resolved with the site. */ async getSiteByUrl(siteUrl: string): Promise { const data = await this.sitesTable.getOne({ siteUrl }); @@ -1147,7 +1148,7 @@ export class CoreSitesProvider { * Gets the public type config for a site with the given url. * * @param siteUrl The site URL. - * @return Promise resolved with public config or null. + * @returns Promise resolved with public config or null. */ async getPublicSiteConfigByUrl(siteUrl: string): Promise { const site = await this.getSiteByUrl(siteUrl); @@ -1159,7 +1160,7 @@ export class CoreSitesProvider { * Create a site from an entry of the sites list DB. The new site is added to the list of "cached" sites: this.sites. * * @param entry Site list entry. - * @return Promised resolved with the created site. + * @returns Promised resolved with the created site. */ async addSiteFromSiteListEntry(entry: SiteDBEntry): Promise { if (this.sites[entry.id] !== undefined) { @@ -1181,7 +1182,7 @@ export class CoreSitesProvider { * Make a site instance from a database entry. * * @param entry Site database entry. - * @return Site. + * @returns Site. */ makeSiteFromSiteListEntry(entry: SiteDBEntry): CoreSite { const info = entry.info ? CoreTextUtils.parseJSON(entry.info) : undefined; @@ -1205,7 +1206,7 @@ export class CoreSitesProvider { * Returns if the site is the current one. * * @param site Site object or siteId to be compared. If not defined, use current site. - * @return Whether site or siteId is the current one. + * @returns Whether site or siteId is the current one. */ isCurrentSite(site?: string | CoreSite): boolean { if (!site || !this.currentSite) { @@ -1221,7 +1222,7 @@ export class CoreSitesProvider { * Returns the database object of a site. * * @param siteId The site ID. If not defined, current site (if available). - * @return Promise resolved with the database. + * @returns Promise resolved with the database. */ async getSiteDb(siteId?: string): Promise { const site = await this.getSite(siteId); @@ -1233,7 +1234,7 @@ export class CoreSitesProvider { * Returns the site home ID of a site. * * @param siteId The site ID. If not defined, current site (if available). - * @return Promise resolved with site home ID. + * @returns Promise resolved with site home ID. */ async getSiteHomeId(siteId?: string): Promise { const site = await this.getSite(siteId); @@ -1245,7 +1246,7 @@ export class CoreSitesProvider { * Get the list of sites stored. * * @param ids IDs of the sites to get. If not defined, return all sites. - * @return Promise resolved when the sites are retrieved. + * @returns Promise resolved when the sites are retrieved. */ async getSites(ids?: string[]): Promise { const sites = await this.sitesTable.getMany(); @@ -1276,7 +1277,7 @@ export class CoreSitesProvider { * Get the list of sites stored, sorted by sitename, URL and fullname. * * @param ids IDs of the sites to get. If not defined, return all sites. - * @return Promise resolved when the sites are retrieved. + * @returns Promise resolved when the sites are retrieved. */ async getSortedSites(ids?: string[]): Promise { const sites = await this.getSites(ids); @@ -1311,7 +1312,7 @@ export class CoreSitesProvider { /** * Get the list of IDs of sites stored and not logged out. * - * @return Promise resolved when the sites IDs are retrieved. + * @returns Promise resolved when the sites IDs are retrieved. */ async getLoggedInSitesIds(): Promise { const sites = await this.sitesTable.getMany({ loggedOut : 0 }); @@ -1322,7 +1323,7 @@ export class CoreSitesProvider { /** * Get the list of IDs of sites stored. * - * @return Promise resolved when the sites IDs are retrieved. + * @returns Promise resolved when the sites IDs are retrieved. */ async getSitesIds(): Promise { const sites = await this.sitesTable.getMany(); @@ -1333,7 +1334,7 @@ export class CoreSitesProvider { /** * Get instances of all stored sites. * - * @return Promise resolved when the sites are retrieved. + * @returns Promise resolved when the sites are retrieved. */ async getSitesInstances(): Promise { const siteIds = await this.getSitesIds(); @@ -1345,7 +1346,7 @@ export class CoreSitesProvider { * Login the user in a site. * * @param siteId ID of the site the user is accessing. - * @return Promise resolved when current site is stored. + * @returns Promise resolved when current site is stored. */ async login(siteId: string): Promise { await CoreConfig.set(CORE_SITE_CURRENT_SITE_ID_CONFIG, siteId); @@ -1357,7 +1358,7 @@ export class CoreSitesProvider { * Logout the user. * * @param options Logout options. - * @return Promise resolved when the user is logged out. + * @returns Promise resolved when the user is logged out. */ async logout(options: CoreSitesLogoutOptions = {}): Promise { if (!this.currentSite) { @@ -1390,7 +1391,7 @@ export class CoreSitesProvider { * * @param siteId Site that will be opened after logout. * @param redirectData Page/url to open after logout. - * @return Promise resolved with boolean: true if app will be reloaded after logout. + * @returns Promise resolved with boolean: true if app will be reloaded after logout. */ async logoutForRedirect(siteId: string, redirectData: CoreRedirectPayload): Promise { if (!this.currentSite) { @@ -1410,7 +1411,7 @@ export class CoreSitesProvider { /** * Restores the session to the previous one so the user doesn't has to login everytime the app is started. * - * @return Promise resolved if a session is restored. + * @returns Promise resolved if a session is restored. */ async restoreSession(): Promise { if (this.sessionRestored) { @@ -1434,7 +1435,7 @@ export class CoreSitesProvider { * * @param siteId ID of the site. * @param isLoggedOut True if logged out and needs to authenticate again, false otherwise. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async setSiteLoggedOut(siteId: string, isLoggedOut: boolean = true): Promise { const site = await this.getSite(siteId); @@ -1458,7 +1459,7 @@ export class CoreSitesProvider { * @param username Username. * @param token User's new token. * @param privateToken User's private token. - * @return A promise resolved when the site is updated. + * @returns A promise resolved when the site is updated. */ async updateSiteToken(siteUrl: string, username: string, token: string, privateToken: string = ''): Promise { const siteId = this.createSiteID(siteUrl, username); @@ -1474,7 +1475,7 @@ export class CoreSitesProvider { * @param siteId Site Id. * @param token User's new token. * @param privateToken User's private token. - * @return A promise resolved when the site is updated. + * @returns A promise resolved when the site is updated. */ async updateSiteTokenBySiteId(siteId: string, token: string, privateToken: string = ''): Promise { const site = await this.getSite(siteId); @@ -1497,7 +1498,7 @@ export class CoreSitesProvider { * Updates a site's info. * * @param siteId Site's ID. - * @return A promise resolved when the site is updated. + * @returns A promise resolved when the site is updated. */ async updateSiteInfo(siteId?: string): Promise { const site = await this.getSite(siteId); @@ -1546,7 +1547,7 @@ export class CoreSitesProvider { * * @param siteUrl Site's URL. * @param username Username. - * @return A promise to be resolved when the site is updated. + * @returns A promise to be resolved when the site is updated. */ updateSiteInfoByUrl(siteUrl: string, username: string): Promise { const siteId = this.createSiteID(siteUrl, username); @@ -1562,7 +1563,7 @@ export class CoreSitesProvider { * @param prioritize True if it should prioritize current site. If the URL belongs to current site then it won't * check any other site, it will only return current site. * @param username If set, it will return only the sites where the current user has this username. - * @return Promise resolved with the site IDs (array). + * @returns Promise resolved with the site IDs (array). */ async getSiteIdsFromUrl(url: string, prioritize?: boolean, username?: string): Promise { // If prioritize is true, check current site first. @@ -1612,7 +1613,7 @@ export class CoreSitesProvider { /** * Get the site ID stored in DB as current site. * - * @return Promise resolved with the site ID. + * @returns Promise resolved with the site ID. */ async getStoredCurrentSiteId(): Promise { await this.migrateCurrentSiteLegacyTable(); @@ -1623,7 +1624,7 @@ export class CoreSitesProvider { /** * Remove current site stored in DB. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async removeStoredCurrentSite(): Promise { await CoreConfig.delete(CORE_SITE_CURRENT_SITE_ID_CONFIG); @@ -1633,7 +1634,7 @@ export class CoreSitesProvider { * Get the public config of a certain site. * * @param siteUrl URL of the site. - * @return Promise resolved with the public config. + * @returns Promise resolved with the public config. */ getSitePublicConfig(siteUrl: string): Promise { const temporarySite = CoreSitesFactory.makeSite(undefined, siteUrl); @@ -1645,7 +1646,7 @@ export class CoreSitesProvider { * Get site config. * * @param site The site to get the config. - * @return Promise resolved with config if available. + * @returns Promise resolved with config if available. */ protected async getSiteConfig(site: CoreSite): Promise { return site.getConfig(undefined, true); @@ -1656,7 +1657,7 @@ export class CoreSitesProvider { * * @param name Name of the feature to check. * @param siteId The site ID. If not defined, current site (if available). - * @return Promise resolved with true if disabled. + * @returns Promise resolved with true if disabled. */ async isFeatureDisabled(name: string, siteId?: string): Promise { const site = await this.getSite(siteId); @@ -1668,7 +1669,7 @@ export class CoreSitesProvider { * Check if a WS is available in the current site, if any. * * @param method WS name. - * @return Whether the WS is available. + * @returns Whether the WS is available. */ wsAvailableInCurrentSite(method: string): boolean { const site = this.getCurrentSite(); @@ -1682,7 +1683,7 @@ export class CoreSitesProvider { * should use the registerCoreSiteSchema method instead. * * @param schema The schema to register. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async registerSiteSchema(schema: CoreSiteSchema): Promise { if (!this.currentSite) { @@ -1707,7 +1708,7 @@ export class CoreSitesProvider { * Install and upgrade all the registered schemas and tables. * * @param site Site. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async migrateSiteSchemas(site: CoreSite): Promise { if (!site.id) { @@ -1738,7 +1739,7 @@ export class CoreSitesProvider { * * @param site Site. * @param schemas Schemas to migrate. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async applySiteSchemas(site: CoreSite, schemas: {[name: string]: CoreRegisteredSiteSchema}): Promise { // Fetch installed versions of the schema. @@ -1772,7 +1773,7 @@ export class CoreSitesProvider { * @param site Site. * @param schema Schema to migrate. * @param oldVersion Old version of the schema. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async applySiteSchema(site: CoreSite, schema: CoreRegisteredSiteSchema, oldVersion: number): Promise { if (!site.id) { @@ -1800,7 +1801,7 @@ export class CoreSitesProvider { * * @param url URL to check. * @param username Username to check. - * @return Promise resolved with site to use and the list of sites that have + * @returns Promise resolved with site to use and the list of sites that have * the URL. Site will be undefined if it isn't the root URL of any stored site. */ async isStoredRootURL(url: string, username?: string): Promise<{site?: CoreSite; siteIds: string[]}> { @@ -1834,7 +1835,7 @@ export class CoreSitesProvider { * Returns the Site Schema names that can be cleared on space storage. * * @param site The site that will be cleared. - * @return Name of the site schemas. + * @returns Name of the site schemas. */ getSiteTableSchemasToClear(site: CoreSite): string[] { let reset: string[] = []; @@ -1853,7 +1854,7 @@ export class CoreSitesProvider { * Returns presets for a given reading strategy. * * @param strategy Reading strategy. - * @return PreSets options object. + * @returns PreSets options object. */ getReadingStrategyPreSets(strategy?: CoreSitesReadingStrategy): CoreSiteWSPreSets { switch (strategy) { @@ -1890,7 +1891,7 @@ export class CoreSitesProvider { * Returns site info found on the backend. * * @param search Searched text. - * @return Site info list. + * @returns Site info list. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars async findSites(search: string): Promise { @@ -2055,7 +2056,7 @@ export type CoreSiteSchema = { * @param db Site database. * @param oldVersion Old version of the schema or 0 if not installed. * @param siteId Site Id to migrate. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ migrate?(db: SQLiteDB, oldVersion: number, siteId: string): Promise | void; @@ -2066,7 +2067,7 @@ export type CoreSiteSchema = { * * @param db Site database. * @param siteId Site Id to migrate. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ install?(db: SQLiteDB, siteId: string): Promise | void; }; diff --git a/src/core/services/sync.ts b/src/core/services/sync.ts index e25cd4a56..70f990d4f 100644 --- a/src/core/services/sync.ts +++ b/src/core/services/sync.ts @@ -95,7 +95,7 @@ export class CoreSyncProvider { * @param component Component name. * @param id Unique ID per component. * @param siteId Site ID. If not defined, current site. - * @return Record if found or reject. + * @returns Record if found or reject. */ async getSyncRecord(component: string, id: string | number, siteId?: string): Promise { const db = await CoreSites.getSiteDb(siteId); @@ -110,7 +110,7 @@ export class CoreSyncProvider { * @param id Unique ID per component. * @param data Data that updates the record. * @param siteId Site ID. If not defined, current site. - * @return Promise resolved with done. + * @returns Promise resolved with done. */ async insertOrUpdateSyncRecord( component: string, @@ -131,7 +131,7 @@ export class CoreSyncProvider { * * @param component Component name. * @param id Unique ID per component. - * @return Unique sync id. + * @returns Unique sync id. */ protected getUniqueSyncBlockId(component: string, id: string | number): string { return component + '#' + id; @@ -144,7 +144,7 @@ export class CoreSyncProvider { * @param component Component name. * @param id Unique ID per component. * @param siteId Site ID. If not defined, current site. - * @return Whether it's blocked. + * @returns Whether it's blocked. */ isBlocked(component: string, id: string | number, siteId?: string): boolean { siteId = siteId || CoreSites.getCurrentSiteId(); diff --git a/src/core/services/update-manager.ts b/src/core/services/update-manager.ts index f720228eb..dc8cdbbff 100644 --- a/src/core/services/update-manager.ts +++ b/src/core/services/update-manager.ts @@ -50,7 +50,7 @@ export class CoreUpdateManagerProvider { /** * Returns a promise resolved when the load function is done. * - * @return Promise resolved when the load function is done. + * @returns Promise resolved when the load function is done. */ get donePromise(): Promise { return this.doneDeferred; @@ -60,7 +60,7 @@ export class CoreUpdateManagerProvider { * Check if the app has been updated and performs the needed processes. * This function shouldn't be used outside of core. * - * @return Promise resolved when the update process finishes. + * @returns Promise resolved when the update process finishes. */ async initialize(): Promise { const promises: Promise[] = []; @@ -106,7 +106,7 @@ export class CoreUpdateManagerProvider { /** * If there is a current site, check if it's still supported in the new app. * - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async checkCurrentSiteAllowed(): Promise { if (!CoreLoginHelper.getFixedSites()) { diff --git a/src/core/services/urlschemes.ts b/src/core/services/urlschemes.ts index 5f21ea24b..635949b9d 100644 --- a/src/core/services/urlschemes.ts +++ b/src/core/services/urlschemes.ts @@ -48,7 +48,7 @@ export class CoreCustomURLSchemesProvider { * Given some data of a custom URL with a token, create a site if it needs to be created. * * @param data URL data. - * @return Promise resolved with the site ID if created or already exists. + * @returns Promise resolved with the site ID if created or already exists. */ protected async createSiteIfNeeded(data: CoreCustomURLSchemesParams): Promise { if (!data.token) { @@ -86,7 +86,7 @@ export class CoreCustomURLSchemesProvider { * Handle an URL received by custom URL scheme. * * @param url URL to treat. - * @return Promise resolved when done. If rejected, the parameter is of type CoreCustomURLSchemesHandleError. + * @returns Promise resolved when done. If rejected, the parameter is of type CoreCustomURLSchemesHandleError. */ async handleCustomURL(url: string): Promise { if (!this.isCustomURL(url)) { @@ -226,7 +226,7 @@ export class CoreCustomURLSchemesProvider { * moodlemobile://username@domain.com?token=TOKEN&privatetoken=PRIVATETOKEN&redirect=http://domain.com/course/view.php?id=2 * * @param url URL to treat. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async getCustomURLData(url: string): Promise { if (!this.isCustomURL(url)) { @@ -279,7 +279,7 @@ export class CoreCustomURLSchemesProvider { * Get the data from a "link" custom URL scheme. This kind of URL is deprecated. * * @param url URL to treat. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async getCustomURLLinkData(url: string): Promise { if (!this.isCustomURLLink(url)) { @@ -341,7 +341,7 @@ export class CoreCustomURLSchemesProvider { * Get the data from a "token" custom URL scheme. This kind of URL is deprecated. * * @param url URL to treat. - * @return Promise resolved with the data. + * @returns Promise resolved with the data. */ protected async getCustomURLTokenData(url: string): Promise { if (!this.isCustomURLToken(url)) { @@ -387,7 +387,7 @@ export class CoreCustomURLSchemesProvider { * * @param data URL data. * @param checkResponse Result of checkSite. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async goToAddSite(data: CoreCustomURLSchemesParams, checkResponse: CoreSiteCheckResponse): Promise { const ssoNeeded = CoreLoginHelper.isSSOLoginNeeded(checkResponse.code); @@ -430,7 +430,7 @@ export class CoreCustomURLSchemesProvider { * Check whether a URL is a custom URL scheme. * * @param url URL to check. - * @return Whether it's a custom URL scheme. + * @returns Whether it's a custom URL scheme. */ isCustomURL(url: string): boolean { if (!url) { @@ -444,7 +444,7 @@ export class CoreCustomURLSchemesProvider { * Check whether a URL is a custom URL scheme with the "link" param (deprecated). * * @param url URL to check. - * @return Whether it's a custom URL scheme. + * @returns Whether it's a custom URL scheme. */ isCustomURLLink(url: string): boolean { if (!url) { @@ -458,7 +458,7 @@ export class CoreCustomURLSchemesProvider { * Check whether a URL is a custom URL scheme with a "token" param (deprecated). * * @param url URL to check. - * @return Whether it's a custom URL scheme. + * @returns Whether it's a custom URL scheme. */ isCustomURLToken(url: string): boolean { if (!url) { @@ -472,7 +472,7 @@ export class CoreCustomURLSchemesProvider { * Remove the scheme from a custom URL. * * @param url URL to treat. - * @return URL without scheme. + * @returns URL without scheme. */ removeCustomURLScheme(url: string): string { return url.replace(CoreConstants.CONFIG.customurlscheme + '://', ''); @@ -482,7 +482,7 @@ export class CoreCustomURLSchemesProvider { * Remove the scheme and the "link=" prefix from a link custom URL. * * @param url URL to treat. - * @return URL without scheme and prefix. + * @returns URL without scheme and prefix. */ removeCustomURLLinkScheme(url: string): string { return url.replace(CoreConstants.CONFIG.customurlscheme + '://link=', ''); @@ -492,7 +492,7 @@ export class CoreCustomURLSchemesProvider { * Remove the scheme and the "token=" prefix from a token custom URL. * * @param url URL to treat. - * @return URL without scheme and prefix. + * @returns URL without scheme and prefix. */ removeCustomURLTokenScheme(url: string): string { return url.replace(CoreConstants.CONFIG.customurlscheme + '://token=', ''); diff --git a/src/core/services/utils/dom.ts b/src/core/services/utils/dom.ts index 865a2501b..36a155f72 100644 --- a/src/core/services/utils/dom.ts +++ b/src/core/services/utils/dom.ts @@ -103,7 +103,7 @@ export class CoreDomUtilsProvider { * * @param element DOM Element. * @param selector Selector to search. - * @return Closest ancestor. + * @returns Closest ancestor. * @deprecated since app 4.0 Not needed anymore since it's supported on both Android and iOS. Use closest instead. */ closest(element: Element | undefined | null, selector: string): Element | null { @@ -119,7 +119,7 @@ export class CoreDomUtilsProvider { * @param wifiThreshold Threshold to show confirm in WiFi connection. Default: CoreWifiDownloadThreshold. * @param limitedThreshold Threshold to show confirm in limited connection. Default: CoreDownloadThreshold. * @param alwaysConfirm True to show a confirm even if the size isn't high, false otherwise. - * @return Promise resolved when the user confirms or if no confirm needed. + * @returns Promise resolved when the user confirms or if no confirm needed. */ async confirmDownloadSize( size: CoreFileSizeSum, @@ -214,7 +214,7 @@ export class CoreDomUtilsProvider { * Convert some HTML as text into an HTMLElement. This HTML is put inside a div or a body. * * @param html Text to convert. - * @return Element. + * @returns Element. */ convertToElement(html: string): HTMLElement { // Add a div to hold the content, that's the element that will be returned. @@ -226,7 +226,7 @@ export class CoreDomUtilsProvider { /** * Create a "cancelled" error. These errors won't display an error message in showErrorModal functions. * - * @return The error object. + * @returns The error object. * @deprecated since 3.9.5. Just create the error directly. */ createCanceledError(): CoreCanceledError { @@ -238,7 +238,7 @@ export class CoreDomUtilsProvider { * passed to the ngOnChanges functions. * * @param changes Changes detected by KeyValueDiffer. - * @return Changes in a format like ngOnChanges. + * @returns Changes in a format like ngOnChanges. */ createChangesFromKeyValueDiff(changes: KeyValueChanges): { [name: string]: SimpleChange } { const newChanges: { [name: string]: SimpleChange } = {}; @@ -263,7 +263,7 @@ export class CoreDomUtilsProvider { * Search all the URLs in a CSS file content. * * @param code CSS code. - * @return List of URLs. + * @returns List of URLs. */ extractUrlsFromCSS(code: string): string[] { // First of all, search all the url(...) occurrences that don't include "data:". @@ -289,7 +289,7 @@ export class CoreDomUtilsProvider { * Fix syntax errors in HTML. * * @param html HTML text. - * @return Fixed HTML text. + * @returns Fixed HTML text. */ fixHtml(html: string): string { this.template.innerHTML = html; @@ -358,7 +358,7 @@ export class CoreDomUtilsProvider { * Returned size will have a format like '500px'. * * @param size Size to format. - * @return Formatted size. If size is not valid, returns an empty string. + * @returns Formatted size. If size is not valid, returns an empty string. */ formatPixelsSize(size: string | number): string { if (typeof size == 'string' && (size.indexOf('px') > -1 || size.indexOf('%') > -1 || size == 'auto' || size == 'initial')) { @@ -383,7 +383,7 @@ export class CoreDomUtilsProvider { * * @param element DOM element to search in. * @param selector Selector to search. - * @return Selection contents. Undefined if not found. + * @returns Selection contents. Undefined if not found. */ getContentsOfElement(element: HTMLElement, selector: string): string | undefined { const selected = element.querySelector(selector); @@ -396,7 +396,7 @@ export class CoreDomUtilsProvider { * Get the data from a form. It will only collect elements that have a name. * * @param form The form to get the data from. - * @return Object with the data. The keys are the names of the inputs. + * @returns Object with the data. The keys are the names of the inputs. * @deprecated since 3.9.5. Function has been moved to CoreForms. */ getDataFromForm(form: HTMLFormElement): CoreFormFields { @@ -408,7 +408,7 @@ export class CoreDomUtilsProvider { * * @param html HTML element in string. * @param attribute Attribute to get. - * @return Attribute value. + * @returns Attribute value. */ getHTMLElementAttribute(html: string, attribute: string): string | null { return this.convertToElement(html).children[0].getAttribute(attribute); @@ -422,7 +422,7 @@ export class CoreDomUtilsProvider { * @param useMargin Whether to use margin to calculate the measure. * @param useBorder Whether to use borders to calculate the measure. * @param innerMeasure If inner measure is needed: padding, margin or borders will be substracted. - * @return Height in pixels. + * @returns Height in pixels. * @deprecated since app 4.0 Use getBoundingClientRect.height instead. */ getElementHeight( @@ -444,7 +444,7 @@ export class CoreDomUtilsProvider { * @param useMargin Whether to use margin to calculate the measure. * @param useBorder Whether to use borders to calculate the measure. * @param innerMeasure If inner measure is needed: padding, margin or borders will be substracted. - * @return Measure in pixels. + * @returns Measure in pixels. * @deprecated since app 4.0 Use getBoundingClientRect.height or width instead. */ getElementMeasure( @@ -503,7 +503,7 @@ export class CoreDomUtilsProvider { * * @param style Style from getComputedStyle. * @param measure Measure to get. - * @return Result of the measure. + * @returns Result of the measure. */ getComputedStyleMeasure(style: CSSStyleDeclaration, measure: string): number { return parseInt(style[measure], 10) || 0; @@ -517,7 +517,7 @@ export class CoreDomUtilsProvider { * @param useMargin Whether to use margin to calculate the measure. * @param useBorder Whether to use borders to calculate the measure. * @param innerMeasure If inner measure is needed: padding, margin or borders will be substracted. - * @return Width in pixels. + * @returns Width in pixels. * @deprecated since app 4.0 Use getBoundingClientRect.width instead. */ getElementWidth( @@ -536,7 +536,7 @@ export class CoreDomUtilsProvider { * @param element Element to search in. * @param selector Selector to find the element to gets the position. * @param positionParentClass Parent Class where to stop calculating the position. Default inner-scroll. - * @return positionLeft, positionTop of the element relative to. + * @returns positionLeft, positionTop of the element relative to. * @deprecated since app 4.0. Use CoreDom.getRelativeElementPosition instead. */ getElementXY(element: HTMLElement, selector?: string, positionParentClass = 'inner-scroll'): [number, number] | null { @@ -569,7 +569,7 @@ export class CoreDomUtilsProvider { * * @param message Message text. * @param error Error object. - * @return True if the message error is a network error, false otherwise. + * @returns True if the message error is a network error, false otherwise. */ protected isNetworkError(message: string, error?: CoreError | CoreTextErrorObject | string): boolean { return message == Translate.instant('core.networkerrormsg') || @@ -596,7 +596,7 @@ export class CoreDomUtilsProvider { * * @param error Message to show. * @param needsTranslate Whether the error needs to be translated. - * @return Error message, null if no error should be displayed. + * @returns Error message, null if no error should be displayed. */ getErrorMessage(error: CoreError | CoreTextErrorObject | string, needsTranslate?: boolean): string | null { if (typeof error != 'string' && !error) { @@ -665,7 +665,7 @@ export class CoreDomUtilsProvider { * or Angular's injection. * * @param element The root element of the component/directive. - * @return The instance, undefined if not found. + * @returns The instance, undefined if not found. * @deprecated since 4.0.0. Use CoreComponentsRegistry instead. */ getInstanceByElement(element: Element): T | undefined { @@ -676,7 +676,7 @@ export class CoreDomUtilsProvider { * Check whether an error is an error caused because the user canceled a showConfirm. * * @param error Error to check. - * @return Whether it's a canceled error. + * @returns Whether it's a canceled error. */ isCanceledError(error: CoreAnyError): boolean { return error instanceof CoreCanceledError; @@ -686,7 +686,7 @@ export class CoreDomUtilsProvider { * Check whether an error is an error caused because the user canceled a showConfirm. * * @param error Error to check. - * @return Whether it's a canceled error. + * @returns Whether it's a canceled error. */ isSilentError(error: CoreAnyError): boolean { return error instanceof CoreSilentError; @@ -698,7 +698,7 @@ export class CoreDomUtilsProvider { * @param findFunction The function used to find the element. * @param retries Number of retries before giving up. * @param retryAfter Milliseconds to wait before retrying if the element wasn't found. - * @return Resolved if found, rejected if too many tries. + * @returns Resolved if found, rejected if too many tries. * @deprecated since app 4.0 Use CoreDom.waitToBeInsideElement instead. */ async waitElementToExist( @@ -766,7 +766,7 @@ export class CoreDomUtilsProvider { * @param scrollEl The element that must be scrolled. * @param element DOM element to check. * @param point The point of the element to check. - * @return Whether the element is outside of the viewport. + * @returns Whether the element is outside of the viewport. */ isElementOutsideOfScreen( scrollEl: HTMLElement, @@ -803,7 +803,7 @@ export class CoreDomUtilsProvider { /** * Check if rich text editor is enabled. * - * @return Promise resolved with boolean: true if enabled, false otherwise. + * @returns Promise resolved with boolean: true if enabled, false otherwise. */ async isRichTextEditorEnabled(): Promise { const enabled = await CoreConfig.get(CoreConstants.SETTINGS_RICH_TEXT_EDITOR, true); @@ -814,7 +814,7 @@ export class CoreDomUtilsProvider { /** * Check if rich text editor is supported in the platform. * - * @return Whether it's supported. + * @returns Whether it's supported. * @deprecated since 3.9.5 */ isRichTextEditorSupported(): boolean { @@ -827,7 +827,7 @@ export class CoreDomUtilsProvider { * @param oldParent The old parent. * @param newParent The new parent. * @param prepend If true, adds the children to the beginning of the new parent. - * @return List of moved children. + * @returns List of moved children. */ moveChildren(oldParent: HTMLElement, newParent: HTMLElement, prepend?: boolean): Node[] { const movedChildren: Node[] = []; @@ -862,7 +862,7 @@ export class CoreDomUtilsProvider { * @param html HTML code to change. * @param selector Selector to search. * @param removeAll True if it should remove all matches found, false if it should only remove the first one. - * @return HTML without the element. + * @returns HTML without the element. */ removeElementFromHtml(html: string, selector: string, removeAll?: boolean): string { const element = this.convertToElement(html); @@ -928,7 +928,7 @@ export class CoreDomUtilsProvider { * @param html HTML code. * @param paths Object linking URLs in the html code with the real URLs to use. * @param anchorFn Function to call with each anchor. Optional. - * @return Treated HTML code. + * @returns Treated HTML code. */ restoreSourcesInHtml( html: string, @@ -986,7 +986,7 @@ export class CoreDomUtilsProvider { * @param x The x-value to scroll to. * @param y The y-value to scroll to. * @param duration Duration of the scroll animation in milliseconds. - * @return Returns a promise which is resolved when the scroll has completed. + * @returns Returns a promise which is resolved when the scroll has completed. * @deprecated since 3.9.5. Use directly the IonContent class. */ scrollTo(content: IonContent, x: number, y: number, duration = 0): Promise { @@ -998,7 +998,7 @@ export class CoreDomUtilsProvider { * * @param content Content to scroll. * @param duration Duration of the scroll animation in milliseconds. - * @return Returns a promise which is resolved when the scroll has completed. + * @returns Returns a promise which is resolved when the scroll has completed. * @deprecated since 3.9.5. Use directly the IonContent class. */ scrollToBottom(content: IonContent, duration = 0): Promise { @@ -1010,7 +1010,7 @@ export class CoreDomUtilsProvider { * * @param content Content to scroll. * @param duration Duration of the scroll animation in milliseconds. - * @return Returns a promise which is resolved when the scroll has completed. + * @returns Returns a promise which is resolved when the scroll has completed. * @deprecated since 3.9.5. Use directly the IonContent class. */ scrollToTop(content: IonContent, duration = 0): Promise { @@ -1021,7 +1021,7 @@ export class CoreDomUtilsProvider { * Returns height of the content. * * @param content Content where to execute the function. - * @return Promise resolved with content height. + * @returns Promise resolved with content height. */ async getContentHeight(content: IonContent): Promise { try { @@ -1037,7 +1037,7 @@ export class CoreDomUtilsProvider { * Returns scroll height of the content. * * @param content Content where to execute the function. - * @return Promise resolved with scroll height. + * @returns Promise resolved with scroll height. */ async getScrollHeight(content: IonContent): Promise { try { @@ -1053,7 +1053,7 @@ export class CoreDomUtilsProvider { * Returns scrollTop of the content. * * @param content Content where to execute the function. - * @return Promise resolved with scroll top. + * @returns Promise resolved with scroll top. */ async getScrollTop(content: IonContent): Promise { try { @@ -1072,7 +1072,7 @@ export class CoreDomUtilsProvider { * @param element The element to scroll to. * @param scrollParentClass Not used anymore. * @param duration Duration of the scroll animation in milliseconds. - * @return True if the element is found, false otherwise. + * @returns True if the element is found, false otherwise. * @deprecated since app 4.0 Use CoreDom.scrollToElement instead. */ scrollToElement(content: IonContent, element: HTMLElement, scrollParentClass?: string, duration?: number): boolean { @@ -1089,7 +1089,7 @@ export class CoreDomUtilsProvider { * @param selector Selector to find the element to scroll to. * @param scrollParentClass Not used anymore. * @param duration Duration of the scroll animation in milliseconds. - * @return True if the element is found, false otherwise. + * @returns True if the element is found, false otherwise. * @deprecated since app 4.0 Use CoreDom.scrollToElement instead. */ scrollToElementBySelector( @@ -1113,7 +1113,7 @@ export class CoreDomUtilsProvider { * Search for an input with error (core-input-error directive) and scrolls to it if found. * * @param container The element that contains the element that must be scrolled. - * @return True if the element is found, false otherwise. + * @returns True if the element is found, false otherwise. * @deprecated since app 4.0 Use CoreDom.scrollToInputError instead. */ scrollToInputError(container: HTMLElement | null): boolean { @@ -1142,7 +1142,7 @@ export class CoreDomUtilsProvider { * @param message Message to show. * @param buttonText Text of the button. * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return Promise resolved with the alert modal. + * @returns Promise resolved with the alert modal. */ async showAlert( header: string | undefined, @@ -1162,7 +1162,7 @@ export class CoreDomUtilsProvider { * * @param options Alert options to pass to the alert. * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return Promise resolved with the alert modal. + * @returns Promise resolved with the alert modal. */ async showAlertWithOptions(options: AlertOptions = {}, autocloseTime?: number): Promise { const hasHTMLTags = CoreTextUtils.hasHTMLTags( options.message || ''); @@ -1234,7 +1234,7 @@ export class CoreDomUtilsProvider { * @param message Message to show. * @param buttonText Text of the button. * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return Promise resolved with the alert modal. + * @returns Promise resolved with the alert modal. */ showAlertTranslated( header: string | undefined, @@ -1255,7 +1255,7 @@ export class CoreDomUtilsProvider { * @param translateMessage String key to show in the modal body translated. Default: 'core.areyousure'. * @param translateArgs Arguments to pass to translate if necessary. * @param options More options. See https://ionicframework.com/docs/v3/api/components/alert/AlertController/ - * @return Promise resolved if the user confirms and rejected with a canceled error if he cancels. + * @returns Promise resolved if the user confirms and rejected with a canceled error if he cancels. */ showDeleteConfirm( translateMessage: string = 'core.areyousure', @@ -1298,7 +1298,7 @@ export class CoreDomUtilsProvider { * @param okText Text of the OK button. * @param cancelText Text of the Cancel button. * @param options More options. - * @return Promise resolved if the user confirms and rejected with a canceled error if he cancels. + * @returns Promise resolved if the user confirms and rejected with a canceled error if he cancels. */ showConfirm( message: string, @@ -1341,7 +1341,7 @@ export class CoreDomUtilsProvider { * @param error Message to show. * @param needsTranslate Whether the error needs to be translated. * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return Promise resolved with the alert modal. + * @returns Promise resolved with the alert modal. */ async showErrorModal( error: CoreError | CoreTextErrorObject | string, @@ -1423,7 +1423,7 @@ export class CoreDomUtilsProvider { * @param defaultError Message to show if the error is not a string. * @param needsTranslate Whether the error needs to be translated. * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return Promise resolved with the alert modal. + * @returns Promise resolved with the alert modal. */ async showErrorModalDefault( error: CoreAnyError, @@ -1456,7 +1456,7 @@ export class CoreDomUtilsProvider { * @param defaultError Message to show if the error is not a string. * @param needsTranslate Whether the error needs to be translated. * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return Promise resolved with the alert modal. + * @returns Promise resolved with the alert modal. */ showErrorModalFirstWarning( warnings: CoreWSExternalWarning[], @@ -1472,7 +1472,7 @@ export class CoreDomUtilsProvider { * * @param text The text of the modal window. Default: core.loading. * @param needsTranslate Whether the 'text' needs to be translated. - * @return Loading element instance. + * @returns Loading element instance. * @description * Usage: * let modal = await domUtils.showModalLoading(myText); @@ -1508,7 +1508,7 @@ export class CoreDomUtilsProvider { * * @param message The warning message. * @param link Link to the app to download if any. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async showDownloadAppNoticeModal(message: string, link?: string): Promise { const buttons: AlertButton[] = [{ @@ -1548,8 +1548,8 @@ export class CoreDomUtilsProvider { * @param placeholderOrLabel Placeholder (for textual/numeric inputs) or label (for radio/checkbox). By default, "Password". * @param type Type of the input element. By default, password. * @param buttons Buttons. If not provided or it's an object with texts, OK and Cancel buttons will be displayed. - * @para options Other alert options. - * @return Promise resolved with the input data (true for checkbox/radio) if the user clicks OK, rejected if cancels. + * @param options Other alert options. + * @returns Promise resolved with the input data (true for checkbox/radio) if the user clicks OK, rejected if cancels. */ showPrompt( message: string, @@ -1634,7 +1634,7 @@ export class CoreDomUtilsProvider { * @param message Modal message. * @param buttons Buttons to pass to the modal. * @param placeholder Placeholder of the input element if any. - * @return Promise resolved with the entered text if any. + * @returns Promise resolved with the entered text if any. */ async showTextareaPrompt( title: string, @@ -1673,7 +1673,7 @@ export class CoreDomUtilsProvider { * @param needsTranslate Whether the 'text' needs to be translated. * @param duration Duration in ms of the dimissable toast. * @param cssClass Class to add to the toast. - * @return Toast instance. + * @returns Toast instance. */ async showToast( text: string, @@ -1697,7 +1697,7 @@ export class CoreDomUtilsProvider { * Show toast with some options. * * @param options Options. - * @return Promise resolved with Toast instance. + * @returns Promise resolved with Toast instance. */ async showToastWithOptions(options: ShowToastOptions): Promise { // Convert some values and set default values. @@ -1729,7 +1729,7 @@ export class CoreDomUtilsProvider { * Check if an element supports input via keyboard. * * @param el HTML element to check. - * @return Whether it supports input using keyboard. + * @returns Whether it supports input using keyboard. */ supportsInputKeyboard(el: HTMLElement): boolean { return el && @@ -1742,7 +1742,7 @@ export class CoreDomUtilsProvider { * Converts HTML formatted text to DOM element(s). * * @param text HTML text. - * @return Same text converted to HTMLCollection. + * @returns Same text converted to HTMLCollection. */ toDom(text: string): HTMLCollection { const element = this.convertToElement(text); @@ -1780,6 +1780,7 @@ export class CoreDomUtilsProvider { * Opens a Modal. * * @param options Modal Options. + * @returns The modal data when the modal closes. */ async openModal( options: OpenModalOptions, @@ -1829,6 +1830,7 @@ export class CoreDomUtilsProvider { * Opens a side Modal. * * @param options Modal Options. + * @returns The modal data when the modal closes. */ async openSideModal( options: OpenModalOptions, @@ -1849,7 +1851,7 @@ export class CoreDomUtilsProvider { * Opens a popover. * * @param options Options. - * @return Promise resolved when the popover is dismissed or will be dismissed. + * @returns Promise resolved when the popover is dismissed or will be dismissed. */ async openPopover(options: OpenPopoverOptions): Promise { @@ -1912,7 +1914,7 @@ export class CoreDomUtilsProvider { * Wait for images to load. * * @param element The element to search in. - * @return Promise resolved with a boolean: whether there was any image to load. + * @returns Promise resolved with a boolean: whether there was any image to load. */ async waitForImages(element: HTMLElement): Promise { const imgs = Array.from(element.querySelectorAll('img')); @@ -1985,6 +1987,7 @@ export class CoreDomUtilsProvider { * @param windowWidth Initial window width. * @param windowHeight Initial window height. * @param retries Number of retries done. + * @returns Promise resolved when done. */ async waitForResizeDone(windowWidth?: number, windowHeight?: number, retries = 0): Promise { if (!CoreApp.isIOS()) { @@ -2009,7 +2012,7 @@ export class CoreDomUtilsProvider { * Check whether a CSS class indicating an app mode is set. * * @param className Class name. - * @return Whether the CSS class is set. + * @returns Whether the CSS class is set. */ hasModeClass(className: string): boolean { return document.documentElement.classList.contains(className); @@ -2018,7 +2021,7 @@ export class CoreDomUtilsProvider { /** * Get active mode CSS classes. * - * @return Mode classes. + * @returns Mode classes. */ getModeClasses(): string[] { return Array.from(document.documentElement.classList); diff --git a/src/core/services/utils/iframe.ts b/src/core/services/utils/iframe.ts index 4a25a0f67..fc3a05e25 100644 --- a/src/core/services/utils/iframe.ts +++ b/src/core/services/utils/iframe.ts @@ -61,7 +61,7 @@ export class CoreIframeUtilsProvider { * * @param element The frame to check (iframe, embed, ...). * @param isSubframe Whether it's a frame inside another frame. - * @return True if frame is online and the app is offline, false otherwise. + * @returns True if frame is online and the app is offline, false otherwise. */ checkOnlineFrameInOffline(element: CoreFrameElement, isSubframe?: boolean): boolean { const src = 'src' in element ? element.src : element.data; @@ -115,7 +115,7 @@ export class CoreIframeUtilsProvider { * @param element The frame to check (iframe, embed, ...). * @param src Frame src. * @param isSubframe Whether it's a frame inside another frame. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async addOfflineWarning(element: HTMLElement, src: string, isSubframe?: boolean): Promise { const site = CoreSites.getCurrentSite(); @@ -134,7 +134,7 @@ export class CoreIframeUtilsProvider { const canHandleLink = await CoreContentLinksHelper.canHandleLink(src, undefined, username); if (!canHandleLink) { - // @todo: The not connected icon isn't seen due to the div's height. Also, it's quite big. + // @todo The not connected icon isn't seen due to the div's height. Also, it's quite big. div.innerHTML = (isSubframe ? '' : '
') + '

' + Translate.instant('core.networkerroriframemsg') + '

'; @@ -185,7 +185,7 @@ export class CoreIframeUtilsProvider { * * @param iframe Iframe element. * @param url Original URL. - * @return Promise resolved with the URL. + * @returns Promise resolved with the URL. */ async getAutoLoginUrlForIframe(iframe: HTMLIFrameElement, url: string): Promise { const currentSite = CoreSites.getCurrentSite(); @@ -229,7 +229,7 @@ export class CoreIframeUtilsProvider { * Please notice that the element should be an iframe, embed or similar. * * @param element Element to treat (iframe, embed, ...). - * @return Window and Document. + * @returns Window and Document. */ getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } { let contentWindow: Window | null = 'contentWindow' in element ? element.contentWindow : null; @@ -410,7 +410,7 @@ export class CoreIframeUtilsProvider { * @param url URL passed to window.open. * @param name Name passed to window.open. * @param element HTML element of the frame. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async windowOpen(url: string, name: string, element?: CoreFrameElement): Promise { const scheme = CoreUrlUtils.getUrlScheme(url); @@ -464,7 +464,7 @@ export class CoreIframeUtilsProvider { * @param link Link clicked, or data of the link clicked. * @param element Frame element. * @param event Click event. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ protected async linkClicked( link: CoreIframeHTMLAnchorElement | {href: string; target?: string; originalHref?: string}, @@ -561,7 +561,7 @@ export class CoreIframeUtilsProvider { * Fix cookies for an iframe URL. * * @param url URL of the iframe. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async fixIframeCookies(url: string): Promise { if (!CoreApp.isIOS() || !url || CoreUrlUtils.isLocalFileUrl(url)) { @@ -590,7 +590,7 @@ export class CoreIframeUtilsProvider { /** * Check whether the help should be displayed in current OS. * - * @return Boolean. + * @returns Boolean. */ shouldDisplayHelp(): boolean { return CoreApp.isIOS() && CoreApp.getPlatformMajorVersion() >= 14; @@ -600,7 +600,7 @@ export class CoreIframeUtilsProvider { * Check whether the help should be displayed for a certain iframe. * * @param url Iframe URL. - * @return Boolean. + * @returns Boolean. */ shouldDisplayHelpForUrl(url: string): boolean { return this.shouldDisplayHelp() && !CoreUrlUtils.isLocalFileUrl(url); diff --git a/src/core/services/utils/mimetype.ts b/src/core/services/utils/mimetype.ts index c9fdd1fa1..bf9105362 100644 --- a/src/core/services/utils/mimetype.ts +++ b/src/core/services/utils/mimetype.ts @@ -64,7 +64,7 @@ export class CoreMimetypeUtilsProvider { * Check if a file extension can be embedded without using iframes. * * @param extension Extension. - * @return Whether it can be embedded. + * @returns Whether it can be embedded. */ canBeEmbedded(extension?: string): boolean { return this.isExtensionInGroup(extension, ['web_image', 'web_video', 'web_audio']); @@ -74,7 +74,7 @@ export class CoreMimetypeUtilsProvider { * Clean a extension, removing the dot, hash, extra params... * * @param extension Extension to clean. - * @return Clean extension. + * @returns Clean extension. */ cleanExtension(extension: string): string { if (!extension) { @@ -133,7 +133,7 @@ export class CoreMimetypeUtilsProvider { * * @param mimetype Mimetype. * @param url URL of the file. It will be used if there's more than one possible extension. - * @return Extension. + * @returns Extension. */ getExtension(mimetype: string, url?: string): string | undefined { mimetype = mimetype || ''; @@ -163,6 +163,7 @@ export class CoreMimetypeUtilsProvider { * * @param file File object. * @param path Alternative path that will override fileurl from file object. + * @returns The embedded HTML string. */ getEmbeddedHtml(file: CoreFileEntry, path?: string): string { const filename = CoreUtils.isFileEntry(file) ? (file as FileEntry).name : file.filename; @@ -207,7 +208,7 @@ export class CoreMimetypeUtilsProvider { * Get the URL of the icon of an extension. * * @param extension Extension. - * @return Icon URL. + * @returns Icon URL. */ getExtensionIcon(extension: string): string { const icon = this.getExtensionIconName(extension) || 'unknown'; @@ -219,7 +220,7 @@ export class CoreMimetypeUtilsProvider { * Get the name of the icon of an extension. * * @param extension Extension. - * @return Icon. Undefined if not found. + * @returns Icon. Undefined if not found. */ getExtensionIconName(extension: string): string | undefined { if (this.extToMime[extension]) { @@ -238,7 +239,7 @@ export class CoreMimetypeUtilsProvider { * Get the "type" (string) of an extension, something like "image", "video" or "audio". * * @param extension Extension. - * @return Type of the extension. + * @returns Type of the extension. */ getExtensionType(extension: string): string | undefined { extension = this.cleanExtension(extension); @@ -252,7 +253,7 @@ export class CoreMimetypeUtilsProvider { * Get all the possible extensions of a mimetype. Returns empty array if not found. * * @param mimetype Mimetype. - * @return Extensions. + * @returns Extensions. */ getExtensions(mimetype: string): string[] { mimetype = mimetype || ''; @@ -264,8 +265,8 @@ export class CoreMimetypeUtilsProvider { /** * Get a file icon URL based on its file name. * - * @param The name of the file. - * @return The path to a file icon. + * @param filename The name of the file. + * @returns The path to a file icon. */ getFileIcon(filename: string): string { const extension = this.getFileExtension(filename); @@ -277,7 +278,7 @@ export class CoreMimetypeUtilsProvider { /** * Get the folder icon URL. * - * @return The path to a folder icon. + * @returns The path to a folder icon. */ getFolderIcon(): string { return 'assets/img/files/folder-64.png'; @@ -287,7 +288,7 @@ export class CoreMimetypeUtilsProvider { * Given a type (audio, video, html, ...), return its file icon path. * * @param type The type to get the icon. - * @return The icon path. + * @returns The icon path. */ getFileIconForType(type: string): string { return 'assets/img/files/' + type + '-64.png'; @@ -298,7 +299,7 @@ export class CoreMimetypeUtilsProvider { * This is very weak and unreliable. * * @param fileUrl The file URL. - * @return The lowercased extension without the dot, or undefined. + * @returns The lowercased extension without the dot, or undefined. */ guessExtensionFromUrl(fileUrl: string): string | undefined { const split = fileUrl.split('.'); @@ -337,7 +338,7 @@ export class CoreMimetypeUtilsProvider { * When the file does not have an extension, it returns undefined. * * @param filename The file name. - * @return The lowercased extension, or undefined. + * @returns The lowercased extension, or undefined. */ getFileExtension(filename: string): string | undefined { const dot = filename.lastIndexOf('.'); @@ -363,7 +364,7 @@ export class CoreMimetypeUtilsProvider { * * @param group Group name. * @param field The field to get. If not supplied, all the info will be returned. - * @return Info for the group. + * @returns Info for the group. */ getGroupMimeInfo(group: string): MimeTypeGroupInfo; getGroupMimeInfo(group: string, field: string): string[] | undefined; @@ -383,7 +384,7 @@ export class CoreMimetypeUtilsProvider { * Get the mimetype of an extension. Returns undefined if not found. * * @param extension Extension. - * @return Mimetype. + * @returns Mimetype. */ getMimeType(extension?: string): string | undefined { if (!extension) { @@ -403,7 +404,7 @@ export class CoreMimetypeUtilsProvider { * * @param obj Instance of FileEntry OR object with 'filename' and 'mimetype' OR string with mimetype. * @param capitalise If true, capitalises first character of result. - * @return Type description. + * @returns Type description. */ getMimetypeDescription(obj: CoreFileEntry | string, capitalise?: boolean): string { const langPrefix = 'assets.mimetypes.'; @@ -483,7 +484,7 @@ export class CoreMimetypeUtilsProvider { * Get the "type" (string) of a mimetype, something like "image", "video" or "audio". * * @param mimetype Mimetype. - * @return Type of the mimetype. + * @returns Type of the mimetype. */ getMimetypeType(mimetype: string): string | undefined { mimetype = mimetype.split(';')[0]; // Remove codecs from the mimetype if any. @@ -505,7 +506,7 @@ export class CoreMimetypeUtilsProvider { * Get the icon of a mimetype. * * @param mimetype Mimetype. - * @return Type of the mimetype. + * @returns Type of the mimetype. */ getMimetypeIcon(mimetype: string): string { mimetype = mimetype.split(';')[0]; // Remove codecs from the mimetype if any. @@ -529,7 +530,7 @@ export class CoreMimetypeUtilsProvider { * Given a group name, return the translated name. * * @param name Group name. - * @return Translated name. + * @returns Translated name. */ getTranslatedGroupName(name: string): string { const key = 'assets.mimetypes.group:' + name; @@ -544,7 +545,7 @@ export class CoreMimetypeUtilsProvider { * * @param extension Extension. * @param groups List of groups to check. - * @return Whether the extension belongs to any of the groups. + * @returns Whether the extension belongs to any of the groups. */ isExtensionInGroup(extension: string | undefined, groups: string[]): boolean { if (!extension) { @@ -566,7 +567,7 @@ export class CoreMimetypeUtilsProvider { * Check if a mimetype belongs to a file that can be streamed (audio, video). * * @param mimetype Mimetype. - * @return Boolean. + * @returns Boolean. */ isStreamedMimetype(mimetype: string): boolean { return mimetype.indexOf('video') != -1 || mimetype.indexOf('audio') != -1; @@ -576,7 +577,7 @@ export class CoreMimetypeUtilsProvider { * Remove the extension from a path (if any). * * @param path Path. - * @return Path without extension. + * @returns Path without extension. */ removeExtension(path: string): string { const position = path.lastIndexOf('.'); diff --git a/src/core/services/utils/text.ts b/src/core/services/utils/text.ts index 88fcc37e5..4b90eaae9 100644 --- a/src/core/services/utils/text.ts +++ b/src/core/services/utils/text.ts @@ -104,7 +104,7 @@ export class CoreTextUtilsProvider { * Add ending slash from a path or URL. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ addEndingSlash(text: string): string { if (!text) { @@ -123,7 +123,7 @@ export class CoreTextUtilsProvider { * * @param error Error message or object. * @param text Text to add. - * @return Modified error. + * @returns Modified error. */ addTextToError(error: string | CoreError | CoreTextErrorObject | undefined | null, text: string): string | CoreTextErrorObject { if (typeof error == 'string') { @@ -158,7 +158,7 @@ export class CoreTextUtilsProvider { * * @param error Error message or object. * @param title Title to add. - * @return Modified error. + * @returns Modified error. */ addTitleToError(error: string | CoreError | CoreTextErrorObject | undefined | null, title: string): CoreTextErrorObject { let improvedError: CoreTextErrorObject = {}; @@ -178,7 +178,7 @@ export class CoreTextUtilsProvider { * Given an address as a string, return a URL to open the address in maps. * * @param address The address. - * @return URL to view the address. + * @returns URL to view the address. */ buildAddressURL(address: string): SafeUrl { const parsedUrl = CoreUrl.parse(address); @@ -195,7 +195,7 @@ export class CoreTextUtilsProvider { * Given a list of sentences, build a message with all of them wrapped in

. * * @param messages Messages to show. - * @return Message with all the messages. + * @returns Message with all the messages. */ buildMessage(messages: string[]): string { let result = ''; @@ -213,7 +213,7 @@ export class CoreTextUtilsProvider { * Build a message with several paragraphs. * * @param paragraphs List of paragraphs. - * @return Built message. + * @returns Built message. */ buildSeveralParagraphsMessage(paragraphs: (string | CoreTextErrorObject)[]): string { // Filter invalid messages, and convert them to messages in case they're errors. @@ -246,7 +246,7 @@ export class CoreTextUtilsProvider { * * @param bytes Number of bytes to convert. * @param precision Number of digits after the decimal separator. - * @return Size in human readable format. + * @returns Size in human readable format. */ bytesToSize(bytes: number, precision: number = 2): string { if (bytes === undefined || bytes === null || bytes < 0) { @@ -278,7 +278,7 @@ export class CoreTextUtilsProvider { * * @param text The text to be cleaned. * @param singleLine True if new lines should be removed (all the text in a single line). - * @return Clean text. + * @returns Clean text. */ cleanTags(text: string | undefined, singleLine?: boolean): string { if (!text) { @@ -300,7 +300,7 @@ export class CoreTextUtilsProvider { * * @param leftPath Left path. * @param rightPath Right path. - * @return Concatenated path. + * @returns Concatenated path. * @deprecated since 4.0. Use CorePath instead. */ concatenatePaths(leftPath: string, rightPath: string): string { @@ -312,7 +312,7 @@ export class CoreTextUtilsProvider { * This function is the same as in DomUtils, but we cannot use that one because of circular dependencies. * * @param html Text to convert. - * @return Element. + * @returns Element. */ protected convertToElement(html: string): HTMLElement { // Add a div to hold the content, that's the element that will be returned. @@ -326,7 +326,7 @@ export class CoreTextUtilsProvider { * This function is based on Moodle's count_words. * * @param text Text to count. - * @return Number of words. + * @returns Number of words. */ countWords(text: string): number { if (!text || typeof text != 'string') { @@ -364,7 +364,7 @@ export class CoreTextUtilsProvider { * Decode an escaped HTML text. This implementation is based on PHP's htmlspecialchars_decode. * * @param text Text to decode. - * @return Decoded text. + * @returns Decoded text. */ decodeHTML(text: string | number): string { if (text === undefined || text === null || (typeof text == 'number' && isNaN(text))) { @@ -386,7 +386,7 @@ export class CoreTextUtilsProvider { * Decode HTML entities in a text. Equivalent to PHP html_entity_decode. * * @param text Text to decode. - * @return Decoded text. + * @returns Decoded text. */ decodeHTMLEntities(text: string): string { if (text) { @@ -400,7 +400,7 @@ export class CoreTextUtilsProvider { * Same as Javascript's decodeURI, but if an exception is thrown it will return the original URI. * * @param uri URI to decode. - * @return Decoded URI, or original URI if an exception is thrown. + * @returns Decoded URI, or original URI if an exception is thrown. */ decodeURI(uri: string): string { try { @@ -416,7 +416,7 @@ export class CoreTextUtilsProvider { * Same as Javascript's decodeURIComponent, but if an exception is thrown it will return the original URI. * * @param uri URI to decode. - * @return Decoded URI, or original URI if an exception is thrown. + * @returns Decoded URI, or original URI if an exception is thrown. */ decodeURIComponent(uri: string): string { try { @@ -432,7 +432,7 @@ export class CoreTextUtilsProvider { * Escapes some characters in a string to be used as a regular expression. * * @param text Text to escape. - * @return Escaped text. + * @returns Escaped text. */ escapeForRegex(text: string): string { if (!text || typeof text != 'string') { @@ -447,7 +447,7 @@ export class CoreTextUtilsProvider { * * @param text Text to escape. * @param doubleEncode If false, it will not convert existing html entities. Defaults to true. - * @return Escaped text. + * @returns Escaped text. */ escapeHTML(text?: string | number | null, doubleEncode: boolean = true): string { if (text === undefined || text === null || (typeof text == 'number' && isNaN(text))) { @@ -481,6 +481,7 @@ export class CoreTextUtilsProvider { * @param contextLevel The context level. * @param instanceId The instance ID related to the context. * @param courseId Course ID the text belongs to. It can be used to improve performance with filters. + * @returns Promise resolved when done. * @deprecated since 3.8.3. Please use viewText instead. */ expandText( @@ -509,7 +510,7 @@ export class CoreTextUtilsProvider { * Formats a text, in HTML replacing new lines by correct html new lines. * * @param text Text to format. - * @return Formatted text. + * @returns Formatted text. */ formatHtmlLines(text: string): string { const hasHTMLTags = this.hasHTMLTags(text); @@ -530,7 +531,7 @@ export class CoreTextUtilsProvider { * Get the error message from an error object. * * @param error Error. - * @return Error message, undefined if not found. + * @returns Error message, undefined if not found. */ getErrorMessageFromError(error?: CoreAnyError): string | undefined { if (typeof error == 'string') { @@ -552,7 +553,7 @@ export class CoreTextUtilsProvider { * Given some HTML code, return the HTML code inside tags. If there are no body tags, return the whole HTML. * * @param html HTML text. - * @return Body HTML. + * @returns Body HTML. */ getHTMLBodyContent(html: string): string { const matches = html.match(/([\s\S]*)<\/body>/im); @@ -564,7 +565,7 @@ export class CoreTextUtilsProvider { * Get the pluginfile URL to replace @@PLUGINFILE@@ wildcards. * * @param files Files to extract the URL from. They need to have the URL in a 'url' or 'fileurl' attribute. - * @return Pluginfile URL, undefined if no files found. + * @returns Pluginfile URL, undefined if no files found. */ getTextPluginfileUrl(files: CoreWSFile[]): string | undefined { if (files?.length) { @@ -581,7 +582,7 @@ export class CoreTextUtilsProvider { * Check if a text contains HTML tags. * * @param text Text to check. - * @return Whether it has HTML tags. + * @returns Whether it has HTML tags. */ hasHTMLTags(text: string): boolean { return /<[a-z][\s\S]*>/i.test(text); @@ -592,7 +593,7 @@ export class CoreTextUtilsProvider { * * @param text Full text. * @param searchText Text to search and highlight. - * @return Highlighted text. + * @returns Highlighted text. */ highlightText(text: string, searchText: string): string { if (!text || typeof text != 'string') { @@ -610,7 +611,7 @@ export class CoreTextUtilsProvider { * Check if HTML content is blank. * * @param content HTML content. - * @return True if the string does not contain actual content: text, images, etc. + * @returns True if the string does not contain actual content: text, images, etc. */ htmlIsBlank(content: string): boolean { if (!content) { @@ -627,7 +628,7 @@ export class CoreTextUtilsProvider { * Using as threshold Hex value D800 * * @param text Text to check. - * @return True if has Unicode chars, false otherwise. + * @returns True if has Unicode chars, false otherwise. */ hasUnicode(text: string): boolean { for (let x = 0; x < text.length; x++) { @@ -643,7 +644,7 @@ export class CoreTextUtilsProvider { * Check if an object has any long Unicode char. * * @param data Object to be checked. - * @return If the data has any long Unicode char on it. + * @returns If the data has any long Unicode char on it. */ hasUnicodeData(data: Record): boolean { for (const el in data) { @@ -668,7 +669,7 @@ export class CoreTextUtilsProvider { * * @param text Text to match against. * @param pattern Glob pattern. - * @return Whether the pattern matches. + * @returns Whether the pattern matches. */ matchesGlob(text: string, pattern: string): boolean { pattern = pattern @@ -692,7 +693,7 @@ export class CoreTextUtilsProvider { * @param json JSON text. * @param defaultValue Default value to return if the parse fails. Defaults to the original value. * @param logErrorFn An error to call with the exception to log the error. If not supplied, no error. - * @return JSON parsed as object or what it gets. + * @returns JSON parsed as object or what it gets. */ parseJSON(json: string, defaultValue?: T, logErrorFn?: (error?: Error) => void): T { try { @@ -713,6 +714,10 @@ export class CoreTextUtilsProvider { } /** + * Remove ending slash from a path or URL. + * + * @param text Text to treat. + * @returns Treated text. * @deprecated since 3.9.5. Use CoreText instead. */ removeEndingSlash(text?: string): string { @@ -723,7 +728,7 @@ export class CoreTextUtilsProvider { * Replace all characters that cause problems with files in Android and iOS. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ removeSpecialCharactersForFiles(text: string): string { if (!text || typeof text != 'string') { @@ -760,7 +765,7 @@ export class CoreTextUtilsProvider { * * @param text The text to be treated. * @param newValue Text to use instead of new lines. - * @return Treated text. + * @returns Treated text. */ replaceNewLines(text: string, newValue: string): string { if (!text || typeof text != 'string') { @@ -776,7 +781,7 @@ export class CoreTextUtilsProvider { * @param siteUrl URL of the site. * @param text Text to treat, including draftfile URLs. * @param files List of files of the area, using pluginfile URLs. - * @return Treated text and map with the replacements. + * @returns Treated text and map with the replacements. */ replaceDraftfileUrls( siteUrl: string, @@ -832,7 +837,7 @@ export class CoreTextUtilsProvider { * * @param text to treat. * @param files Files to extract the pluginfile URL from. They need to have the URL in a url or fileurl attribute. - * @return Treated text. + * @returns Treated text. */ replacePluginfileUrls(text: string, files: CoreWSFile[]): string { if (text && typeof text == 'string') { @@ -852,7 +857,7 @@ export class CoreTextUtilsProvider { * @param treatedText Treated text with replacements. * @param originalText Original text. * @param files List of files to search and replace. - * @return Treated text. + * @returns Treated text. */ restoreDraftfileUrls(siteUrl: string, treatedText: string, originalText: string, files: CoreWSFile[]): string { if (!treatedText || !files || !files.length) { @@ -883,7 +888,7 @@ export class CoreTextUtilsProvider { * * @param text Text to treat. * @param files Files to extract the pluginfile URL from. They need to have the URL in a url or fileurl attribute. - * @return Treated text. + * @returns Treated text. */ restorePluginfileUrls(text: string, files: CoreWSFile[]): string { if (text && typeof text == 'string') { @@ -904,7 +909,7 @@ export class CoreTextUtilsProvider { * * @param num Number to round. * @param decimals Number of decimals. By default, 2. - * @return Rounded number. + * @returns Rounded number. */ roundToDecimals(num: number, decimals: number = 2): number { const multiplier = Math.pow(10, decimals); @@ -919,7 +924,7 @@ export class CoreTextUtilsProvider { * Based on Moodle's s() function. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ s(text: string): string { if (!text) { @@ -934,7 +939,7 @@ export class CoreTextUtilsProvider { * * @param text The text to be shortened. * @param length The desired length. - * @return Shortened text. + * @returns Shortened text. */ shortenText(text: string, length: number): string { if (text.length > length) { @@ -956,7 +961,7 @@ export class CoreTextUtilsProvider { * Using as threshold Hex value D800 * * @param text Text to check. - * @return Without the Unicode chars. + * @returns Without the Unicode chars. */ stripUnicode(text: string): string { let stripped = ''; @@ -977,7 +982,7 @@ export class CoreTextUtilsProvider { * @param start The index where to start putting the new string. If negative, it will count from the end of the string. * @param length Length of the portion of string which is to be replaced. If negative, it represents the number of characters * from the end of string at which to stop replacing. If not provided, replace until the end of the string. - * @return Treated string. + * @returns Treated string. */ substrReplace(str: string, replace: string, start: number, length?: number): string { return Locutus.substrReplace(str, replace, start, length); @@ -987,7 +992,7 @@ export class CoreTextUtilsProvider { * Treat the list of disabled features, replacing old nomenclature with the new one. * * @param features List of disabled features. - * @return Treated list. + * @returns Treated list. */ treatDisabledFeatures(features: string): string { if (!features) { @@ -1008,7 +1013,7 @@ export class CoreTextUtilsProvider { * * @param text Text to treat. * @param character Character to remove. - * @return Treated text. + * @returns Treated text. */ trimCharacter(text: string, character: string): string { const escaped = this.escapeForRegex(character); @@ -1021,7 +1026,7 @@ export class CoreTextUtilsProvider { * If a number has only 1 digit, add a leading zero to it. * * @param num Number to convert. - * @return Number with leading zeros. + * @returns Number with leading zeros. */ twoDigits(num: string | number): string { if (num < 10) { @@ -1035,7 +1040,7 @@ export class CoreTextUtilsProvider { * Make a string's first character uppercase. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ ucFirst(text: string): string { return text.charAt(0).toUpperCase() + text.slice(1); @@ -1045,7 +1050,7 @@ export class CoreTextUtilsProvider { * Unserialize Array from PHP. * * @param data String to unserialize. - * @return Unserialized data. + * @returns Unserialized data. */ unserialize(data: string): T { return Locutus.unserialize(data); @@ -1057,7 +1062,7 @@ export class CoreTextUtilsProvider { * @param title Title of the new state. * @param content Content of the text to be expanded. * @param options Options. - * @return Promise resolved when the modal is displayed. + * @returns Promise resolved when the modal is displayed. */ async viewText(title: string, content: string, options?: CoreTextUtilsViewTextOptions): Promise { if (!content.length) { diff --git a/src/core/services/utils/time.ts b/src/core/services/utils/time.ts index b22b5b44b..049c2825f 100644 --- a/src/core/services/utils/time.ts +++ b/src/core/services/utils/time.ts @@ -86,7 +86,7 @@ export class CoreTimeUtilsProvider { * Convert a PHP format to a Moment format. * * @param format PHP format. - * @return Converted format. + * @returns Converted format. */ convertPHPToMoment(format: string): string { if (typeof format != 'string') { @@ -136,7 +136,7 @@ export class CoreTimeUtilsProvider { * Fix format to use in an ion-datetime. * * @param format Format to use. - * @return Fixed format. + * @returns Fixed format. */ fixFormatForDatetime(format: string): string { if (!format) { @@ -160,7 +160,7 @@ export class CoreTimeUtilsProvider { * * @param seconds A number of seconds * @param precision Number of elements to have in precision. - * @return Seconds in a human readable format. + * @returns Seconds in a human readable format. * @deprecated since app 4.0. Use CoreTime.formatTime instead. */ formatTime(seconds: number, precision = 2): string { @@ -171,7 +171,7 @@ export class CoreTimeUtilsProvider { * Converts a number of seconds into a short human readable format: minutes and seconds, in fromat: 3' 27''. * * @param duration Seconds - * @return Short human readable text. + * @returns Short human readable text. * @deprecated since app 4.0. Use CoreTime.formatTimeShort instead. */ formatTimeShort(duration: number): string { @@ -183,7 +183,7 @@ export class CoreTimeUtilsProvider { * * @param duration Duration in seconds * @param precision Number of elements to have in precision. 0 or undefined to full precission. - * @return Duration in a human readable format. + * @returns Duration in a human readable format. * @deprecated since app 4.0. Use CoreTime.formatTime instead. */ formatDuration(duration: number, precision?: number): string { @@ -194,7 +194,7 @@ export class CoreTimeUtilsProvider { * Returns duration in a short human readable format: minutes and seconds, in fromat: 3' 27''. * * @param duration Duration in seconds - * @return Duration in a short human readable format. + * @returns Duration in a short human readable format. * @deprecated since app 4.0. Use CoreTime.formatTimeShort instead. */ formatDurationShort(duration: number): string { @@ -204,7 +204,7 @@ export class CoreTimeUtilsProvider { /** * Return the current timestamp in a "readable" format: YYYYMMDDHHmmSS. * - * @return The readable timestamp. + * @returns The readable timestamp. */ readableTimestamp(): string { return moment(Date.now()).format('YYYYMMDDHHmmSS'); @@ -213,7 +213,7 @@ export class CoreTimeUtilsProvider { /** * Return the current timestamp (UNIX format, seconds). * - * @return The current timestamp in seconds. + * @returns The current timestamp in seconds. */ timestamp(): number { return Math.round(Date.now() / 1000); @@ -227,7 +227,7 @@ export class CoreTimeUtilsProvider { * @param convert If true (default), convert the format from PHP to Moment. Set it to false for Moment formats. * @param fixDay If true (default) then the leading zero from %d is removed. * @param fixHour If true (default) then the leading zero from %I is removed. - * @return Readable date. + * @returns Readable date. */ userDate(timestamp: number, format?: string, convert: boolean = true, fixDay: boolean = true, fixHour: boolean = true): string { format = Translate.instant(format ? format : 'core.strftimedaydatetime') as string; @@ -252,7 +252,7 @@ export class CoreTimeUtilsProvider { * Convert a timestamp to the format to set to a datetime input. * * @param timestamp Timestamp to convert (in ms). If not provided, current time. - * @return Formatted time. + * @returns Formatted time. */ toDatetimeFormat(timestamp?: number): string { return moment(timestamp || Date.now()).toISOString(); @@ -263,7 +263,7 @@ export class CoreTimeUtilsProvider { * * @param date To convert to timestamp. * @param applyOffset Whether to apply offset to date or not. - * @return Converted timestamp. + * @returns Converted timestamp. * @deprecated since 4.1. Use moment(date).unix() instead. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -276,7 +276,7 @@ export class CoreTimeUtilsProvider { * DO NOT USE this function for ion-datetime format. Moment escapes characters with [], but ion-datetime doesn't support it. * * @param localizedFormat Format to use. - * @return Localized ISO format + * @returns Localized ISO format */ getLocalizedDateFormat(localizedFormat: LongDateFormatKey): string { return moment.localeData().longDateFormat(localizedFormat); @@ -289,7 +289,7 @@ export class CoreTimeUtilsProvider { * for today to ensure that timezones are preserved. * * @param timestamp The timestamp to calculate from. If not defined, return today's midnight. - * @return The midnight value of the user's timestamp. + * @returns The midnight value of the user's timestamp. */ getMidnightForTimestamp(timestamp?: number): number { if (timestamp) { @@ -301,6 +301,8 @@ export class CoreTimeUtilsProvider { /** * Get the default max year for datetime inputs. + * + * @returns The maximum year for datetime inputs. */ getDatetimeDefaultMax(): string { return String(moment().year() + 20); @@ -308,6 +310,8 @@ export class CoreTimeUtilsProvider { /** * Get the default min year for datetime inputs. + * + * @returns The minimum year for datetime inputs. */ getDatetimeDefaultMin(): string { return String(moment().year() - 20); diff --git a/src/core/services/utils/url.ts b/src/core/services/utils/url.ts index 841f10b31..71ab26903 100644 --- a/src/core/services/utils/url.ts +++ b/src/core/services/utils/url.ts @@ -33,7 +33,7 @@ export class CoreUrlUtilsProvider { * Add or remove 'www' from a URL. The url needs to have http or https protocol. * * @param url URL to modify. - * @return Modified URL. + * @returns Modified URL. */ addOrRemoveWWW(url: string): string { if (url) { @@ -56,7 +56,7 @@ export class CoreUrlUtilsProvider { * @param params Object with the params to add. * @param anchor Anchor text if needed. * @param boolToNumber Whether to convert bools to 1 or 0. - * @return URL with params. + * @returns URL with params. */ addParamsToUrl(url: string, params?: Record, anchor?: string, boolToNumber?: boolean): string { // Remove any existing anchor to add the params before it. @@ -101,7 +101,7 @@ export class CoreUrlUtilsProvider { * * @param url URL. * @param text Text of the link. - * @return Link. + * @returns Link. */ buildLink(url: string, text: string): string { return '' + text + ''; @@ -113,7 +113,7 @@ export class CoreUrlUtilsProvider { * @param url URL to check. * @param siteUrl The URL of the site the URL belongs to. * @param accessKey User access key for tokenpluginfile. - * @return Whether tokenpluginfile.php can be used. + * @returns Whether tokenpluginfile.php can be used. */ canUseTokenPluginFile(url: string, siteUrl: string, accessKey?: string): boolean { // Do not use tokenpluginfile if site doesn't use slash params, the URL doesn't work. @@ -127,7 +127,7 @@ export class CoreUrlUtilsProvider { * Extracts the parameters from a URL and stores them in an object. * * @param url URL to treat. - * @return Object with the params. + * @returns Object with the params. */ extractUrlParams(url: string): CoreUrlParams { const regex = /[?&]+([^=&]+)=?([^&]*)?/gi; @@ -176,7 +176,7 @@ export class CoreUrlUtilsProvider { * @param token Token to use. * @param siteUrl The URL of the site the URL belongs to. * @param accessKey User access key for tokenpluginfile. - * @return Fixed URL. + * @returns Fixed URL. */ fixPluginfileURL(url: string, token: string, siteUrl: string, accessKey?: string): string { if (!url) { @@ -216,7 +216,7 @@ export class CoreUrlUtilsProvider { * Formats a URL, trim, lowercase, etc... * * @param url The url to be formatted. - * @return Fromatted url. + * @returns Fromatted url. */ formatURL(url: string): string { url = url.trim(); @@ -242,7 +242,7 @@ export class CoreUrlUtilsProvider { * * @param release Moodle release. * @param page Docs page to go to. - * @return Promise resolved with the Moodle docs URL. + * @returns Promise resolved with the Moodle docs URL. */ async getDocsUrl(release?: string, page: string = 'Mobile_app'): Promise { let docsUrl = 'https://docs.moodle.org/en/' + page; @@ -271,7 +271,7 @@ export class CoreUrlUtilsProvider { * Returns the Youtube Embed Video URL or null if not found. * * @param url URL - * @return Youtube Embed Video URL or null if not found. + * @returns Youtube Embed Video URL or null if not found. */ getYoutubeEmbedUrl(url?: string): string | void { if (!url) { @@ -327,7 +327,7 @@ export class CoreUrlUtilsProvider { * http://mysite.com/a/course.html?id=1 -> course.html * * @param url URL to treat. - * @return Last file without params. + * @returns Last file without params. */ getLastFileWithoutParams(url: string): string { let filename = url.substring(url.lastIndexOf('/') + 1); @@ -343,7 +343,7 @@ export class CoreUrlUtilsProvider { * E.g. http://www.google.com returns 'http'. * * @param url URL to treat. - * @return Protocol, undefined if no protocol found. + * @returns Protocol, undefined if no protocol found. */ getUrlProtocol(url: string): string | void { if (!url) { @@ -361,7 +361,7 @@ export class CoreUrlUtilsProvider { * E.g. javascript:doSomething() returns 'javascript'. * * @param url URL to treat. - * @return Scheme, undefined if no scheme found. + * @returns Scheme, undefined if no scheme found. */ getUrlScheme(url: string): string | void { if (!url) { @@ -378,7 +378,7 @@ export class CoreUrlUtilsProvider { * Gets a username from a URL like: user@mysite.com. * * @param url URL to treat. - * @return Username. Undefined if no username found. + * @returns Username. Undefined if no username found. */ getUsernameFromUrl(url: string): string | undefined { if (url.indexOf('@') > -1) { @@ -397,7 +397,7 @@ export class CoreUrlUtilsProvider { * Returns if a URL has any protocol (not a relative URL). * * @param url The url to test against the pattern. - * @return Whether the url is absolute. + * @returns Whether the url is absolute. */ isAbsoluteURL(url: string): boolean { return /^[^:]{2,}:\/\//i.test(url) || /^(tel:|mailto:|geo:)/.test(url); @@ -407,7 +407,7 @@ export class CoreUrlUtilsProvider { * Returns if a URL is downloadable: plugin file OR theme/image.php OR gravatar. * * @param url The URL to test. - * @return Whether the URL is downloadable. + * @returns Whether the URL is downloadable. */ isDownloadableUrl(url: string): boolean { return this.isPluginFileUrl(url) || this.isTokenPluginFileUrl(url) || this.isThemeImageUrl(url) || this.isGravatarUrl(url); @@ -417,7 +417,7 @@ export class CoreUrlUtilsProvider { * Returns if a URL is a gravatar URL. * * @param url The URL to test. - * @return Whether the URL is a gravatar URL. + * @returns Whether the URL is a gravatar URL. */ isGravatarUrl(url: string): boolean { return url?.indexOf('gravatar.com/avatar') !== -1; @@ -427,7 +427,7 @@ export class CoreUrlUtilsProvider { * Check if a URL uses http or https protocol. * * @param url The url to test. - * @return Whether the url uses http or https protocol. + * @returns Whether the url uses http or https protocol. */ isHttpURL(url: string): boolean { return /^https?:\/\/.+/i.test(url); @@ -437,7 +437,7 @@ export class CoreUrlUtilsProvider { * Check whether an URL belongs to a local file. * * @param url URL to check. - * @return Whether the URL belongs to a local file. + * @returns Whether the URL belongs to a local file. */ isLocalFileUrl(url: string): boolean { const urlParts = CoreUrl.parse(url); @@ -449,7 +449,7 @@ export class CoreUrlUtilsProvider { * Check whether a URL scheme belongs to a local file. * * @param scheme Scheme to check. - * @return Whether the scheme belongs to a local file. + * @returns Whether the scheme belongs to a local file. */ isLocalFileUrlScheme(scheme: string, domain: string): boolean { if (!scheme) { @@ -461,14 +461,14 @@ export class CoreUrlUtilsProvider { scheme == 'file' || scheme == 'filesystem' || scheme == CoreConstants.CONFIG.ioswebviewscheme || - (CorePlatform.isMobile() && scheme === 'http' && domain === 'localhost'); // @todo: Get served domain from ENV. + (CorePlatform.isMobile() && scheme === 'http' && domain === 'localhost'); // @todo Get served domain from ENV. } /** * Returns if a URL is a pluginfile URL. * * @param url The URL to test. - * @return Whether the URL is a pluginfile URL. + * @returns Whether the URL is a pluginfile URL. */ isPluginFileUrl(url: string): boolean { return url.indexOf('/pluginfile.php') !== -1; @@ -478,7 +478,7 @@ export class CoreUrlUtilsProvider { * Returns if a URL is a tokenpluginfile URL. * * @param url The URL to test. - * @return Whether the URL is a tokenpluginfile URL. + * @returns Whether the URL is a tokenpluginfile URL. */ isTokenPluginFileUrl(url: string): boolean { return url.indexOf('/tokenpluginfile.php') !== -1; @@ -488,7 +488,7 @@ export class CoreUrlUtilsProvider { * Returns if a URL is a theme image URL. * * @param url The URL to test. - * @return Whether the URL is a theme image URL. + * @returns Whether the URL is a theme image URL. */ isThemeImageUrl(url: string): boolean { return url?.indexOf('/theme/image.php') !== -1; @@ -498,7 +498,7 @@ export class CoreUrlUtilsProvider { * Remove protocol and www from a URL. * * @param url URL to treat. - * @return Treated URL. + * @returns Treated URL. */ removeProtocolAndWWW(url: string): string { // Remove protocol. @@ -513,7 +513,7 @@ export class CoreUrlUtilsProvider { * Remove the parameters from a URL, returning the URL without them. * * @param url URL to treat. - * @return URL without params. + * @returns URL without params. */ removeUrlParams(url: string): string { const matches = url.match(/^[^?]+/); @@ -526,7 +526,7 @@ export class CoreUrlUtilsProvider { * * @param url The url to be fixed. * @param siteUrl The URL of the site the URL belongs to. - * @return Modified URL. + * @returns Modified URL. */ unfixPluginfileURL(url: string, siteUrl?: string): string { if (!url) { diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 3bb84933a..a55bd56ff 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -65,7 +65,7 @@ export class CoreUtilsProvider { * * @param error Error object or message. * @param defaultError Message to show if the error is not a string. - * @return New error message. + * @returns New error message. */ addDataNotDownloadedError(error: Error | string, defaultError?: string): string { const errorMessage = CoreTextUtils.getErrorMessageFromError(error) || defaultError || ''; @@ -82,7 +82,7 @@ export class CoreUtilsProvider { * Similar to Promise.all, but if a promise fails this function's promise won't be rejected until ALL promises have finished. * * @param promises Promises. - * @return Promise resolved if all promises are resolved and rejected if at least 1 promise fails. + * @returns Promise resolved if all promises are resolved and rejected if at least 1 promise fails. */ async allPromises(promises: unknown[]): Promise { if (!promises || !promises.length) { @@ -109,7 +109,7 @@ export class CoreUtilsProvider { * Combination of allPromises and ignoreErrors functions. * * @param promises Promises. - * @return Promise resolved if all promises are resolved and rejected if at least 1 promise fails. + * @returns Promise resolved if all promises are resolved and rejected if at least 1 promise fails. */ async allPromisesIgnoringErrors(promises: Promise[]): Promise { await CoreUtils.ignoreErrors(this.allPromises(promises)); @@ -123,7 +123,7 @@ export class CoreUtilsProvider { * @param array The array to convert. * @param propertyName The name of the property to use as the key. If not provided, the whole item will be used. * @param result Object where to put the properties. If not defined, a new object will be created. - * @return The object. + * @returns The object. */ arrayToObject( array: T[] = [], @@ -157,7 +157,7 @@ export class CoreUtilsProvider { * @param array The array to convert. * @param propertyName The name of the property to use as the key. If not provided, the whole item will be used. * @param result Object where to put the properties. If not defined, a new object will be created. - * @return The object. + * @returns The object. */ arrayToObjectMultiple( array: T[] = [], @@ -186,7 +186,7 @@ export class CoreUtilsProvider { * @param maxLevels Number of levels to reach if 2 objects are compared. * @param level Current deep level (when comparing objects). * @param undefinedIsNull True if undefined is equal to null. Defaults to true. - * @return Whether both items are equal. + * @returns Whether both items are equal. */ basicLeftCompare( itemA: any, // eslint-disable-line @typescript-eslint/no-explicit-any @@ -238,7 +238,7 @@ export class CoreUtilsProvider { * Check if a URL has a redirect. * * @param url The URL to check. - * @return Promise resolved with boolean_ whether there is a redirect. + * @returns Promise resolved with boolean_ whether there is a redirect. */ async checkRedirect(url: string): Promise { if (!window.fetch) { @@ -282,7 +282,7 @@ export class CoreUtilsProvider { /** * Get inapp browser instance (if any). * - * @return IAB instance, undefined if not open. + * @returns IAB instance, undefined if not open. */ getInAppBrowserInstance(): InAppBrowserObject | undefined { return this.iabInstance; @@ -291,7 +291,7 @@ export class CoreUtilsProvider { /** * Check if inapp browser is open. * - * @return Whether it's open. + * @returns Whether it's open. */ isInAppBrowserOpen(): boolean { return !!this.iabInstance; @@ -302,7 +302,7 @@ export class CoreUtilsProvider { * * @param source The variable to clone. * @param level Depth we are right now inside a cloned object. It's used to prevent reaching max call stack size. - * @return Cloned variable. + * @returns Cloned variable. */ clone(source: T, level: number = 0): T { if (level >= 20) { @@ -364,7 +364,7 @@ export class CoreUtilsProvider { * Copies a text to clipboard and shows a toast message. * * @param text Text to be copied - * @return Promise resolved when text is copied. + * @returns Promise resolved when text is copied. */ async copyToClipboard(text: string): Promise { try { @@ -387,7 +387,7 @@ export class CoreUtilsProvider { * * @param message The message to include in the error. * @param needsTranslate If the message needs to be translated. - * @return Fake WS error. + * @returns Fake WS error. * @deprecated since 3.9.5. Just create the error directly. */ createFakeWSError(message: string, needsTranslate?: boolean): CoreWSError { @@ -420,7 +420,7 @@ export class CoreUtilsProvider { * Execute promises one depending on the previous. * * @param orderedPromisesData Data to be executed. - * @return Promise resolved when all promises are resolved. + * @returns Promise resolved when all promises are resolved. */ executeOrderedPromises(orderedPromisesData: OrderedPromiseData[]): Promise { const promises: Promise[] = []; @@ -458,7 +458,7 @@ export class CoreUtilsProvider { * * @param obj Object to flatten. * @param useDotNotation Whether to use dot notation '.' or square brackets '['. - * @return Flattened object. + * @returns Flattened object. */ flattenObject(obj: Record, useDotNotation?: boolean): Record { const toReturn = {}; @@ -492,7 +492,7 @@ export class CoreUtilsProvider { * * @param array Array to filter. * @param regex RegExp to apply to each string. - * @return Filtered array. + * @returns Filtered array. */ filterByRegexp(array: string[], regex: RegExp): string[] { if (!array || !array.length) { @@ -514,8 +514,7 @@ export class CoreUtilsProvider { * after 'checkAll'. * @param checkAll True if it should check all the sites, false if it should check only 1 and treat them all * depending on this result. - * @param ...args All the params sent after checkAll will be passed to isEnabledFn. - * @return Promise resolved with the list of enabled sites. + * @returns Promise resolved with the list of enabled sites. */ async filterEnabledSites

( siteIds: string[], @@ -553,7 +552,7 @@ export class CoreUtilsProvider { * Based on Moodle's format_float. * * @param float The float to print. - * @return Locale float. + * @returns Locale float. */ formatFloat(float: unknown): string { if (float === undefined || float === null || typeof float == 'boolean') { @@ -578,7 +577,7 @@ export class CoreUtilsProvider { * @param idFieldName Name of the children field to match with parent. * @param rootParentId The id of the root. * @param maxDepth Max Depth to convert to tree. Children found will be in the last level of depth. - * @return Array with the formatted tree, children will be on each node under children field. + * @returns Array with the formatted tree, children will be on each node under children field. */ formatTree( list: T[], @@ -654,7 +653,7 @@ export class CoreUtilsProvider { * Get country name based on country code. * * @param code Country code (AF, ES, US, ...). - * @return Country name. If the country is not found, return the country code. + * @returns Country name. If the country is not found, return the country code. */ getCountryName(code: string): string { const countryKey = 'assets.countries.' + code; @@ -666,7 +665,7 @@ export class CoreUtilsProvider { /** * Get list of countries with their code and translated name. * - * @return Promise resolved with the list of countries. + * @returns Promise resolved with the list of countries. */ async getCountryList(): Promise> { // Get the keys of the countries. @@ -688,7 +687,7 @@ export class CoreUtilsProvider { /** * Get list of countries with their code and translated name. Sorted by the name of the country. * - * @return Promise resolved with the list of countries. + * @returns Promise resolved with the list of countries. */ async getCountryListSorted(): Promise { // Get the keys of the countries. @@ -703,7 +702,7 @@ export class CoreUtilsProvider { /** * Get the list of language keys of the countries. * - * @return Promise resolved with the countries list. Rejected if not translated. + * @returns Promise resolved with the countries list. Rejected if not translated. */ protected async getCountryKeysList(): Promise { // It's possible that the current language isn't translated, so try with default language first. @@ -728,7 +727,7 @@ export class CoreUtilsProvider { * Get the list of language keys of the countries, based on the translation table for a certain language. * * @param lang Language to check. - * @return Promise resolved with the countries list. Rejected if not translated. + * @returns Promise resolved with the countries list. Rejected if not translated. */ protected async getCountryKeysListForLanguage(lang: string): Promise { // Get the translation table for the language. @@ -757,7 +756,7 @@ export class CoreUtilsProvider { * This function is in here instead of MimetypeUtils to prevent circular dependencies. * * @param url The URL of the file. - * @return Promise resolved with the mimetype. + * @returns Promise resolved with the mimetype. */ async getMimeTypeFromUrl(url: string): Promise { // First check if it can be guessed from the URL. @@ -778,7 +777,7 @@ export class CoreUtilsProvider { * Get a unique ID for a certain name. * * @param name The name to get the ID for. - * @return Unique ID. + * @returns Unique ID. */ getUniqueId(name: string): number { if (!this.uniqueIds[name]) { @@ -792,7 +791,7 @@ export class CoreUtilsProvider { * Check if a file is a FileEntry * * @param file File. - * @return Type guard indicating if the file is a FileEntry. + * @returns Type guard indicating if the file is a FileEntry. */ isFileEntry(file: CoreFileEntry): file is FileEntry { return 'isFile' in file; @@ -802,7 +801,7 @@ export class CoreUtilsProvider { * Check if an unknown value is a FileEntry. * * @param file Object to check. - * @return Type guard indicating if the file is a FileEntry. + * @returns Type guard indicating if the file is a FileEntry. */ valueIsFileEntry(file: unknown): file is FileEntry { // We cannot use instanceof because FileEntry is a type. Check some of the properties. @@ -814,7 +813,7 @@ export class CoreUtilsProvider { * Check if a value is an object. * * @param object Variable. - * @return Type guard indicating if this is an object. + * @returns Type guard indicating if this is an object. */ isObject(object: unknown): object is Record { return typeof object === 'object' && object !== null; @@ -824,7 +823,7 @@ export class CoreUtilsProvider { * Given a list of files, check if there are repeated names. * * @param files List of files. - * @return String with error message if repeated, false if no repeated. + * @returns String with error message if repeated, false if no repeated. */ hasRepeatedFilenames(files: CoreFileEntry[]): string | false { if (!files || !files.length) { @@ -853,7 +852,7 @@ export class CoreUtilsProvider { * * @param array Array to search. * @param regex RegExp to apply to each string. - * @return Index of the first string that matches the RegExp. -1 if not found. + * @returns Index of the first string that matches the RegExp. -1 if not found. */ indexOfRegexp(array: string[], regex: RegExp): number { if (!array || !array.length) { @@ -876,7 +875,7 @@ export class CoreUtilsProvider { * Return true if the param is false (bool), 0 (number) or "0" (string). * * @param value Value to check. - * @return Whether the value is false, 0 or "0". + * @returns Whether the value is false, 0 or "0". */ // eslint-disable-next-line @typescript-eslint/no-explicit-any isFalseOrZero(value: any): boolean { @@ -887,7 +886,7 @@ export class CoreUtilsProvider { * Return true if the param is true (bool), 1 (number) or "1" (string). * * @param value Value to check. - * @return Whether the value is true, 1 or "1". + * @returns Whether the value is true, 1 or "1". */ // eslint-disable-next-line @typescript-eslint/no-explicit-any isTrueOrOne(value: any): boolean { @@ -898,7 +897,7 @@ export class CoreUtilsProvider { * Given an error returned by a WS call, check if the error is generated by the app or it has been returned by the WebService. * * @param error Error to check. - * @return Whether the error was returned by the WebService. + * @returns Whether the error was returned by the WebService. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any isWebServiceError(error: any): boolean { @@ -919,7 +918,7 @@ export class CoreUtilsProvider { * Given an error returned by a WS call, check if the error is a token expired error. * * @param error Error to check. - * @return Whether the error is a token expired error. + * @returns Whether the error is a token expired error. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any isExpiredTokenError(error: any): boolean { @@ -935,7 +934,7 @@ export class CoreUtilsProvider { * @param defaultLabel Element that will become default option, if not defined, it won't be added. * @param separator The separator used within the list string. Default ','. * @param defaultValue Element that will become default option value. Default 0. - * @return The now assembled array + * @returns The now assembled array */ makeMenuFromList( list: string, @@ -965,7 +964,7 @@ export class CoreUtilsProvider { * @param array1 The first array. * @param array2 The second array. * @param [key] Key of the property that must be unique. If not specified, the whole entry. - * @return Merged array. + * @returns Merged array. */ mergeArraysWithoutDuplicates(array1: T[], array2: T[], key?: string): T[] { return this.uniqueArray(array1.concat(array2), key) as T[]; @@ -975,7 +974,7 @@ export class CoreUtilsProvider { * Check if a value isn't null or undefined. * * @param value Value to check. - * @return True if not null and not undefined. + * @returns True if not null and not undefined. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any notNullOrUndefined(value: any): boolean { @@ -987,7 +986,7 @@ export class CoreUtilsProvider { * * @param path The local path of the file to be open. * @param options Options. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ async openFile(path: string, options: CoreUtilsOpenFileOptions = {}): Promise { // Convert the path to a native path if needed. @@ -1058,7 +1057,7 @@ export class CoreUtilsProvider { * * @param url The URL to open. * @param options Override default options passed to InAppBrowser. - * @return The opened window. + * @returns The opened window. */ openInApp(url: string, options?: InAppBrowserOptions): InAppBrowserObject { options = options || {}; @@ -1125,7 +1124,7 @@ export class CoreUtilsProvider { * Given some IAB options, set the toolbar colors properties to the right values. * * @param options Options to change. - * @return Changed options. + * @returns Changed options. */ protected setInAppBrowserToolbarColors(options: InAppBrowserOptions): InAppBrowserOptions { if (options.toolbarcolor) { @@ -1188,7 +1187,7 @@ export class CoreUtilsProvider { * Specially useful for audio and video since they can be streamed. * * @param url The URL of the file. - * @return Promise resolved when opened. + * @returns Promise resolved when opened. */ async openOnlineFile(url: string): Promise { if (CoreApp.isAndroid()) { @@ -1222,7 +1221,7 @@ export class CoreUtilsProvider { * Converts an object into an array, losing the keys. * * @param obj Object to convert. - * @return Array with the values of the object but losing the keys. + * @returns Array with the values of the object but losing the keys. */ objectToArray(obj: Record): T[] { return Object.keys(obj).map((key) => obj[key]); @@ -1238,7 +1237,7 @@ export class CoreUtilsProvider { * @param valueName Name of the properties where to store the values. * @param sortByKey True to sort keys alphabetically, false otherwise. Has priority over sortByValue. * @param sortByValue True to sort values alphabetically, false otherwise. - * @return Array of objects with the name & value of each property. + * @returns Array of objects with the name & value of each property. */ objectToArrayOfObjects< A extends Record = Record, @@ -1307,7 +1306,7 @@ export class CoreUtilsProvider { * @param keyName Name of the properties where the keys are stored. * @param valueName Name of the properties where the values are stored. * @param keyPrefix Key prefix if neededs to delete it. - * @return Object. + * @returns Object. */ objectToKeyValueMap( objects: Record[], @@ -1335,7 +1334,7 @@ export class CoreUtilsProvider { * * @param object Object to convert. * @param removeEmpty Whether to remove params whose value is null/undefined. - * @return GET params. + * @returns GET params. */ objectToGetParams(object: Record, removeEmpty: boolean = true): string { // First of all, flatten the object so all properties are in the first level. @@ -1366,7 +1365,7 @@ export class CoreUtilsProvider { * * @param data Object. * @param prefix Prefix to add. - * @return Prefixed object. + * @returns Prefixed object. */ prefixKeys(data: Record, prefix: string): Record { const newObj = {}; @@ -1381,6 +1380,9 @@ export class CoreUtilsProvider { /** * Function to enumerate enum keys. + * + * @param enumeration Enumeration object. + * @returns Keys of the enumeration. */ enumKeys(enumeration: O): K[] { return Object.keys(enumeration).filter(k => Number.isNaN(+k)) as K[]; @@ -1389,7 +1391,7 @@ export class CoreUtilsProvider { /** * Create a deferred promise that can be resolved or rejected explicitly. * - * @return The deferred promise. + * @returns The deferred promise. * @deprecated since app 4.1. Use CorePromisedValue instead. */ promiseDefer(): CorePromisedValue { @@ -1400,7 +1402,7 @@ export class CoreUtilsProvider { * Given a promise, returns true if it's rejected or false if it's resolved. * * @param promise Promise to check - * @return Promise resolved with boolean: true if the promise is rejected or false if it's resolved. + * @returns Promise resolved with boolean: true if the promise is rejected or false if it's resolved. */ async promiseFails(promise: Promise): Promise { try { @@ -1416,7 +1418,7 @@ export class CoreUtilsProvider { * Given a promise, returns true if it's resolved or false if it's rejected. * * @param promise Promise to check - * @return Promise resolved with boolean: true if the promise it's resolved or false if it's rejected. + * @returns Promise resolved with boolean: true if the promise it's resolved or false if it's rejected. */ async promiseWorks(promise: Promise): Promise { try { @@ -1436,7 +1438,7 @@ export class CoreUtilsProvider { * @param obj1 The first object or array. * @param obj2 The second object or array. * @param key Key to check. - * @return Whether the two objects/arrays have the same value (or lack of one) for a given key. + * @returns Whether the two objects/arrays have the same value (or lack of one) for a given key. */ sameAtKeyMissingIsBlank( obj1: Record | unknown[], @@ -1461,7 +1463,7 @@ export class CoreUtilsProvider { * {b: 2, a: 1} -> '{"a":1,"b":2}' * * @param obj Object to stringify. - * @return Stringified object. + * @returns Stringified object. */ sortAndStringify(obj: Record): string { return JSON.stringify(this.sortProperties(obj)); @@ -1471,7 +1473,7 @@ export class CoreUtilsProvider { * Given an object, sort its properties and the properties of all the nested objects. * * @param obj The object to sort. If it isn't an object, the original value will be returned. - * @return Sorted object. + * @returns Sorted object. */ sortProperties(obj: T): T { if (obj != null && typeof obj == 'object' && !Array.isArray(obj)) { @@ -1491,7 +1493,7 @@ export class CoreUtilsProvider { * Given an object, sort its values. Values need to be primitive values, it cannot have subobjects. * * @param obj The object to sort. If it isn't an object, the original value will be returned. - * @return Sorted object. + * @returns Sorted object. */ sortValues(obj: T): T { if (typeof obj == 'object' && !Array.isArray(obj)) { @@ -1510,7 +1512,7 @@ export class CoreUtilsProvider { * * @param promise The promise to timeout. * @param time Number of milliseconds of the timeout. - * @return Promise with the timeout. + * @returns Promise with the timeout. */ timeoutPromise(promise: Promise, time: number): Promise { return new Promise((resolve, reject): void => { @@ -1543,7 +1545,7 @@ export class CoreUtilsProvider { * * @param localeFloat Locale aware float representation. * @param strict If true, then check the input and return false if it is not a valid number. - * @return False if bad format, empty string if empty value or the parsed float if not. + * @returns False if bad format, empty string if empty value or the parsed float if not. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any unformatFloat(localeFloat: any, strict?: boolean): false | '' | number { @@ -1583,7 +1585,7 @@ export class CoreUtilsProvider { * * @param array The array to treat. * @param [key] Key of the property that must be unique. If not specified, the whole entry. - * @return Array without duplicate values. + * @returns Array without duplicate values. */ uniqueArray(array: T[], key?: string): T[] { const unique = {}; // Use an object to make it faster to check if it's duplicate. @@ -1606,7 +1608,7 @@ export class CoreUtilsProvider { * * @param fn Function to debounce. * @param delay Time that must pass until the function is called. - * @return Debounced function. + * @returns Debounced function. */ debounce(fn: (...args: T) => unknown, delay: number): (...args: T) => void { let timeoutID: number; @@ -1625,7 +1627,7 @@ export class CoreUtilsProvider { * * @param fn Function to throttle. * @param duration Time that must pass until the function is called. - * @return Throttled function. + * @returns Throttled function. */ throttle(fn: (...args: T) => unknown, duration: number): (...args: T) => void { let shouldWait = false; @@ -1648,7 +1650,7 @@ export class CoreUtilsProvider { /** * Check whether the app can scan QR codes. * - * @return Whether the app can scan QR codes. + * @returns Whether the app can scan QR codes. */ canScanQR(): boolean { return CorePlatform.isMobile(); @@ -1658,7 +1660,7 @@ export class CoreUtilsProvider { * Open a modal to scan a QR code. * * @param title Title of the modal. Defaults to "QR reader". - * @return Promise resolved with the captured text or undefined if cancelled or error. + * @returns Promise resolved with the captured text or undefined if cancelled or error. */ async scanQR(title?: string): Promise { return CoreDomUtils.openModal({ @@ -1673,7 +1675,7 @@ export class CoreUtilsProvider { /** * Start scanning for a QR code. * - * @return Promise resolved with the QR string, rejected if error or cancelled. + * @returns Promise resolved with the QR string, rejected if error or cancelled. */ async startScanQR(): Promise { if (!CorePlatform.isMobile()) { @@ -1769,7 +1771,7 @@ export class CoreUtilsProvider { * * @param promise Promise to ignore errors. * @param fallback Value to return if the promise is rejected. - * @return Promise with ignored errors, resolving to the fallback result if provided. + * @returns Promise with ignored errors, resolving to the fallback result if provided. */ async ignoreErrors(promise: Promise): Promise; async ignoreErrors(promise: Promise, fallback: Fallback): Promise; @@ -1788,7 +1790,7 @@ export class CoreUtilsProvider { * Wait some time. * * @param milliseconds Number of milliseconds to wait. - * @return Promise resolved after the time has passed. + * @returns Promise resolved after the time has passed. */ wait(milliseconds: number): Promise { return new Promise(resolve => setTimeout(resolve, milliseconds)); @@ -1796,6 +1798,8 @@ export class CoreUtilsProvider { /** * Wait until the next tick. + * + * @returns Promise resolved when tick has been done. */ nextTick(): Promise { return this.wait(0); @@ -1814,7 +1818,7 @@ export class CoreUtilsProvider { * Given some options, check if a file should be opened with showOpenWithDialog. * * @param options Options. - * @return Boolean. + * @returns Boolean. */ shouldOpenWithDialog(options: CoreUtilsOpenFileOptions = {}): boolean { const openFileAction = options.iOSOpenFileAction ?? CoreConstants.CONFIG.iOSDefaultOpenFileAction; diff --git a/src/core/services/ws.ts b/src/core/services/ws.ts index 887473db0..f9e1abafe 100644 --- a/src/core/services/ws.ts +++ b/src/core/services/ws.ts @@ -67,7 +67,7 @@ export class CoreWSProvider { * @param siteUrl Complete site url to perform the call. * @param data Arguments to pass to the method. * @param preSets Extra settings and information. - * @return Deferred promise resolved with the response data in success and rejected with the error if it fails. + * @returns Deferred promise resolved with the response data in success and rejected with the error if it fails. */ protected addToRetryQueue( method: string, @@ -94,7 +94,7 @@ export class CoreWSProvider { * @param method The WebService method to be called. * @param data Arguments to pass to the method. It's recommended to call convertValuesToString before passing the data. * @param preSets Extra settings and information. - * @return Promise resolved with the response data in success and rejected if it fails. + * @returns Promise resolved with the response data in success and rejected if it fails. */ call(method: string, data: Record, preSets: CoreWSPreSets): Promise { if (!preSets) { @@ -130,7 +130,7 @@ export class CoreWSProvider { * @param method The WebService method to be called. * @param data Arguments to pass to the method. * @param preSets Extra settings and information. Only some - * @return Promise resolved with the response data in success and rejected with CoreAjaxError. + * @returns Promise resolved with the response data in success and rejected with CoreAjaxError. */ callAjax(method: string, data: Record, preSets: CoreWSAjaxPreSets): Promise { const cacheParams = { @@ -154,7 +154,7 @@ export class CoreWSProvider { * * @param data The data that needs all the non-object values set to strings. * @param stripUnicode If Unicode long chars need to be stripped. - * @return The cleaned object or null if some strings becomes empty after stripping Unicode. + * @returns The cleaned object or null if some strings becomes empty after stripping Unicode. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any convertValuesToString(data: any, stripUnicode?: boolean): any { @@ -213,7 +213,7 @@ export class CoreWSProvider { * @param message The message to include in the error. * @param needsTranslate If the message needs to be translated. * @param translateParams Translation params, if needed. - * @return Fake WS error. + * @returns Fake WS error. * @deprecated since 3.9.5. Just create the error directly. */ createFakeWSError(message: string, needsTranslate?: boolean, translateParams?: {[name: string]: string}): CoreError { @@ -247,7 +247,7 @@ export class CoreWSProvider { * @param path Local path to store the file. * @param addExtension True if extension need to be added to the final path. * @param onProgress Function to call on progress. - * @return Promise resolved with the downloaded file. + * @returns Promise resolved with the downloaded file. */ async downloadFile( url: string, @@ -328,6 +328,7 @@ export class CoreWSProvider { * @param method Method of the HTTP request. * @param url Base URL of the HTTP request. * @param params Params of the HTTP request. + * @returns the on going call if any. */ protected getPromiseHttp(method: string, url: string, params?: Record): Promise | undefined { const queueItemId = this.getQueueItemId(method, url, params); @@ -341,7 +342,7 @@ export class CoreWSProvider { * * @param url File URL. * @param ignoreCache True to ignore cache, false otherwise. - * @return Promise resolved with the mimetype or '' if failure. + * @returns Promise resolved with the mimetype or '' if failure. */ async getRemoteFileMimeType(url: string, ignoreCache?: boolean): Promise { const cachedMimeType = this.mimeTypeCache[url]; @@ -370,7 +371,7 @@ export class CoreWSProvider { * Perform a HEAD request to get the size of a remote file. * * @param url File URL. - * @return Promise resolved with the size or -1 if failure. + * @returns Promise resolved with the size or -1 if failure. */ getRemoteFileSize(url: string): Promise { return this.performHead(url).then((response) => { @@ -388,7 +389,7 @@ export class CoreWSProvider { /** * Get a request timeout based on the network connection. * - * @return Timeout in ms. + * @returns Timeout in ms. */ getRequestTimeout(): number { return CoreNetwork.isNetworkAccessLimited() ? CoreConstants.WS_TIMEOUT : CoreConstants.WS_TIMEOUT_WIFI; @@ -400,7 +401,7 @@ export class CoreWSProvider { * @param method Method of the HTTP request. * @param url Base URL of the HTTP request. * @param params Params of the HTTP request. - * @return Queue item ID. + * @returns Queue item ID. */ protected getQueueItemId(method: string, url: string, params?: Record): string { if (params) { @@ -416,7 +417,7 @@ export class CoreWSProvider { * @param method The WebService method to be called. * @param data Arguments to pass to the method. * @param preSets Extra settings and information. Only some - * @return Promise resolved with the response data in success and rejected with CoreAjaxError. + * @returns Promise resolved with the response data in success and rejected with CoreAjaxError. */ protected performAjax(method: string, data: Record, preSets: CoreWSAjaxPreSets): Promise { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -531,7 +532,7 @@ export class CoreWSProvider { * Perform a HEAD request and save the promise while waiting to be resolved. * * @param url URL to perform the request. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ performHead(url: string): Promise> { let promise = this.getPromiseHttp>('head', url); @@ -555,7 +556,7 @@ export class CoreWSProvider { * @param siteUrl Complete site url to perform the call. * @param ajaxData Arguments to pass to the method. * @param preSets Extra settings and information. - * @return Promise resolved with the response data in success and rejected with CoreWSError if it fails. + * @returns Promise resolved with the response data in success and rejected with CoreWSError if it fails. */ async performPost( method: string, @@ -604,7 +605,7 @@ export class CoreWSProvider { * * @param object1 First object. * @param object2 Second object. - * @return First object with items added. + * @returns First object with items added. */ protected combineObjectsArrays(object1: T, object2: T): T { for (const name in object2) { @@ -626,7 +627,7 @@ export class CoreWSProvider { * @param ajaxData Arguments to pass to the method. * @param preSets Extra settings and information. * @param options Request options. - * @return Promise resolved with the response data in success and rejected with CoreWSError if it fails. + * @returns Promise resolved with the response data in success and rejected with CoreWSError if it fails. */ protected performSinglePost( method: string, @@ -780,7 +781,7 @@ export class CoreWSProvider { * @param method Method of the HTTP request. * @param url Base URL of the HTTP request. * @param params Params of the HTTP request. - * @return The promise saved. + * @returns The promise saved. */ protected setPromiseHttp( promise: Promise, @@ -812,8 +813,7 @@ export class CoreWSProvider { * @param method The WebService method to be called. * @param data Arguments to pass to the method. * @param preSets Extra settings and information. - * @return Promise resolved with the response data in success and rejected with the error message if it fails. - * @return Request response. + * @returns Promise resolved with the response data in success and rejected with the error message if it fails. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any syncCall(method: string, data: any, preSets: CoreWSPreSets): T { @@ -891,7 +891,7 @@ export class CoreWSProvider { * @param options File upload options. * @param preSets Must contain siteUrl and wsToken. * @param onProgress Function to call on progress. - * @return Promise resolved when uploaded. + * @returns Promise resolved when uploaded. */ async uploadFile( filePath: string, @@ -991,7 +991,7 @@ export class CoreWSProvider { * * @param error Original error. * @param status Status code (if any). - * @return CoreHttpError. + * @returns CoreHttpError. */ protected createHttpError(error: CoreTextErrorObject, status: number): CoreHttpError { const message = CoreTextUtils.buildSeveralParagraphsMessage([ @@ -1008,7 +1008,7 @@ export class CoreWSProvider { * Perform an HTTP request requesting for a text response. * * @param url Url to get. - * @return Resolved with the text when done. + * @returns Resolved with the text when done. */ async getText(url: string): Promise { // Fetch the URL content. @@ -1033,7 +1033,7 @@ export class CoreWSProvider { * * @param url URL of the request. * @param options Options for the request. - * @return Promise resolved with the response. + * @returns Promise resolved with the response. */ async sendHTTPRequest(url: string, options: HttpRequestOptions): Promise> { // Set default values. @@ -1113,7 +1113,7 @@ export class CoreWSProvider { * Check if a URL works (it returns a 2XX status). * * @param url URL to check. - * @return Promise resolved with boolean: whether it works. + * @returns Promise resolved with boolean: whether it works. */ async urlWorks(url: string): Promise { try { @@ -1130,7 +1130,7 @@ export class CoreWSProvider { * * @param siteUrl Site url. * @param options Error options. - * @return Cannot connect error. + * @returns Cannot connect error. */ protected async createCannotConnectSiteError( siteUrl: string, diff --git a/src/core/singletons/array.ts b/src/core/singletons/array.ts index 5ed86de9b..9cae5fa13 100644 --- a/src/core/singletons/array.ts +++ b/src/core/singletons/array.ts @@ -22,7 +22,7 @@ export class CoreArray { * * @param arr Array. * @param item Item. - * @return Whether item is within the array. + * @returns Whether item is within the array. * @deprecated since 4.1. Use arr.includes() instead. */ static contains(arr: T[], item: T): boolean { @@ -38,7 +38,7 @@ export class CoreArray { * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat#reduce_and_concat * * @param arr Original array. - * @return Flattened array. + * @returns Flattened array. */ static flatten(arr: T[][]): T[] { return ( []).concat(...arr); @@ -49,7 +49,7 @@ export class CoreArray { * * @param arr Array. * @param item Item to remove. - * @return Array without the specified item. + * @returns Array without the specified item. */ static withoutItem(arr: T[], item: T): T[] { const newArray = [...arr]; diff --git a/src/core/singletons/browser.ts b/src/core/singletons/browser.ts index c4138c07b..5ff1d3dde 100644 --- a/src/core/singletons/browser.ts +++ b/src/core/singletons/browser.ts @@ -53,7 +53,7 @@ export class CoreBrowser { * Read a cookie. * * @param name Cookie name. - * @return Cookie value. + * @returns Cookie value. */ static getCookie(name: string): string | null { const cookies = (document.cookie ?? '').split(';').reduce((cookies, cookie) => { @@ -71,7 +71,7 @@ export class CoreBrowser { * Read a localStorage key. * * @param key localStorage key. - * @return localStorage value. + * @returns localStorage value. */ static getLocalStorage(key: string): string | null { return localStorage.getItem(key); @@ -118,6 +118,7 @@ export class CoreBrowser { * Get development setting key. * * @param name Development setting name. + * @returns THe development setting key. */ protected static getDevelopmentSettingKey(name: string): string { return `MoodleApp${name}`; diff --git a/src/core/singletons/colors.ts b/src/core/singletons/colors.ts index a208fc0d1..44affaa59 100644 --- a/src/core/singletons/colors.ts +++ b/src/core/singletons/colors.ts @@ -46,7 +46,7 @@ export class CoreColors { * Returns better contrast color. * * @param color Black or white texts. - * @return True if white contrasts better than black. False otherwise. + * @returns True if white contrasts better than black. False otherwise. */ static isWhiteContrastingBetter(color: string): boolean { return CoreColors.luma(color) < 165; @@ -56,7 +56,7 @@ export class CoreColors { * Returns the same color % darker. * * @param color Color to get darker. - * @return Darker Hex RGB color. + * @returns Darker Hex RGB color. */ static darker(color: string, percent: number = 48): string { const inversePercent = 1 - (percent / 100); @@ -72,7 +72,7 @@ export class CoreColors { * Returns the same color % lighter. * * @param color Color to get lighter. - * @return Lighter Hex RGB color. + * @returns Lighter Hex RGB color. */ static lighter(color: string, percent: number = 80): string { percent = percent / 100; @@ -90,7 +90,7 @@ export class CoreColors { * Returns the hex code from any color css type (ie named). * * @param color Color in any format. - * @return Color in hex format. + * @returns Color in hex format. */ static getColorHex(color: string): string { const rgba = CoreColors.getColorRGBA(color); @@ -109,7 +109,7 @@ export class CoreColors { * Returns RGBA color from any color format. * * @param color Color in any format. - * @return Red, green, blue and alpha. + * @returns Red, green, blue and alpha. */ static getColorRGBA(color: string): number[] { if (!color.match(/rgba?\(.*\)/)) { @@ -131,7 +131,7 @@ export class CoreColors { * Gets the luma of a color. * * @param color Hex RGB color. - * @return Luma number based on SMPTE C, Rec. 709 weightings. + * @returns Luma number based on SMPTE C, Rec. 709 weightings. */ protected static luma(color: string): number { const rgb = CoreColors.hexToRGB(color); @@ -143,7 +143,7 @@ export class CoreColors { * Converts Hex RGB to Color components. * * @param color Hexadec RGB Color. - * @return RGB color components. + * @returns RGB color components. */ static hexToRGB(color: string): ColorComponents { if (color.charAt(0) == '#') { @@ -168,7 +168,7 @@ export class CoreColors { * Converts RGB components to Hex string. * * @param color Color components. - * @return RGB color in string. + * @returns RGB color in string. */ protected static RGBToHex(color: ColorComponents): string { return '#' + CoreColors.componentToHex(color.red) + @@ -181,7 +181,7 @@ export class CoreColors { * Converts a color component from decimal to hexadec. * * @param c color component in decimal. - * @return Hexadec of the color component. + * @returns Hexadec of the color component. */ protected static componentToHex(c: number): string { return ('0' + c.toString(16)).slice(-2); @@ -190,7 +190,7 @@ export class CoreColors { /** * Get the toolbar's current background color. * - * @return Color in hex format. + * @returns Color in hex format. */ static getToolbarBackgroundColor(): string { const element = document.querySelector('ion-header ion-toolbar'); diff --git a/src/core/singletons/components-registry.ts b/src/core/singletons/components-registry.ts index 0a5e18cea..d79e9ca9e 100644 --- a/src/core/singletons/components-registry.ts +++ b/src/core/singletons/components-registry.ts @@ -72,7 +72,7 @@ export class CoreComponentsRegistry { * * @param element Root element. * @param componentClass Component class. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ static async waitComponentReady( element: Element | null, @@ -94,7 +94,7 @@ export class CoreComponentsRegistry { * @param element Element where to search. * @param selector Selector to search on parent. * @param componentClass Component class. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ static async waitComponentsReady( element: Element, diff --git a/src/core/singletons/dom.ts b/src/core/singletons/dom.ts index 357fd6264..262e65ebe 100644 --- a/src/core/singletons/dom.ts +++ b/src/core/singletons/dom.ts @@ -32,7 +32,7 @@ export class CoreDom { * * @param node DOM Element. * @param selector Selector to search. - * @return Closest ancestor or null if not found. + * @returns Closest ancestor or null if not found. */ static closest(node: HTMLElement | Node | null, selector: string): T | null { if (!node) { @@ -59,7 +59,7 @@ export class CoreDom { * * @param element Element to get the position. * @param parent Parent element to get relative position. - * @return X and Y position. + * @returns X and Y position. */ static getRelativeElementPosition(element: HTMLElement, parent: HTMLElement): CoreCoordinates { // Get the top, left coordinates of two elements @@ -77,7 +77,7 @@ export class CoreDom { * Check whether an element has been added to the DOM. * * @param element Element. - * @return True if element has been added to the DOM, false otherwise. + * @returns True if element has been added to the DOM, false otherwise. */ static isElementInDom(element: HTMLElement): boolean { return element.getRootNode({ composed: true }) === document; @@ -86,9 +86,9 @@ export class CoreDom { /** * Check whether an element is intersecting the intersectionRatio in viewport. * - * @param element + * @param element Element to check. * @param intersectionRatio Intersection ratio (From 0 to 1). - * @return True if in viewport. + * @returns True if in viewport. */ static isElementInViewport(element: HTMLElement, intersectionRatio = 1): boolean { const elementRectangle = element.getBoundingClientRect(); @@ -116,7 +116,7 @@ export class CoreDom { * * @param element Element. * @param checkSize Wether to check size to check for visibility. - * @return True if element is visible inside the DOM. + * @returns True if element is visible inside the DOM. */ static isElementVisible(element: HTMLElement, checkSize = true): boolean { if (checkSize && (element.clientWidth === 0 || element.clientHeight === 0)) { @@ -184,7 +184,7 @@ export class CoreDom { * * @param resizeFunction Function to execute on resize. * @param debounceDelay Debounce time in ms. - * @return Event observer to call off when finished. + * @returns Event observer to call off when finished. */ static onWindowResize(resizeFunction: (ev?: Event) => void, debounceDelay = 20): CoreEventObserver { const resizeListener = CoreUtils.debounce(async (ev?: Event) => { @@ -208,7 +208,7 @@ export class CoreDom { * @param element The element to scroll to. * @param selector Selector to find the element to scroll to inside the defined element. * @param scrollOptions Scroll Options. - * @return Wether the scroll suceeded. + * @returns Wether the scroll suceeded. */ static async scrollToElement(element: HTMLElement, selector?: string, scrollOptions: CoreScrollOptions = {}): Promise { if (selector) { @@ -253,7 +253,7 @@ export class CoreDom { * Search for an input with error (core-input-error directive) and scrolls to it if found. * * @param container The element that contains the element that must be scrolled. - * @return True if the element is found, false otherwise. + * @returns True if the element is found, false otherwise. */ static async scrollToInputError(container: HTMLElement): Promise { return CoreDom.scrollToElement(container, '.core-input-error'); @@ -264,7 +264,7 @@ export class CoreDom { * * @param scrollElement Scroll Element. * @param marginError Error margin when calculating. - * @return Wether the scroll reached the bottom. + * @returns Wether the scroll reached the bottom. */ static scrollIsBottom(scrollElement?: HTMLElement, marginError = 0): boolean { if (!scrollElement) { @@ -279,7 +279,7 @@ export class CoreDom { * * @param element HTML Element. * @param slot Slot name. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ static slotOnContent(element: HTMLElement, slot = 'fixed'): CoreCancellablePromise { element.setAttribute('slot', slot); @@ -310,7 +310,7 @@ export class CoreDom { * Wait an element to be added to the root DOM. * * @param element Element to wait. - * @return Cancellable promise. + * @returns Cancellable promise. */ static waitToBeInDOM(element: HTMLElement): CoreCancellablePromise { const root = element.getRootNode({ composed: true }); @@ -347,7 +347,7 @@ export class CoreDom { * Wait an element to be in dom of another element using a selector * * @param container Element to wait. - * @return Cancellable promise. + * @returns Cancellable promise. */ static async waitToBeInsideElement(container: HTMLElement, selector: string): Promise> { await CoreDom.waitToBeInDOM(container); @@ -387,7 +387,7 @@ export class CoreDom { * @param element Element to watch. * @param intersectionRatio Intersection ratio (From 0 to 1). * @param callback Callback when visibility changes. - * @return Function to stop watching. + * @returns Function to stop watching. */ static watchElementInViewport( element: HTMLElement, @@ -400,7 +400,7 @@ export class CoreDom { * * @param element Element to watch. * @param callback Callback when visibility changes. - * @return Function to stop watching. + * @returns Function to stop watching. */ static watchElementInViewport(element: HTMLElement, callback: (visible: boolean) => void): () => void; @@ -442,7 +442,7 @@ export class CoreDom { * * @param element Element to wait. * @param intersectionRatio Intersection ratio (From 0 to 1). - * @return Cancellable promise. + * @returns Cancellable promise. */ static waitToBeInViewport(element: HTMLElement, intersectionRatio = 1): CoreCancellablePromise { let unsubscribe: (() => void) | undefined; @@ -477,7 +477,7 @@ export class CoreDom { * * @param element Element to wait. * @param checkSize Wether to check size to check for visibility. - * @return Cancellable promise. + * @returns Cancellable promise. */ static waitToBeVisible(element: HTMLElement, checkSize = true): CoreCancellablePromise { const domPromise = CoreDom.waitToBeInDOM(element); diff --git a/src/core/singletons/events.ts b/src/core/singletons/events.ts index 2409a5dd3..fb1a9c33a 100644 --- a/src/core/singletons/events.ts +++ b/src/core/singletons/events.ts @@ -137,7 +137,7 @@ export class CoreEvents { * @param eventName Name of the event to listen to. * @param callBack Function to call when the event is triggered. * @param siteId Site where to trigger the event. Undefined won't check the site. - * @return Observer to stop listening. + * @returns Observer to stop listening. */ static on( eventName: Event, @@ -190,7 +190,7 @@ export class CoreEvents { * @param eventName Name of the event to listen to. * @param callBack Function to call when the event is triggered. * @param siteId Site where to trigger the event. Undefined won't check the site. - * @return Observer to stop listening. + * @returns Observer to stop listening. */ static once( eventName: Event, @@ -214,7 +214,7 @@ export class CoreEvents { * @param eventNames Names of the events to listen to. * @param callBack Function to call when any of the events is triggered. * @param siteId Site where to trigger the event. Undefined won't check the site. - * @return Observer to stop listening. + * @returns Observer to stop listening. */ static onMultiple(eventNames: string[], callBack: (value: T) => void, siteId?: string): CoreEventObserver { const observers = eventNames.map((name) => this.on(name, callBack, siteId)); @@ -232,7 +232,7 @@ export class CoreEvents { /** * Triggers an event, notifying all the observers. * - * @param event Name of the event to trigger. + * @param eventName Name of the event to trigger. * @param data Data to pass to the observers. * @param siteId Site where to trigger the event. Undefined means no Site. */ @@ -253,7 +253,7 @@ export class CoreEvents { /** * Triggers a unique event, notifying all the observers. If the event has already been triggered, don't do anything. * - * @param event Name of the event to trigger. + * @param eventName Name of the event to trigger. * @param data Data to pass to the observers. * @param siteId Site where to trigger the event. Undefined means no Site. */ diff --git a/src/core/singletons/form.ts b/src/core/singletons/form.ts index 50d9e222e..5cdc0d77c 100644 --- a/src/core/singletons/form.ts +++ b/src/core/singletons/form.ts @@ -26,7 +26,7 @@ export class CoreForms { * Get the data from a form. It will only collect elements that have a name. * * @param form The form to get the data from. - * @return Object with the data. The keys are the names of the inputs. + * @returns Object with the data. The keys are the names of the inputs. */ static getDataFromForm(form: HTMLFormElement): CoreFormFields { if (!form || !form.elements) { diff --git a/src/core/singletons/index.ts b/src/core/singletons/index.ts index ebaf9f791..acc10439c 100644 --- a/src/core/singletons/index.ts +++ b/src/core/singletons/index.ts @@ -75,6 +75,8 @@ const singletonsInjector = new CorePromisedValue(); /** * Helper to create a method that proxies calls to the underlying singleton instance. + * + * @returns Function. */ // eslint-disable-next-line let createSingletonMethodProxy = (instance: any, method: Function, property: string | number | symbol) => method.bind(instance); @@ -118,7 +120,7 @@ export function setCreateSingletonMethodProxy(method: typeof createSingletonMeth * * @param injectionToken Injection token used to resolve the service. This is usually the service class if the provider was * defined using a class or the string used in the `provide` key if it was defined using an object. - * @return Singleton proxy. + * @returns Singleton proxy. */ export function makeSingleton( // eslint-disable-line @typescript-eslint/ban-types injectionToken: Type | AbstractType | Type | string, diff --git a/src/core/singletons/logger.ts b/src/core/singletons/logger.ts index e7520c050..12314cafc 100644 --- a/src/core/singletons/logger.ts +++ b/src/core/singletons/logger.ts @@ -64,7 +64,7 @@ export class CoreLogger { * Get a logger instance for a certain class, service or component. * * @param className Name to use in the messages. - * @return Instance. + * @returns Instance. */ static getInstance(className: string): CoreLogger { // Disable log on production and testing. @@ -103,7 +103,7 @@ export class CoreLogger { * * @param logFn Log function to use. * @param className Name to use in the messages. - * @return Prepared function. + * @returns Prepared function. */ private static prepareLogFn(logFn: LogFunction, className: string): LogFunction { // Return our own function that will call the logging function with the treated message. diff --git a/src/core/singletons/math.ts b/src/core/singletons/math.ts index 1c32c947f..af51906ae 100644 --- a/src/core/singletons/math.ts +++ b/src/core/singletons/math.ts @@ -23,7 +23,7 @@ export class CoreMath { * @param value Original value. * @param min Minimum value. * @param max Maximum value. - * @return Clamped value. + * @returns Clamped value. */ static clamp(value: number, min: number, max: number): number { return Math.min(Math.max(value, min), max); diff --git a/src/core/singletons/object.ts b/src/core/singletons/object.ts index a3d2b9797..e89b0e0ff 100644 --- a/src/core/singletons/object.ts +++ b/src/core/singletons/object.ts @@ -35,7 +35,7 @@ export class CoreObject { * * @param a First object. * @param b Second object. - * @return Whether objects are equal. + * @returns Whether objects are equal. */ static deepEquals(a: T, b: T): boolean { return JSON.stringify(a) === JSON.stringify(b); @@ -45,7 +45,7 @@ export class CoreObject { * Get all the properties names of an object, including the inherited ones except the ones from Object.prototype. * * @param object Object to get its properties. - * @return Set of property names. + * @returns Set of property names. */ static getAllPropertyNames(object: unknown): Set { if (typeof object !== 'object' || object === null || object === Object.prototype) { @@ -64,7 +64,7 @@ export class CoreObject { * Check whether the given object is empty. * * @param object Object. - * @return Whether the given object is empty. + * @returns Whether the given object is empty. */ static isEmpty(object: Record): boolean { return Object.keys(object).length === 0; @@ -75,7 +75,7 @@ export class CoreObject { * * @param obj Object. * @param keysOrRegex If array is supplied, keys to include. Otherwise, regular expression used to filter keys. - * @return New object with only the specified keys. + * @returns New object with only the specified keys. */ static only(obj: T, keys: K[]): Pick; static only(obj: T, regex: RegExp): Partial; @@ -104,7 +104,7 @@ export class CoreObject { * * @param obj Object. * @param keys Keys to remove from the new object. - * @return New object without the specified keys. + * @returns New object without the specified keys. */ static without(obj: T, keys: K[]): Omit { const newObject: T = { ...obj }; @@ -120,7 +120,7 @@ export class CoreObject { * Create a new object without empty values (null or undefined). * * @param obj Objet. - * @return New object without empty values. + * @returns New object without empty values. */ static withoutEmpty(obj: T): CoreObjectWithoutEmpty { const cleanObj = {}; @@ -140,7 +140,7 @@ export class CoreObject { * Create a new object without undefined values. * * @param obj Objet. - * @return New object without undefined values. + * @returns New object without undefined values. */ static withoutUndefined(obj: T): CoreObjectWithoutUndefined { const cleanObj = {}; diff --git a/src/core/singletons/path.ts b/src/core/singletons/path.ts index e2bcb0552..01e584e31 100644 --- a/src/core/singletons/path.ts +++ b/src/core/singletons/path.ts @@ -31,7 +31,7 @@ export class CorePath { * * @param initialFolder The initial folder path. * @param finalFolder The final folder. The "root" should be the same as initialFolder. - * @return Relative path. + * @returns Relative path. */ static calculateRelativePath(initialFolder: string, finalFolder: string): string { initialFolder = CoreText.removeStartingSlash(CoreText.removeEndingSlash(initialFolder)); @@ -67,7 +67,7 @@ export class CorePath { * @param currentFolder The current folder path. * @param path The relative path. * @param newFolder The folder to use to calculate the new relative path. The "root" should be the same as currentFolder. - * @return Relative path. + * @returns Relative path. */ static changeRelativePath(currentFolder: string, path: string, newFolder: string): string { return CorePath.concatenatePaths(CorePath.calculateRelativePath(newFolder, currentFolder), path); @@ -78,7 +78,7 @@ export class CorePath { * * @param leftPath Left path. * @param rightPath Right path. - * @return Concatenated path. + * @returns Concatenated path. */ static concatenatePaths(leftPath: string, rightPath: string): string { if (!leftPath) { diff --git a/src/core/singletons/subscriptions.ts b/src/core/singletons/subscriptions.ts index f5c23b795..de07d8e1a 100644 --- a/src/core/singletons/subscriptions.ts +++ b/src/core/singletons/subscriptions.ts @@ -33,7 +33,7 @@ export class CoreSubscriptions { * @param onSuccess Callback to run when the subscription is updated. * @param onError Callback to run when the an error happens. * @param onComplete Callback to run when the observable completes. - * @return A function to unsubscribe. + * @returns A function to unsubscribe. */ static once( subscribable: Subscribable, diff --git a/src/core/singletons/tests/colors.test.ts b/src/core/singletons/tests/colors.test.ts index 0cefa4966..5befd468b 100644 --- a/src/core/singletons/tests/colors.test.ts +++ b/src/core/singletons/tests/colors.test.ts @@ -47,7 +47,7 @@ describe('CoreColors singleton', () => { expect(CoreColors.getColorHex('rgb(255, 100, 70)')).toEqual('#ff6446'); expect(CoreColors.getColorHex('rgba(255, 100, 70, 0.5)')).toEqual('#ff6446'); - // @todo: There are problems when testing color names (e.g. violet) or hsf colors. + // @todo There are problems when testing color names (e.g. violet) or hsf colors. // They work fine in real browsers but not in unit tests. }); @@ -56,7 +56,7 @@ describe('CoreColors singleton', () => { expect(CoreColors.getColorRGBA('rgb(255, 100, 70)')).toEqual([255, 100, 70]); expect(CoreColors.getColorRGBA('rgba(255, 100, 70, 0.5)')).toEqual([255, 100, 70, 0.5]); - // @todo: There are problems when testing color names (e.g. violet) or hsf colors. + // @todo There are problems when testing color names (e.g. violet) or hsf colors. // They work fine in real browsers but not in unit tests. }); diff --git a/src/core/singletons/text.ts b/src/core/singletons/text.ts index 782837242..e4ec26140 100644 --- a/src/core/singletons/text.ts +++ b/src/core/singletons/text.ts @@ -28,7 +28,7 @@ export class CoreText { * Add starting slash to a string if needed. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ static addStartingSlash(text = ''): string { if (text[0] === '/') { @@ -42,7 +42,7 @@ export class CoreText { * Remove ending slash from a path or URL. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ static removeEndingSlash(text?: string): string { if (!text) { @@ -60,7 +60,7 @@ export class CoreText { * Remove starting slash from a string if needed. * * @param text Text to treat. - * @return Treated text. + * @returns Treated text. */ static removeStartingSlash(text = ''): string { if (text[0] !== '/') { @@ -75,7 +75,7 @@ export class CoreText { * * @param leftPath Left path. * @param rightPath Right path. - * @return Concatenated path. + * @returns Concatenated path. * @deprecated since 4.1.0. Please use CorePath.concatenatePaths instead. */ static concatenatePaths(leftPath: string, rightPath: string): string { diff --git a/src/core/singletons/time.ts b/src/core/singletons/time.ts index fd855b383..69548a694 100644 --- a/src/core/singletons/time.ts +++ b/src/core/singletons/time.ts @@ -25,7 +25,7 @@ export class CoreTime { * * @param seconds A number of seconds * @param precision Number of elements to have in precision. - * @return Seconds in a human readable format. + * @returns Seconds in a human readable format. */ static formatTime(seconds: number, precision = 2): string { precision = precision || 5; // Use max precision if 0 is passed. @@ -82,7 +82,7 @@ export class CoreTime { * Converts a number of seconds into a short human readable format: minutes and seconds, in fromat: 3' 27''. * * @param duration Duration in seconds. - * @return Short human readable text. + * @returns Short human readable text. */ static formatTimeShort(duration: number): string { const minutes = Math.floor(duration / 60); @@ -104,7 +104,7 @@ export class CoreTime { * Wrap a function so that it is called only once. * * @param fn Function. - * @return Wrapper that will call the underlying function only once. + * @returns Wrapper that will call the underlying function only once. */ static once(fn: (...args: T) => unknown): (...args: T) => void { let called = false; diff --git a/src/core/singletons/url.ts b/src/core/singletons/url.ts index 67f105e70..2a20a528d 100644 --- a/src/core/singletons/url.ts +++ b/src/core/singletons/url.ts @@ -81,7 +81,7 @@ export class CoreUrl { * Parse parts of a url, using an implicit protocol if it is missing from the url. * * @param url Url. - * @return Url parts. + * @returns Url parts. */ static parse(url: string): UrlParts | null { // Parse url with regular expression taken from RFC 3986: https://tools.ietf.org/html/rfc3986#appendix-B. @@ -116,7 +116,7 @@ export class CoreUrl { * Given some parts of a URL, returns the URL as a string. * * @param parts Parts. - * @return Assembled URL. + * @returns Assembled URL. */ static assemble(parts: UrlParts): string { return (parts.protocol ? `${parts.protocol}://` : '') + @@ -132,7 +132,7 @@ export class CoreUrl { * Guess the Moodle domain from a site url. * * @param url Site url. - * @return Guessed Moodle domain. + * @returns Guessed Moodle domain. */ static guessMoodleDomain(url: string): string | null { // Add protocol if it was missing. Moodle can only be served through http or https, so this is a fair assumption to make. @@ -164,7 +164,7 @@ export class CoreUrl { /** * Returns the pattern to check if the URL is a valid Moodle Url. * - * @return Desired RegExp. + * @returns Desired RegExp. */ static getValidMoodleUrlPattern(): RegExp { // Regular expression based on RFC 3986: https://tools.ietf.org/html/rfc3986#appendix-B. @@ -176,7 +176,7 @@ export class CoreUrl { * Check if the given url is valid for the app to connect. * * @param url Url to check. - * @return True if valid, false otherwise. + * @returns True if valid, false otherwise. */ static isValidMoodleUrl(url: string): boolean { const patt = CoreUrl.getValidMoodleUrlPattern(); @@ -188,7 +188,7 @@ export class CoreUrl { * Removes protocol from the url. * * @param url Site url. - * @return Url without protocol. + * @returns Url without protocol. */ static removeProtocol(url: string): string { return url.replace(/^[a-zA-Z]+:\/\//i, ''); @@ -199,7 +199,7 @@ export class CoreUrl { * * @param urlA First URL. * @param urlB Second URL. - * @return Whether they have same domain and path. + * @returns Whether they have same domain and path. */ static sameDomainAndPath(urlA: string, urlB: string): boolean { // Add protocol if missing, the parse function requires it. @@ -225,7 +225,7 @@ export class CoreUrl { * E.g. myurl.com#foo=1#bar=2 will return #foo=1#bar=2. * * @param url URL. - * @return Anchor, undefined if no anchor. + * @returns Anchor, undefined if no anchor. */ static getUrlAnchor(url: string): string | undefined { const firstAnchorIndex = url.indexOf('#'); @@ -240,7 +240,7 @@ export class CoreUrl { * Remove the anchor from a URL. * * @param url URL. - * @return URL without anchor if any. + * @returns URL without anchor if any. */ static removeUrlAnchor(url: string): string { const urlAndAnchor = url.split('#'); @@ -253,7 +253,7 @@ export class CoreUrl { * * @param parentUrl The parent URL. * @param url The url to convert. - * @return Absolute URL. + * @returns Absolute URL. */ static toAbsoluteURL(parentUrl: string, url: string): string { const parsedUrl = CoreUrl.parse(url); @@ -286,7 +286,7 @@ export class CoreUrl { * * @param parentUrl The parent URL. * @param url The url to convert. - * @return Relative URL. + * @returns Relative URL. */ static toRelativeURL(parentUrl: string, url: string): string { parentUrl = CoreUrl.removeProtocol(parentUrl); diff --git a/src/core/singletons/window.ts b/src/core/singletons/window.ts index 089938fb9..78dbaa519 100644 --- a/src/core/singletons/window.ts +++ b/src/core/singletons/window.ts @@ -52,7 +52,7 @@ export class CoreWindow { * Show a confirm before opening a link in browser, unless the user previously marked to not show again. * * @param url URL to open. - * @return Promise resolved if confirmed, rejected if rejected. + * @returns Promise resolved if confirmed, rejected if rejected. */ static async confirmOpenBrowserIfNeeded(url: string): Promise { if (!CoreUrlUtils.isHttpURL(url)) { @@ -88,7 +88,7 @@ export class CoreWindow { * * @param url URL to open. * @param name Name of the browsing context into which to load the URL. - * @return Promise resolved when done. + * @returns Promise resolved when done. */ static async open(url: string, name?: string): Promise { if (CoreUrlUtils.isLocalFileUrl(url)) { diff --git a/src/core/utils/rxjs.ts b/src/core/utils/rxjs.ts index b583b0fe5..b206d052e 100644 --- a/src/core/utils/rxjs.ts +++ b/src/core/utils/rxjs.ts @@ -105,7 +105,7 @@ export function firstValueFrom(observable: Observable): Promise { * * @param observable Observable to ignore errors. * @param fallback Value to return if the observer errors. - * @return Observable with ignored errors, returning the fallback result if provided. + * @returns Observable with ignored errors, returning the fallback result if provided. */ export function ignoreErrors(observable: Observable): Observable; export function ignoreErrors(observable: Observable, fallback: Fallback): Observable; @@ -135,7 +135,7 @@ type ZipObservableData = { * as the other observables continue to emit values. * * @param observables Observables to zip. - * @return Observable that emits the zipped values. + * @returns Observable that emits the zipped values. */ export function zipIncludingComplete[]>( ...observables: T diff --git a/src/testing/services/behat-blocking.ts b/src/testing/services/behat-blocking.ts index 345dba3c9..68498ed3a 100644 --- a/src/testing/services/behat-blocking.ts +++ b/src/testing/services/behat-blocking.ts @@ -53,6 +53,8 @@ export class TestingBehatBlockingService { /** * Get pending list on window M object. + * + * @returns List of pending JS blockers. */ protected get pendingList(): string[] { const win = window as BehatTestsWindow; @@ -77,7 +79,7 @@ export class TestingBehatBlockingService { * Adds a pending key to the array. * * @param key Key to add. It will be generated if none. - * @return Key name. + * @returns Key name. */ block(key = ''): string { // Add a special DELAY entry whenever another entry is added. diff --git a/src/testing/services/behat-dom.ts b/src/testing/services/behat-dom.ts index aebcaafd3..b43193e3e 100644 --- a/src/testing/services/behat-dom.ts +++ b/src/testing/services/behat-dom.ts @@ -28,7 +28,7 @@ export class TestingBehatDomUtilsService { * Check if an element is clickable. * * @param element Element. - * @return Whether the element is clickable or not. + * @returns Whether the element is clickable or not. */ isElementClickable(element: HTMLElement): boolean { return element.getAttribute('aria-disabled') !== 'true' && !element.hasAttribute('disabled'); @@ -39,7 +39,7 @@ export class TestingBehatDomUtilsService { * * @param element Element. * @param container Container. If set, the function will also check parent elements visibility. - * @return Whether the element is visible or not. + * @returns Whether the element is visible or not. */ isElementVisible(element: HTMLElement, container?: HTMLElement): boolean { if (element.getAttribute('aria-hidden') === 'true' || getComputedStyle(element).display === 'none') { @@ -67,7 +67,7 @@ export class TestingBehatDomUtilsService { * * @param element Element. * @param container Container. - * @return Whether the element is selected or not. + * @returns Whether the element is selected or not. */ isElementSelected(element: HTMLElement, container: HTMLElement): boolean { const ariaCurrent = element.getAttribute('aria-current'); @@ -93,7 +93,7 @@ export class TestingBehatDomUtilsService { * @param container Parent element to search the element within * @param text Text to look for * @param options Search options. - * @return Elements containing the given text with exact boolean. + * @returns Elements containing the given text with exact boolean. */ protected findElementsBasedOnTextWithinWithExact( container: HTMLElement, @@ -204,7 +204,7 @@ export class TestingBehatDomUtilsService { * * @param element Element to check. * @param text Text to check. - * @return If text matches any of the label attributes. + * @returns If text matches any of the label attributes. */ protected checkElementLabel(element: HTMLElement, text: string): boolean { return element.title === text || @@ -219,7 +219,7 @@ export class TestingBehatDomUtilsService { * @param container Parent element to search the element within. * @param text Text to look for. * @param options Search options. - * @return Elements containing the given text. + * @returns Elements containing the given text. */ protected findElementsBasedOnTextWithin( container: HTMLElement, @@ -240,7 +240,7 @@ export class TestingBehatDomUtilsService { * This will remote duplicates and drop any elements nested within each other. * * @param elements Elements list. - * @return Top ancestors. + * @returns Top ancestors. */ protected getTopAncestors(elements: HTMLElement[]): HTMLElement[] { const uniqueElements = new Set(elements); @@ -264,7 +264,7 @@ export class TestingBehatDomUtilsService { * Get parent element, including Shadow DOM parents. * * @param element Element. - * @return Parent element. + * @returns Parent element. */ protected getParentElement(element: HTMLElement): HTMLElement | null { return element.parentElement || @@ -278,7 +278,7 @@ export class TestingBehatDomUtilsService { * @param element Element. * @param selector Selector. * @param container Topmost container to search within. - * @return Closest matching element. + * @returns Closest matching element. */ protected getClosestMatching(element: HTMLElement, selector: string, container: HTMLElement | null): HTMLElement | null { if (element.matches(selector)) { @@ -296,7 +296,7 @@ export class TestingBehatDomUtilsService { * Function to find top container elements. * * @param containerName Whether to search inside the a container name. - * @return Found top container elements. + * @returns Found top container elements. */ protected getCurrentTopContainerElements(containerName: string): HTMLElement[] { const topContainers: HTMLElement[] = []; @@ -363,7 +363,7 @@ export class TestingBehatDomUtilsService { * * @param locator Element locator. * @param options Search options. - * @return First found element. + * @returns First found element. */ findElementBasedOnText( locator: TestingBehatElementLocator, @@ -377,7 +377,7 @@ export class TestingBehatDomUtilsService { * * @param locator Element locator. * @param options Search options. - * @return Found elements + * @returns Found elements */ protected findElementsBasedOnText( locator: TestingBehatElementLocator, @@ -402,7 +402,7 @@ export class TestingBehatDomUtilsService { * @param locator Element locator. * @param topContainer Container to search in. * @param options Search options. - * @return Found elements + * @returns Found elements */ protected findElementsBasedOnTextInContainer( locator: TestingBehatElementLocator, @@ -486,6 +486,7 @@ export class TestingBehatDomUtilsService { * Make sure that an element is visible and wait to trigger the callback. * * @param element Element. + * @returns Promise resolved with the DOM rectangle. */ protected async ensureElementVisible(element: HTMLElement): Promise { const initialRect = element.getBoundingClientRect(); diff --git a/src/testing/services/behat-runtime.ts b/src/testing/services/behat-runtime.ts index 878df655b..e514da1ce 100644 --- a/src/testing/services/behat-runtime.ts +++ b/src/testing/services/behat-runtime.ts @@ -98,7 +98,7 @@ export class TestingBehatRuntimeService { * Run an operation inside the angular zone and return result. * * @param operation Operation callback. - * @return OK if successful, or ERROR: followed by message. + * @returns OK if successful, or ERROR: followed by message. */ async runInZone(operation: () => unknown, blocking: boolean = false): Promise { const blockKey = blocking && TestingBehatBlocking.block(); @@ -117,7 +117,7 @@ export class TestingBehatRuntimeService { /** * Wait all controlled components to be rendered. * - * @return Promise resolved when all components have been rendered. + * @returns Promise resolved when all components have been rendered. */ async waitLoadingToFinish(): Promise { await NgZone.run(async () => { @@ -133,7 +133,7 @@ export class TestingBehatRuntimeService { * Function to find and click an app standard button. * * @param button Type of button to press. - * @return OK if successful, or ERROR: followed by message. + * @returns OK if successful, or ERROR: followed by message. */ async pressStandard(button: string): Promise { this.log('Action - Click standard button: ' + button); @@ -179,7 +179,7 @@ export class TestingBehatRuntimeService { /** * When there is a popup, clicks on the backdrop. * - * @return OK if successful, or ERROR: followed by message + * @returns OK if successful, or ERROR: followed by message */ closePopup(): string { this.log('Action - Close popup'); @@ -207,7 +207,7 @@ export class TestingBehatRuntimeService { * * @param locator Element locator. * @param options Search options. - * @return OK if successful, or ERROR: followed by message + * @returns OK if successful, or ERROR: followed by message */ find(locator: TestingBehatElementLocator, options: Partial = {}): string { this.log('Action - Find', { locator, ...options }); @@ -235,7 +235,7 @@ export class TestingBehatRuntimeService { * Scroll an element into view. * * @param locator Element locator. - * @return OK if successful, or ERROR: followed by message + * @returns OK if successful, or ERROR: followed by message */ scrollTo(locator: TestingBehatElementLocator): string { this.log('Action - scrollTo', { locator }); @@ -262,7 +262,7 @@ export class TestingBehatRuntimeService { /** * Load more items form an active list with infinite loader. * - * @return OK if successful, or ERROR: followed by message + * @returns OK if successful, or ERROR: followed by message */ async loadMoreItems(): Promise { this.log('Action - loadMoreItems'); @@ -309,7 +309,7 @@ export class TestingBehatRuntimeService { * Check whether an item is selected or not. * * @param locator Element locator. - * @return YES or NO if successful, or ERROR: followed by message + * @returns YES or NO if successful, or ERROR: followed by message */ isSelected(locator: TestingBehatElementLocator): string { this.log('Action - Is Selected', locator); @@ -331,7 +331,7 @@ export class TestingBehatRuntimeService { * Function to press arbitrary item based on its text or Aria label. * * @param locator Element locator. - * @return OK if successful, or ERROR: followed by message + * @returns OK if successful, or ERROR: followed by message */ async press(locator: TestingBehatElementLocator): Promise { this.log('Action - Press', locator); @@ -354,7 +354,7 @@ export class TestingBehatRuntimeService { /** * Trigger a pull to refresh gesture in the current page. * - * @return OK if successful, or ERROR: followed by message + * @returns OK if successful, or ERROR: followed by message */ async pullToRefresh(): Promise { this.log('Action - pullToRefresh'); @@ -381,7 +381,7 @@ export class TestingBehatRuntimeService { /** * Gets the currently displayed page header. * - * @return OK: followed by header text if successful, or ERROR: followed by message. + * @returns OK: followed by header text if successful, or ERROR: followed by message. */ getHeader(): string { this.log('Action - Get header'); @@ -407,7 +407,7 @@ export class TestingBehatRuntimeService { * * @param field Field name * @param value New value - * @return OK or ERROR: followed by message + * @returns OK or ERROR: followed by message */ async setField(field: string, value: string): Promise { this.log('Action - Set field ' + field + ' to: ' + value); @@ -430,7 +430,7 @@ export class TestingBehatRuntimeService { * * @param field Field name * @param value New value - * @return OK or ERROR: followed by message + * @returns OK or ERROR: followed by message */ async fieldMatches(field: string, value: string): Promise { this.log('Action - Field ' + field + ' matches value: ' + value); @@ -453,7 +453,7 @@ export class TestingBehatRuntimeService { * Find a field. * * @param field Field name. - * @return Field element. + * @returns Field element. */ protected findField(field: string): HTMLElement | HTMLInputElement | undefined { return TestingBehatDomUtils.findElementBasedOnText( @@ -466,7 +466,7 @@ export class TestingBehatRuntimeService { * Get the value of a certain field. * * @param element Field to get the value. - * @return Value. + * @returns Value. */ protected getFieldValue(element: HTMLElement | HTMLInputElement): string { if (element.tagName === 'ION-DATETIME') { @@ -485,7 +485,7 @@ export class TestingBehatRuntimeService { * * @param selector Element selector * @param className Constructor class name - * @return Component instance + * @returns Component instance */ getAngularInstance(selector: string, className: string): T | null { this.log('Action - Get Angular instance ' + selector + ', ' + className); @@ -518,7 +518,7 @@ export class TestingBehatRuntimeService { * Check a notification is present. * * @param title Title of the notification - * @return YES or NO: depending on the result. + * @returns YES or NO: depending on the result. */ async notificationIsPresentWithText(title: string): Promise { const notifications = await LocalNotifications.getAllTriggered(); @@ -541,7 +541,7 @@ export class TestingBehatRuntimeService { * Close notification. * * @param title Title of the notification - * @return OK or ERROR + * @returns OK or ERROR */ async closeNotification(title: string): Promise { const notifications = await LocalNotifications.getAllTriggered(); diff --git a/src/testing/utils.ts b/src/testing/utils.ts index 0072cb595..e790fff28 100644 --- a/src/testing/utils.ts +++ b/src/testing/utils.ts @@ -231,7 +231,7 @@ export function requireElement( * * @param instance Instance to mock. * @param overrides Object with the properties or methods to override, or a list of methods to override with an empty function. - * @return Mock instance. + * @returns Mock instance. */ export function mock( instance: T | Partial = {},