Merge pull request #2096 from albertgasset/MOBILE-3147

Mobile 3147
main
Juan Leyva 2019-09-25 11:47:09 +02:00 committed by GitHub
commit 98ebbd329e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
750 changed files with 15943 additions and 16313 deletions

View File

@ -0,0 +1,71 @@
const fs = require('fs')
const path = require('path')
const srcPath = path.join(__dirname, '..', 'src')
function findFiles(dirPath) {
const result = []
const entries = fs.readdirSync(dirPath, {withFileTypes: true})
entries.forEach((entry) => {
const entryPath = path.join(dirPath, entry.name)
if (entry.isFile() && entry.name.endsWith('.ts')) {
result.push(entryPath)
} else if (entry.isDirectory()) {
result.push(...findFiles(entryPath))
}
})
return result
}
findFiles(srcPath).forEach((file) => {
let src = fs.readFileSync(file, 'utf-8')
// Fix wrong use of @type instead of @return.
src = src.replace(/(\n +\* \@param [^\n]*\n +\* )\@type /g, (match, p1) => p1 + '@return ')
// Remove square brackets and default values from @param lines.
src = src.replace(/(\n +\* @param +\{[^\n]+\} +)\[(\w+)[^\]\n]*\]/g, (match, p1, p2) => p1 + p2)
// Remove types from @param and @return lines.
src = src.replace(/(\n +\* \@(?:param|returns?) *)([a-zA-Z0-9_]+ *)?(\{[^\n]*)/g, (match, p1, p2, p3) => {
p2 = p2 || ''
let brackets = 1;
let end = 0;
for (let i = 1; brackets > 0 && i < p3.length; i++) {
if (p3[i] == '{') {
brackets++
} else if (p3[i] == '}') {
brackets--
end = i + 1
}
}
p1 = p1.trimEnd().replace('@returns', '@return')
p2 = p2.trim()
p3 = p3.slice(end).trim().replace(/^([a-zA-Z0-9_]+) +/, '$1 ')
if (!p2 && !p3) return ''
return p1 + ' ' + p2 + (p2 && p3 ? ' ' + p3 : p3)
})
// Remove @type lines.
src = src.replace(/\n +\* \@type .*\n/g, '\n')
// Remove consecutive empty doc lines.
src = src.replace(/\n *\* *(\n *\*\/? *\n)/g, (match, p1) => p1)
// Remove empty docs.
src = src.replace(/\n *\/\*\*[ \n\*]+\*\/ *\n/g, '\n')
// Fix indentation.
src = src.replace(/(\n +\* +(?:@param \w+|@return) )([^\n]*)((?:\n +\* +[^@\n][^\n]+)+)/g, (match, p1, p2, p3) => {
const indent = p1.length
p3 = p3.replace(/(\n +\*)( +)([^\n]+)/g, (match, p1, p2, p3) => {
p2 = new Array(Math.max(0, indent - p1.length + 1)).join(' ')
return p1 + p2 + p3
})
return p1 + p2 + p3
})
fs.writeFileSync(file, src)
})

View File

@ -65,7 +65,7 @@ export class AddonBadgesIssuedBadgePage {
/** /**
* Fetch the issued badge required for the view. * Fetch the issued badge required for the view.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchIssuedBadge(): Promise<any> { fetchIssuedBadge(): Promise<any> {
const promises = []; const promises = [];
@ -101,7 +101,7 @@ export class AddonBadgesIssuedBadgePage {
/** /**
* Refresh the badges. * Refresh the badges.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshBadges(refresher: any): void { refreshBadges(refresher: any): void {
this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => { this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => {

View File

@ -64,7 +64,7 @@ export class AddonBadgesUserBadgesPage {
/** /**
* Fetch all the badges required for the view. * Fetch all the badges required for the view.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchBadges(): Promise<any> { fetchBadges(): Promise<any> {
this.currentTime = this.timeUtils.timestamp(); this.currentTime = this.timeUtils.timestamp();
@ -79,7 +79,7 @@ export class AddonBadgesUserBadgesPage {
/** /**
* Refresh the badges. * Refresh the badges.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshBadges(refresher: any): void { refreshBadges(refresher: any): void {
this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => { this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => {
@ -92,7 +92,7 @@ export class AddonBadgesUserBadgesPage {
/** /**
* Navigate to a particular badge. * Navigate to a particular badge.
* *
* @param {string} badgeHash Badge to load. * @param badgeHash Badge to load.
*/ */
loadIssuedBadge(badgeHash: string): void { loadIssuedBadge(badgeHash: string): void {
this.badgeHash = badgeHash; this.badgeHash = badgeHash;

View File

@ -33,11 +33,11 @@ export class AddonBadgesBadgeLinkHandler extends CoreContentLinksHandlerBase {
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -53,11 +53,11 @@ export class AddonBadgesBadgeLinkHandler extends CoreContentLinksHandlerBase {
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {

View File

@ -35,8 +35,8 @@ export class AddonBadgesProvider {
* This method is called quite often and thus should only perform a quick * This method is called quite often and thus should only perform a quick
* check, we should not be calling WS from here. * check, we should not be calling WS from here.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with true if enabled, false otherwise. * @return Promise resolved with true if enabled, false otherwise.
*/ */
isPluginEnabled(siteId?: string): Promise<boolean> { isPluginEnabled(siteId?: string): Promise<boolean> {
@ -54,9 +54,9 @@ export class AddonBadgesProvider {
/** /**
* Get the cache key for the get badges call. * Get the cache key for the get badges call.
* *
* @param {number} courseId ID of the course to get the badges from. * @param courseId ID of the course to get the badges from.
* @param {number} userId ID of the user to get the badges from. * @param userId ID of the user to get the badges from.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getBadgesCacheKey(courseId: number, userId: number): string { protected getBadgesCacheKey(courseId: number, userId: number): string {
return this.ROOT_CACHE_KEY + 'badges:' + courseId + ':' + userId; return this.ROOT_CACHE_KEY + 'badges:' + courseId + ':' + userId;
@ -65,10 +65,10 @@ export class AddonBadgesProvider {
/** /**
* Get issued badges for a certain user in a course. * Get issued badges for a certain user in a course.
* *
* @param {number} courseId ID of the course to get the badges from. * @param courseId ID of the course to get the badges from.
* @param {number} userId ID of the user to get the badges from. * @param userId ID of the user to get the badges from.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>}Promise to be resolved when the badges are retrieved. * @return Promise to be resolved when the badges are retrieved.
*/ */
getUserBadges(courseId: number, userId: number, siteId?: string): Promise<any> { getUserBadges(courseId: number, userId: number, siteId?: string): Promise<any> {
@ -98,10 +98,10 @@ export class AddonBadgesProvider {
/** /**
* Invalidate get badges WS call. * Invalidate get badges WS call.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {number} userId ID of the user to get the badges from. * @param userId ID of the user to get the badges from.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when data is invalidated. * @return Promise resolved when data is invalidated.
*/ */
invalidateUserBadges(courseId: number, userId: number, siteId?: string): Promise<any> { invalidateUserBadges(courseId: number, userId: number, siteId?: string): Promise<any> {

View File

@ -34,11 +34,11 @@ export class AddonBadgesMyBadgesLinkHandler extends CoreContentLinksHandlerBase
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -54,11 +54,11 @@ export class AddonBadgesMyBadgesLinkHandler extends CoreContentLinksHandlerBase
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {

View File

@ -33,8 +33,8 @@ export class AddonBadgesPushClickHandler implements CorePushNotificationsClickHa
/** /**
* Check if a notification click is handled by this handler. * Check if a notification click is handled by this handler.
* *
* @param {any} notification The notification to check. * @param notification The notification to check.
* @return {boolean} Whether the notification click is handled by this handler * @return Whether the notification click is handled by this handler
*/ */
handles(notification: any): boolean | Promise<boolean> { handles(notification: any): boolean | Promise<boolean> {
const data = notification.customdata || {}; const data = notification.customdata || {};
@ -50,8 +50,8 @@ export class AddonBadgesPushClickHandler implements CorePushNotificationsClickHa
/** /**
* Handle the notification click. * Handle the notification click.
* *
* @param {any} notification The notification to check. * @param notification The notification to check.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
handleClick(notification: any): Promise<any> { handleClick(notification: any): Promise<any> {
const data = notification.customdata || {}; const data = notification.customdata || {};

View File

@ -30,7 +30,7 @@ export class AddonBadgesUserHandler implements CoreUserProfileHandler {
/** /**
* Check if handler is enabled. * Check if handler is enabled.
* *
* @return {Promise<boolean>} Always enabled. * @return Always enabled.
*/ */
isEnabled(): Promise<boolean> { isEnabled(): Promise<boolean> {
return this.badgesProvider.isPluginEnabled(); return this.badgesProvider.isPluginEnabled();
@ -39,11 +39,11 @@ export class AddonBadgesUserHandler implements CoreUserProfileHandler {
/** /**
* Check if handler is enabled for this user in this context. * Check if handler is enabled for this user in this context.
* *
* @param {any} user User to check. * @param user User to check.
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean} True if enabled, false otherwise. * @return True if enabled, false otherwise.
*/ */
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean { isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean {
@ -58,7 +58,7 @@ export class AddonBadgesUserHandler implements CoreUserProfileHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreUserProfileHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData { getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData {
return { return {

View File

@ -52,7 +52,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
return this.courseProvider.invalidateSections(this.instanceId); return this.courseProvider.invalidateSections(this.instanceId);
@ -61,7 +61,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i
/** /**
* Fetch the data to render the block. * Fetch the data to render the block.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
return this.courseProvider.getSections(this.instanceId, false, true).then((sections) => { return this.courseProvider.getSections(this.instanceId, false, true).then((sections) => {

View File

@ -32,11 +32,11 @@ export class AddonBlockActivityModulesHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockBadgesHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockBlogMenuHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockBlogRecentHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockBlogTagsHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockCalendarMonthHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockCalendarUpcomingHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockCommentsHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockCompletionStatusHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockGlossaryRandomHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockHtmlHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockLearningPlansHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -133,7 +133,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
const promises = []; const promises = [];
@ -161,7 +161,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* Fetch the courses for my overview. * Fetch the courses for my overview.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
return this.coursesHelper.getUserCoursesWithOptions(this.sort).then((courses) => { return this.coursesHelper.getUserCoursesWithOptions(this.sort).then((courses) => {
@ -197,7 +197,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* The filter has changed. * The filter has changed.
* *
* @param {any} Received Event. * @param Received Event.
*/ */
filterChanged(event: any): void { filterChanged(event: any): void {
const newValue = event.target.value && event.target.value.trim().toLowerCase(); const newValue = event.target.value && event.target.value.trim().toLowerCase();
@ -239,7 +239,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* Prefetch all the shown courses. * Prefetch all the shown courses.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
prefetchCourses(): Promise<any> { prefetchCourses(): Promise<any> {
const selected = this.selectedFilter, const selected = this.selectedFilter,
@ -264,7 +264,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* Init courses filters. * Init courses filters.
* *
* @param {any[]} courses Courses to filter. * @param courses Courses to filter.
*/ */
initCourseFilters(courses: any[]): void { initCourseFilters(courses: any[]): void {
if (this.showSortFilter) { if (this.showSortFilter) {
@ -319,7 +319,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* The selected courses sort filter have changed. * The selected courses sort filter have changed.
* *
* @param {string} sort New sorting. * @param sort New sorting.
*/ */
switchSort(sort: string): void { switchSort(sort: string): void {
this.sort = sort; this.sort = sort;
@ -344,7 +344,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem
/** /**
* If switch button that enables the filter input is shown or not. * If switch button that enables the filter input is shown or not.
* *
* @return {boolean} If switch button that enables the filter input is shown or not. * @return If switch button that enables the filter input is shown or not.
*/ */
showFilterSwitchButton(): boolean { showFilterSwitchButton(): boolean {
return this.loaded && this.courses['all'] && this.courses['all'].length > 5; return this.loaded && this.courses['all'] && this.courses['all'].length > 5;

View File

@ -34,7 +34,7 @@ export class AddonBlockMyOverviewHandler extends CoreBlockBaseHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan('3.6') || return this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan('3.6') ||
@ -44,11 +44,11 @@ export class AddonBlockMyOverviewHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockNewsItemsHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockOnlineUsersHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockPrivateFilesHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockRecentActivityHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -79,7 +79,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
const promises = []; const promises = [];
@ -104,7 +104,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
/** /**
* Fetch the courses for recent courses. * Fetch the courses for recent courses.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
return this.coursesHelper.getUserCoursesWithOptions('lastaccess', 10).then((courses) => { return this.coursesHelper.getUserCoursesWithOptions('lastaccess', 10).then((courses) => {
@ -133,7 +133,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom
/** /**
* Prefetch all the shown courses. * Prefetch all the shown courses.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
prefetchCourses(): Promise<any> { prefetchCourses(): Promise<any> {
const initialIcon = this.prefetchCoursesData.icon; const initialIcon = this.prefetchCoursesData.icon;

View File

@ -32,11 +32,11 @@ export class AddonBlockRecentlyAccessedCoursesHandler extends CoreBlockBaseHandl
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -50,7 +50,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
return this.recentItemsProvider.invalidateRecentItems(); return this.recentItemsProvider.invalidateRecentItems();
@ -59,7 +59,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo
/** /**
* Fetch the data to render the block. * Fetch the data to render the block.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
return this.recentItemsProvider.getRecentItems().then((items) => { return this.recentItemsProvider.getRecentItems().then((items) => {
@ -70,8 +70,8 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo
/** /**
* Event clicked. * Event clicked.
* *
* @param {Event} e Click event. * @param e Click event.
* @param {any} item Activity item info. * @param item Activity item info.
*/ */
action(e: Event, item: any): void { action(e: Event, item: any): void {
e.preventDefault(); e.preventDefault();

View File

@ -32,11 +32,11 @@ export class AddonBlockRecentlyAccessedItemsHandler extends CoreBlockBaseHandler
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -30,7 +30,7 @@ export class AddonBlockRecentlyAccessedItemsProvider {
/** /**
* Get cache key for get last accessed items value WS call. * Get cache key for get last accessed items value WS call.
* *
* @return {string} Cache key. * @return Cache key.
*/ */
protected getRecentItemsCacheKey(): string { protected getRecentItemsCacheKey(): string {
return this.ROOT_CACHE_KEY + ':recentitems'; return this.ROOT_CACHE_KEY + ':recentitems';
@ -39,8 +39,8 @@ export class AddonBlockRecentlyAccessedItemsProvider {
/** /**
* Get last accessed items. * Get last accessed items.
* *
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved when the info is retrieved. * @return Promise resolved when the info is retrieved.
*/ */
getRecentItems(siteId?: string): Promise<any[]> { getRecentItems(siteId?: string): Promise<any[]> {
@ -63,8 +63,8 @@ export class AddonBlockRecentlyAccessedItemsProvider {
/** /**
* Invalidates get last accessed items WS call. * Invalidates get last accessed items WS call.
* *
* @param {string} [siteId] Site ID to invalidate. If not defined, use current site. * @param siteId Site ID to invalidate. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateRecentItems(siteId?: string): Promise<any> { invalidateRecentItems(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {

View File

@ -33,11 +33,11 @@ export class AddonBlockRssClientHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,11 +32,11 @@ export class AddonBlockSelfCompletionHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -54,7 +54,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
const promises = []; const promises = [];
@ -73,7 +73,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl
/** /**
* Fetch the data to render the block. * Fetch the data to render the block.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => { return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => {

View File

@ -32,11 +32,11 @@ export class AddonBlockSiteMainMenuHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -79,7 +79,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
const promises = []; const promises = [];
@ -104,7 +104,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im
/** /**
* Fetch the courses. * Fetch the courses.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
return this.coursesHelper.getUserCoursesWithOptions('timemodified', 0, 'isfavourite').then((courses) => { return this.coursesHelper.getUserCoursesWithOptions('timemodified', 0, 'isfavourite').then((courses) => {
@ -133,7 +133,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im
/** /**
* Prefetch all the shown courses. * Prefetch all the shown courses.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
prefetchCourses(): Promise<any> { prefetchCourses(): Promise<any> {
const initialIcon = this.prefetchCoursesData.icon; const initialIcon = this.prefetchCoursesData.icon;

View File

@ -32,11 +32,11 @@ export class AddonBlockStarredCoursesHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -33,11 +33,11 @@ export class AddonBlockTagsHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -89,9 +89,9 @@ export class AddonBlockTimelineEventsComponent implements OnChanges {
/** /**
* Filter the events by time. * Filter the events by time.
* *
* @param {number} start Number of days to start getting events from today. E.g. -1 will get events from yesterday. * @param start Number of days to start getting events from today. E.g. -1 will get events from yesterday.
* @param {number} [end] Number of days after the start. * @param end Number of days after the start.
* @return {any[]} Filtered events. * @return Filtered events.
*/ */
protected filterEventsByTime(start: number, end?: number): any[] { protected filterEventsByTime(start: number, end?: number): any[] {
start = moment().add(start, 'days').startOf('day').unix(); start = moment().add(start, 'days').startOf('day').unix();
@ -121,8 +121,8 @@ export class AddonBlockTimelineEventsComponent implements OnChanges {
/** /**
* Action clicked. * Action clicked.
* *
* @param {Event} e Click event. * @param e Click event.
* @param {string} url Url of the action. * @param url Url of the action.
*/ */
action(e: Event, url: string): void { action(e: Event, url: string): void {
e.preventDefault(); e.preventDefault();

View File

@ -75,7 +75,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
/** /**
* Perform the invalidate content function. * Perform the invalidate content function.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected invalidateContent(): Promise<any> { protected invalidateContent(): Promise<any> {
const promises = []; const promises = [];
@ -94,7 +94,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
/** /**
* Fetch the courses for my overview. * Fetch the courses for my overview.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchContent(): Promise<any> { protected fetchContent(): Promise<any> {
if (this.sort == 'sortbydates') { if (this.sort == 'sortbydates') {
@ -120,8 +120,8 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
/** /**
* Load more events. * Load more events.
* *
* @param {any} course Course. * @param course Course.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
loadMoreCourse(course: any): Promise<any> { loadMoreCourse(course: any): Promise<any> {
return this.timelineProvider.getActionEventsByCourse(course.id, course.canLoadMore).then((courseEvents) => { return this.timelineProvider.getActionEventsByCourse(course.id, course.canLoadMore).then((courseEvents) => {
@ -135,8 +135,8 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
/** /**
* Fetch the timeline. * Fetch the timeline.
* *
* @param {number} [afterEventId] The last event id. * @param afterEventId The last event id.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchMyOverviewTimeline(afterEventId?: number): Promise<any> { protected fetchMyOverviewTimeline(afterEventId?: number): Promise<any> {
return this.timelineProvider.getActionEventsByTimesort(afterEventId).then((events) => { return this.timelineProvider.getActionEventsByTimesort(afterEventId).then((events) => {
@ -148,7 +148,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
/** /**
* Fetch the timeline by courses. * Fetch the timeline by courses.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchMyOverviewTimelineByCourses(): Promise<any> { protected fetchMyOverviewTimelineByCourses(): Promise<any> {
return this.coursesHelper.getUserCoursesWithOptions().then((courses) => { return this.coursesHelper.getUserCoursesWithOptions().then((courses) => {
@ -210,7 +210,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
/** /**
* Change timeline sort being viewed. * Change timeline sort being viewed.
* *
* @param {string} sort New sorting. * @param sort New sorting.
*/ */
switchSort(sort: string): void { switchSort(sort: string): void {
this.sort = sort; this.sort = sort;

View File

@ -37,7 +37,7 @@ export class AddonBlockTimelineHandler extends CoreBlockBaseHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.timelineProvider.isAvailable().then((enabled) => { return this.timelineProvider.isAvailable().then((enabled) => {
@ -49,11 +49,11 @@ export class AddonBlockTimelineHandler extends CoreBlockBaseHandler {
/** /**
* Returns the data needed to render the block. * Returns the data needed to render the block.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {any} block The block to render. * @param block The block to render.
* @param {string} contextLevel The context where the block will be used. * @param contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level. * @param instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> { : CoreBlockHandlerData | Promise<CoreBlockHandlerData> {

View File

@ -32,10 +32,10 @@ export class AddonBlockTimelineProvider {
/** /**
* Get calendar action events for the given course. * Get calendar action events for the given course.
* *
* @param {number} courseId Only events in this course. * @param courseId Only events in this course.
* @param {number} [afterEventId] The last seen event id. * @param afterEventId The last seen event id.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<{events: any[], canLoadMore: number}>} Promise resolved when the info is retrieved. * @return Promise resolved when the info is retrieved.
*/ */
getActionEventsByCourse(courseId: number, afterEventId?: number, siteId?: string): getActionEventsByCourse(courseId: number, afterEventId?: number, siteId?: string):
Promise<{ events: any[], canLoadMore: number }> { Promise<{ events: any[], canLoadMore: number }> {
@ -68,8 +68,8 @@ export class AddonBlockTimelineProvider {
/** /**
* Get cache key for get calendar action events for the given course value WS call. * Get cache key for get calendar action events for the given course value WS call.
* *
* @param {number} courseId Only events in this course. * @param courseId Only events in this course.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getActionEventsByCourseCacheKey(courseId: number): string { protected getActionEventsByCourseCacheKey(courseId: number): string {
return this.getActionEventsByCoursesCacheKey() + ':' + courseId; return this.getActionEventsByCoursesCacheKey() + ':' + courseId;
@ -78,9 +78,9 @@ export class AddonBlockTimelineProvider {
/** /**
* Get calendar action events for a given list of courses. * Get calendar action events for a given list of courses.
* *
* @param {number[]} courseIds Course IDs. * @param courseIds Course IDs.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<{[s: string]: {events: any[], canLoadMore: number}}>} Promise resolved when the info is retrieved. * @return Promise resolved when the info is retrieved.
*/ */
getActionEventsByCourses(courseIds: number[], siteId?: string): Promise<{ [s: string]: getActionEventsByCourses(courseIds: number[], siteId?: string): Promise<{ [s: string]:
{ events: any[], canLoadMore: number } }> { { events: any[], canLoadMore: number } }> {
@ -114,7 +114,7 @@ export class AddonBlockTimelineProvider {
/** /**
* Get cache key for get calendar action events for a given list of courses value WS call. * Get cache key for get calendar action events for a given list of courses value WS call.
* *
* @return {string} Cache key. * @return Cache key.
*/ */
protected getActionEventsByCoursesCacheKey(): string { protected getActionEventsByCoursesCacheKey(): string {
return this.ROOT_CACHE_KEY + 'bycourse'; return this.ROOT_CACHE_KEY + 'bycourse';
@ -123,9 +123,9 @@ export class AddonBlockTimelineProvider {
/** /**
* Get calendar action events based on the timesort value. * Get calendar action events based on the timesort value.
* *
* @param {number} [afterEventId] The last seen event id. * @param afterEventId The last seen event id.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<{events: any[], canLoadMore: number}>} Promise resolved when the info is retrieved. * @return Promise resolved when the info is retrieved.
*/ */
getActionEventsByTimesort(afterEventId: number, siteId?: string): Promise<{ events: any[], canLoadMore: number }> { getActionEventsByTimesort(afterEventId: number, siteId?: string): Promise<{ events: any[], canLoadMore: number }> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -167,7 +167,7 @@ export class AddonBlockTimelineProvider {
/** /**
* Get prefix cache key for calendar action events based on the timesort value WS calls. * Get prefix cache key for calendar action events based on the timesort value WS calls.
* *
* @return {string} Cache key. * @return Cache key.
*/ */
protected getActionEventsByTimesortPrefixCacheKey(): string { protected getActionEventsByTimesortPrefixCacheKey(): string {
return this.ROOT_CACHE_KEY + 'bytimesort:'; return this.ROOT_CACHE_KEY + 'bytimesort:';
@ -176,9 +176,9 @@ export class AddonBlockTimelineProvider {
/** /**
* Get cache key for get calendar action events based on the timesort value WS call. * Get cache key for get calendar action events based on the timesort value WS call.
* *
* @param {number} [afterEventId] The last seen event id. * @param afterEventId The last seen event id.
* @param {number} [limit] Limit num of the call. * @param limit Limit num of the call.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getActionEventsByTimesortCacheKey(afterEventId?: number, limit?: number): string { protected getActionEventsByTimesortCacheKey(afterEventId?: number, limit?: number): string {
afterEventId = afterEventId || 0; afterEventId = afterEventId || 0;
@ -190,8 +190,8 @@ export class AddonBlockTimelineProvider {
/** /**
* Invalidates get calendar action events for a given list of courses WS call. * Invalidates get calendar action events for a given list of courses WS call.
* *
* @param {string} [siteId] Site ID to invalidate. If not defined, use current site. * @param siteId Site ID to invalidate. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateActionEventsByCourses(siteId?: string): Promise<any> { invalidateActionEventsByCourses(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -202,8 +202,8 @@ export class AddonBlockTimelineProvider {
/** /**
* Invalidates get calendar action events based on the timesort value WS call. * Invalidates get calendar action events based on the timesort value WS call.
* *
* @param {string} [siteId] Site ID to invalidate. If not defined, use current site. * @param siteId Site ID to invalidate. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateActionEventsByTimesort(siteId?: string): Promise<any> { invalidateActionEventsByTimesort(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -214,8 +214,8 @@ export class AddonBlockTimelineProvider {
/** /**
* Returns whether or not My Overview is available for a certain site. * Returns whether or not My Overview is available for a certain site.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with true if available, resolved with false or rejected otherwise. * @return Promise resolved with true if available, resolved with false or rejected otherwise.
*/ */
isAvailable(siteId?: string): Promise<boolean> { isAvailable(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -232,9 +232,9 @@ export class AddonBlockTimelineProvider {
/** /**
* Handles course events, filtering and treating if more can be loaded. * Handles course events, filtering and treating if more can be loaded.
* *
* @param {any} course Object containing response course events info. * @param course Object containing response course events info.
* @param {number} timeFrom Current time to filter events from. * @param timeFrom Current time to filter events from.
* @return {{events: any[], canLoadMore: number}} Object with course events and last loaded event id if more can be loaded. * @return Object with course events and last loaded event id if more can be loaded.
*/ */
protected treatCourseEvents(course: any, timeFrom: number): { events: any[], canLoadMore: number } { protected treatCourseEvents(course: any, timeFrom: number): { events: any[], canLoadMore: number } {
const canLoadMore: number = const canLoadMore: number =

View File

@ -104,8 +104,8 @@ export class AddonBlogEntriesComponent implements OnInit {
/** /**
* Fetch blog entries. * Fetch blog entries.
* *
* @param {boolean} [refresh] Empty events array first. * @param refresh Empty events array first.
* @return {Promise<any>} Promise with the entries. * @return Promise with the entries.
*/ */
private fetchEntries(refresh: boolean = false): Promise<any> { private fetchEntries(refresh: boolean = false): Promise<any> {
this.loadMoreError = false; this.loadMoreError = false;
@ -174,7 +174,7 @@ export class AddonBlogEntriesComponent implements OnInit {
/** /**
* Toggle between showing only my entries or not. * Toggle between showing only my entries or not.
* *
* @param {boolean} enabled If true, filter my entries. False otherwise. * @param enabled If true, filter my entries. False otherwise.
*/ */
onlyMyEntriesToggleChanged(enabled: boolean): void { onlyMyEntriesToggleChanged(enabled: boolean): void {
if (enabled) { if (enabled) {
@ -198,8 +198,8 @@ export class AddonBlogEntriesComponent implements OnInit {
/** /**
* Function to load more entries. * Function to load more entries.
* *
* @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
loadMore(infiniteComplete?: any): Promise<any> { loadMore(infiniteComplete?: any): Promise<any> {
return this.fetchEntries().finally(() => { return this.fetchEntries().finally(() => {
@ -210,7 +210,7 @@ export class AddonBlogEntriesComponent implements OnInit {
/** /**
* Refresh blog entries on PTR. * Refresh blog entries on PTR.
* *
* @param {any} refresher Refresher instance. * @param refresher Refresher instance.
*/ */
refresh(refresher?: any): void { refresh(refresher?: any): void {
const promises = this.entries.map((entry) => { const promises = this.entries.map((entry) => {

View File

@ -40,8 +40,8 @@ export class AddonBlogProvider {
* This method is called quite often and thus should only perform a quick * This method is called quite often and thus should only perform a quick
* check, we should not be calling WS from here. * check, we should not be calling WS from here.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with true if enabled, resolved with false or rejected otherwise. * @return Promise resolved with true if enabled, resolved with false or rejected otherwise.
*/ */
isPluginEnabled(siteId?: string): Promise<boolean> { isPluginEnabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -53,8 +53,8 @@ export class AddonBlogProvider {
/** /**
* Get the cache key for the blog entries. * Get the cache key for the blog entries.
* *
* @param {any} [filter] Filter to apply on search. * @param filter Filter to apply on search.
* @return {string} Cache key. * @return Cache key.
*/ */
getEntriesCacheKey(filter: any = {}): string { getEntriesCacheKey(filter: any = {}): string {
return this.ROOT_CACHE_KEY + this.utils.sortAndStringify(filter); return this.ROOT_CACHE_KEY + this.utils.sortAndStringify(filter);
@ -63,10 +63,10 @@ export class AddonBlogProvider {
/** /**
* Get blog entries. * Get blog entries.
* *
* @param {any} [filter] Filter to apply on search. * @param filter Filter to apply on search.
* @param {any} [page=0] Page of the blog entries to fetch. * @param page Page of the blog entries to fetch.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise to be resolved when the entries are retrieved. * @return Promise to be resolved when the entries are retrieved.
*/ */
getEntries(filter: any = {}, page: number = 0, siteId?: string): Promise<any> { getEntries(filter: any = {}, page: number = 0, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -88,9 +88,9 @@ export class AddonBlogProvider {
/** /**
* Invalidate blog entries WS call. * Invalidate blog entries WS call.
* *
* @param {any} [filter] Filter to apply on search * @param filter Filter to apply on search
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when data is invalidated. * @return Promise resolved when data is invalidated.
*/ */
invalidateEntries(filter: any = {}, siteId?: string): Promise<any> { invalidateEntries(filter: any = {}, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -101,9 +101,9 @@ export class AddonBlogProvider {
/** /**
* Trigger the blog_entries_viewed event. * Trigger the blog_entries_viewed event.
* *
* @param {any} [filter] Filter to apply on search. * @param filter Filter to apply on search.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise to be resolved when done. * @return Promise to be resolved when done.
*/ */
logView(filter: any = {}, siteId?: string): Promise<any> { logView(filter: any = {}, siteId?: string): Promise<any> {
this.pushNotificationsProvider.logViewListEvent('blog', 'core_blog_view_entries', filter, siteId); this.pushNotificationsProvider.logViewListEvent('blog', 'core_blog_view_entries', filter, siteId);

View File

@ -37,10 +37,10 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler {
/** /**
* Should invalidate the data to determine if the handler is enabled for a certain course. * Should invalidate the data to determine if the handler is enabled for a certain course.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> { invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> {
return this.courseProvider.invalidateCourseBlocks(courseId); return this.courseProvider.invalidateCourseBlocks(courseId);
@ -49,7 +49,7 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.blogProvider.isPluginEnabled(); return this.blogProvider.isPluginEnabled();
@ -58,11 +58,11 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler {
/** /**
* Whether or not the handler is enabled for a certain course. * Whether or not the handler is enabled for a certain course.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @param {any} accessData Access type and data. Default, guest, ... * @param accessData Access type and data. Default, guest, ...
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean|Promise<boolean>} True or promise resolved with true if enabled. * @return True or promise resolved with true if enabled.
*/ */
isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> { isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
return this.courseHelper.hasABlockNamed(courseId, 'blog_menu').then((enabled) => { return this.courseHelper.hasABlockNamed(courseId, 'blog_menu').then((enabled) => {
@ -77,9 +77,9 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {number} course The course. * @param course The course.
* @return {CoreCourseOptionsHandlerData|Promise<CoreCourseOptionsHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise<CoreCourseOptionsHandlerData> { getDisplayData(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise<CoreCourseOptionsHandlerData> {
return { return {
@ -92,8 +92,8 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler {
/** /**
* Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline. * Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline.
* *
* @param {any} course The course. * @param course The course.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
prefetch(course: any): Promise<any> { prefetch(course: any): Promise<any> {
const siteId = this.sitesProvider.getCurrentSiteId(); const siteId = this.sitesProvider.getCurrentSiteId();

View File

@ -34,11 +34,11 @@ export class AddonBlogIndexLinkHandler extends CoreContentLinksHandlerBase {
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -62,11 +62,11 @@ export class AddonBlogIndexLinkHandler extends CoreContentLinksHandlerBase {
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {

View File

@ -29,7 +29,7 @@ export class AddonBlogMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.blogProvider.isPluginEnabled(); return this.blogProvider.isPluginEnabled();
@ -38,7 +38,7 @@ export class AddonBlogMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreMainMenuHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(): CoreMainMenuHandlerData { getDisplayData(): CoreMainMenuHandlerData {
return { return {

View File

@ -30,7 +30,7 @@ export class AddonBlogTagAreaHandler implements CoreTagAreaHandler {
/** /**
* Whether or not the handler is enabled on a site level. * Whether or not the handler is enabled on a site level.
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.blogProvider.isPluginEnabled(); return this.blogProvider.isPluginEnabled();
@ -39,8 +39,8 @@ export class AddonBlogTagAreaHandler implements CoreTagAreaHandler {
/** /**
* Parses the rendered content of a tag index and returns the items. * Parses the rendered content of a tag index and returns the items.
* *
* @param {string} content Rendered content. * @param content Rendered content.
* @return {any[]|Promise<any[]>} Area items (or promise resolved with the items). * @return Area items (or promise resolved with the items).
*/ */
parseContent(content: string): any[] | Promise<any[]> { parseContent(content: string): any[] | Promise<any[]> {
return this.tagHelper.parseFeedContent(content); return this.tagHelper.parseFeedContent(content);
@ -49,8 +49,8 @@ export class AddonBlogTagAreaHandler implements CoreTagAreaHandler {
/** /**
* Get the component to use to display items. * Get the component to use to display items.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @return {any|Promise<any>} The component (or promise resolved with component) to use, undefined if not found. * @return The component (or promise resolved with component) to use, undefined if not found.
*/ */
getComponent(injector: Injector): any | Promise<any> { getComponent(injector: Injector): any | Promise<any> {
return CoreTagFeedComponent; return CoreTagFeedComponent;

View File

@ -31,7 +31,7 @@ export class AddonBlogUserHandler implements CoreUserProfileHandler {
/** /**
* Whether or not the handler is enabled on a site level. * Whether or not the handler is enabled on a site level.
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.blogProvider.isPluginEnabled(); return this.blogProvider.isPluginEnabled();
@ -40,11 +40,11 @@ export class AddonBlogUserHandler implements CoreUserProfileHandler {
/** /**
* Check if handler is enabled for this user in this context. * Check if handler is enabled for this user in this context.
* *
* @param {any} user User to check. * @param user User to check.
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean|Promise<boolean>} Promise resolved with true if enabled, resolved with false otherwise. * @return Promise resolved with true if enabled, resolved with false otherwise.
*/ */
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> { isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
return true; return true;
@ -53,7 +53,7 @@ export class AddonBlogUserHandler implements CoreUserProfileHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreUserProfileHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData { getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData {
return { return {

View File

@ -134,8 +134,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Fetch contacts. * Fetch contacts.
* *
* @param {boolean} [refresh=false] True if we are refreshing events. * @param refresh True if we are refreshing events.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(refresh: boolean = false): Promise<any> { fetchData(refresh: boolean = false): Promise<any> {
const promises = []; const promises = [];
@ -184,7 +184,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Fetch the events for current month. * Fetch the events for current month.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchEvents(): Promise<any> { fetchEvents(): Promise<any> {
// Don't pass courseId and categoryId, we'll filter them locally. // Don't pass courseId and categoryId, we'll filter them locally.
@ -238,7 +238,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Load categories to be able to filter events. * Load categories to be able to filter events.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected loadCategories(): Promise<any> { protected loadCategories(): Promise<any> {
if (this.categoriesRetrieved) { if (this.categoriesRetrieved) {
@ -285,8 +285,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Refresh events. * Refresh events.
* *
* @param {boolean} [afterChange] Whether the refresh is done after an event has changed or has been synced. * @param afterChange Whether the refresh is done after an event has changed or has been synced.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(afterChange?: boolean): Promise<any> { refreshData(afterChange?: boolean): Promise<any> {
const promises = []; const promises = [];
@ -340,8 +340,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* An event was clicked. * An event was clicked.
* *
* @param {any} calendarEvent Calendar event.. * @param calendarEvent Calendar event..
* @param {MouseEvent} event Mouse event. * @param event Mouse event.
*/ */
eventClicked(calendarEvent: any, event: MouseEvent): void { eventClicked(calendarEvent: any, event: MouseEvent): void {
this.onEventClicked.emit(calendarEvent.id); this.onEventClicked.emit(calendarEvent.id);
@ -351,7 +351,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* A day was clicked. * A day was clicked.
* *
* @param {number} day Day. * @param day Day.
*/ */
dayClicked(day: number): void { dayClicked(day: number): void {
this.onDayClicked.emit({day: day, month: this.month, year: this.year}); this.onDayClicked.emit({day: day, month: this.month, year: this.year});
@ -461,7 +461,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Sort events by timestart. * Sort events by timestart.
* *
* @param {any[]} events List to sort. * @param events List to sort.
*/ */
protected sortEvents(events: any[]): any[] { protected sortEvents(events: any[]): any[] {
return events.sort((a, b) => { return events.sort((a, b) => {
@ -476,7 +476,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Undelete a certain event. * Undelete a certain event.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
*/ */
protected undeleteEvent(eventId: number): void { protected undeleteEvent(eventId: number): void {
if (!this.weeks) { if (!this.weeks) {
@ -498,8 +498,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest
/** /**
* Returns if the event is in the past or not. * Returns if the event is in the past or not.
* @param {any} event Event object. * @param event Event object.
* @return {boolean} True if it's in the past. * @return True if it's in the past.
*/ */
isEventPast(event: any): boolean { isEventPast(event: any): boolean {
return (event.timestart + event.timeduration) < this.currentTime; return (event.timestart + event.timeduration) < this.currentTime;

View File

@ -106,8 +106,8 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Fetch data. * Fetch data.
* *
* @param {boolean} [refresh=false] True if we are refreshing events. * @param refresh True if we are refreshing events.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(refresh: boolean = false): Promise<any> { fetchData(refresh: boolean = false): Promise<any> {
const promises = []; const promises = [];
@ -151,7 +151,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Fetch upcoming events. * Fetch upcoming events.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchEvents(): Promise<any> { fetchEvents(): Promise<any> {
// Don't pass courseId and categoryId, we'll filter them locally. // Don't pass courseId and categoryId, we'll filter them locally.
@ -185,7 +185,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Load categories to be able to filter events. * Load categories to be able to filter events.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected loadCategories(): Promise<any> { protected loadCategories(): Promise<any> {
if (this.categoriesRetrieved) { if (this.categoriesRetrieved) {
@ -225,8 +225,8 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Refresh events. * Refresh events.
* *
* @param {boolean} [afterChange] Whether the refresh is done after an event has changed or has been synced. * @param afterChange Whether the refresh is done after an event has changed or has been synced.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(afterChange?: boolean): Promise<any> { refreshData(afterChange?: boolean): Promise<any> {
const promises = []; const promises = [];
@ -249,7 +249,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* An event was clicked. * An event was clicked.
* *
* @param {any} event Event. * @param event Event.
*/ */
eventClicked(event: any): void { eventClicked(event: any): void {
this.onEventClicked.emit(event.id); this.onEventClicked.emit(event.id);
@ -258,7 +258,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Merge online events with the offline events of that period. * Merge online events with the offline events of that period.
* *
* @return {any[]} Merged events. * @return Merged events.
*/ */
protected mergeEvents(): any[] { protected mergeEvents(): any[] {
if (!this.offlineEvents.length && !this.deletedEvents.length) { if (!this.offlineEvents.length && !this.deletedEvents.length) {
@ -302,7 +302,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Sort events by timestart. * Sort events by timestart.
* *
* @param {any[]} events List to sort. * @param events List to sort.
*/ */
protected sortEvents(events: any[]): any[] { protected sortEvents(events: any[]): any[] {
return events.sort((a, b) => { return events.sort((a, b) => {
@ -317,7 +317,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges,
/** /**
* Undelete a certain event. * Undelete a certain event.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
*/ */
protected undeleteEvent(eventId: number): void { protected undeleteEvent(eventId: number): void {
const event = this.onlineEvents.find((event) => { const event = this.onlineEvents.find((event) => {

View File

@ -208,9 +208,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Fetch all the data required for the view. * Fetch all the data required for the view.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(sync?: boolean, showErrors?: boolean): Promise<any> { fetchData(sync?: boolean, showErrors?: boolean): Promise<any> {
@ -280,7 +280,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Fetch the events for current day. * Fetch the events for current day.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchEvents(): Promise<any> { fetchEvents(): Promise<any> {
// Don't pass courseId and categoryId, we'll filter them locally. // Don't pass courseId and categoryId, we'll filter them locally.
@ -328,7 +328,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Merge online events with the offline events of that period. * Merge online events with the offline events of that period.
* *
* @return {any[]} Merged events. * @return Merged events.
*/ */
protected mergeEvents(): any[] { protected mergeEvents(): any[] {
this.hasOffline = false; this.hasOffline = false;
@ -389,7 +389,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Sort events by timestart. * Sort events by timestart.
* *
* @param {any[]} events List to sort. * @param events List to sort.
*/ */
protected sortEvents(events: any[]): any[] { protected sortEvents(events: any[]): any[] {
return events.sort((a, b) => { return events.sort((a, b) => {
@ -404,10 +404,10 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> { doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> {
if (this.loaded) { if (this.loaded) {
@ -423,10 +423,10 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @param {boolean} [afterChange] Whether the refresh is done after an event has changed or has been synced. * @param afterChange Whether the refresh is done after an event has changed or has been synced.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(sync?: boolean, showErrors?: boolean, afterChange?: boolean): Promise<any> { refreshData(sync?: boolean, showErrors?: boolean, afterChange?: boolean): Promise<any> {
this.syncIcon = 'spinner'; this.syncIcon = 'spinner';
@ -449,7 +449,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Load categories to be able to filter events. * Load categories to be able to filter events.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected loadCategories(): Promise<any> { protected loadCategories(): Promise<any> {
return this.coursesProvider.getCategories(0, true).then((cats) => { return this.coursesProvider.getCategories(0, true).then((cats) => {
@ -467,8 +467,8 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Try to synchronize offline events. * Try to synchronize offline events.
* *
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected sync(showErrors?: boolean): Promise<any> { protected sync(showErrors?: boolean): Promise<any> {
return this.calendarSync.syncEvents().then((result) => { return this.calendarSync.syncEvents().then((result) => {
@ -495,7 +495,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Navigate to a particular event. * Navigate to a particular event.
* *
* @param {number} eventId Event to load. * @param eventId Event to load.
*/ */
gotoEvent(eventId: number): void { gotoEvent(eventId: number): void {
if (eventId < 0) { if (eventId < 0) {
@ -511,7 +511,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Show the context menu. * Show the context menu.
* *
* @param {MouseEvent} event Event. * @param event Event.
*/ */
openCourseFilter(event: MouseEvent): void { openCourseFilter(event: MouseEvent): void {
this.coursesHelper.selectCourse(event, this.courses, this.courseId).then((result) => { this.coursesHelper.selectCourse(event, this.courses, this.courseId).then((result) => {
@ -532,7 +532,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Open page to create/edit an event. * Open page to create/edit an event.
* *
* @param {number} [eventId] Event ID to edit. * @param eventId Event ID to edit.
*/ */
openEdit(eventId?: number): void { openEdit(eventId?: number): void {
const params: any = {}; const params: any = {};
@ -658,9 +658,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Find an event and mark it as deleted. * Find an event and mark it as deleted.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {boolean} deleted Whether to mark it as deleted or not. * @param deleted Whether to mark it as deleted or not.
* @return {boolean} Whether the event was found. * @return Whether the event was found.
*/ */
protected markAsDeleted(eventId: number, deleted: boolean): boolean { protected markAsDeleted(eventId: number, deleted: boolean): boolean {
const event = this.onlineEvents.find((event) => { const event = this.onlineEvents.find((event) => {
@ -678,8 +678,8 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
/** /**
* Returns if the event is in the past or not. * Returns if the event is in the past or not.
* @param {any} event Event object. * @param event Event object.
* @return {boolean} True if it's in the past. * @return True if it's in the past.
*/ */
isEventPast(event: any): boolean { isEventPast(event: any): boolean {
return (event.timestart + event.timeduration) < this.currentTime; return (event.timestart + event.timeduration) < this.currentTime;

View File

@ -148,8 +148,8 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* Fetch the data needed to render the form. * Fetch the data needed to render the form.
* *
* @param {boolean} [refresh] Whether it's refreshing data. * @param refresh Whether it's refreshing data.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchData(refresh?: boolean): Promise<any> { protected fetchData(refresh?: boolean): Promise<any> {
let accessInfo; let accessInfo;
@ -289,9 +289,9 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* Load an event data into the form. * Load an event data into the form.
* *
* @param {any} event Event data. * @param event Event data.
* @param {boolean} isOffline Whether the data is from offline or not. * @param isOffline Whether the data is from offline or not.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected loadEventData(event: any, isOffline: boolean): Promise<any> { protected loadEventData(event: any, isOffline: boolean): Promise<any> {
const courseId = event.course ? event.course.id : event.courseid; const courseId = event.course ? event.course.id : event.courseid;
@ -344,7 +344,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* Pull to refresh. * Pull to refresh.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshData(refresher: any): void { refreshData(refresher: any): void {
const promises = [ const promises = [
@ -375,7 +375,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* A course was selected, get its groups. * A course was selected, get its groups.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
*/ */
groupCourseSelected(courseId: number): void { groupCourseSelected(courseId: number): void {
if (!courseId) { if (!courseId) {
@ -396,8 +396,8 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* Load groups of a certain course. * Load groups of a certain course.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected loadGroups(courseId: number): Promise<any> { protected loadGroups(courseId: number): Promise<any> {
this.loadingGroups = true; this.loadingGroups = true;
@ -515,7 +515,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* Convenience function to update or return to event list depending on device. * Convenience function to update or return to event list depending on device.
* *
* @param {number} [event] Event. * @param event Event.
*/ */
protected returnToList(event?: any): void { protected returnToList(event?: any): void {
// Unblock the sync because the view will be destroyed and the sync process could be triggered before ngOnDestroy. // Unblock the sync because the view will be destroyed and the sync process could be triggered before ngOnDestroy.
@ -568,7 +568,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
/** /**
* Check if we can leave the page or not. * Check if we can leave the page or not.
* *
* @return {boolean|Promise<void>} Resolved if we can leave it, rejected if not. * @return Resolved if we can leave it, rejected if not.
*/ */
ionViewCanLeave(): boolean | Promise<void> { ionViewCanLeave(): boolean | Promise<void> {

View File

@ -144,9 +144,9 @@ export class AddonCalendarEventPage implements OnDestroy {
/** /**
* Fetches the event and updates the view. * Fetches the event and updates the view.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchEvent(sync?: boolean, showErrors?: boolean): Promise<any> { fetchEvent(sync?: boolean, showErrors?: boolean): Promise<any> {
const currentSite = this.sitesProvider.getCurrentSite(), const currentSite = this.sitesProvider.getCurrentSite(),
@ -312,7 +312,7 @@ export class AddonCalendarEventPage implements OnDestroy {
/** /**
* Add a reminder for this event. * Add a reminder for this event.
* *
* @param {Event} e Click event. * @param e Click event.
*/ */
addNotificationTime(e: Event): void { addNotificationTime(e: Event): void {
e.preventDefault(); e.preventDefault();
@ -342,8 +342,8 @@ export class AddonCalendarEventPage implements OnDestroy {
/** /**
* Cancel the selected notification. * Cancel the selected notification.
* *
* @param {number} id Reminder ID. * @param id Reminder ID.
* @param {Event} e Click event. * @param e Click event.
*/ */
cancelNotification(id: number, e: Event): void { cancelNotification(id: number, e: Event): void {
e.preventDefault(); e.preventDefault();
@ -359,10 +359,10 @@ export class AddonCalendarEventPage implements OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> { doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> {
if (this.eventLoaded) { if (this.eventLoaded) {
@ -378,9 +378,9 @@ export class AddonCalendarEventPage implements OnDestroy {
/** /**
* Refresh the event. * Refresh the event.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshEvent(sync?: boolean, showErrors?: boolean): Promise<any> { refreshEvent(sync?: boolean, showErrors?: boolean): Promise<any> {
this.syncIcon = 'spinner'; this.syncIcon = 'spinner';
@ -511,8 +511,8 @@ export class AddonCalendarEventPage implements OnDestroy {
/** /**
* Check the result of an automatic sync or a manual sync not done by this page. * Check the result of an automatic sync or a manual sync not done by this page.
* *
* @param {boolean} isManual Whether it's a manual sync. * @param isManual Whether it's a manual sync.
* @param {any} data Sync result. * @param data Sync result.
*/ */
protected checkSyncResult(isManual: boolean, data: any): void { protected checkSyncResult(isManual: boolean, data: any): void {
if (!data) { if (!data) {

View File

@ -164,9 +164,9 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* Fetch all the data required for the view. * Fetch all the data required for the view.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(sync?: boolean, showErrors?: boolean): Promise<any> { fetchData(sync?: boolean, showErrors?: boolean): Promise<any> {
@ -230,10 +230,10 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> { doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> {
if (this.loaded) { if (this.loaded) {
@ -249,10 +249,10 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @param {boolean} [afterChange] Whether the refresh is done after an event has changed or has been synced. * @param afterChange Whether the refresh is done after an event has changed or has been synced.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(sync?: boolean, showErrors?: boolean, afterChange?: boolean): Promise<any> { refreshData(sync?: boolean, showErrors?: boolean, afterChange?: boolean): Promise<any> {
this.syncIcon = 'spinner'; this.syncIcon = 'spinner';
@ -276,7 +276,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* Navigate to a particular event. * Navigate to a particular event.
* *
* @param {number} eventId Event to load. * @param eventId Event to load.
*/ */
gotoEvent(eventId: number): void { gotoEvent(eventId: number): void {
if (eventId < 0) { if (eventId < 0) {
@ -292,7 +292,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* View a certain day. * View a certain day.
* *
* @param {any} data Data with the year, month and day. * @param data Data with the year, month and day.
*/ */
gotoDay(data: any): void { gotoDay(data: any): void {
const params: any = { const params: any = {
@ -311,7 +311,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* Show the context menu. * Show the context menu.
* *
* @param {MouseEvent} event Event. * @param event Event.
*/ */
openCourseFilter(event: MouseEvent): void { openCourseFilter(event: MouseEvent): void {
this.coursesHelper.selectCourse(event, this.courses, this.courseId).then((result) => { this.coursesHelper.selectCourse(event, this.courses, this.courseId).then((result) => {
@ -330,7 +330,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
/** /**
* Open page to create/edit an event. * Open page to create/edit an event.
* *
* @param {number} [eventId] Event ID to edit. * @param eventId Event ID to edit.
*/ */
openEdit(eventId?: number): void { openEdit(eventId?: number): void {
const params: any = {}; const params: any = {};

View File

@ -233,10 +233,10 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Fetch all the data required for the view. * Fetch all the data required for the view.
* *
* @param {boolean} [refresh] Empty events array first. * @param refresh Empty events array first.
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(refresh?: boolean, sync?: boolean, showErrors?: boolean): Promise<any> { fetchData(refresh?: boolean, sync?: boolean, showErrors?: boolean): Promise<any> {
this.initialTime = this.timeUtils.timestamp(); this.initialTime = this.timeUtils.timestamp();
@ -314,8 +314,8 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Fetches the events and updates the view. * Fetches the events and updates the view.
* *
* @param {boolean} [refresh] Empty events array first. * @param refresh Empty events array first.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchEvents(refresh?: boolean): Promise<any> { fetchEvents(refresh?: boolean): Promise<any> {
this.loadMoreError = false; this.loadMoreError = false;
@ -388,8 +388,8 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Function to load more events. * Function to load more events.
* *
* @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
loadMoreEvents(infiniteComplete?: any): Promise<any> { loadMoreEvents(infiniteComplete?: any): Promise<any> {
return this.fetchEvents().finally(() => { return this.fetchEvents().finally(() => {
@ -400,7 +400,7 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Get filtered events. * Get filtered events.
* *
* @return {any[]} Filtered events. * @return Filtered events.
*/ */
protected getFilteredEvents(): any[] { protected getFilteredEvents(): any[] {
if (!this.courseId) { if (!this.courseId) {
@ -415,8 +415,8 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Returns if the current state should load categories or not. * Returns if the current state should load categories or not.
* @param {any[]} events Events to parse. * @param events Events to parse.
* @return {boolean} True if categories should be loaded. * @return True if categories should be loaded.
*/ */
protected shouldLoadCategories(events: any[]): boolean { protected shouldLoadCategories(events: any[]): boolean {
if (this.categoriesRetrieved || this.getCategories) { if (this.categoriesRetrieved || this.getCategories) {
@ -433,7 +433,7 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Load categories to be able to filter events. * Load categories to be able to filter events.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected loadCategories(): Promise<any> { protected loadCategories(): Promise<any> {
return this.coursesProvider.getCategories(0, true).then((cats) => { return this.coursesProvider.getCategories(0, true).then((cats) => {
@ -451,8 +451,8 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Merge a period of online events with the offline events of that period. * Merge a period of online events with the offline events of that period.
* *
* @param {any[]} onlineEvents Online events. * @param onlineEvents Online events.
* @return {any[]} Merged events. * @return Merged events.
*/ */
protected mergeEvents(onlineEvents: any[]): any[] { protected mergeEvents(onlineEvents: any[]): any[] {
if (!this.offlineEvents.length && !this.deletedEvents.length) { if (!this.offlineEvents.length && !this.deletedEvents.length) {
@ -501,7 +501,7 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Sort events by timestart. * Sort events by timestart.
* *
* @param {any[]} events List to sort. * @param events List to sort.
*/ */
protected sortEvents(events: any[]): any[] { protected sortEvents(events: any[]): any[] {
return events.sort((a, b) => { return events.sort((a, b) => {
@ -516,10 +516,10 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> { doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise<any> {
if (this.eventsLoaded) { if (this.eventsLoaded) {
@ -535,9 +535,9 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Refresh the events. * Refresh the events.
* *
* @param {boolean} [sync] Whether it should try to synchronize offline events. * @param sync Whether it should try to synchronize offline events.
* @param {boolean} [showErrors] Whether to show sync errors to the user. * @param showErrors Whether to show sync errors to the user.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshEvents(sync?: boolean, showErrors?: boolean): Promise<any> { refreshEvents(sync?: boolean, showErrors?: boolean): Promise<any> {
this.syncIcon = 'spinner'; this.syncIcon = 'spinner';
@ -561,9 +561,9 @@ export class AddonCalendarListPage implements OnDestroy {
* Check date should be shown on event list for the current event. * Check date should be shown on event list for the current event.
* If date has changed from previous to current event it should be shown. * If date has changed from previous to current event it should be shown.
* *
* @param {any} event Current event where to show the date. * @param event Current event where to show the date.
* @param {any} [prevEvent] Previous event where to compare the date with. * @param prevEvent Previous event where to compare the date with.
* @return {boolean} If date has changed and should be shown. * @return If date has changed and should be shown.
*/ */
protected showDate(event: any, prevEvent?: any): boolean { protected showDate(event: any, prevEvent?: any): boolean {
if (!prevEvent) { if (!prevEvent) {
@ -578,8 +578,8 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Check if event ends the same date or not. * Check if event ends the same date or not.
* *
* @param {any} event Event info. * @param event Event info.
* @return {boolean} If date has changed and should be shown. * @return If date has changed and should be shown.
*/ */
protected endsSameDay(event: any): boolean { protected endsSameDay(event: any): boolean {
if (!event.timeduration) { if (!event.timeduration) {
@ -594,7 +594,7 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Show the context menu. * Show the context menu.
* *
* @param {MouseEvent} event Event. * @param event Event.
*/ */
openCourseFilter(event: MouseEvent): void { openCourseFilter(event: MouseEvent): void {
this.coursesHelper.selectCourse(event, this.courses, this.courseId).then((result) => { this.coursesHelper.selectCourse(event, this.courses, this.courseId).then((result) => {
@ -617,7 +617,7 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Open page to create/edit an event. * Open page to create/edit an event.
* *
* @param {number} [eventId] Event ID to edit. * @param eventId Event ID to edit.
*/ */
openEdit(eventId?: number): void { openEdit(eventId?: number): void {
this.eventId = undefined; this.eventId = undefined;
@ -644,7 +644,7 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Navigate to a particular event. * Navigate to a particular event.
* *
* @param {number} eventId Event to load. * @param eventId Event to load.
*/ */
gotoEvent(eventId: number): void { gotoEvent(eventId: number): void {
this.eventId = eventId; this.eventId = eventId;
@ -662,8 +662,8 @@ export class AddonCalendarListPage implements OnDestroy {
/** /**
* Find an event and mark it as deleted. * Find an event and mark it as deleted.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {boolean} deleted Whether to mark it as deleted or not. * @param deleted Whether to mark it as deleted or not.
*/ */
protected markAsDeleted(eventId: number, deleted: boolean): void { protected markAsDeleted(eventId: number, deleted: boolean): void {
const event = this.onlineEvents.find((event) => { const event = this.onlineEvents.find((event) => {

View File

@ -45,7 +45,7 @@ export class AddonCalendarSettingsPage {
/** /**
* Update default time. * Update default time.
* *
* @param {number} newTime New time. * @param newTime New time.
*/ */
updateDefaultTime(newTime: number): void { updateDefaultTime(newTime: number): void {
this.calendarProvider.setDefaultNotificationTime(newTime); this.calendarProvider.setDefaultNotificationTime(newTime);

View File

@ -148,9 +148,9 @@ export class AddonCalendarOfflineProvider {
/** /**
* Delete an offline event. * Delete an offline event.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if deleted, rejected if failure. * @return Promise resolved if deleted, rejected if failure.
*/ */
deleteEvent(eventId: number, siteId?: string): Promise<any> { deleteEvent(eventId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -165,8 +165,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get the IDs of all the events created/edited/deleted in offline. * Get the IDs of all the events created/edited/deleted in offline.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<number[]>} Promise resolved with the IDs. * @return Promise resolved with the IDs.
*/ */
getAllEventsIds(siteId?: string): Promise<number[]> { getAllEventsIds(siteId?: string): Promise<number[]> {
const promises = []; const promises = [];
@ -182,8 +182,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get all the events deleted in offline. * Get all the events deleted in offline.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any[]>} Promise resolved with all the events deleted in offline. * @return Promise resolved with all the events deleted in offline.
*/ */
getAllDeletedEvents(siteId?: string): Promise<any[]> { getAllDeletedEvents(siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -194,8 +194,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get the IDs of all the events deleted in offline. * Get the IDs of all the events deleted in offline.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<number[]>} Promise resolved with the IDs of all the events deleted in offline. * @return Promise resolved with the IDs of all the events deleted in offline.
*/ */
getAllDeletedEventsIds(siteId?: string): Promise<number[]> { getAllDeletedEventsIds(siteId?: string): Promise<number[]> {
return this.getAllDeletedEvents(siteId).then((events) => { return this.getAllDeletedEvents(siteId).then((events) => {
@ -208,8 +208,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get all the events created/edited in offline. * Get all the events created/edited in offline.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any[]>} Promise resolved with events. * @return Promise resolved with events.
*/ */
getAllEditedEvents(siteId?: string): Promise<any[]> { getAllEditedEvents(siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -220,8 +220,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get the IDs of all the events created/edited in offline. * Get the IDs of all the events created/edited in offline.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<number[]>} Promise resolved with events IDs. * @return Promise resolved with events IDs.
*/ */
getAllEditedEventsIds(siteId?: string): Promise<number[]> { getAllEditedEventsIds(siteId?: string): Promise<number[]> {
return this.getAllEditedEvents(siteId).then((events) => { return this.getAllEditedEvents(siteId).then((events) => {
@ -234,9 +234,9 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get an event deleted in offline. * Get an event deleted in offline.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the deleted event. * @return Promise resolved with the deleted event.
*/ */
getDeletedEvent(eventId: number, siteId?: string): Promise<any> { getDeletedEvent(eventId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -251,9 +251,9 @@ export class AddonCalendarOfflineProvider {
/** /**
* Get an offline event. * Get an offline event.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the event. * @return Promise resolved with the event.
*/ */
getEvent(eventId: number, siteId?: string): Promise<any> { getEvent(eventId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -268,8 +268,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Check if there are offline events to send. * Check if there are offline events to send.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with boolean: true if has offline events, false otherwise. * @return Promise resolved with boolean: true if has offline events, false otherwise.
*/ */
hasEditedEvents(siteId?: string): Promise<boolean> { hasEditedEvents(siteId?: string): Promise<boolean> {
return this.getAllEditedEvents(siteId).then((events) => { return this.getAllEditedEvents(siteId).then((events) => {
@ -283,8 +283,8 @@ export class AddonCalendarOfflineProvider {
/** /**
* Check whether there's offline data for a site. * Check whether there's offline data for a site.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with boolean: true if has offline data, false otherwise. * @return Promise resolved with boolean: true if has offline data, false otherwise.
*/ */
hasOfflineData(siteId?: string): Promise<boolean> { hasOfflineData(siteId?: string): Promise<boolean> {
return this.getAllEventsIds(siteId).then((ids) => { return this.getAllEventsIds(siteId).then((ids) => {
@ -295,9 +295,9 @@ export class AddonCalendarOfflineProvider {
/** /**
* Check if an event is deleted. * Check if an event is deleted.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with boolean: whether the event is deleted. * @return Promise resolved with boolean: whether the event is deleted.
*/ */
isEventDeleted(eventId: number, siteId?: string): Promise<boolean> { isEventDeleted(eventId: number, siteId?: string): Promise<boolean> {
return this.getDeletedEvent(eventId, siteId).then((event) => { return this.getDeletedEvent(eventId, siteId).then((event) => {
@ -310,11 +310,11 @@ export class AddonCalendarOfflineProvider {
/** /**
* Mark an event as deleted. * Mark an event as deleted.
* *
* @param {number} eventId Event ID to delete. * @param eventId Event ID to delete.
* @param {number} name Name of the event to delete. * @param name Name of the event to delete.
* @param {boolean} [deleteAll] If it's a repeated event. whether to delete all events of the series. * @param deleteAll If it's a repeated event. whether to delete all events of the series.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
markDeleted(eventId: number, name: string, deleteAll?: boolean, siteId?: string): Promise<any> { markDeleted(eventId: number, name: string, deleteAll?: boolean, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -332,11 +332,11 @@ export class AddonCalendarOfflineProvider {
/** /**
* Offline version for adding a new discussion to a forum. * Offline version for adding a new discussion to a forum.
* *
* @param {number} eventId Event ID. If it's a new event, set it to undefined/null. * @param eventId Event ID. If it's a new event, set it to undefined/null.
* @param {any} data Event data. * @param data Event data.
* @param {number} [timeCreated] The time the event was created. If not defined, current time. * @param timeCreated The time the event was created. If not defined, current time.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the stored event. * @return Promise resolved with the stored event.
*/ */
saveEvent(eventId: number, data: any, timeCreated?: number, siteId?: string): Promise<any> { saveEvent(eventId: number, data: any, timeCreated?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -373,9 +373,9 @@ export class AddonCalendarOfflineProvider {
/** /**
* Unmark an event as deleted. * Unmark an event as deleted.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if deleted, rejected if failure. * @return Promise resolved if deleted, rejected if failure.
*/ */
unmarkDeleted(eventId: number, siteId?: string): Promise<any> { unmarkDeleted(eventId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {

View File

@ -59,9 +59,9 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider {
/** /**
* Try to synchronize all events in a certain site or in all sites. * Try to synchronize all events in a certain site or in all sites.
* *
* @param {string} [siteId] Site ID to sync. If not defined, sync all sites. * @param siteId Site ID to sync. If not defined, sync all sites.
* @param {boolean} [force] Wether to force sync not depending on last execution. * @param force Wether to force sync not depending on last execution.
* @return {Promise<any>} Promise resolved if sync is successful, rejected if sync fails. * @return Promise resolved if sync is successful, rejected if sync fails.
*/ */
syncAllEvents(siteId?: string, force?: boolean): Promise<any> { syncAllEvents(siteId?: string, force?: boolean): Promise<any> {
return this.syncOnSites('all calendar events', this.syncAllEventsFunc.bind(this), [force], siteId); return this.syncOnSites('all calendar events', this.syncAllEventsFunc.bind(this), [force], siteId);
@ -70,9 +70,9 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider {
/** /**
* Sync all events on a site. * Sync all events on a site.
* *
* @param {string} siteId Site ID to sync. * @param siteId Site ID to sync.
* @param {boolean} [force] Wether to force sync not depending on last execution. * @param force Wether to force sync not depending on last execution.
* @return {Promise<any>} Promise resolved if sync is successful, rejected if sync fails. * @return Promise resolved if sync is successful, rejected if sync fails.
*/ */
protected syncAllEventsFunc(siteId: string, force?: boolean): Promise<any> { protected syncAllEventsFunc(siteId: string, force?: boolean): Promise<any> {
@ -93,8 +93,8 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider {
/** /**
* Sync a site events only if a certain time has passed since the last time. * Sync a site events only if a certain time has passed since the last time.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the events are synced or if it doesn't need to be synced. * @return Promise resolved when the events are synced or if it doesn't need to be synced.
*/ */
syncEventsIfNeeded(siteId?: string): Promise<any> { syncEventsIfNeeded(siteId?: string): Promise<any> {
siteId = siteId || this.sitesProvider.getCurrentSiteId(); siteId = siteId || this.sitesProvider.getCurrentSiteId();
@ -109,8 +109,8 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider {
/** /**
* Synchronize all offline events of a certain site. * Synchronize all offline events of a certain site.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if sync is successful, rejected otherwise. * @return Promise resolved if sync is successful, rejected otherwise.
*/ */
syncEvents(siteId?: string): Promise<any> { syncEvents(siteId?: string): Promise<any> {
siteId = siteId || this.sitesProvider.getCurrentSiteId(); siteId = siteId || this.sitesProvider.getCurrentSiteId();
@ -182,10 +182,10 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider {
/** /**
* Synchronize an offline event. * Synchronize an offline event.
* *
* @param {number} eventId The event ID to sync. * @param eventId The event ID to sync.
* @param {any} result Object where to store the result of the sync. * @param result Object where to store the result of the sync.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if sync is successful, rejected otherwise. * @return Promise resolved if sync is successful, rejected otherwise.
*/ */
protected syncOfflineEvent(eventId: number, result: any, siteId?: string): Promise<any> { protected syncOfflineEvent(eventId: number, result: any, siteId?: string): Promise<any> {

View File

@ -335,8 +335,8 @@ export class AddonCalendarProvider {
/** /**
* Check if a certain site allows deleting events. * Check if a certain site allows deleting events.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if can delete. * @return Promise resolved with true if can delete.
* @since 3.3 * @since 3.3
*/ */
canDeleteEvents(siteId?: string): Promise<boolean> { canDeleteEvents(siteId?: string): Promise<boolean> {
@ -350,8 +350,8 @@ export class AddonCalendarProvider {
/** /**
* Check if a certain site allows deleting events. * Check if a certain site allows deleting events.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether events can be deleted. * @return Whether events can be deleted.
* @since 3.3 * @since 3.3
*/ */
canDeleteEventsInSite(site?: CoreSite): boolean { canDeleteEventsInSite(site?: CoreSite): boolean {
@ -363,8 +363,8 @@ export class AddonCalendarProvider {
/** /**
* Check if a certain site allows creating and editing events. * Check if a certain site allows creating and editing events.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if can create/edit. * @return Promise resolved with true if can create/edit.
* @since 3.7.1 * @since 3.7.1
*/ */
canEditEvents(siteId?: string): Promise<boolean> { canEditEvents(siteId?: string): Promise<boolean> {
@ -378,8 +378,8 @@ export class AddonCalendarProvider {
/** /**
* Check if a certain site allows creating and editing events. * Check if a certain site allows creating and editing events.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether events can be created and edited. * @return Whether events can be created and edited.
* @since 3.7.1 * @since 3.7.1
*/ */
canEditEventsInSite(site?: CoreSite): boolean { canEditEventsInSite(site?: CoreSite): boolean {
@ -392,8 +392,8 @@ export class AddonCalendarProvider {
/** /**
* Check if a certain site allows viewing events in monthly view. * Check if a certain site allows viewing events in monthly view.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if monthly view is supported. * @return Promise resolved with true if monthly view is supported.
* @since 3.4 * @since 3.4
*/ */
canViewMonth(siteId?: string): Promise<boolean> { canViewMonth(siteId?: string): Promise<boolean> {
@ -407,8 +407,8 @@ export class AddonCalendarProvider {
/** /**
* Check if a certain site allows viewing events in monthly view. * Check if a certain site allows viewing events in monthly view.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether monthly view is supported. * @return Whether monthly view is supported.
* @since 3.4 * @since 3.4
*/ */
canViewMonthInSite(site?: CoreSite): boolean { canViewMonthInSite(site?: CoreSite): boolean {
@ -420,8 +420,8 @@ export class AddonCalendarProvider {
/** /**
* Removes expired events from local DB. * Removes expired events from local DB.
* *
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
cleanExpiredEvents(siteId?: string): Promise<any> { cleanExpiredEvents(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -442,12 +442,12 @@ export class AddonCalendarProvider {
/** /**
* Delete an event. * Delete an event.
* *
* @param {number} eventId Event ID to delete. * @param eventId Event ID to delete.
* @param {string} name Name of the event to delete. * @param name Name of the event to delete.
* @param {boolean} [deleteAll] If it's a repeated event. whether to delete all events of the series. * @param deleteAll If it's a repeated event. whether to delete all events of the series.
* @param {boolean} [forceOffline] True to always save it in offline. * @param forceOffline True to always save it in offline.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
deleteEvent(eventId: number, name: string, deleteAll?: boolean, forceOffline?: boolean, siteId?: string): Promise<boolean> { deleteEvent(eventId: number, name: string, deleteAll?: boolean, forceOffline?: boolean, siteId?: string): Promise<boolean> {
@ -484,10 +484,10 @@ export class AddonCalendarProvider {
/** /**
* Delete an event. It will fail if offline or cannot connect. * Delete an event. It will fail if offline or cannot connect.
* *
* @param {number} eventId Event ID to delete. * @param eventId Event ID to delete.
* @param {boolean} [deleteAll] If it's a repeated event. whether to delete all events of the series. * @param deleteAll If it's a repeated event. whether to delete all events of the series.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
deleteEventOnline(eventId: number, deleteAll?: boolean, siteId?: string): Promise<any> { deleteEventOnline(eventId: number, deleteAll?: boolean, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -511,9 +511,9 @@ export class AddonCalendarProvider {
/** /**
* Delete a locally stored event cancelling all the reminders and notifications. * Delete a locally stored event cancelling all the reminders and notifications.
* *
* @param {number} eventId Event ID. * @param eventId Event ID.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected deleteLocalEvent(eventId: number, siteId?: string): Promise<any> { protected deleteLocalEvent(eventId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -538,8 +538,8 @@ export class AddonCalendarProvider {
/** /**
* Check if event ends the same day or not. * Check if event ends the same day or not.
* *
* @param {any} event Event info. * @param event Event info.
* @return {boolean} If the . * @return If the .
*/ */
endsSameDay(event: any): boolean { endsSameDay(event: any): boolean {
if (!event.timeduration) { if (!event.timeduration) {
@ -554,13 +554,13 @@ export class AddonCalendarProvider {
/** /**
* Format event time. Similar to calendar_format_event_time. * Format event time. Similar to calendar_format_event_time.
* *
* @param {any} event Event to format. * @param event Event to format.
* @param {string} format Calendar time format (from getCalendarTimeFormat). * @param format Calendar time format (from getCalendarTimeFormat).
* @param {boolean} [useCommonWords=true] Whether to use common words like "Today", "Yesterday", etc. * @param useCommonWords Whether to use common words like "Today", "Yesterday", etc.
* @param {number} [seenDay] Timestamp of day currently seen. If set, the function will not add links to this day. * @param seenDay Timestamp of day currently seen. If set, the function will not add links to this day.
* @param {number} [showTime=0] Determine the show time GMT timestamp. * @param showTime Determine the show time GMT timestamp.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<string>} Promise resolved with the formatted event time. * @return Promise resolved with the formatted event time.
*/ */
formatEventTime(event: any, format: string, useCommonWords: boolean = true, seenDay?: number, showTime: number = 0, formatEventTime(event: any, format: string, useCommonWords: boolean = true, seenDay?: number, showTime: number = 0,
siteId?: string): Promise<string> { siteId?: string): Promise<string> {
@ -630,9 +630,9 @@ export class AddonCalendarProvider {
/** /**
* Get access information for a calendar (either course calendar or site calendar). * Get access information for a calendar (either course calendar or site calendar).
* *
* @param {number} [courseId] Course ID. If not defined, site calendar. * @param courseId Course ID. If not defined, site calendar.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with object with access information. * @return Promise resolved with object with access information.
* @since 3.7 * @since 3.7
*/ */
getAccessInformation(courseId?: number, siteId?: string): Promise<any> { getAccessInformation(courseId?: number, siteId?: string): Promise<any> {
@ -653,8 +653,8 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for calendar access information WS calls. * Get cache key for calendar access information WS calls.
* *
* @param {number} [courseId] Course ID. * @param courseId Course ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getAccessInformationCacheKey(courseId?: number): string { protected getAccessInformationCacheKey(courseId?: number): string {
return this.ROOT_CACHE_KEY + 'accessInformation:' + (courseId || 0); return this.ROOT_CACHE_KEY + 'accessInformation:' + (courseId || 0);
@ -663,8 +663,8 @@ export class AddonCalendarProvider {
/** /**
* Get all calendar events from local Db. * Get all calendar events from local Db.
* *
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved with all the events. * @return Promise resolved with all the events.
*/ */
getAllEventsFromLocalDb(siteId?: string): Promise<any[]> { getAllEventsFromLocalDb(siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -675,9 +675,9 @@ export class AddonCalendarProvider {
/** /**
* Get the type of events a user can create (either course calendar or site calendar). * Get the type of events a user can create (either course calendar or site calendar).
* *
* @param {number} [courseId] Course ID. If not defined, site calendar. * @param courseId Course ID. If not defined, site calendar.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with an object indicating the types. * @return Promise resolved with an object indicating the types.
* @since 3.7 * @since 3.7
*/ */
getAllowedEventTypes(courseId?: number, siteId?: string): Promise<any> { getAllowedEventTypes(courseId?: number, siteId?: string): Promise<any> {
@ -709,8 +709,8 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for calendar allowed event types WS calls. * Get cache key for calendar allowed event types WS calls.
* *
* @param {number} [courseId] Course ID. * @param courseId Course ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getAllowedEventTypesCacheKey(courseId?: number): string { protected getAllowedEventTypesCacheKey(courseId?: number): string {
return this.ROOT_CACHE_KEY + 'allowedEventTypes:' + (courseId || 0); return this.ROOT_CACHE_KEY + 'allowedEventTypes:' + (courseId || 0);
@ -719,8 +719,8 @@ export class AddonCalendarProvider {
/** /**
* Get the "look ahead" for a certain user. * Get the "look ahead" for a certain user.
* *
* @param {string} [siteId] ID of the site. If not defined, use current site. * @param siteId ID of the site. If not defined, use current site.
* @return {Promise<number>} Promise resolved with the look ahead (number of days). * @return Promise resolved with the look ahead (number of days).
*/ */
getCalendarLookAhead(siteId?: string): Promise<number> { getCalendarLookAhead(siteId?: string): Promise<number> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -739,8 +739,8 @@ export class AddonCalendarProvider {
/** /**
* Get the time format to use in calendar. * Get the time format to use in calendar.
* *
* @param {string} [siteId] ID of the site. If not defined, use current site. * @param siteId ID of the site. If not defined, use current site.
* @return {Promise<string>} Promise resolved with the format. * @return Promise resolved with the format.
*/ */
getCalendarTimeFormat(siteId?: string): Promise<string> { getCalendarTimeFormat(siteId?: string): Promise<string> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -766,9 +766,9 @@ export class AddonCalendarProvider {
/** /**
* Return the representation day. Equivalent to Moodle's calendar_day_representation. * Return the representation day. Equivalent to Moodle's calendar_day_representation.
* *
* @param {number} time Timestamp to get the day from. * @param time Timestamp to get the day from.
* @param {boolean} [useCommonWords=true] Whether to use common words like "Today", "Yesterday", etc. * @param useCommonWords Whether to use common words like "Today", "Yesterday", etc.
* @return {string} The formatted date/time. * @return The formatted date/time.
*/ */
getDayRepresentation(time: number, useCommonWords: boolean = true): string { getDayRepresentation(time: number, useCommonWords: boolean = true): string {
@ -797,8 +797,8 @@ export class AddonCalendarProvider {
/** /**
* Get the configured default notification time. * Get the configured default notification time.
* *
* @param {string} [siteId] ID of the site. If not defined, use current site. * @param siteId ID of the site. If not defined, use current site.
* @return {Promise<number>} Promise resolved with the default time. * @return Promise resolved with the default time.
*/ */
getDefaultNotificationTime(siteId?: string): Promise<number> { getDefaultNotificationTime(siteId?: string): Promise<number> {
siteId = siteId || this.sitesProvider.getCurrentSiteId(); siteId = siteId || this.sitesProvider.getCurrentSiteId();
@ -811,10 +811,10 @@ export class AddonCalendarProvider {
/** /**
* Get a calendar event. If the server request fails and data is not cached, try to get it from local DB. * Get a calendar event. If the server request fails and data is not cached, try to get it from local DB.
* *
* @param {number} id Event ID. * @param id Event ID.
* @param {boolean} [refresh] True when we should update the event data. * @param refresh True when we should update the event data.
* @param {string} [siteId] ID of the site. If not defined, use current site. * @param siteId ID of the site. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the event data is retrieved. * @return Promise resolved when the event data is retrieved.
*/ */
getEvent(id: number, siteId?: string): Promise<any> { getEvent(id: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -848,10 +848,10 @@ export class AddonCalendarProvider {
/** /**
* Get a calendar event by ID. This function returns more data than getEvent, but it isn't available in all Moodles. * Get a calendar event by ID. This function returns more data than getEvent, but it isn't available in all Moodles.
* *
* @param {number} id Event ID. * @param id Event ID.
* @param {boolean} [refresh] True when we should update the event data. * @param refresh True when we should update the event data.
* @param {string} [siteId] ID of the site. If not defined, use current site. * @param siteId ID of the site. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the event data is retrieved. * @return Promise resolved when the event data is retrieved.
* @since 3.4 * @since 3.4
*/ */
getEventById(id: number, siteId?: string): Promise<any> { getEventById(id: number, siteId?: string): Promise<any> {
@ -877,8 +877,8 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for a single event WS call. * Get cache key for a single event WS call.
* *
* @param {number} id Event ID. * @param id Event ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getEventCacheKey(id: number): string { protected getEventCacheKey(id: number): string {
return this.ROOT_CACHE_KEY + 'events:' + id; return this.ROOT_CACHE_KEY + 'events:' + id;
@ -887,9 +887,9 @@ export class AddonCalendarProvider {
/** /**
* Get a calendar event from local Db. * Get a calendar event from local Db.
* *
* @param {number} id Event ID. * @param id Event ID.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the event data is retrieved. * @return Promise resolved when the event data is retrieved.
*/ */
getEventFromLocalDb(id: number, siteId?: string): Promise<any> { getEventFromLocalDb(id: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -913,10 +913,10 @@ export class AddonCalendarProvider {
/** /**
* Adds an event reminder and schedule a new notification. * Adds an event reminder and schedule a new notification.
* *
* @param {any} event Event to update its notification time. * @param event Event to update its notification time.
* @param {number} time New notification setting timestamp. * @param time New notification setting timestamp.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the notification is updated. * @return Promise resolved when the notification is updated.
*/ */
addEventReminder(event: any, time: number, siteId?: string): Promise<any> { addEventReminder(event: any, time: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -935,8 +935,8 @@ export class AddonCalendarProvider {
* Return the normalised event type. * Return the normalised event type.
* Activity events are normalised to be course events. * Activity events are normalised to be course events.
* *
* @param {any} event The event to get its type. * @param event The event to get its type.
* @return {string} Event type. * @return Event type.
*/ */
getEventType(event: any): string { getEventType(event: any): string {
if (event.modulename) { if (event.modulename) {
@ -949,9 +949,9 @@ export class AddonCalendarProvider {
/** /**
* Remove an event reminder and cancel the notification. * Remove an event reminder and cancel the notification.
* *
* @param {number} id Reminder ID. * @param id Reminder ID.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the notification is updated. * @return Promise resolved when the notification is updated.
*/ */
deleteEventReminder(id: number, siteId?: string): Promise<any> { deleteEventReminder(id: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -966,14 +966,14 @@ export class AddonCalendarProvider {
/** /**
* Get calendar events for a certain day. * Get calendar events for a certain day.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @param {number} day Day to get. * @param day Day to get.
* @param {number} [courseId] Course to get. * @param courseId Course to get.
* @param {number} [categoryId] Category to get. * @param categoryId Category to get.
* @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down).
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the response. * @return Promise resolved with the response.
*/ */
getDayEvents(year: number, month: number, day: number, courseId?: number, categoryId?: number, ignoreCache?: boolean, getDayEvents(year: number, month: number, day: number, courseId?: number, categoryId?: number, ignoreCache?: boolean,
siteId?: string): Promise<any> { siteId?: string): Promise<any> {
@ -1014,7 +1014,7 @@ export class AddonCalendarProvider {
/** /**
* Get prefix cache key for day events WS calls. * Get prefix cache key for day events WS calls.
* *
* @return {string} Prefix Cache key. * @return Prefix Cache key.
*/ */
protected getDayEventsPrefixCacheKey(): string { protected getDayEventsPrefixCacheKey(): string {
return this.ROOT_CACHE_KEY + 'day:'; return this.ROOT_CACHE_KEY + 'day:';
@ -1023,10 +1023,10 @@ export class AddonCalendarProvider {
/** /**
* Get prefix cache key for a certain day for day events WS calls. * Get prefix cache key for a certain day for day events WS calls.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @param {number} day Day to get. * @param day Day to get.
* @return {string} Prefix Cache key. * @return Prefix Cache key.
*/ */
protected getDayEventsDayPrefixCacheKey(year: number, month: number, day: number): string { protected getDayEventsDayPrefixCacheKey(year: number, month: number, day: number): string {
return this.getDayEventsPrefixCacheKey() + year + ':' + month + ':' + day + ':'; return this.getDayEventsPrefixCacheKey() + year + ':' + month + ':' + day + ':';
@ -1035,12 +1035,12 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for day events WS calls. * Get cache key for day events WS calls.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @param {number} day Day to get. * @param day Day to get.
* @param {number} [courseId] Course to get. * @param courseId Course to get.
* @param {number} [categoryId] Category to get. * @param categoryId Category to get.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getDayEventsCacheKey(year: number, month: number, day: number, courseId?: number, categoryId?: number): string { protected getDayEventsCacheKey(year: number, month: number, day: number, courseId?: number, categoryId?: number): string {
return this.getDayEventsDayPrefixCacheKey(year, month, day) + (courseId ? courseId : '') + ':' + return this.getDayEventsDayPrefixCacheKey(year, month, day) + (courseId ? courseId : '') + ':' +
@ -1050,9 +1050,9 @@ export class AddonCalendarProvider {
/** /**
* Get a calendar reminders from local Db. * Get a calendar reminders from local Db.
* *
* @param {number} id Event ID. * @param id Event ID.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the event data is retrieved. * @return Promise resolved when the event data is retrieved.
*/ */
getEventReminders(id: number, siteId?: string): Promise<any> { getEventReminders(id: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1067,11 +1067,11 @@ export class AddonCalendarProvider {
* E.g. using provider.getEventsList(undefined, 30, 30) is going to get the events starting after 30 days from now * E.g. using provider.getEventsList(undefined, 30, 30) is going to get the events starting after 30 days from now
* and ending before 60 days from now. * and ending before 60 days from now.
* *
* @param {number} [initialTime] Timestamp when the first fetch was done. If not defined, current time. * @param initialTime Timestamp when the first fetch was done. If not defined, current time.
* @param {number} [daysToStart=0] Number of days from now to start getting events. * @param daysToStart Number of days from now to start getting events.
* @param {number} [daysInterval=30] Number of days between timestart and timeend. * @param daysInterval Number of days between timestart and timeend.
* @param {string} [siteId] Site to get the events from. If not defined, use current site. * @param siteId Site to get the events from. If not defined, use current site.
* @return {Promise<any[]>} Promise to be resolved when the participants are retrieved. * @return Promise to be resolved when the participants are retrieved.
*/ */
getEventsList(initialTime?: number, daysToStart: number = 0, daysInterval: number = AddonCalendarProvider.DAYS_INTERVAL, getEventsList(initialTime?: number, daysToStart: number = 0, daysInterval: number = AddonCalendarProvider.DAYS_INTERVAL,
siteId?: string): Promise<any[]> { siteId?: string): Promise<any[]> {
@ -1137,7 +1137,7 @@ export class AddonCalendarProvider {
/** /**
* Get prefix cache key for events list WS calls. * Get prefix cache key for events list WS calls.
* *
* @return {string} Prefix Cache key. * @return Prefix Cache key.
*/ */
protected getEventsListPrefixCacheKey(): string { protected getEventsListPrefixCacheKey(): string {
return this.ROOT_CACHE_KEY + 'events:'; return this.ROOT_CACHE_KEY + 'events:';
@ -1146,9 +1146,9 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for events list WS calls. * Get cache key for events list WS calls.
* *
* @param {number} daysToStart Number of days from now to start getting events. * @param daysToStart Number of days from now to start getting events.
* @param {number} daysInterval Number of days between timestart and timeend. * @param daysInterval Number of days between timestart and timeend.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getEventsListCacheKey(daysToStart: number, daysInterval: number): string { protected getEventsListCacheKey(daysToStart: number, daysInterval: number): string {
return this.getEventsListPrefixCacheKey() + daysToStart + ':' + daysInterval; return this.getEventsListPrefixCacheKey() + daysToStart + ':' + daysInterval;
@ -1157,9 +1157,9 @@ export class AddonCalendarProvider {
/** /**
* Get calendar events from local Db that have the same repeatid. * Get calendar events from local Db that have the same repeatid.
* *
* @param {number} [repeatId] Repeat Id of the event. * @param repeatId Repeat Id of the event.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved with all the events. * @return Promise resolved with all the events.
*/ */
getLocalEventsByRepeatIdFromLocalDb(repeatId: number, siteId?: string): Promise<any[]> { getLocalEventsByRepeatIdFromLocalDb(repeatId: number, siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1169,13 +1169,13 @@ export class AddonCalendarProvider {
/** /**
* Get monthly calendar events. * Get monthly calendar events.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @param {number} [courseId] Course to get. * @param courseId Course to get.
* @param {number} [categoryId] Category to get. * @param categoryId Category to get.
* @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down).
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the response. * @return Promise resolved with the response.
*/ */
getMonthlyEvents(year: number, month: number, courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string) getMonthlyEvents(year: number, month: number, courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string)
: Promise<any> { : Promise<any> {
@ -1230,7 +1230,7 @@ export class AddonCalendarProvider {
/** /**
* Get prefix cache key for monthly events WS calls. * Get prefix cache key for monthly events WS calls.
* *
* @return {string} Prefix Cache key. * @return Prefix Cache key.
*/ */
protected getMonthlyEventsPrefixCacheKey(): string { protected getMonthlyEventsPrefixCacheKey(): string {
return this.ROOT_CACHE_KEY + 'monthly:'; return this.ROOT_CACHE_KEY + 'monthly:';
@ -1239,9 +1239,9 @@ export class AddonCalendarProvider {
/** /**
* Get prefix cache key for a certain month for monthly events WS calls. * Get prefix cache key for a certain month for monthly events WS calls.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @return {string} Prefix Cache key. * @return Prefix Cache key.
*/ */
protected getMonthlyEventsMonthPrefixCacheKey(year: number, month: number): string { protected getMonthlyEventsMonthPrefixCacheKey(year: number, month: number): string {
return this.getMonthlyEventsPrefixCacheKey() + year + ':' + month + ':'; return this.getMonthlyEventsPrefixCacheKey() + year + ':' + month + ':';
@ -1250,11 +1250,11 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for monthly events WS calls. * Get cache key for monthly events WS calls.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @param {number} [courseId] Course to get. * @param courseId Course to get.
* @param {number} [categoryId] Category to get. * @param categoryId Category to get.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getMonthlyEventsCacheKey(year: number, month: number, courseId?: number, categoryId?: number): string { protected getMonthlyEventsCacheKey(year: number, month: number, courseId?: number, categoryId?: number): string {
return this.getMonthlyEventsMonthPrefixCacheKey(year, month) + (courseId ? courseId : '') + ':' + return this.getMonthlyEventsMonthPrefixCacheKey(year, month) + (courseId ? courseId : '') + ':' +
@ -1264,11 +1264,11 @@ export class AddonCalendarProvider {
/** /**
* Get upcoming calendar events. * Get upcoming calendar events.
* *
* @param {number} [courseId] Course to get. * @param courseId Course to get.
* @param {number} [categoryId] Category to get. * @param categoryId Category to get.
* @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down).
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the response. * @return Promise resolved with the response.
*/ */
getUpcomingEvents(courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string): Promise<any> { getUpcomingEvents(courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string): Promise<any> {
@ -1304,7 +1304,7 @@ export class AddonCalendarProvider {
/** /**
* Get prefix cache key for upcoming events WS calls. * Get prefix cache key for upcoming events WS calls.
* *
* @return {string} Prefix Cache key. * @return Prefix Cache key.
*/ */
protected getUpcomingEventsPrefixCacheKey(): string { protected getUpcomingEventsPrefixCacheKey(): string {
return this.ROOT_CACHE_KEY + 'upcoming:'; return this.ROOT_CACHE_KEY + 'upcoming:';
@ -1313,9 +1313,9 @@ export class AddonCalendarProvider {
/** /**
* Get cache key for upcoming events WS calls. * Get cache key for upcoming events WS calls.
* *
* @param {number} [courseId] Course to get. * @param courseId Course to get.
* @param {number} [categoryId] Category to get. * @param categoryId Category to get.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getUpcomingEventsCacheKey(courseId?: number, categoryId?: number): string { protected getUpcomingEventsCacheKey(courseId?: number, categoryId?: number): string {
return this.getUpcomingEventsPrefixCacheKey() + (courseId ? courseId : '') + ':' + (categoryId ? categoryId : ''); return this.getUpcomingEventsPrefixCacheKey() + (courseId ? courseId : '') + ':' + (categoryId ? categoryId : '');
@ -1324,11 +1324,11 @@ export class AddonCalendarProvider {
/** /**
* Get URL to view a calendar. * Get URL to view a calendar.
* *
* @param {string} view The view to load: 'month', 'day', 'upcoming', etc. * @param view The view to load: 'month', 'day', 'upcoming', etc.
* @param {number} [time] Time to load. If not defined, current time. * @param time Time to load. If not defined, current time.
* @param {string} [courseId] Course to load. If not defined, all courses. * @param courseId Course to load. If not defined, all courses.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<string>} Promise resolved with the URL.x * @return Promise resolved with the URL.x
*/ */
getViewUrl(view: string, time?: number, courseId?: string, siteId?: string): Promise<string> { getViewUrl(view: string, time?: number, courseId?: string, siteId?: string): Promise<string> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1349,8 +1349,8 @@ export class AddonCalendarProvider {
/** /**
* Get the week days, already ordered according to a specified starting day. * Get the week days, already ordered according to a specified starting day.
* *
* @param {number} [startingDay=0] Starting day. 0=Sunday, 1=Monday, ... * @param startingDay Starting day. 0=Sunday, 1=Monday, ...
* @return {any[]} Week days. * @return Week days.
*/ */
getWeekDays(startingDay?: number): any[] { getWeekDays(startingDay?: number): any[] {
startingDay = startingDay || 0; startingDay = startingDay || 0;
@ -1361,9 +1361,9 @@ export class AddonCalendarProvider {
/** /**
* Invalidates access information. * Invalidates access information.
* *
* @param {number} [courseId] Course ID. If not defined, site calendar. * @param courseId Course ID. If not defined, site calendar.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateAccessInformation(courseId?: number, siteId?: string): Promise<any> { invalidateAccessInformation(courseId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1374,9 +1374,9 @@ export class AddonCalendarProvider {
/** /**
* Invalidates allowed event types. * Invalidates allowed event types.
* *
* @param {number} [courseId] Course ID. If not defined, site calendar. * @param courseId Course ID. If not defined, site calendar.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateAllowedEventTypes(courseId?: number, siteId?: string): Promise<any> { invalidateAllowedEventTypes(courseId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1387,8 +1387,8 @@ export class AddonCalendarProvider {
/** /**
* Invalidates day events for all days. * Invalidates day events for all days.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateAllDayEvents(siteId?: string): Promise<any> { invalidateAllDayEvents(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1399,10 +1399,10 @@ export class AddonCalendarProvider {
/** /**
* Invalidates day events for a certain day. * Invalidates day events for a certain day.
* *
* @param {number} year Year. * @param year Year.
* @param {number} month Month. * @param month Month.
* @param {number} day Day. * @param day Day.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateDayEvents(year: number, month: number, day: number, siteId?: string): Promise<any> { invalidateDayEvents(year: number, month: number, day: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1413,8 +1413,8 @@ export class AddonCalendarProvider {
/** /**
* Invalidates events list and all the single events and related info. * Invalidates events list and all the single events and related info.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved when the list is invalidated. * @return Promise resolved when the list is invalidated.
*/ */
invalidateEventsList(siteId?: string): Promise<any[]> { invalidateEventsList(siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1433,9 +1433,9 @@ export class AddonCalendarProvider {
/** /**
* Invalidates a single event. * Invalidates a single event.
* *
* @param {number} eventId List of courses or course ids. * @param eventId List of courses or course ids.
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the list is invalidated. * @return Promise resolved when the list is invalidated.
*/ */
invalidateEvent(eventId: number, siteId?: string): Promise<any> { invalidateEvent(eventId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1446,8 +1446,8 @@ export class AddonCalendarProvider {
/** /**
* Invalidates monthly events for all months. * Invalidates monthly events for all months.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateAllMonthlyEvents(siteId?: string): Promise<any> { invalidateAllMonthlyEvents(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1458,9 +1458,9 @@ export class AddonCalendarProvider {
/** /**
* Invalidates monthly events for a certain months. * Invalidates monthly events for a certain months.
* *
* @param {number} year Year. * @param year Year.
* @param {number} month Month. * @param month Month.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateMonthlyEvents(year: number, month: number, siteId?: string): Promise<any> { invalidateMonthlyEvents(year: number, month: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1471,8 +1471,8 @@ export class AddonCalendarProvider {
/** /**
* Invalidates upcoming events for all courses and categories. * Invalidates upcoming events for all courses and categories.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateAllUpcomingEvents(siteId?: string): Promise<any> { invalidateAllUpcomingEvents(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1483,10 +1483,10 @@ export class AddonCalendarProvider {
/** /**
* Invalidates upcoming events for a certain course or category. * Invalidates upcoming events for a certain course or category.
* *
* @param {number} [courseId] Course ID. * @param courseId Course ID.
* @param {number} [categoryId] Category ID. * @param categoryId Category ID.
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateUpcomingEvents(courseId?: number, categoryId?: number, siteId?: string): Promise<any> { invalidateUpcomingEvents(courseId?: number, categoryId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1497,8 +1497,8 @@ export class AddonCalendarProvider {
/** /**
* Invalidates look ahead setting. * Invalidates look ahead setting.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateLookAhead(siteId?: string): Promise<any> { invalidateLookAhead(siteId?: string): Promise<any> {
return this.userProvider.invalidateUserPreference('calendar_lookahead', siteId); return this.userProvider.invalidateUserPreference('calendar_lookahead', siteId);
@ -1507,8 +1507,8 @@ export class AddonCalendarProvider {
/** /**
* Invalidates time format setting. * Invalidates time format setting.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateTimeFormat(siteId?: string): Promise<any> { invalidateTimeFormat(siteId?: string): Promise<any> {
return this.userProvider.invalidateUserPreference('calendar_timeformat', siteId); return this.userProvider.invalidateUserPreference('calendar_timeformat', siteId);
@ -1517,8 +1517,8 @@ export class AddonCalendarProvider {
/** /**
* Check if Calendar is disabled in a certain site. * Check if Calendar is disabled in a certain site.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether it's disabled. * @return Whether it's disabled.
*/ */
isCalendarDisabledInSite(site?: CoreSite): boolean { isCalendarDisabledInSite(site?: CoreSite): boolean {
site = site || this.sitesProvider.getCurrentSite(); site = site || this.sitesProvider.getCurrentSite();
@ -1529,8 +1529,8 @@ export class AddonCalendarProvider {
/** /**
* Check if Calendar is disabled in a certain site. * Check if Calendar is disabled in a certain site.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if disabled, rejected or resolved with false otherwise. * @return Promise resolved with true if disabled, rejected or resolved with false otherwise.
*/ */
isDisabled(siteId?: string): Promise<boolean> { isDisabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1541,8 +1541,8 @@ export class AddonCalendarProvider {
/** /**
* Check if the get event by ID WS is available. * Check if the get event by ID WS is available.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if available. * @return Promise resolved with true if available.
* @since 3.4 * @since 3.4
*/ */
isGetEventByIdAvailable(siteId?: string): Promise<boolean> { isGetEventByIdAvailable(siteId?: string): Promise<boolean> {
@ -1556,8 +1556,8 @@ export class AddonCalendarProvider {
/** /**
* Check if the get event by ID WS is available in a certain site. * Check if the get event by ID WS is available in a certain site.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether it's available. * @return Whether it's available.
* @since 3.4 * @since 3.4
*/ */
isGetEventByIdAvailableInSite(site?: CoreSite): boolean { isGetEventByIdAvailableInSite(site?: CoreSite): boolean {
@ -1571,7 +1571,7 @@ export class AddonCalendarProvider {
* If an event notification time is 0, cancel its scheduled notification (if any). * If an event notification time is 0, cancel its scheduled notification (if any).
* If local notification plugin is not enabled, resolve the promise. * If local notification plugin is not enabled, resolve the promise.
* *
* @return {Promise} Promise resolved when all the notifications have been scheduled. * @return Promise resolved when all the notifications have been scheduled.
*/ */
scheduleAllSitesEventsNotifications(): Promise<any[]> { scheduleAllSitesEventsNotifications(): Promise<any[]> {
const notificationsEnabled = this.localNotificationsProvider.isAvailable(); const notificationsEnabled = this.localNotificationsProvider.isAvailable();
@ -1603,10 +1603,10 @@ export class AddonCalendarProvider {
* Schedules an event notification. If time is 0, cancel scheduled notification if any. * Schedules an event notification. If time is 0, cancel scheduled notification if any.
* If local notification plugin is not enabled, resolve the promise. * If local notification plugin is not enabled, resolve the promise.
* *
* @param {any} event Event to schedule. * @param event Event to schedule.
* @param {number} time Notification setting time (in minutes). E.g. 10 means "notificate 10 minutes before start". * @param time Notification setting time (in minutes). E.g. 10 means "notificate 10 minutes before start".
* @param {string} [siteId] Site ID the event belongs to. If not defined, use current site. * @param siteId Site ID the event belongs to. If not defined, use current site.
* @return {Promise<void>} Promise resolved when the notification is scheduled. * @return Promise resolved when the notification is scheduled.
*/ */
protected scheduleEventNotification(event: any, reminderId: number, time: number, siteId?: string): Promise<void> { protected scheduleEventNotification(event: any, reminderId: number, time: number, siteId?: string): Promise<void> {
if (this.localNotificationsProvider.isAvailable()) { if (this.localNotificationsProvider.isAvailable()) {
@ -1668,9 +1668,9 @@ export class AddonCalendarProvider {
* If an event notification time is 0, cancel its scheduled notification (if any). * If an event notification time is 0, cancel its scheduled notification (if any).
* If local notification plugin is not enabled, resolve the promise. * If local notification plugin is not enabled, resolve the promise.
* *
* @param {any[]} events Events to schedule. * @param events Events to schedule.
* @param {string} [siteId] ID of the site the events belong to. If not defined, use current site. * @param siteId ID of the site the events belong to. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved when all the notifications have been scheduled. * @return Promise resolved when all the notifications have been scheduled.
*/ */
scheduleEventsNotifications(events: any[], siteId?: string): Promise<any[]> { scheduleEventsNotifications(events: any[], siteId?: string): Promise<any[]> {
@ -1699,9 +1699,9 @@ export class AddonCalendarProvider {
/** /**
* Set the default notification time. * Set the default notification time.
* *
* @param {number} time New default time. * @param time New default time.
* @param {string} [siteId] ID of the site. If not defined, use current site. * @param siteId ID of the site. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved when stored. * @return Promise resolved when stored.
*/ */
setDefaultNotificationTime(time: number, siteId?: string): Promise<any[]> { setDefaultNotificationTime(time: number, siteId?: string): Promise<any[]> {
siteId = siteId || this.sitesProvider.getCurrentSiteId(); siteId = siteId || this.sitesProvider.getCurrentSiteId();
@ -1714,9 +1714,9 @@ export class AddonCalendarProvider {
/** /**
* Store an event in local DB as it is. * Store an event in local DB as it is.
* *
* @param {any} event Event to store. * @param event Event to store.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any>} Promise resolved when stored. * @return Promise resolved when stored.
*/ */
storeEventInLocalDb(event: any, siteId?: string): Promise<any> { storeEventInLocalDb(event: any, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1780,9 +1780,9 @@ export class AddonCalendarProvider {
/** /**
* Store events in local DB. * Store events in local DB.
* *
* @param {any[]} events Events to store. * @param events Events to store.
* @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. * @param siteId ID of the site the event belongs to. If not defined, use current site.
* @return {Promise<any[]>} Promise resolved when the events are stored. * @return Promise resolved when the events are stored.
*/ */
protected storeEventsInLocalDB(events: any[], siteId?: string): Promise<any[]> { protected storeEventsInLocalDB(events: any[], siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -1798,13 +1798,13 @@ export class AddonCalendarProvider {
/** /**
* Submit a calendar event. * Submit a calendar event.
* *
* @param {number} eventId ID of the event. If undefined/null, create a new event. * @param eventId ID of the event. If undefined/null, create a new event.
* @param {any} formData Form data. * @param formData Form data.
* @param {number} [timeCreated] The time the event was created. Only if modifying a new offline event. * @param timeCreated The time the event was created. Only if modifying a new offline event.
* @param {boolean} [forceOffline] True to always save it in offline. * @param forceOffline True to always save it in offline.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<{sent: boolean, event: any}>} Promise resolved with the event and a boolean indicating if data was * @return Promise resolved with the event and a boolean indicating if data was
* sent to server or stored in offline. * sent to server or stored in offline.
*/ */
submitEvent(eventId: number, formData: any, timeCreated?: number, forceOffline?: boolean, siteId?: string): submitEvent(eventId: number, formData: any, timeCreated?: number, forceOffline?: boolean, siteId?: string):
Promise<{sent: boolean, event: any}> { Promise<{sent: boolean, event: any}> {
@ -1842,10 +1842,10 @@ export class AddonCalendarProvider {
/** /**
* Submit an event, either to create it or to edit it. It will fail if offline or cannot connect. * Submit an event, either to create it or to edit it. It will fail if offline or cannot connect.
* *
* @param {number} eventId ID of the event. If undefined/null, create a new event. * @param eventId ID of the event. If undefined/null, create a new event.
* @param {any} formData Form data. * @param formData Form data.
* @param {string} [siteId] Site ID. If not provided, current site. * @param siteId Site ID. If not provided, current site.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
submitEventOnline(eventId: number, formData: any, siteId?: string): Promise<any> { submitEventOnline(eventId: number, formData: any, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {

View File

@ -49,8 +49,8 @@ export class AddonCalendarHelperProvider {
/** /**
* Calculate some day data based on a list of events for that day. * Calculate some day data based on a list of events for that day.
* *
* @param {any} day Day. * @param day Day.
* @param {any[]} events Events. * @param events Events.
*/ */
calculateDayData(day: any, events: any[]): void { calculateDayData(day: any, events: any[]): void {
day.hasevents = events.length > 0; day.hasevents = events.length > 0;
@ -71,9 +71,9 @@ export class AddonCalendarHelperProvider {
/** /**
* Check if current user can create/edit events. * Check if current user can create/edit events.
* *
* @param {number} [courseId] Course ID. If not defined, site calendar. * @param courseId Course ID. If not defined, site calendar.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with boolean: whether the user can create events. * @return Promise resolved with boolean: whether the user can create events.
*/ */
canEditEvents(courseId?: number, siteId?: string): Promise<boolean> { canEditEvents(courseId?: number, siteId?: string): Promise<boolean> {
return this.calendarProvider.canEditEvents(siteId).then((canEdit) => { return this.calendarProvider.canEditEvents(siteId).then((canEdit) => {
@ -94,8 +94,8 @@ export class AddonCalendarHelperProvider {
* Classify events into their respective months and days. If an event duration covers more than one day, * Classify events into their respective months and days. If an event duration covers more than one day,
* it will be included in all the days it lasts. * it will be included in all the days it lasts.
* *
* @param {any[]} events Events to classify. * @param events Events to classify.
* @return {{[monthId: string]: {[day: number]: any[]}}} Object with the classified events. * @return Object with the classified events.
*/ */
classifyIntoMonths(events: any[]): {[monthId: string]: {[day: number]: any[]}} { classifyIntoMonths(events: any[]): {[monthId: string]: {[day: number]: any[]}} {
@ -128,7 +128,7 @@ export class AddonCalendarHelperProvider {
/** /**
* Convenience function to format some event data to be rendered. * Convenience function to format some event data to be rendered.
* *
* @param {any} e Event to format. * @param e Event to format.
*/ */
formatEventData(e: any): void { formatEventData(e: any): void {
e.icon = this.EVENTICONS[e.eventtype] || false; e.icon = this.EVENTICONS[e.eventtype] || false;
@ -157,8 +157,8 @@ export class AddonCalendarHelperProvider {
/** /**
* Get options (name & value) for each allowed event type. * Get options (name & value) for each allowed event type.
* *
* @param {any} eventTypes Result of getAllowedEventTypes. * @param eventTypes Result of getAllowedEventTypes.
* @return {{name: string, value: string}[]} Options. * @return Options.
*/ */
getEventTypeOptions(eventTypes: any): {name: string, value: string}[] { getEventTypeOptions(eventTypes: any): {name: string, value: string}[] {
const options = []; const options = [];
@ -185,9 +185,9 @@ export class AddonCalendarHelperProvider {
/** /**
* Get the month "id" (year + month). * Get the month "id" (year + month).
* *
* @param {number} year Year. * @param year Year.
* @param {number} month Month. * @param month Month.
* @return {string} The "id". * @return The "id".
*/ */
getMonthId(year: number, month: number): string { getMonthId(year: number, month: number): string {
return year + '#' + month; return year + '#' + month;
@ -198,10 +198,10 @@ export class AddonCalendarHelperProvider {
* *
* The result has the same structure than getMonthlyEvents, but it only contains fields that are actually used by the app. * The result has the same structure than getMonthlyEvents, but it only contains fields that are actually used by the app.
* *
* @param {number} year Year to get. * @param year Year to get.
* @param {number} month Month to get. * @param month Month to get.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved with the response. * @return Promise resolved with the response.
*/ */
getOfflineMonthWeeks(year: number, month: number, siteId?: string): Promise<any> { getOfflineMonthWeeks(year: number, month: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -256,9 +256,9 @@ export class AddonCalendarHelperProvider {
/** /**
* Check if the data of an event has changed. * Check if the data of an event has changed.
* *
* @param {any} data Current data. * @param data Current data.
* @param {any} [original] Original data. * @param original Original data.
* @return {boolean} True if data has changed, false otherwise. * @return True if data has changed, false otherwise.
*/ */
hasEventDataChanged(data: any, original?: any): boolean { hasEventDataChanged(data: any, original?: any): boolean {
if (!original) { if (!original) {
@ -297,11 +297,11 @@ export class AddonCalendarHelperProvider {
/** /**
* Check if an event should be displayed based on the filter. * Check if an event should be displayed based on the filter.
* *
* @param {any} event Event object. * @param event Event object.
* @param {number} courseId Course ID to filter. * @param courseId Course ID to filter.
* @param {number} categoryId Category ID the course belongs to. * @param categoryId Category ID the course belongs to.
* @param {any} categories Categories indexed by ID. * @param categories Categories indexed by ID.
* @return {boolean} Whether it should be displayed. * @return Whether it should be displayed.
*/ */
shouldDisplayEvent(event: any, courseId: number, categoryId: number, categories: any): boolean { shouldDisplayEvent(event: any, courseId: number, categoryId: number, categories: any): boolean {
if (event.eventtype == 'user' || event.eventtype == 'site') { if (event.eventtype == 'user' || event.eventtype == 'site') {
@ -345,9 +345,9 @@ export class AddonCalendarHelperProvider {
* Refresh the month & day for several created/edited/deleted events, and invalidate the months & days * Refresh the month & day for several created/edited/deleted events, and invalidate the months & days
* for their repeated events if needed. * for their repeated events if needed.
* *
* @param {{event: any, repeated: number}[]} events Events that have been touched and number of times each event is repeated. * @param events Events that have been touched and number of times each event is repeated.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
refreshAfterChangeEvents(events: {event: any, repeated: number}[], siteId?: string): Promise<any> { refreshAfterChangeEvents(events: {event: any, repeated: number}[], siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -458,10 +458,10 @@ export class AddonCalendarHelperProvider {
* Refresh the month & day for a created/edited/deleted event, and invalidate the months & days * Refresh the month & day for a created/edited/deleted event, and invalidate the months & days
* for their repeated events if needed. * for their repeated events if needed.
* *
* @param {any} event Event that has been touched. * @param event Event that has been touched.
* @param {number} repeated Number of times the event is repeated. * @param repeated Number of times the event is repeated.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
refreshAfterChangeEvent(event: any, repeated: number, siteId?: string): Promise<any> { refreshAfterChangeEvent(event: any, repeated: number, siteId?: string): Promise<any> {
return this.refreshAfterChangeEvents([{event: event, repeated: repeated}], siteId); return this.refreshAfterChangeEvents([{event: event, repeated: repeated}], siteId);

View File

@ -29,7 +29,7 @@ export class AddonCalendarMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return !this.calendarProvider.isCalendarDisabledInSite(); return !this.calendarProvider.isCalendarDisabledInSite();
@ -38,7 +38,7 @@ export class AddonCalendarMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreMainMenuHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(): CoreMainMenuHandlerData { getDisplayData(): CoreMainMenuHandlerData {
return { return {

View File

@ -29,9 +29,9 @@ export class AddonCalendarSyncCronHandler implements CoreCronHandler {
* Execute the process. * Execute the process.
* Receives the ID of the site affected, undefined for all sites. * Receives the ID of the site affected, undefined for all sites.
* *
* @param {string} [siteId] ID of the site affected, undefined for all sites. * @param siteId ID of the site affected, undefined for all sites.
* @param {boolean} [force] Wether the execution is forced (manual sync). * @param force Wether the execution is forced (manual sync).
* @return {Promise<any>} Promise resolved when done, rejected if failure. * @return Promise resolved when done, rejected if failure.
*/ */
execute(siteId?: string, force?: boolean): Promise<any> { execute(siteId?: string, force?: boolean): Promise<any> {
return this.calendarSync.syncAllEvents(siteId, force); return this.calendarSync.syncAllEvents(siteId, force);
@ -40,7 +40,7 @@ export class AddonCalendarSyncCronHandler implements CoreCronHandler {
/** /**
* Get the time between consecutive executions. * Get the time between consecutive executions.
* *
* @return {number} Time between consecutive executions (in ms). * @return Time between consecutive executions (in ms).
*/ */
getInterval(): number { getInterval(): number {
return this.calendarSync.syncInterval; return this.calendarSync.syncInterval;

View File

@ -35,11 +35,11 @@ export class AddonCalendarViewLinkHandler extends CoreContentLinksHandlerBase {
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -90,11 +90,11 @@ export class AddonCalendarViewLinkHandler extends CoreContentLinksHandlerBase {
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
if (params.view && this.SUPPORTED_VIEWS.indexOf(params.view) == -1) { if (params.view && this.SUPPORTED_VIEWS.indexOf(params.view) == -1) {

View File

@ -52,7 +52,7 @@ export class AddonCompetencyCourseComponent {
/** /**
* Fetches the competencies and updates the view. * Fetches the competencies and updates the view.
* *
* @return {Promise<void>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchCourseCompetencies(): Promise<void> { protected fetchCourseCompetencies(): Promise<void> {
return this.competencyProvider.getCourseCompetencies(this.courseId, this.userId).then((competencies) => { return this.competencyProvider.getCourseCompetencies(this.courseId, this.userId).then((competencies) => {
@ -70,7 +70,7 @@ export class AddonCompetencyCourseComponent {
/** /**
* Opens a competency. * Opens a competency.
* *
* @param {number} competencyId * @param competencyId
*/ */
openCompetency(competencyId: number): void { openCompetency(competencyId: number): void {
if (this.appProvider.isWide()) { if (this.appProvider.isWide()) {
@ -83,7 +83,7 @@ export class AddonCompetencyCourseComponent {
/** /**
* Opens the summary of a competency. * Opens the summary of a competency.
* *
* @param {number} competencyId * @param competencyId
*/ */
openCompetencySummary(competencyId: number): void { openCompetencySummary(competencyId: number): void {
this.navCtrl.push('AddonCompetencyCompetencySummaryPage', {competencyId}); this.navCtrl.push('AddonCompetencyCompetencySummaryPage', {competencyId});
@ -92,7 +92,7 @@ export class AddonCompetencyCourseComponent {
/** /**
* Refreshes the competencies. * Refreshes the competencies.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshCourseCompetencies(refresher: any): void { refreshCourseCompetencies(refresher: any): void {
this.competencyProvider.invalidateCourseCompetencies(this.courseId, this.userId).finally(() => { this.competencyProvider.invalidateCourseCompetencies(this.courseId, this.userId).finally(() => {

View File

@ -69,7 +69,7 @@ export class AddonCompetencyCompetenciesPage {
/** /**
* Fetches the competencies and updates the view. * Fetches the competencies and updates the view.
* *
* @return {Promise<void>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchCompetencies(): Promise<void> { protected fetchCompetencies(): Promise<void> {
let promise; let promise;
@ -102,7 +102,7 @@ export class AddonCompetencyCompetenciesPage {
/** /**
* Opens a competency. * Opens a competency.
* *
* @param {number} competencyId * @param competencyId
*/ */
openCompetency(competencyId: number): void { openCompetency(competencyId: number): void {
this.competencyId = competencyId; this.competencyId = competencyId;
@ -118,7 +118,7 @@ export class AddonCompetencyCompetenciesPage {
/** /**
* Refreshes the competencies. * Refreshes the competencies.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshCompetencies(refresher: any): void { refreshCompetencies(refresher: any): void {
let promise; let promise;

View File

@ -76,7 +76,7 @@ export class AddonCompetencyCompetencyPage {
/** /**
* Fetches the competency and updates the view. * Fetches the competency and updates the view.
* *
* @return {Promise<void>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchCompetency(): Promise<void> { protected fetchCompetency(): Promise<void> {
let promise; let promise;
@ -124,7 +124,7 @@ export class AddonCompetencyCompetencyPage {
/** /**
* Refreshes the competency. * Refreshes the competency.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshCompetency(refresher: any): void { refreshCompetency(refresher: any): void {
let promise; let promise;
@ -144,7 +144,7 @@ export class AddonCompetencyCompetencyPage {
/** /**
* Opens the summary of a competency. * Opens the summary of a competency.
* *
* @param {number} competencyId * @param competencyId
*/ */
openCompetencySummary(competencyId: number): void { openCompetencySummary(competencyId: number): void {
// Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav.

View File

@ -55,7 +55,7 @@ export class AddonCompetencyCompetencySummaryPage {
/** /**
* Fetches the competency summary and updates the view. * Fetches the competency summary and updates the view.
* *
* @return {Promise<void>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchCompetency(): Promise<void> { protected fetchCompetency(): Promise<void> {
return this.competencyProvider.getCompetencySummary(this.competencyId).then((competency) => { return this.competencyProvider.getCompetencySummary(this.competencyId).then((competency) => {
@ -68,7 +68,7 @@ export class AddonCompetencyCompetencySummaryPage {
/** /**
* Refreshes the competency summary. * Refreshes the competency summary.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshCompetency(refresher: any): void { refreshCompetency(refresher: any): void {
this.competencyProvider.invalidateCompetencySummary(this.competencyId).finally(() => { this.competencyProvider.invalidateCompetencySummary(this.competencyId).finally(() => {
@ -81,7 +81,7 @@ export class AddonCompetencyCompetencySummaryPage {
/** /**
* Opens the summary of a competency. * Opens the summary of a competency.
* *
* @param {number} competencyId * @param competencyId
*/ */
openCompetencySummary(competencyId: number): void { openCompetencySummary(competencyId: number): void {
// Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav.

View File

@ -52,7 +52,7 @@ export class AddonCompetencyPlanPage {
/** /**
* Fetches the learning plan and updates the view. * Fetches the learning plan and updates the view.
* *
* @return {Promise<void>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchLearningPlan(): Promise<void> { protected fetchLearningPlan(): Promise<void> {
return this.competencyProvider.getLearningPlan(this.planId).then((plan) => { return this.competencyProvider.getLearningPlan(this.planId).then((plan) => {
@ -74,7 +74,7 @@ export class AddonCompetencyPlanPage {
/** /**
* Navigates to a particular competency. * Navigates to a particular competency.
* *
* @param {number} competencyId * @param competencyId
*/ */
openCompetency(competencyId: number): void { openCompetency(competencyId: number): void {
const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl; const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl;
@ -88,7 +88,7 @@ export class AddonCompetencyPlanPage {
/** /**
* Refreshes the learning plan. * Refreshes the learning plan.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshLearningPlan(refresher: any): void { refreshLearningPlan(refresher: any): void {
this.competencyProvider.invalidateLearningPlan(this.planId).finally(() => { this.competencyProvider.invalidateLearningPlan(this.planId).finally(() => {

View File

@ -62,7 +62,7 @@ export class AddonCompetencyPlanListPage {
/** /**
* Fetches the learning plans and updates the view. * Fetches the learning plans and updates the view.
* *
* @return {Promise<void>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchLearningPlans(): Promise<void> { protected fetchLearningPlans(): Promise<void> {
return this.competencyProvider.getLearningPlans(this.userId).then((plans) => { return this.competencyProvider.getLearningPlans(this.userId).then((plans) => {
@ -89,7 +89,7 @@ export class AddonCompetencyPlanListPage {
/** /**
* Refreshes the learning plans. * Refreshes the learning plans.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshLearningPlans(refresher: any): void { refreshLearningPlans(refresher: any): void {
this.competencyProvider.invalidateLearningPlans(this.userId).finally(() => { this.competencyProvider.invalidateLearningPlans(this.userId).finally(() => {
@ -102,7 +102,7 @@ export class AddonCompetencyPlanListPage {
/** /**
* Opens a learning plan. * Opens a learning plan.
* *
* @param {number} planId Learning plan to load. * @param planId Learning plan to load.
*/ */
openPlan(planId: number): void { openPlan(planId: number): void {
this.planId = planId; this.planId = planId;

View File

@ -33,11 +33,11 @@ export class AddonCompetencyCompetencyLinkHandler extends CoreContentLinksHandle
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -59,11 +59,11 @@ export class AddonCompetencyCompetencyLinkHandler extends CoreContentLinksHandle
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
// Handler is disabled if all competency features are disabled. // Handler is disabled if all competency features are disabled.

View File

@ -48,8 +48,8 @@ export class AddonCompetencyProvider {
/** /**
* Check if all competencies features are disabled. * Check if all competencies features are disabled.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<boolean>} Promise resolved with boolean: whether all competency features are disabled. * @return Promise resolved with boolean: whether all competency features are disabled.
*/ */
allCompetenciesDisabled(siteId?: string): Promise<boolean> { allCompetenciesDisabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -62,8 +62,8 @@ export class AddonCompetencyProvider {
/** /**
* Get cache key for user learning plans data WS calls. * Get cache key for user learning plans data WS calls.
* *
* @param {number} userId User ID. * @param userId User ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getLearningPlansCacheKey(userId: number): string { protected getLearningPlansCacheKey(userId: number): string {
return this.ROOT_CACHE_KEY + 'userplans:' + userId; return this.ROOT_CACHE_KEY + 'userplans:' + userId;
@ -72,8 +72,8 @@ export class AddonCompetencyProvider {
/** /**
* Get cache key for learning plan data WS calls. * Get cache key for learning plan data WS calls.
* *
* @param {number} planId Plan ID. * @param planId Plan ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getLearningPlanCacheKey(planId: number): string { protected getLearningPlanCacheKey(planId: number): string {
return this.ROOT_CACHE_KEY + 'learningplan:' + planId; return this.ROOT_CACHE_KEY + 'learningplan:' + planId;
@ -82,9 +82,9 @@ export class AddonCompetencyProvider {
/** /**
* Get cache key for competency in plan data WS calls. * Get cache key for competency in plan data WS calls.
* *
* @param {number} planId Plan ID. * @param planId Plan ID.
* @param {number} competencyId Competency ID. * @param competencyId Competency ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getCompetencyInPlanCacheKey(planId: number, competencyId: number): string { protected getCompetencyInPlanCacheKey(planId: number, competencyId: number): string {
return this.ROOT_CACHE_KEY + 'plancompetency:' + planId + ':' + competencyId; return this.ROOT_CACHE_KEY + 'plancompetency:' + planId + ':' + competencyId;
@ -93,10 +93,10 @@ export class AddonCompetencyProvider {
/** /**
* Get cache key for competency in course data WS calls. * Get cache key for competency in course data WS calls.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {number} competencyId Competency ID. * @param competencyId Competency ID.
* @param {number} userId User ID. * @param userId User ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getCompetencyInCourseCacheKey(courseId: number, competencyId: number, userId: number): string { protected getCompetencyInCourseCacheKey(courseId: number, competencyId: number, userId: number): string {
return this.ROOT_CACHE_KEY + 'coursecompetency:' + userId + ':' + courseId + ':' + competencyId; return this.ROOT_CACHE_KEY + 'coursecompetency:' + userId + ':' + courseId + ':' + competencyId;
@ -105,9 +105,9 @@ export class AddonCompetencyProvider {
/** /**
* Get cache key for competency summary data WS calls. * Get cache key for competency summary data WS calls.
* *
* @param {number} competencyId Competency ID. * @param competencyId Competency ID.
* @param {number} userId User ID. * @param userId User ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getCompetencySummaryCacheKey(competencyId: number, userId: number): string { protected getCompetencySummaryCacheKey(competencyId: number, userId: number): string {
return this.ROOT_CACHE_KEY + 'competencysummary:' + userId + ':' + competencyId; return this.ROOT_CACHE_KEY + 'competencysummary:' + userId + ':' + competencyId;
@ -116,8 +116,8 @@ export class AddonCompetencyProvider {
/** /**
* Get cache key for course competencies data WS calls. * Get cache key for course competencies data WS calls.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getCourseCompetenciesCacheKey(courseId: number): string { protected getCourseCompetenciesCacheKey(courseId: number): string {
return this.ROOT_CACHE_KEY + 'coursecompetencies:' + courseId; return this.ROOT_CACHE_KEY + 'coursecompetencies:' + courseId;
@ -126,9 +126,9 @@ export class AddonCompetencyProvider {
/** /**
* Returns whether competencies are enabled. * Returns whether competencies are enabled.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} competencies if enabled for the given course, false otherwise. * @return competencies if enabled for the given course, false otherwise.
*/ */
isPluginForCourseEnabled(courseId: number, siteId?: string): Promise<any> { isPluginForCourseEnabled(courseId: number, siteId?: string): Promise<any> {
if (!this.sitesProvider.isLoggedIn()) { if (!this.sitesProvider.isLoggedIn()) {
@ -143,9 +143,9 @@ export class AddonCompetencyProvider {
/** /**
* Get plans for a certain user. * Get plans for a certain user.
* *
* @param {number} [userId] ID of the user. If not defined, current user. * @param userId ID of the user. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise to be resolved when the plans are retrieved. * @return Promise to be resolved when the plans are retrieved.
*/ */
getLearningPlans(userId?: number, siteId?: string): Promise<any> { getLearningPlans(userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -174,9 +174,9 @@ export class AddonCompetencyProvider {
/** /**
* Get a certain plan. * Get a certain plan.
* *
* @param {number} planId ID of the plan. * @param planId ID of the plan.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise to be resolved when the plans are retrieved. * @return Promise to be resolved when the plans are retrieved.
*/ */
getLearningPlan(planId: number, siteId?: string): Promise<any> { getLearningPlan(planId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -204,10 +204,10 @@ export class AddonCompetencyProvider {
/** /**
* Get a certain competency in a plan. * Get a certain competency in a plan.
* *
* @param {number} planId ID of the plan. * @param planId ID of the plan.
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise to be resolved when the plans are retrieved. * @return Promise to be resolved when the plans are retrieved.
*/ */
getCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise<any> { getCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -236,12 +236,12 @@ export class AddonCompetencyProvider {
/** /**
* Get a certain competency in a course. * Get a certain competency in a course.
* *
* @param {number} courseId ID of the course. * @param courseId ID of the course.
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {number} [userId] ID of the user. If not defined, current user. * @param userId ID of the user. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down).
* @return {Promise<any>} Promise to be resolved when the plans are retrieved. * @return Promise to be resolved when the plans are retrieved.
*/ */
getCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string, ignoreCache?: boolean) getCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string, ignoreCache?: boolean)
: Promise<any> { : Promise<any> {
@ -279,11 +279,11 @@ export class AddonCompetencyProvider {
/** /**
* Get a certain competency summary. * Get a certain competency summary.
* *
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {number} [userId] ID of the user. If not defined, current user. * @param userId ID of the user. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down).
* @return {Promise<any>} Promise to be resolved when the plans are retrieved. * @return Promise to be resolved when the plans are retrieved.
*/ */
getCompetencySummary(competencyId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise<any> { getCompetencySummary(competencyId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -318,11 +318,11 @@ export class AddonCompetencyProvider {
/** /**
* Get all competencies in a course. * Get all competencies in a course.
* *
* @param {number} courseId ID of the course. * @param courseId ID of the course.
* @param {number} [userId] ID of the user. * @param userId ID of the user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down).
* @return {Promise<any>} Promise to be resolved when the course competencies are retrieved. * @return Promise to be resolved when the course competencies are retrieved.
*/ */
getCourseCompetencies(courseId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise<any> { getCourseCompetencies(courseId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -373,9 +373,9 @@ export class AddonCompetencyProvider {
/** /**
* Invalidates User Learning Plans data. * Invalidates User Learning Plans data.
* *
* @param {number} [userId] ID of the user. If not defined, current user. * @param userId ID of the user. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateLearningPlans(userId?: number, siteId?: string): Promise<any> { invalidateLearningPlans(userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -388,9 +388,9 @@ export class AddonCompetencyProvider {
/** /**
* Invalidates Learning Plan data. * Invalidates Learning Plan data.
* *
* @param {number} planId ID of the plan. * @param planId ID of the plan.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateLearningPlan(planId: number, siteId?: string): Promise<any> { invalidateLearningPlan(planId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -401,10 +401,10 @@ export class AddonCompetencyProvider {
/** /**
* Invalidates Competency in Plan data. * Invalidates Competency in Plan data.
* *
* @param {number} planId ID of the plan. * @param planId ID of the plan.
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise<any> { invalidateCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -415,11 +415,11 @@ export class AddonCompetencyProvider {
/** /**
* Invalidates Competency in Course data. * Invalidates Competency in Course data.
* *
* @param {number} courseId ID of the course. * @param courseId ID of the course.
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {number} [userId] ID of the user. If not defined, current user. * @param userId ID of the user. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string): Promise<any> { invalidateCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -432,10 +432,10 @@ export class AddonCompetencyProvider {
/** /**
* Invalidates Competency Summary data. * Invalidates Competency Summary data.
* *
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {number} [userId] ID of the user. If not defined, current user. * @param userId ID of the user. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateCompetencySummary(competencyId: number, userId?: number, siteId?: string): Promise<any> { invalidateCompetencySummary(competencyId: number, userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -448,10 +448,10 @@ export class AddonCompetencyProvider {
/** /**
* Invalidates Course Competencies data. * Invalidates Course Competencies data.
* *
* @param {number} courseId ID of the course. * @param courseId ID of the course.
* @param {number} [userId] ID of the user. * @param userId ID of the user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateCourseCompetencies(courseId: number, userId?: number, siteId?: string): Promise<any> { invalidateCourseCompetencies(courseId: number, userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -477,13 +477,13 @@ export class AddonCompetencyProvider {
/** /**
* Report the competency as being viewed in plan. * Report the competency as being viewed in plan.
* *
* @param {number} planId ID of the plan. * @param planId ID of the plan.
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {number} planStatus Current plan Status to decide what action should be logged. * @param planStatus Current plan Status to decide what action should be logged.
* @param {string} [name] Name of the competency. * @param name Name of the competency.
* @param {number} [userId] User ID. If not defined, current user. * @param userId User ID. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the WS call is successful. * @return Promise resolved when the WS call is successful.
*/ */
logCompetencyInPlanView(planId: number, competencyId: number, planStatus: number, name?: string, userId?: number, logCompetencyInPlanView(planId: number, competencyId: number, planStatus: number, name?: string, userId?: number,
siteId?: string): Promise<any> { siteId?: string): Promise<any> {
@ -519,12 +519,12 @@ export class AddonCompetencyProvider {
/** /**
* Report the competency as being viewed in course. * Report the competency as being viewed in course.
* *
* @param {number} courseId ID of the course. * @param courseId ID of the course.
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {string} [name] Name of the competency. * @param name Name of the competency.
* @param {number} [userId] User ID. If not defined, current user. * @param userId User ID. If not defined, current user.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the WS call is successful. * @return Promise resolved when the WS call is successful.
*/ */
logCompetencyInCourseView(courseId: number, competencyId: number, name?: string, userId?: number, siteId?: string) logCompetencyInCourseView(courseId: number, competencyId: number, name?: string, userId?: number, siteId?: string)
: Promise<any> { : Promise<any> {
@ -558,10 +558,10 @@ export class AddonCompetencyProvider {
/** /**
* Report the competency as being viewed. * Report the competency as being viewed.
* *
* @param {number} competencyId ID of the competency. * @param competencyId ID of the competency.
* @param {string} [name] Name of the competency. * @param name Name of the competency.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when the WS call is successful. * @return Promise resolved when the WS call is successful.
*/ */
logCompetencyView(competencyId: number, name?: string, siteId?: string): Promise<any> { logCompetencyView(competencyId: number, name?: string, siteId?: string): Promise<any> {
if (competencyId) { if (competencyId) {

View File

@ -30,7 +30,7 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand
/** /**
* Whether or not the handler is enabled ona site level. * Whether or not the handler is enabled ona site level.
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return true; return true;
@ -39,11 +39,11 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand
/** /**
* Whether or not the handler is enabled for a certain course. * Whether or not the handler is enabled for a certain course.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @param {any} accessData Access type and data. Default, guest, ... * @param accessData Access type and data. Default, guest, ...
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean|Promise<boolean>} True or promise resolved with true if enabled. * @return True or promise resolved with true if enabled.
*/ */
isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> { isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) {
@ -62,9 +62,9 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @param {Injector} injector Injector. * @param injector Injector.
* @param {number} course The course. * @param course The course.
* @return {CoreCourseOptionsHandlerData|Promise<CoreCourseOptionsHandlerData>} Data or promise resolved with the data. * @return Data or promise resolved with the data.
*/ */
getDisplayData?(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise<CoreCourseOptionsHandlerData> { getDisplayData?(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise<CoreCourseOptionsHandlerData> {
return { return {
@ -77,10 +77,10 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand
/** /**
* Should invalidate the data to determine if the handler is enabled for a certain course. * Should invalidate the data to determine if the handler is enabled for a certain course.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> { invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> {
if (navOptions && typeof navOptions.competencies != 'undefined') { if (navOptions && typeof navOptions.competencies != 'undefined') {
@ -94,8 +94,8 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand
/** /**
* Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline. * Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline.
* *
* @param {any} course The course. * @param course The course.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
prefetch(course: any): Promise<any> { prefetch(course: any): Promise<any> {
// Get the competencies in the course. // Get the competencies in the course.

View File

@ -31,8 +31,8 @@ export class AddonCompetencyHelperProvider {
/** /**
* Convenient helper to get the user profile image. * Convenient helper to get the user profile image.
* *
* @param {number} userId User Id * @param userId User Id
* @return {Promise<any>} User profile Image URL or true if default icon. * @return User profile Image URL or true if default icon.
*/ */
getProfile(userId: number): Promise<any> { getProfile(userId: number): Promise<any> {
if (!userId || userId == this.sitesProvider.getCurrentSiteUserId()) { if (!userId || userId == this.sitesProvider.getCurrentSiteUserId()) {
@ -50,8 +50,7 @@ export class AddonCompetencyHelperProvider {
/** /**
* Get the review status name translated. * Get the review status name translated.
* *
* @param {number} status * @param status
* @return {string}
*/ */
getCompetencyStatusName(status: number): string { getCompetencyStatusName(status: number): string {
let statusTranslateName; let statusTranslateName;
@ -76,8 +75,7 @@ export class AddonCompetencyHelperProvider {
/** /**
* Get the status name translated. * Get the status name translated.
* *
* @param {number} status * @param status
* @return {string}
*/ */
getPlanStatusName(status: number): string { getPlanStatusName(status: number): string {
let statusTranslateName; let statusTranslateName;

View File

@ -29,7 +29,7 @@ export class AddonCompetencyMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
// Check the user has at least one learn plan available. // Check the user has at least one learn plan available.
@ -41,7 +41,7 @@ export class AddonCompetencyMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreMainMenuHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(): CoreMainMenuHandlerData { getDisplayData(): CoreMainMenuHandlerData {
return { return {

View File

@ -33,11 +33,11 @@ export class AddonCompetencyPlanLinkHandler extends CoreContentLinksHandlerBase
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -53,11 +53,11 @@ export class AddonCompetencyPlanLinkHandler extends CoreContentLinksHandlerBase
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
// Handler is disabled if all competency features are disabled. // Handler is disabled if all competency features are disabled.

View File

@ -33,11 +33,11 @@ export class AddonCompetencyPlansLinkHandler extends CoreContentLinksHandlerBase
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -54,11 +54,11 @@ export class AddonCompetencyPlansLinkHandler extends CoreContentLinksHandlerBase
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
// Handler is disabled if all competency features are disabled. // Handler is disabled if all competency features are disabled.

View File

@ -33,8 +33,8 @@ export class AddonCompetencyPushClickHandler implements CorePushNotificationsCli
/** /**
* Check if a notification click is handled by this handler. * Check if a notification click is handled by this handler.
* *
* @param {any} notification The notification to check. * @param notification The notification to check.
* @return {boolean} Whether the notification click is handled by this handler * @return Whether the notification click is handled by this handler
*/ */
handles(notification: any): boolean | Promise<boolean> { handles(notification: any): boolean | Promise<boolean> {
if (this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'moodle' && if (this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'moodle' &&
@ -51,8 +51,8 @@ export class AddonCompetencyPushClickHandler implements CorePushNotificationsCli
/** /**
* Handle the notification click. * Handle the notification click.
* *
* @param {any} notification The notification to check. * @param notification The notification to check.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
handleClick(notification: any): Promise<any> { handleClick(notification: any): Promise<any> {
const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl); const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl);

View File

@ -33,11 +33,11 @@ export class AddonCompetencyUserCompetencyLinkHandler extends CoreContentLinksHa
/** /**
* Get the list of actions for a link (url). * Get the list of actions for a link (url).
* *
* @param {string[]} siteIds List of sites the URL belongs to. * @param siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions. * @return List of (or promise resolved with list of) actions.
*/ */
getActions(siteIds: string[], url: string, params: any, courseId?: number): getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> { CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
@ -53,11 +53,11 @@ export class AddonCompetencyUserCompetencyLinkHandler extends CoreContentLinksHa
* Check if the handler is enabled for a certain site (site + user) and a URL. * Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true. * If not defined, defaults to true.
* *
* @param {string} siteId The site ID. * @param siteId The site ID.
* @param {string} url The URL to treat. * @param url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended. * @param courseId Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site. * @return Whether the handler is enabled for the URL and site.
*/ */
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> { isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
// Handler is disabled if all competency features are disabled. // Handler is disabled if all competency features are disabled.

View File

@ -47,7 +47,7 @@ export class AddonCompetencyUserHandler implements CoreUserProfileHandler {
/** /**
* Whether or not the handler is enabled on a site level. * Whether or not the handler is enabled on a site level.
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return true; return true;
@ -56,11 +56,11 @@ export class AddonCompetencyUserHandler implements CoreUserProfileHandler {
/** /**
* Check if handler is enabled for this user in this context. * Check if handler is enabled for this user in this context.
* *
* @param {any} user User to check. * @param user User to check.
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean|Promise<boolean>} Promise resolved with true if enabled, resolved with false otherwise. * @return Promise resolved with true if enabled, resolved with false otherwise.
*/ */
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> { isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
if (courseId) { if (courseId) {
@ -100,7 +100,7 @@ export class AddonCompetencyUserHandler implements CoreUserProfileHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreUserProfileHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData { getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData {
if (courseId) { if (courseId) {

View File

@ -54,7 +54,7 @@ export class AddonCourseCompletionReportComponent implements OnInit {
/** /**
* Fetch compleiton data. * Fetch compleiton data.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchCompletion(): Promise<any> { protected fetchCompletion(): Promise<any> {
return this.courseCompletionProvider.getCompletion(this.courseId, this.userId).then((completion) => { return this.courseCompletionProvider.getCompletion(this.courseId, this.userId).then((completion) => {
@ -77,7 +77,7 @@ export class AddonCourseCompletionReportComponent implements OnInit {
/** /**
* Refresh completion data on PTR. * Refresh completion data on PTR.
* *
* @param {any} [refresher] Refresher instance. * @param refresher Refresher instance.
*/ */
refreshCompletion(refresher?: any): void { refreshCompletion(refresher?: any): void {
this.courseCompletionProvider.invalidateCourseCompletion(this.courseId, this.userId).finally(() => { this.courseCompletionProvider.invalidateCourseCompletion(this.courseId, this.userId).finally(() => {

View File

@ -30,7 +30,7 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio
/** /**
* Whether or not the handler is enabled on a site level. * Whether or not the handler is enabled on a site level.
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.courseCompletionProvider.isPluginViewEnabled(); return this.courseCompletionProvider.isPluginViewEnabled();
@ -39,11 +39,11 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio
/** /**
* Whether or not the handler is enabled for a certain course. * Whether or not the handler is enabled for a certain course.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @param {any} accessData Access type and data. Default, guest, ... * @param accessData Access type and data. Default, guest, ...
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean|Promise<boolean>} True or promise resolved with true if enabled. * @return True or promise resolved with true if enabled.
*/ */
isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> { isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) {
@ -64,8 +64,8 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @return {CoreCourseOptionsHandlerData} Data. * @return Data.
*/ */
getDisplayData?(injector: Injector, courseId: number): CoreCourseOptionsHandlerData { getDisplayData?(injector: Injector, courseId: number): CoreCourseOptionsHandlerData {
return { return {
@ -78,10 +78,10 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio
/** /**
* Should invalidate the data to determine if the handler is enabled for a certain course. * Should invalidate the data to determine if the handler is enabled for a certain course.
* *
* @param {number} courseId The course ID. * @param courseId The course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> { invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise<any> {
return this.courseCompletionProvider.invalidateCourseCompletion(courseId); return this.courseCompletionProvider.invalidateCourseCompletion(courseId);
@ -90,8 +90,8 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio
/** /**
* Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline. * Called when a course is downloaded. It should prefetch all the data to be able to see the addon in offline.
* *
* @param {any} course The course. * @param course The course.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
prefetch(course: any): Promise<any> { prefetch(course: any): Promise<any> {
return this.courseCompletionProvider.getCompletion(course.id, undefined, { return this.courseCompletionProvider.getCompletion(course.id, undefined, {

View File

@ -39,9 +39,9 @@ export class AddonCourseCompletionProvider {
* Returns whether or not the user can mark a course as self completed. * Returns whether or not the user can mark a course as self completed.
* It can if it's configured in the course and it hasn't been completed yet. * It can if it's configured in the course and it hasn't been completed yet.
* *
* @param {number} userId User ID. * @param userId User ID.
* @param {any} completion Course completion. * @param completion Course completion.
* @return {boolean} True if user can mark course as self completed, false otherwise. * @return True if user can mark course as self completed, false otherwise.
*/ */
canMarkSelfCompleted(userId: number, completion: any): boolean { canMarkSelfCompleted(userId: number, completion: any): boolean {
let selfCompletionActive = false, let selfCompletionActive = false,
@ -65,8 +65,8 @@ export class AddonCourseCompletionProvider {
/** /**
* Get completed status text. The language code returned is meant to be translated. * Get completed status text. The language code returned is meant to be translated.
* *
* @param {any} completion Course completion. * @param completion Course completion.
* @return {string} Language code of the text to show. * @return Language code of the text to show.
*/ */
getCompletedStatusText(completion: any): string { getCompletedStatusText(completion: any): string {
if (completion.completed) { if (completion.completed) {
@ -90,11 +90,11 @@ export class AddonCourseCompletionProvider {
/** /**
* Get course completion status for a certain course and user. * Get course completion status for a certain course and user.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {number} [userId] User ID. If not defined, use current user. * @param userId User ID. If not defined, use current user.
* @param {any} [preSets] Presets to use when calling the WebService. * @param preSets Presets to use when calling the WebService.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any>} Promise to be resolved when the completion is retrieved. * @return Promise to be resolved when the completion is retrieved.
*/ */
getCompletion(courseId: number, userId?: number, preSets?: any, siteId?: string): Promise<any> { getCompletion(courseId: number, userId?: number, preSets?: any, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -125,9 +125,9 @@ export class AddonCourseCompletionProvider {
/** /**
* Get cache key for get completion WS calls. * Get cache key for get completion WS calls.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {number} useIid User ID. * @param useIid User ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getCompletionCacheKey(courseId: number, userId: number): string { protected getCompletionCacheKey(courseId: number, userId: number): string {
return this.ROOT_CACHE_KEY + 'view:' + courseId + ':' + userId; return this.ROOT_CACHE_KEY + 'view:' + courseId + ':' + userId;
@ -136,9 +136,9 @@ export class AddonCourseCompletionProvider {
/** /**
* Invalidates view course completion WS call. * Invalidates view course completion WS call.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {number} [userId] User ID. If not defined, use current user. * @param userId User ID. If not defined, use current user.
* @return {Promise<any>} Promise resolved when the list is invalidated. * @return Promise resolved when the list is invalidated.
*/ */
invalidateCourseCompletion(courseId: number, userId?: number): Promise<any> { invalidateCourseCompletion(courseId: number, userId?: number): Promise<any> {
userId = userId || this.sitesProvider.getCurrentSiteUserId(); userId = userId || this.sitesProvider.getCurrentSiteUserId();
@ -149,7 +149,7 @@ export class AddonCourseCompletionProvider {
/** /**
* Returns whether or not the view course completion plugin is enabled for the current site. * Returns whether or not the view course completion plugin is enabled for the current site.
* *
* @return {boolean} True if plugin enabled, false otherwise. * @return True if plugin enabled, false otherwise.
*/ */
isPluginViewEnabled(): boolean { isPluginViewEnabled(): boolean {
return this.sitesProvider.isLoggedIn(); return this.sitesProvider.isLoggedIn();
@ -158,9 +158,9 @@ export class AddonCourseCompletionProvider {
/** /**
* Returns whether or not the view course completion plugin is enabled for a certain course. * Returns whether or not the view course completion plugin is enabled for a certain course.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {boolean} [preferCache=true] True if shouldn't call WS if data is cached, false otherwise. * @param preferCache True if shouldn't call WS if data is cached, false otherwise.
* @return {Promise<boolean>} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise.
*/ */
isPluginViewEnabledForCourse(courseId: number, preferCache: boolean = true): Promise<boolean> { isPluginViewEnabledForCourse(courseId: number, preferCache: boolean = true): Promise<boolean> {
if (!courseId) { if (!courseId) {
@ -187,9 +187,9 @@ export class AddonCourseCompletionProvider {
/** /**
* Returns whether or not the view course completion plugin is enabled for a certain user. * Returns whether or not the view course completion plugin is enabled for a certain user.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {number} [userId] User ID. If not defined, use current user. * @param userId User ID. If not defined, use current user.
* @return {Promise<boolean>} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise.
*/ */
isPluginViewEnabledForUser(courseId: number, userId?: number): Promise<boolean> { isPluginViewEnabledForUser(courseId: number, userId?: number): Promise<boolean> {
// Check if user wants to view his own completion. // Check if user wants to view his own completion.
@ -242,8 +242,8 @@ export class AddonCourseCompletionProvider {
/** /**
* Mark a course as self completed. * Mark a course as self completed.
* *
* @param {number} courseId Course ID. * @param courseId Course ID.
* @return {Promise<any>} Resolved on success. * @return Resolved on success.
*/ */
markCourseAsSelfCompleted(courseId: number): Promise<any> { markCourseAsSelfCompleted(courseId: number): Promise<any> {
const params = { const params = {

View File

@ -42,7 +42,7 @@ export class AddonCourseCompletionUserHandler implements CoreUserProfileHandler
/** /**
* Whether or not the handler is enabled on a site level. * Whether or not the handler is enabled on a site level.
* @return {boolean|Promise<boolean>} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.courseCompletionProvider.isPluginViewEnabled(); return this.courseCompletionProvider.isPluginViewEnabled();
@ -51,11 +51,11 @@ export class AddonCourseCompletionUserHandler implements CoreUserProfileHandler
/** /**
* Check if handler is enabled for this user in this context. * Check if handler is enabled for this user in this context.
* *
* @param {any} user User to check. * @param user User to check.
* @param {number} courseId Course ID. * @param courseId Course ID.
* @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions.
* @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions.
* @return {boolean|Promise<boolean>} Promise resolved with true if enabled, resolved with false otherwise. * @return Promise resolved with true if enabled, resolved with false otherwise.
*/ */
isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> { isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
if (!courseId) { if (!courseId) {
@ -84,7 +84,7 @@ export class AddonCourseCompletionUserHandler implements CoreUserProfileHandler
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreUserProfileHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData { getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData {
return { return {

View File

@ -89,7 +89,7 @@ export class AddonFilesListPage implements OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshData(refresher: any): void { refreshData(refresher: any): void {
this.refreshFiles().finally(() => { this.refreshFiles().finally(() => {
@ -144,7 +144,7 @@ export class AddonFilesListPage implements OnDestroy {
/** /**
* Fetch the files. * Fetch the files.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchFiles(): Promise<any> { protected fetchFiles(): Promise<any> {
let promise; let promise;
@ -193,7 +193,7 @@ export class AddonFilesListPage implements OnDestroy {
/** /**
* Refresh the displayed files. * Refresh the displayed files.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected refreshFiles(): Promise<any> { protected refreshFiles(): Promise<any> {
const promises = []; const promises = [];

View File

@ -31,7 +31,7 @@ export class AddonFilesProvider {
/** /**
* Check if core_user_get_private_files_info WS call is available. * Check if core_user_get_private_files_info WS call is available.
* *
* @return {boolean} Whether the WS is available, false otherwise. * @return Whether the WS is available, false otherwise.
*/ */
canGetPrivateFilesInfo(): boolean { canGetPrivateFilesInfo(): boolean {
return this.sitesProvider.wsAvailableInCurrentSite('core_user_get_private_files_info'); return this.sitesProvider.wsAvailableInCurrentSite('core_user_get_private_files_info');
@ -40,7 +40,7 @@ export class AddonFilesProvider {
/** /**
* Check if user can view his private files. * Check if user can view his private files.
* *
* @return {boolean} Whether the user can view his private files. * @return Whether the user can view his private files.
*/ */
canViewPrivateFiles(): boolean { canViewPrivateFiles(): boolean {
return this.sitesProvider.getCurrentSite().canAccessMyFiles() && !this.isPrivateFilesDisabledInSite(); return this.sitesProvider.getCurrentSite().canAccessMyFiles() && !this.isPrivateFilesDisabledInSite();
@ -49,7 +49,7 @@ export class AddonFilesProvider {
/** /**
* Check if user can view site files. * Check if user can view site files.
* *
* @return {boolean} Whether the user can view site files. * @return Whether the user can view site files.
*/ */
canViewSiteFiles(): boolean { canViewSiteFiles(): boolean {
return !this.isSiteFilesDisabledInSite(); return !this.isSiteFilesDisabledInSite();
@ -58,7 +58,7 @@ export class AddonFilesProvider {
/** /**
* Check if user can upload private files. * Check if user can upload private files.
* *
* @return {boolean} Whether the user can upload private files. * @return Whether the user can upload private files.
*/ */
canUploadFiles(): boolean { canUploadFiles(): boolean {
const currentSite = this.sitesProvider.getCurrentSite(); const currentSite = this.sitesProvider.getCurrentSite();
@ -69,9 +69,9 @@ export class AddonFilesProvider {
/** /**
* Get the list of files. * Get the list of files.
* *
* @param {any} params A list of parameters accepted by the Web service. * @param params A list of parameters accepted by the Web service.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any[]>} Promise resolved with the files. * @return Promise resolved with the files.
*/ */
getFiles(params: any, siteId?: string): Promise<any[]> { getFiles(params: any, siteId?: string): Promise<any[]> {
@ -121,8 +121,8 @@ export class AddonFilesProvider {
/** /**
* Get cache key for file list WS calls. * Get cache key for file list WS calls.
* *
* @param {any} params Params of the WS. * @param params Params of the WS.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getFilesListCacheKey(params: any): string { protected getFilesListCacheKey(params: any): string {
const root = !params.component ? 'site' : 'my'; const root = !params.component ? 'site' : 'my';
@ -133,7 +133,7 @@ export class AddonFilesProvider {
/** /**
* Get the private files of the current user. * Get the private files of the current user.
* *
* @return {Promise<any[]>} Promise resolved with the files. * @return Promise resolved with the files.
*/ */
getPrivateFiles(): Promise<any[]> { getPrivateFiles(): Promise<any[]> {
return this.getFiles(this.getPrivateFilesRootParams()); return this.getFiles(this.getPrivateFilesRootParams());
@ -142,7 +142,7 @@ export class AddonFilesProvider {
/** /**
* Get params to get root private files directory. * Get params to get root private files directory.
* *
* @return {any} Params. * @return Params.
*/ */
protected getPrivateFilesRootParams(): any { protected getPrivateFilesRootParams(): any {
return { return {
@ -160,9 +160,9 @@ export class AddonFilesProvider {
/** /**
* Get private files info. * Get private files info.
* *
* @param {number} [userId] User ID. If not defined, current user in the site. * @param userId User ID. If not defined, current user in the site.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any>} Promise resolved with the info. * @return Promise resolved with the info.
*/ */
getPrivateFilesInfo(userId?: number, siteId?: string): Promise<any> { getPrivateFilesInfo(userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -183,8 +183,8 @@ export class AddonFilesProvider {
/** /**
* Get the cache key for private files info WS calls. * Get the cache key for private files info WS calls.
* *
* @param {number} userId User ID. * @param userId User ID.
* @return {string} Cache key. * @return Cache key.
*/ */
protected getPrivateFilesInfoCacheKey(userId: number): string { protected getPrivateFilesInfoCacheKey(userId: number): string {
return this.getPrivateFilesInfoCommonCacheKey() + ':' + userId; return this.getPrivateFilesInfoCommonCacheKey() + ':' + userId;
@ -193,7 +193,7 @@ export class AddonFilesProvider {
/** /**
* Get the common part of the cache keys for private files info WS calls. * Get the common part of the cache keys for private files info WS calls.
* *
* @return {string} Cache key. * @return Cache key.
*/ */
protected getPrivateFilesInfoCommonCacheKey(): string { protected getPrivateFilesInfoCommonCacheKey(): string {
return this.ROOT_CACHE_KEY + 'privateInfo'; return this.ROOT_CACHE_KEY + 'privateInfo';
@ -202,7 +202,7 @@ export class AddonFilesProvider {
/** /**
* Get the site files. * Get the site files.
* *
* @return {Promise<any[]>} Promise resolved with the files. * @return Promise resolved with the files.
*/ */
getSiteFiles(): Promise<any[]> { getSiteFiles(): Promise<any[]> {
return this.getFiles(this.getSiteFilesRootParams()); return this.getFiles(this.getSiteFilesRootParams());
@ -211,7 +211,7 @@ export class AddonFilesProvider {
/** /**
* Get params to get root site files directory. * Get params to get root site files directory.
* *
* @return {any} Params. * @return Params.
*/ */
protected getSiteFilesRootParams(): any { protected getSiteFilesRootParams(): any {
return { return {
@ -227,10 +227,10 @@ export class AddonFilesProvider {
/** /**
* Invalidates list of files in a certain directory. * Invalidates list of files in a certain directory.
* *
* @param {string} root Root of the directory ('my' for private files, 'site' for site files). * @param root Root of the directory ('my' for private files, 'site' for site files).
* @param {string} path Path to the directory. * @param path Path to the directory.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidateDirectory(root: string, path: string, siteId?: string): Promise<any> { invalidateDirectory(root: string, path: string, siteId?: string): Promise<any> {
let params; let params;
@ -252,8 +252,8 @@ export class AddonFilesProvider {
/** /**
* Invalidates private files info for all users. * Invalidates private files info for all users.
* *
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidatePrivateFilesInfo(siteId?: string): Promise<any> { invalidatePrivateFilesInfo(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -264,9 +264,9 @@ export class AddonFilesProvider {
/** /**
* Invalidates private files info for a certain user. * Invalidates private files info for a certain user.
* *
* @param {number} [userId] User ID. If not defined, current user in the site. * @param userId User ID. If not defined, current user in the site.
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any>} Promise resolved when the data is invalidated. * @return Promise resolved when the data is invalidated.
*/ */
invalidatePrivateFilesInfoForUser(userId?: number, siteId?: string): Promise<any> { invalidatePrivateFilesInfoForUser(userId?: number, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -279,8 +279,8 @@ export class AddonFilesProvider {
/** /**
* Check if Files is disabled in a certain site. * Check if Files is disabled in a certain site.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if disabled, rejected or resolved with false otherwise. * @return Promise resolved with true if disabled, rejected or resolved with false otherwise.
*/ */
isDisabled(siteId?: string): Promise<boolean> { isDisabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -291,8 +291,8 @@ export class AddonFilesProvider {
/** /**
* Check if Files is disabled in a certain site. * Check if Files is disabled in a certain site.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether it's disabled. * @return Whether it's disabled.
*/ */
isDisabledInSite(site: CoreSite): boolean { isDisabledInSite(site: CoreSite): boolean {
site = site || this.sitesProvider.getCurrentSite(); site = site || this.sitesProvider.getCurrentSite();
@ -303,7 +303,7 @@ export class AddonFilesProvider {
/** /**
* Return whether or not the plugin is enabled. * Return whether or not the plugin is enabled.
* *
* @return {boolean} True if enabled, false otherwise. * @return True if enabled, false otherwise.
*/ */
isPluginEnabled(): boolean { isPluginEnabled(): boolean {
return this.canViewPrivateFiles() || this.canViewSiteFiles() || this.canUploadFiles(); return this.canViewPrivateFiles() || this.canViewSiteFiles() || this.canUploadFiles();
@ -312,8 +312,8 @@ export class AddonFilesProvider {
/** /**
* Check if private files is disabled in a certain site. * Check if private files is disabled in a certain site.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if disabled, rejected or resolved with false otherwise. * @return Promise resolved with true if disabled, rejected or resolved with false otherwise.
*/ */
isPrivateFilesDisabled(siteId?: string): Promise<boolean> { isPrivateFilesDisabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -324,8 +324,8 @@ export class AddonFilesProvider {
/** /**
* Check if private files is disabled in a certain site. * Check if private files is disabled in a certain site.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether it's disabled. * @return Whether it's disabled.
*/ */
isPrivateFilesDisabledInSite(site?: CoreSite): boolean { isPrivateFilesDisabledInSite(site?: CoreSite): boolean {
site = site || this.sitesProvider.getCurrentSite(); site = site || this.sitesProvider.getCurrentSite();
@ -336,8 +336,8 @@ export class AddonFilesProvider {
/** /**
* Check if site files is disabled in a certain site. * Check if site files is disabled in a certain site.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if disabled, rejected or resolved with false otherwise. * @return Promise resolved with true if disabled, rejected or resolved with false otherwise.
*/ */
isSiteFilesDisabled(siteId?: string): Promise<boolean> { isSiteFilesDisabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -348,8 +348,8 @@ export class AddonFilesProvider {
/** /**
* Check if site files is disabled in a certain site. * Check if site files is disabled in a certain site.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether it's disabled. * @return Whether it's disabled.
*/ */
isSiteFilesDisabledInSite(site?: CoreSite): boolean { isSiteFilesDisabledInSite(site?: CoreSite): boolean {
site = site || this.sitesProvider.getCurrentSite(); site = site || this.sitesProvider.getCurrentSite();
@ -360,8 +360,8 @@ export class AddonFilesProvider {
/** /**
* Check if upload files is disabled in a certain site. * Check if upload files is disabled in a certain site.
* *
* @param {string} [siteId] Site Id. If not defined, use current site. * @param siteId Site Id. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if disabled, rejected or resolved with false otherwise. * @return Promise resolved with true if disabled, rejected or resolved with false otherwise.
*/ */
isUploadDisabled(siteId?: string): Promise<boolean> { isUploadDisabled(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -372,8 +372,8 @@ export class AddonFilesProvider {
/** /**
* Check if upload files is disabled in a certain site. * Check if upload files is disabled in a certain site.
* *
* @param {CoreSite} [site] Site. If not defined, use current site. * @param site Site. If not defined, use current site.
* @return {boolean} Whether it's disabled. * @return Whether it's disabled.
*/ */
isUploadDisabledInSite(site?: CoreSite): boolean { isUploadDisabledInSite(site?: CoreSite): boolean {
site = site || this.sitesProvider.getCurrentSite(); site = site || this.sitesProvider.getCurrentSite();
@ -384,9 +384,9 @@ export class AddonFilesProvider {
/** /**
* Move a file from draft area to private files. * Move a file from draft area to private files.
* *
* @param {number} draftId The draft area ID of the file. * @param draftId The draft area ID of the file.
* @param {string} [siteid] ID of the site. If not defined, use current site. * @param siteid ID of the site. If not defined, use current site.
* @return {Promise<any>} Promise resolved in success, rejected otherwise. * @return Promise resolved in success, rejected otherwise.
*/ */
moveFromDraftToPrivate(draftId: number, siteId?: string): Promise<any> { moveFromDraftToPrivate(draftId: number, siteId?: string): Promise<any> {
const params = { const params = {
@ -404,8 +404,8 @@ export class AddonFilesProvider {
/** /**
* Check the Moodle version in order to check if upload files is working. * Check the Moodle version in order to check if upload files is working.
* *
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<boolean>} Promise resolved with true if WS is working, false otherwise. * @return Promise resolved with true if WS is working, false otherwise.
*/ */
versionCanUploadFiles(siteId?: string): Promise<boolean> { versionCanUploadFiles(siteId?: string): Promise<boolean> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {

View File

@ -30,8 +30,8 @@ export class AddonFilesHelperProvider {
/** /**
* Select a file, upload it and move it to private files. * Select a file, upload it and move it to private files.
* *
* @param {any} [info] Private files info. See AddonFilesProvider.getPrivateFilesInfo. * @param info Private files info. See AddonFilesProvider.getPrivateFilesInfo.
* @return {Promise<any>} Promise resolved when a file is uploaded, rejected otherwise. * @return Promise resolved when a file is uploaded, rejected otherwise.
*/ */
uploadPrivateFile(info?: any): Promise<any> { uploadPrivateFile(info?: any): Promise<any> {
// Calculate the max size. // Calculate the max size.

View File

@ -29,7 +29,7 @@ export class AddonFilesMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Check if the handler is enabled on a site level. * Check if the handler is enabled on a site level.
* *
* @return {boolean} Whether or not the handler is enabled on a site level. * @return Whether or not the handler is enabled on a site level.
*/ */
isEnabled(): boolean | Promise<boolean> { isEnabled(): boolean | Promise<boolean> {
return this.filesProvider.isPluginEnabled(); return this.filesProvider.isPluginEnabled();
@ -38,7 +38,7 @@ export class AddonFilesMainMenuHandler implements CoreMainMenuHandler {
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @return {CoreMainMenuHandlerData} Data needed to render the handler. * @return Data needed to render the handler.
*/ */
getDisplayData(): CoreMainMenuHandlerData { getDisplayData(): CoreMainMenuHandlerData {
return { return {

View File

@ -47,7 +47,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy {
/** /**
* Fetches the list of devices. * Fetches the list of devices.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchDevices(): Promise<any> { protected fetchDevices(): Promise<any> {
return this.airnotifierProivder.getUserDevices().then((devices) => { return this.airnotifierProivder.getUserDevices().then((devices) => {
@ -94,7 +94,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy {
/** /**
* Refresh the list of devices. * Refresh the list of devices.
* *
* @param {any} refresher Refresher. * @param refresher Refresher.
*/ */
refreshDevices(refresher: any): void { refreshDevices(refresher: any): void {
this.airnotifierProivder.invalidateUserDevices().finally(() => { this.airnotifierProivder.invalidateUserDevices().finally(() => {
@ -107,8 +107,8 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy {
/** /**
* Enable or disable a certain device. * Enable or disable a certain device.
* *
* @param {any} device The device object. * @param device The device object.
* @param {boolean} enable True to enable the device, false to disable it. * @param enable True to enable the device, false to disable it.
*/ */
enableDevice(device: any, enable: boolean): void { enableDevice(device: any, enable: boolean): void {
device.updating = true; device.updating = true;

View File

@ -34,10 +34,10 @@ export class AddonMessageOutputAirnotifierProvider {
/** /**
* Enables or disables a device. * Enables or disables a device.
* *
* @param {number} deviceId Device ID. * @param deviceId Device ID.
* @param {boolean} enable True to enable, false to disable. * @param enable True to enable, false to disable.
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved if success. * @return Promise resolved if success.
*/ */
enableDevice(deviceId: number, enable: boolean, siteId?: string): Promise<any> { enableDevice(deviceId: number, enable: boolean, siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -62,7 +62,7 @@ export class AddonMessageOutputAirnotifierProvider {
/** /**
* Get the cache key for the get user devices call. * Get the cache key for the get user devices call.
* *
* @return {string} Cache key. * @return Cache key.
*/ */
protected getUserDevicesCacheKey(): string { protected getUserDevicesCacheKey(): string {
return this.ROOT_CACHE_KEY + 'userDevices'; return this.ROOT_CACHE_KEY + 'userDevices';
@ -71,8 +71,8 @@ export class AddonMessageOutputAirnotifierProvider {
/** /**
* Get user devices. * Get user devices.
* *
* @param {string} [siteId] Site ID. If not defined, use current site. * @param siteId Site ID. If not defined, use current site.
* @return {Promise<any>} Promise resolved with the devices. * @return Promise resolved with the devices.
*/ */
getUserDevices(siteId?: string): Promise<any> { getUserDevices(siteId?: string): Promise<any> {
this.logger.debug('Get user devices'); this.logger.debug('Get user devices');
@ -95,8 +95,8 @@ export class AddonMessageOutputAirnotifierProvider {
/** /**
* Invalidate get user devices. * Invalidate get user devices.
* *
* @param {string} [siteId] Site ID. If not defined, current site. * @param siteId Site ID. If not defined, current site.
* @return {Promise<any>} Promise resolved when data is invalidated. * @return Promise resolved when data is invalidated.
*/ */
invalidateUserDevices(siteId?: string): Promise<any> { invalidateUserDevices(siteId?: string): Promise<any> {
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
@ -107,7 +107,7 @@ export class AddonMessageOutputAirnotifierProvider {
/** /**
* Returns whether or not the plugin is enabled for the current site. * Returns whether or not the plugin is enabled for the current site.
* *
* @return {boolean} True if enabled, false otherwise. * @return True if enabled, false otherwise.
* @since 3.2 * @since 3.2
*/ */
isEnabled(): boolean { isEnabled(): boolean {

View File

@ -29,7 +29,7 @@ export class AddonMessageOutputAirnotifierHandler implements AddonMessageOutputH
/** /**
* Whether or not the module is enabled for the site. * Whether or not the module is enabled for the site.
* *
* @return {boolean} True if enabled, false otherwise. * @return True if enabled, false otherwise.
*/ */
isEnabled(): boolean { isEnabled(): boolean {
return this.airnotifierProvider.isEnabled(); return this.airnotifierProvider.isEnabled();
@ -38,8 +38,8 @@ export class AddonMessageOutputAirnotifierHandler implements AddonMessageOutputH
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @param {any} processor The processor object. * @param processor The processor object.
* @return {CoreMainMenuHandlerData} Data. * @return Data.
*/ */
getDisplayData(processor: any): AddonMessageOutputHandlerData { getDisplayData(processor: any): AddonMessageOutputHandlerData {
return { return {

View File

@ -24,15 +24,14 @@ import { CoreSitesProvider } from '@providers/sites';
export interface AddonMessageOutputHandler extends CoreDelegateHandler { export interface AddonMessageOutputHandler extends CoreDelegateHandler {
/** /**
* The name of the processor. E.g. 'airnotifier'. * The name of the processor. E.g. 'airnotifier'.
* @type {string}
*/ */
processorName: string; processorName: string;
/** /**
* Returns the data needed to render the handler. * Returns the data needed to render the handler.
* *
* @param {any} processor The processor object. * @param processor The processor object.
* @return {CoreMainMenuHandlerData} Data. * @return Data.
*/ */
getDisplayData(processor: any): AddonMessageOutputHandlerData; getDisplayData(processor: any): AddonMessageOutputHandlerData;
} }
@ -43,31 +42,26 @@ export interface AddonMessageOutputHandler extends CoreDelegateHandler {
export interface AddonMessageOutputHandlerData { export interface AddonMessageOutputHandlerData {
/** /**
* Handler's priority. * Handler's priority.
* @type {number}
*/ */
priority: number; priority: number;
/** /**
* Name of the page to load for the handler. * Name of the page to load for the handler.
* @type {string}
*/ */
page: string; page: string;
/** /**
* Label to display for the handler. * Label to display for the handler.
* @type {string}
*/ */
label: string; label: string;
/** /**
* Name of the icon to display for the handler. * Name of the icon to display for the handler.
* @type {string}
*/ */
icon: string; icon: string;
/** /**
* Params to pass to the page. * Params to pass to the page.
* @type {any}
*/ */
pageParams?: any; pageParams?: any;
} }
@ -88,8 +82,8 @@ export interface AddonMessageOutputHandlerData {
/** /**
* Get the display data of the handler. * Get the display data of the handler.
* *
* @param {string} processor The processor object. * @param processor The processor object.
* @return {AddonMessageOutputHandlerData} Data. * @return Data.
*/ */
getDisplayData(processor: any): AddonMessageOutputHandlerData { getDisplayData(processor: any): AddonMessageOutputHandlerData {
return this.executeFunctionOnEnabled(processor.name, 'getDisplayData', processor); return this.executeFunctionOnEnabled(processor.name, 'getDisplayData', processor);

View File

@ -80,8 +80,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro
/** /**
* Fetch contacts. * Fetch contacts.
* *
* @param {boolean} [refresh=false] True if we are refreshing contacts, false if we are loading more. * @param refresh True if we are refreshing contacts, false if we are loading more.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(refresh: boolean = false): Promise<any> { fetchData(refresh: boolean = false): Promise<any> {
this.loadMoreError = false; this.loadMoreError = false;
@ -112,8 +112,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro
/** /**
* Refresh contacts. * Refresh contacts.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(refresher?: any): Promise<any> { refreshData(refresher?: any): Promise<any> {
// No need to invalidate contacts, we always try to get the latest. // No need to invalidate contacts, we always try to get the latest.
@ -125,8 +125,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro
/** /**
* Load more contacts. * Load more contacts.
* *
* @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
loadMore(infiniteComplete?: any): Promise<any> { loadMore(infiniteComplete?: any): Promise<any> {
return this.fetchData().finally(() => { return this.fetchData().finally(() => {
@ -137,8 +137,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro
/** /**
* Notify that a contact has been selected. * Notify that a contact has been selected.
* *
* @param {number} userId User id. * @param userId User id.
* @param {boolean} [onInit=false] Whether the contact is selected on initial load. * @param onInit Whether the contact is selected on initial load.
*/ */
selectUser(userId: number, onInit: boolean = false): void { selectUser(userId: number, onInit: boolean = false): void {
this.selectedUserId = userId; this.selectedUserId = userId;

View File

@ -71,8 +71,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy
/** /**
* Fetch contact requests. * Fetch contact requests.
* *
* @param {boolean} [refresh=false] True if we are refreshing contact requests, false if we are loading more. * @param refresh True if we are refreshing contact requests, false if we are loading more.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
fetchData(refresh: boolean = false): Promise<any> { fetchData(refresh: boolean = false): Promise<any> {
this.loadMoreError = false; this.loadMoreError = false;
@ -103,8 +103,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy
/** /**
* Refresh contact requests. * Refresh contact requests.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(refresher?: any): Promise<any> { refreshData(refresher?: any): Promise<any> {
// Refresh the number of contacts requests to update badges. // Refresh the number of contacts requests to update badges.
@ -119,8 +119,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy
/** /**
* Load more contact requests. * Load more contact requests.
* *
* @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
loadMore(infiniteComplete?: any): Promise<any> { loadMore(infiniteComplete?: any): Promise<any> {
return this.fetchData().finally(() => { return this.fetchData().finally(() => {
@ -131,8 +131,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy
/** /**
* Notify that a contact has been selected. * Notify that a contact has been selected.
* *
* @param {number} userId User id. * @param userId User id.
* @param {boolean} [onInit=false] Whether the contact is selected on initial load. * @param onInit Whether the contact is selected on initial load.
*/ */
selectUser(userId: number, onInit: boolean = false): void { selectUser(userId: number, onInit: boolean = false): void {
this.selectedUserId = userId; this.selectedUserId = userId;

View File

@ -101,8 +101,8 @@ export class AddonMessagesContactsComponent {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(refresher?: any): Promise<any> { refreshData(refresher?: any): Promise<any> {
let promise; let promise;
@ -125,7 +125,7 @@ export class AddonMessagesContactsComponent {
/** /**
* Fetch contacts. * Fetch contacts.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchData(): Promise<any> { protected fetchData(): Promise<any> {
this.loadingMessage = this.loadingMessages; this.loadingMessage = this.loadingMessages;
@ -147,8 +147,8 @@ export class AddonMessagesContactsComponent {
/** /**
* Sort user list by fullname * Sort user list by fullname
* @param {any[]} list List to sort. * @param list List to sort.
* @return {any[]} Sorted list. * @return Sorted list.
*/ */
protected sortUsers(list: any[]): any[] { protected sortUsers(list: any[]): any[] {
return list.sort((a, b) => { return list.sort((a, b) => {
@ -179,8 +179,8 @@ export class AddonMessagesContactsComponent {
/** /**
* Search users from the UI. * Search users from the UI.
* *
* @param {string} query Text to search for. * @param query Text to search for.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
search(query: string): Promise<any> { search(query: string): Promise<any> {
this.appProvider.closeKeyboard(); this.appProvider.closeKeyboard();
@ -196,8 +196,8 @@ export class AddonMessagesContactsComponent {
/** /**
* Perform the search of users. * Perform the search of users.
* *
* @param {string} query Text to search for. * @param query Text to search for.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected performSearch(query: string): Promise<any> { protected performSearch(query: string): Promise<any> {
return this.messagesProvider.searchContacts(query).then((result) => { return this.messagesProvider.searchContacts(query).then((result) => {
@ -214,8 +214,8 @@ export class AddonMessagesContactsComponent {
/** /**
* Navigate to a particular discussion. * Navigate to a particular discussion.
* *
* @param {number} discussionUserId Discussion Id to load. * @param discussionUserId Discussion Id to load.
* @param {boolean} [onlyWithSplitView=false] Only go to Discussion if split view is on. * @param onlyWithSplitView Only go to Discussion if split view is on.
*/ */
gotoDiscussion(discussionUserId: number, onlyWithSplitView: boolean = false): void { gotoDiscussion(discussionUserId: number, onlyWithSplitView: boolean = false): void {
this.discussionUserId = discussionUserId; this.discussionUserId = discussionUserId;

View File

@ -139,9 +139,9 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @param {boolean} [refreshUnreadCounts=true] Whteher to refresh unread counts. * @param refreshUnreadCounts Whteher to refresh unread counts.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise<any> { refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise<any> {
const promises = []; const promises = [];
@ -163,7 +163,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
/** /**
* Fetch discussions. * Fetch discussions.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchData(): Promise<any> { protected fetchData(): Promise<any> {
this.loadingMessage = this.loadingMessages; this.loadingMessage = this.loadingMessages;
@ -208,8 +208,8 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
/** /**
* Search messages cotaining text. * Search messages cotaining text.
* *
* @param {string} query Text to search for. * @param query Text to search for.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
searchMessage(query: string): Promise<any> { searchMessage(query: string): Promise<any> {
this.appProvider.closeKeyboard(); this.appProvider.closeKeyboard();
@ -229,9 +229,9 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy {
/** /**
* Navigate to a particular discussion. * Navigate to a particular discussion.
* *
* @param {number} discussionUserId Discussion Id to load. * @param discussionUserId Discussion Id to load.
* @param {number} [messageId] Message to scroll after loading the discussion. Used when searching. * @param messageId Message to scroll after loading the discussion. Used when searching.
* @param {boolean} [onlyWithSplitView=false] Only go to Discussion if split view is on. * @param onlyWithSplitView Only go to Discussion if split view is on.
*/ */
gotoDiscussion(discussionUserId: number, messageId?: number, onlyWithSplitView: boolean = false): void { gotoDiscussion(discussionUserId: number, messageId?: number, onlyWithSplitView: boolean = false): void {
this.discussionUserId = discussionUserId; this.discussionUserId = discussionUserId;

View File

@ -91,9 +91,9 @@ export class AddonMessagesContactsPage implements OnDestroy {
/** /**
* Set the selected user and open the conversation in the split view if needed. * Set the selected user and open the conversation in the split view if needed.
* *
* @param {string} tab Active tab: "contacts" or "requests". * @param tab Active tab: "contacts" or "requests".
* @param {number} [userId] Id of the selected user, undefined to use the last selected user in the tab. * @param userId Id of the selected user, undefined to use the last selected user in the tab.
* @param {boolean} [onInit=false] Whether the contact was selected on initial load. * @param onInit Whether the contact was selected on initial load.
*/ */
selectUser(tab: string, userId?: number, onInit: boolean = false): void { selectUser(tab: string, userId?: number, onInit: boolean = false): void {
userId = userId || this.selectedUserId[tab]; userId = userId || this.selectedUserId[tab];

View File

@ -52,7 +52,7 @@ export class AddonMessagesConversationInfoPage implements OnInit {
/** /**
* Fetch the required data. * Fetch the required data.
* *
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchData(): Promise<any> { protected fetchData(): Promise<any> {
// Get the conversation data first. // Get the conversation data first.
@ -69,8 +69,8 @@ export class AddonMessagesConversationInfoPage implements OnInit {
/** /**
* Get conversation members. * Get conversation members.
* *
* @param {boolean} [loadingMore} Whether we are loading more data or just the first ones. * @param loadingMore Whether we are loading more data or just the first ones.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
protected fetchMembers(loadingMore?: boolean): Promise<any> { protected fetchMembers(loadingMore?: boolean): Promise<any> {
this.loadMoreError = false; this.loadMoreError = false;
@ -91,8 +91,8 @@ export class AddonMessagesConversationInfoPage implements OnInit {
/** /**
* Function to load more members. * Function to load more members.
* *
* @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
loadMoreMembers(infiniteComplete?: any): Promise<any> { loadMoreMembers(infiniteComplete?: any): Promise<any> {
return this.fetchMembers(true).catch((error) => { return this.fetchMembers(true).catch((error) => {
@ -106,8 +106,8 @@ export class AddonMessagesConversationInfoPage implements OnInit {
/** /**
* Refresh the data. * Refresh the data.
* *
* @param {any} [refresher] Refresher. * @param refresher Refresher.
* @return {Promise<any>} Promise resolved when done. * @return Promise resolved when done.
*/ */
refreshData(refresher?: any): Promise<any> { refreshData(refresher?: any): Promise<any> {
const promises = []; const promises = [];
@ -125,7 +125,7 @@ export class AddonMessagesConversationInfoPage implements OnInit {
/** /**
* Close modal. * Close modal.
* *
* @param {number} [userId] User conversation to load. * @param userId User conversation to load.
*/ */
closeModal(userId?: number): void { closeModal(userId?: number): void {
this.viewCtrl.dismiss(userId); this.viewCtrl.dismiss(userId);

View File

@ -136,8 +136,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Adds a new message to the message list. * Adds a new message to the message list.
* *
* @param {any} message Message to be added. * @param message Message to be added.
* @param {boolean} [keep=true] If set the keep flag or not. * @param keep If set the keep flag or not.
*/ */
protected addMessage(message: any, keep: boolean = true): void { protected addMessage(message: any, keep: boolean = true): void {
/* Create a hash to identify the message. The text of online messages isn't reliable because it can have random data /* Create a hash to identify the message. The text of online messages isn't reliable because it can have random data
@ -156,7 +156,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Remove a message if it shouldn't be in the list anymore. * Remove a message if it shouldn't be in the list anymore.
* *
* @param {string} hash Hash of the message to be removed. * @param hash Hash of the message to be removed.
*/ */
protected removeMessage(hash: any): void { protected removeMessage(hash: any): void {
if (this.keepMessageMap[hash]) { if (this.keepMessageMap[hash]) {
@ -197,7 +197,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Convenience function to fetch the conversation data. * Convenience function to fetch the conversation data.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected fetchData(): Promise<any> { protected fetchData(): Promise<any> {
let loader; let loader;
@ -300,7 +300,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Convenience function to fetch messages. * Convenience function to fetch messages.
* *
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected fetchMessages(): Promise<any> { protected fetchMessages(): Promise<any> {
this.loadMoreError = false; this.loadMoreError = false;
@ -351,7 +351,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Format and load a list of messages into the view. * Format and load a list of messages into the view.
* *
* @param {any[]} messages Messages to load. * @param messages Messages to load.
*/ */
protected loadMessages(messages: any[]): void { protected loadMessages(messages: any[]): void {
if (this.viewDestroyed) { if (this.viewDestroyed) {
@ -406,9 +406,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Get the conversation. * Get the conversation.
* *
* @param {number} conversationId Conversation ID. * @param conversationId Conversation ID.
* @param {number} userId User ID. * @param userId User ID.
* @return {Promise<boolean>} Promise resolved with a boolean: whether the conversation exists or not. * @return Promise resolved with a boolean: whether the conversation exists or not.
*/ */
protected getConversation(conversationId: number, userId: number): Promise<boolean> { protected getConversation(conversationId: number, userId: number): Promise<boolean> {
let promise, let promise,
@ -491,9 +491,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Get the messages of the conversation. Used if group messaging is supported. * Get the messages of the conversation. Used if group messaging is supported.
* *
* @param {number} pagesToLoad Number of "pages" to load. * @param pagesToLoad Number of "pages" to load.
* @param {number} [offset=0] Offset for message list. * @param offset Offset for message list.
* @return {Promise<any[]>} Promise resolved with the list of messages. * @return Promise resolved with the list of messages.
*/ */
protected getConversationMessages(pagesToLoad: number, offset: number = 0): Promise<any[]> { protected getConversationMessages(pagesToLoad: number, offset: number = 0): Promise<any[]> {
const excludePending = offset > 0; const excludePending = offset > 0;
@ -527,12 +527,12 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Get a discussion. Can load several "pages". * Get a discussion. Can load several "pages".
* *
* @param {number} pagesToLoad Number of pages to load. * @param pagesToLoad Number of pages to load.
* @param {number} [lfReceivedUnread=0] Number of unread received messages already fetched, so fetch will be done from this. * @param lfReceivedUnread Number of unread received messages already fetched, so fetch will be done from this.
* @param {number} [lfReceivedRead=0] Number of read received messages already fetched, so fetch will be done from this. * @param lfReceivedRead Number of read received messages already fetched, so fetch will be done from this.
* @param {number} [lfSentUnread=0] Number of unread sent 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 {number} [lfSentRead=0] Number of read 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 {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
protected getDiscussionMessages(pagesToLoad: number, lfReceivedUnread: number = 0, lfReceivedRead: number = 0, protected getDiscussionMessages(pagesToLoad: number, lfReceivedUnread: number = 0, lfReceivedRead: number = 0,
lfSentUnread: number = 0, lfSentRead: number = 0): Promise<any> { lfSentUnread: number = 0, lfSentRead: number = 0): Promise<any> {
@ -755,7 +755,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Wait until fetching is false. * Wait until fetching is false.
* @return {Promise<void>} Resolved when done. * @return Resolved when done.
*/ */
protected waitForFetch(): Promise<void> { protected waitForFetch(): Promise<void> {
if (!this.fetching) { if (!this.fetching) {
@ -806,7 +806,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Copy message to clipboard. * Copy message to clipboard.
* *
* @param {any} message Message to be copied. * @param message Message to be copied.
*/ */
copyMessage(message: any): void { copyMessage(message: any): void {
const text = this.textUtils.decodeHTMLEntities(message.smallmessage || message.text || ''); const text = this.textUtils.decodeHTMLEntities(message.smallmessage || message.text || '');
@ -816,8 +816,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Function to delete a message. * Function to delete a message.
* *
* @param {any} message Message object to delete. * @param message Message object to delete.
* @param {number} index Index where the message is to delete it from the view. * @param index Index where the message is to delete it from the view.
*/ */
deleteMessage(message: any, index: number): void { deleteMessage(message: any, index: number): void {
const canDeleteAll = this.conversation && this.conversation.candeletemessagesforallusers, const canDeleteAll = this.conversation && this.conversation.candeletemessagesforallusers,
@ -857,8 +857,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Function to load previous messages. * Function to load previous messages.
* *
* @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @return {Promise<any>} Resolved when done. * @return Resolved when done.
*/ */
loadPrevious(infiniteComplete?: any): Promise<any> { loadPrevious(infiniteComplete?: any): Promise<any> {
let infiniteHeight = this.infinite ? this.infinite.getHeight() : 0; let infiniteHeight = this.infinite ? this.infinite.getHeight() : 0;
@ -959,7 +959,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Sends a message to the server. * Sends a message to the server.
* *
* @param {string} text Message text. * @param text Message text.
*/ */
sendMessage(text: string): void { sendMessage(text: string): void {
let message; let message;
@ -1046,9 +1046,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
* Check date should be shown on message list for the current message. * Check date should be shown on message list for the current message.
* If date has changed from previous to current message it should be shown. * If date has changed from previous to current message it should be shown.
* *
* @param {any} message Current message where to show the date. * @param message Current message where to show the date.
* @param {any} [prevMessage] Previous message where to compare the date with. * @param prevMessage Previous message where to compare the date with.
* @return {boolean} If date has changed and should be shown. * @return If date has changed and should be shown.
*/ */
showDate(message: any, prevMessage?: any): boolean { showDate(message: any, prevMessage?: any): boolean {
if (!prevMessage) { if (!prevMessage) {
@ -1064,9 +1064,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
* Check if the user info should be displayed for the current message. * Check if the user info should be displayed for the current message.
* User data is only displayed for group conversations if the previous message was from another user. * User data is only displayed for group conversations if the previous message was from another user.
* *
* @param {any} message Current message where to show the user info. * @param message Current message where to show the user info.
* @param {any} [prevMessage] Previous message. * @param prevMessage Previous message.
* @return {boolean} Whether user data should be shown. * @return Whether user data should be shown.
*/ */
showUserData(message: any, prevMessage?: any): boolean { showUserData(message: any, prevMessage?: any): boolean {
return this.isGroup && message.useridfrom != this.currentUserId && this.members[message.useridfrom] && return this.isGroup && message.useridfrom != this.currentUserId && this.members[message.useridfrom] &&
@ -1076,9 +1076,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Check if a css tail should be shown. * Check if a css tail should be shown.
* *
* @param {any} message Current message where to show the user info. * @param message Current message where to show the user info.
* @param {any} [nextMessage] Next message. * @param nextMessage Next message.
* @return {boolean} Whether user data should be shown. * @return Whether user data should be shown.
*/ */
showTail(message: any, nextMessage?: any): boolean { showTail(message: any, nextMessage?: any): boolean {
return !nextMessage || nextMessage.useridfrom != message.useridfrom || nextMessage.showDate; return !nextMessage || nextMessage.useridfrom != message.useridfrom || nextMessage.showDate;
@ -1125,7 +1125,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Change the favourite state of the current conversation. * Change the favourite state of the current conversation.
* *
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
*/ */
changeFavourite(done?: () => void): void { changeFavourite(done?: () => void): void {
this.favouriteIcon = 'spinner'; this.favouriteIcon = 'spinner';
@ -1153,7 +1153,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Change the mute state of the current conversation. * Change the mute state of the current conversation.
* *
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
*/ */
changeMute(done?: () => void): void { changeMute(done?: () => void): void {
this.muteIcon = 'spinner'; this.muteIcon = 'spinner';
@ -1218,7 +1218,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Displays a confirmation modal to block the user of the individual conversation. * Displays a confirmation modal to block the user of the individual conversation.
* *
* @return {Promise<any>} Promise resolved when user is blocked or dialog is cancelled. * @return Promise resolved when user is blocked or dialog is cancelled.
*/ */
blockUser(): Promise<any> { blockUser(): Promise<any> {
if (!this.otherMember) { if (!this.otherMember) {
@ -1249,7 +1249,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Delete the conversation. * Delete the conversation.
* *
* @param {Function} [done] Function to call when done. * @param done Function to call when done.
*/ */
deleteConversation(done?: () => void): void { deleteConversation(done?: () => void): void {
const confirmMessage = 'addon.messages.' + (this.isSelf ? 'deleteallselfconfirm' : 'deleteallconfirm'); const confirmMessage = 'addon.messages.' + (this.isSelf ? 'deleteallselfconfirm' : 'deleteallconfirm');
@ -1276,7 +1276,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Displays a confirmation modal to unblock the user of the individual conversation. * Displays a confirmation modal to unblock the user of the individual conversation.
* *
* @return {Promise<any>} Promise resolved when user is unblocked or dialog is cancelled. * @return Promise resolved when user is unblocked or dialog is cancelled.
*/ */
unblockUser(): Promise<any> { unblockUser(): Promise<any> {
if (!this.otherMember) { if (!this.otherMember) {
@ -1307,7 +1307,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Displays a confirmation modal to send a contact request to the other user of the individual conversation. * Displays a confirmation modal to send a contact request to the other user of the individual conversation.
* *
* @return {Promise<any>} Promise resolved when the request is sent or the dialog is cancelled. * @return Promise resolved when the request is sent or the dialog is cancelled.
*/ */
createContactRequest(): Promise<any> { createContactRequest(): Promise<any> {
if (!this.otherMember) { if (!this.otherMember) {
@ -1338,7 +1338,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Confirms the contact request of the other user of the individual conversation. * Confirms the contact request of the other user of the individual conversation.
* *
* @return {Promise<any>} Promise resolved when the request is confirmed. * @return Promise resolved when the request is confirmed.
*/ */
confirmContactRequest(): Promise<any> { confirmContactRequest(): Promise<any> {
if (!this.otherMember) { if (!this.otherMember) {
@ -1360,7 +1360,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Declines the contact request of the other user of the individual conversation. * Declines the contact request of the other user of the individual conversation.
* *
* @return {Promise<any>} Promise resolved when the request is confirmed. * @return Promise resolved when the request is confirmed.
*/ */
declineContactRequest(): Promise<any> { declineContactRequest(): Promise<any> {
if (!this.otherMember) { if (!this.otherMember) {
@ -1382,7 +1382,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy {
/** /**
* Displays a confirmation modal to remove the other user of the conversation from contacts. * Displays a confirmation modal to remove the other user of the conversation from contacts.
* *
* @return {Promise<any>} Promise resolved when the request is sent or the dialog is cancelled. * @return Promise resolved when the request is sent or the dialog is cancelled.
*/ */
removeContact(): Promise<any> { removeContact(): Promise<any> {
if (!this.otherMember) { if (!this.otherMember) {

Some files were not shown because too many files have changed in this diff Show More